diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.OwlBot.yaml.baseline deleted file mode 100644 index e15cb90e8caa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/asset/google-cloud-asset-nodejs - dest: /owl-bot-staging/google-cloud-asset - -api-name: asset \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 33d3087684fa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/README.md.baseline deleted file mode 100644 index 57be2f240e6d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Asset: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/asset.svg)](https://www.npmjs.org/package/@google-cloud/asset) - -Asset client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Asset Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/asset/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Asset API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/asset -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/asset@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/index.ts.baseline deleted file mode 100644 index 0cf6954ad4d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const AssetServiceClient = v1.AssetServiceClient; -type AssetServiceClient = v1.AssetServiceClient; -export {v1, AssetServiceClient}; -export default {v1, AssetServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client.ts.baseline deleted file mode 100644 index 2a0014fe8f34..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client.ts.baseline +++ /dev/null @@ -1,1257 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as asset_service_client_config from './asset_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'asset_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Asset service definition. - * @class - * @memberof v1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('asset'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 AssetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudasset.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderFeedPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/feeds/{feed}' - ), - organizationFeedPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/feeds/{feed}' - ), - projectFeedPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/feeds/{feed}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const exportAssetsResponse = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsResponse') as gax.protobuf.Type; - const exportAssetsMetadata = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsRequest') as gax.protobuf.Type; - - this.descriptors.longrunning = { - exportAssets: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAssetsResponse.decode.bind(exportAssetsResponse), - exportAssetsMetadata.decode.bind(exportAssetsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1.AssetService', gapicConfig as gax.ClientConfig, - 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.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['exportAssets', 'batchGetAssetsHistory', 'createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Batch gets the update history of assets that overlap a time window. - * For RESOURCE content, this API outputs history with asset in both - * non-delete or deleted status. - * For IAM_POLICY content, this API outputs history when the asset and its - * attached IAM POLICY both exist. This can create gaps in the output history. - * If a specified asset does not exist, this API returns an INVALID_ARGUMENT - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - * @param {string[]} request.assetNames - * A list of the full names of the assets. For example: - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * See [Resource - * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name - * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - * for more info. - * - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - * @param {google.cloud.asset.v1.ContentType} [request.contentType] - * Optional. The content type. - * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - * @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 {@link protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse|BatchGetAssetsHistoryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.batch_get_assets_history.js - * region_tag:cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async - */ - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchGetAssetsHistory request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchGetAssetsHistory response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.batchGetAssetsHistory(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]) => { - this._log.info('batchGetAssetsHistory response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a feed in a parent project/folder/organization to listen to its - * asset updates. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project/folder/organization where this feed - * should be created in. It can only be an organization number (such as - * "organizations/123"), a folder number (such as "folders/123"), a project ID - * (such as "projects/my-project-id")", or a project number (such as - * "projects/12345"). - * @param {string} request.feedId - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.create_feed.js - * region_tag:cloudasset_v1_generated_AssetService_CreateFeed_async - */ - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createFeed response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]) => { - this._log.info('createFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets details about an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.get_feed.js - * region_tag:cloudasset_v1_generated_AssetService_GetFeed_async - */ - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getFeed response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]) => { - this._log.info('getFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Lists all asset feeds in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent project/folder/organization whose feeds are to be - * listed. It can only be using project/folder/organization number (such as - * "folders/12345")", or a project ID (such as "projects/my-project-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 {@link protos.google.cloud.asset.v1.ListFeedsResponse|ListFeedsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.list_feeds.js - * region_tag:cloudasset_v1_generated_AssetService_ListFeeds_async - */ - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listFeeds request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listFeeds response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listFeeds(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]) => { - this._log.info('listFeeds response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an asset feed configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * @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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.update_feed.js - * region_tag:cloudasset_v1_generated_AssetService_UpdateFeed_async - */ - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'feed.name': request.feed!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateFeed response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]) => { - this._log.info('updateFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.delete_feed.js - * region_tag:cloudasset_v1_generated_AssetService_DeleteFeed_async - */ - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteFeed request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteFeed response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Exports assets with time and resource types to a given Cloud Storage - * location. The output format is newline-delimited JSON. - * This API implements the {@link protos.google.longrunning.Operation|google.longrunning.Operation} API allowing you - * to keep track of the export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will be - * returned. - * @param {google.cloud.asset.v1.OutputConfig} request.outputConfig - * Required. Output configuration indicating where the results will be output - * to. All results will be in newline delimited JSON format. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportAssets response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('exportAssets request %j', request); - return this.innerApiCalls.exportAssets(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportAssets response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportAssets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - async checkExportAssetsProgress(name: string): Promise>{ - this._log.info('exportAssets long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAssets, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderFeed resource name string. - * - * @param {string} folder - * @param {string} feed - * @returns {string} Resource name string. - */ - folderFeedPath(folder:string,feed:string) { - return this.pathTemplates.folderFeedPathTemplate.render({ - folder: folder, - feed: feed, - }); - } - - /** - * Parse the folder from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; - } - - /** - * Parse the feed from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; - } - - /** - * Return a fully-qualified organizationFeed resource name string. - * - * @param {string} organization - * @param {string} feed - * @returns {string} Resource name string. - */ - organizationFeedPath(organization:string,feed:string) { - return this.pathTemplates.organizationFeedPathTemplate.render({ - organization: organization, - feed: feed, - }); - } - - /** - * Parse the organization from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; - } - - /** - * Parse the feed from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; - } - - /** - * Return a fully-qualified projectFeed resource name string. - * - * @param {string} project - * @param {string} feed - * @returns {string} Resource name string. - */ - projectFeedPath(project:string,feed:string) { - return this.pathTemplates.projectFeedPathTemplate.render({ - project: project, - feed: feed, - }); - } - - /** - * Parse the project from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; - } - - /** - * Parse the feed from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client_config.json.baseline deleted file mode 100644 index a58073cc047f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_client_config.json.baseline +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ExportAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchGetAssetsHistory": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFeeds": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_proto_list.json.baseline deleted file mode 100644 index 44d0dc0156d4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/asset_service_proto_list.json.baseline +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1/asset_service.proto", - "../../protos/google/cloud/asset/v1/assets.proto", - "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", - "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", - "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 05391a84280a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {AssetServiceClient} from './asset_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 38cbcbd76681..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const asset = require('@google-cloud/asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index aa2ac18d2d15..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as asset from '@google-cloud/asset'; - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 40aa52c8666e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {AssetServiceClient} from '@google-cloud/asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/test/gapic_asset_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/test/gapic_asset_service_v1.ts.baseline deleted file mode 100644 index 685a59b84d45..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/esm/test/gapic_asset_service_v1.ts.baseline +++ /dev/null @@ -1,1162 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath; - assert.strictEqual(servicePath, 'cloudasset.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new assetserviceModule.v1.AssetServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new assetserviceModule.v1.AssetServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new assetserviceModule.v1.AssetServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = assetserviceModule.v1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.assetServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchGetAssetsHistory', () => { - it('invokes batchGetAssetsHistory without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(expectedResponse); - const [response] = await client.batchGetAssetsHistory(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchGetAssetsHistory( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - }); - }); - - describe('createFeed', () => { - it('invokes createFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); - const [response] = await client.createFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createFeed(request), expectedError); - }); - }); - - describe('getFeed', () => { - it('invokes getFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); - const [response] = await client.getFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFeed(request), expectedError); - }); - }); - - describe('listFeeds', () => { - it('invokes listFeeds without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); - const [response] = await client.listFeeds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeeds( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IListFeedsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeeds(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listFeeds(request), expectedError); - }); - }); - - describe('updateFeed', () => { - it('invokes updateFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); - const [response] = await client.updateFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateFeed(request), expectedError); - }); - }); - - describe('deleteFeed', () => { - it('invokes deleteFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); - const [response] = await client.deleteFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeed( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteFeed(request), expectedError); - }); - }); - - describe('exportAssets', () => { - it('invokes exportAssets without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAssets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAssets( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with call error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with LRO error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAssets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportAssetsProgress without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAssetsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAssetsProgress with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAssetsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('folderFeed', () => { - const fakePath = "/rendered/path/folderFeed"; - const expectedParameters = { - folder: "folderValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderFeedPath', () => { - const result = client.folderFeedPath("folderValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderFeedName', () => { - const result = client.matchFolderFromFolderFeedName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromFolderFeedName', () => { - const result = client.matchFeedFromFolderFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationFeed', () => { - const fakePath = "/rendered/path/organizationFeed"; - const expectedParameters = { - organization: "organizationValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationFeedPath', () => { - const result = client.organizationFeedPath("organizationValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromOrganizationFeedName', () => { - const result = client.matchFeedFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectFeed', () => { - const fakePath = "/rendered/path/projectFeed"; - const expectedParameters = { - project: "projectValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectFeedPath', () => { - const result = client.projectFeedPath("projectValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectFeedName', () => { - const result = client.matchProjectFromProjectFeedName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromProjectFeedName', () => { - const result = client.matchFeedFromProjectFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json b/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json deleted file mode 100644 index 659bdec70889..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "@google-cloud/asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/asset_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/asset_service.proto.baseline deleted file mode 100644 index 9c7b16d036ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/asset_service.proto.baseline +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/asset/v1/assets.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Exports assets with time and resource types to a given Cloud Storage - // location. The output format is newline-delimited JSON. - // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you - // to keep track of the export. - rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=*/*}:exportAssets" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.asset.v1.ExportAssetsResponse" - metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" - }; - } - - // Batch gets the update history of assets that overlap a time window. - // For RESOURCE content, this API outputs history with asset in both - // non-delete or deleted status. - // For IAM_POLICY content, this API outputs history when the asset and its - // attached IAM POLICY both exist. This can create gaps in the output history. - // If a specified asset does not exist, this API returns an INVALID_ARGUMENT - // error. - rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}:batchGetAssetsHistory" - }; - } - - // Creates a feed in a parent project/folder/organization to listen to its - // asset updates. - rpc CreateFeed(CreateFeedRequest) returns (Feed) { - option (google.api.http) = { - post: "/v1/{parent=*/*}/feeds" - body: "*" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about an asset feed. - rpc GetFeed(GetFeedRequest) returns (Feed) { - option (google.api.http) = { - get: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all asset feeds in a parent project/folder/organization. - rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}/feeds" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an asset feed configuration. - rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { - option (google.api.http) = { - patch: "/v1/{feed.name=*/*/feeds/*}" - body: "*" - }; - option (google.api.method_signature) = "feed"; - } - - // Deletes an asset feed. - rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Export asset request. -message ExportAssetsRequest { - // Required. The relative name of the root asset. This can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id"), or a project number (such as "projects/12345"), - // or a folder number (such as "folders/123"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // Timestamp to take an asset snapshot. This can only be set to a timestamp - // between the current time and the current time minus 35 days (inclusive). - // If not specified, the current time will be used. Due to delays in resource - // data collection and indexing, there is a volatile window during which - // running the same query may get different results. - google.protobuf.Timestamp read_time = 2; - - // A list of asset types of which to take a snapshot for. For example: - // "compute.googleapis.com/Disk". If specified, only matching assets will be - // returned. See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name will be - // returned. - ContentType content_type = 4; - - // Required. Output configuration indicating where the results will be output - // to. All results will be in newline delimited JSON format. - OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// The export asset response. This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. -message ExportAssetsResponse { - // Time the snapshot was taken. - google.protobuf.Timestamp read_time = 1; - - // Output configuration indicating where the results were output to. - // All results are in JSON format. - OutputConfig output_config = 2; -} - -// Batch get assets history request. -message BatchGetAssetsHistoryRequest { - // Required. The relative name of the root asset. It can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id")", or a project number (such as "projects/12345"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // A list of the full names of the assets. For example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // and [Resource Name - // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - // for more info. - // - // The request becomes a no-op if the asset name list is empty, and the max - // size of the asset name list is 100 in one request. - repeated string asset_names = 2; - - // Optional. The content type. - ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time window for the asset history. Both start_time and - // end_time are optional and if set, it must be after the current time minus - // 35 days. If end_time is not set, it is default to current timestamp. - // If start_time is not set, the snapshot of the assets at end_time will be - // returned. The returned results contain all temporal assets whose time - // window overlap with read_time_window. - TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Batch get assets history response. -message BatchGetAssetsHistoryResponse { - // A list of assets with valid time windows. - repeated TemporalAsset assets = 1; -} - -// Create asset feed request. -message CreateFeedRequest { - // Required. The name of the project/folder/organization where this feed - // should be created in. It can only be an organization number (such as - // "organizations/123"), a folder number (such as "folders/123"), a project ID - // (such as "projects/my-project-id")", or a project number (such as - // "projects/12345"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. This is the client-assigned asset feed identifier and it needs to - // be unique under a specific parent project/folder/organization. - string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The feed details. The field `name` must be empty and it will be generated - // in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Get asset feed request. -message GetFeedRequest { - // Required. The name of the Feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// List asset feeds request. -message ListFeedsRequest { - // Required. The parent project/folder/organization whose feeds are to be - // listed. It can only be using project/folder/organization number (such as - // "folders/12345")", or a project ID (such as "projects/my-project-id"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message ListFeedsResponse { - // A list of feeds. - repeated Feed feeds = 1; -} - -// Update asset feed request. -message UpdateFeedRequest { - // Required. The new values of feed details. It must match an existing feed and the - // field `name` must be in the format of: - // projects/project_number/feeds/feed_id or - // folders/folder_number/feeds/feed_id or - // organizations/organization_number/feeds/feed_id. - Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `feed` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteFeedRequest { - // Required. The name of the feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// Output configuration for export assets destination. -message OutputConfig { - // Asset export destination. - oneof destination { - // Destination on Cloud Storage. - GcsDestination gcs_destination = 1; - - // Destination on BigQuery. The output table stores the fields in asset - // proto as columns in BigQuery. The resource/iam_policy field is converted - // to a record with each field to a column, except metadata to a single JSON - // string. - BigQueryDestination bigquery_destination = 2; - } -} - -// A Cloud Storage location. -message GcsDestination { - // Required. - oneof object_uri { - // The uri of the Cloud Storage object. It's the same uri that is used by - // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and - // Editing Object - // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) - // for more information. - string uri = 1; - - // The uri prefix of all generated Cloud Storage objects. For example: - // "gs://bucket_name/object_name_prefix". Each object uri is in format: - // "gs://bucket_name/object_name_prefix// and only - // contains assets for that type. starts from 0. For example: - // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is - // the first shard of output objects containing all - // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be - // returned if file with the same name "gs://bucket_name/object_name_prefix" - // already exists. - string uri_prefix = 2; - } -} - -// A BigQuery destination. -message BigQueryDestination { - // Required. The BigQuery dataset in format - // "projects/projectId/datasets/datasetId", to which the snapshot result - // should be exported. If this dataset does not exist, the export call returns - // an INVALID_ARGUMENT error. - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table to which the snapshot result should be - // written. If this table does not exist, a new table with the given name - // will be created. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - - // If the destination table already exists and this flag is `TRUE`, the - // table will be overwritten by the contents of assets snapshot. If the flag - // is `FALSE` or unset and the destination table already exists, the export - // call returns an INVALID_ARGUMEMT error. - bool force = 3; -} - -// A Pub/Sub destination. -message PubsubDestination { - // The name of the Pub/Sub topic to publish to. - // For example: `projects/PROJECT_ID/topics/TOPIC_ID`. - string topic = 1; -} - -// Output configuration for asset feed destination. -message FeedOutputConfig { - // Asset feed destination. - oneof destination { - // Destination on Pub/Sub. - PubsubDestination pubsub_destination = 1; - } -} - -// An asset feed used to export asset updates to a destinations. -// An asset feed filter controls what updates are exported. -// The asset feed must be created within a project, organization, or -// folder. Supported destinations are: -// Pub/Sub topics. -message Feed { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Feed" - pattern: "projects/{project}/feeds/{feed}" - pattern: "folders/{folder}/feeds/{feed}" - pattern: "organizations/{organization}/feeds/{feed}" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // Required. The format will be - // projects/{project_number}/feeds/{client-assigned_feed_identifier} or - // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or - // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} - // - // The client-assigned feed identifier must be unique within the parent - // project/folder/organization. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of the full names of the assets to receive updates. You must specify - // either or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. For - // example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more info. - repeated string asset_names = 2; - - // A list of types of the assets to receive updates. You must specify either - // or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. - // For example: `"compute.googleapis.com/Disk"` - // - // See [this - // topic](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for a list of all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name and - // type will be returned. - ContentType content_type = 4; - - // Required. Feed output configuration defining where the asset updates are - // published to. - FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; - - // Resource metadata. - RESOURCE = 1; - - // The actual IAM policy set on a resource. - IAM_POLICY = 2; - - // The Cloud Organization Policy set on an asset. - ORG_POLICY = 4; - - // The Cloud Access context mananger Policy set on an asset. - ACCESS_POLICY = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/assets.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/assets.proto.baseline deleted file mode 100644 index 1e8b40a11d92..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/asset/v1/assets.proto.baseline +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/resource.proto"; -import "google/cloud/orgpolicy/v1/orgpolicy.proto"; -import "google/iam/v1/policy.proto"; -import "google/identity/accesscontextmanager/v1/access_level.proto"; -import "google/identity/accesscontextmanager/v1/access_policy.proto"; -import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// An asset in Google Cloud and its temporal metadata, including the time window -// when it was observed and its status during that window. -message TemporalAsset { - // The time window when the asset data and state was observed. - TimeWindow window = 1; - - // Whether the asset has been deleted or not. - bool deleted = 2; - - // An asset in Google Cloud. - Asset asset = 3; -} - -// A time window specified by its "start_time" and "end_time". -message TimeWindow { - // Start time of the time window (exclusive). - google.protobuf.Timestamp start_time = 1; - - // End time of the time window (inclusive). If not specified, the current - // timestamp is used instead. - google.protobuf.Timestamp end_time = 2; -} - -// An asset in Google Cloud. An asset can be any resource in the Google Cloud -// [resource -// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), -// a resource outside the Google Cloud resource hierarchy (such as Google -// Kubernetes Engine clusters and objects), or a Cloud IAM policy. -message Asset { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Asset" - pattern: "*" - }; - - // The full name of the asset. For example: - // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1" - // - // See [Resource - // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // The type of the asset. For example: "compute.googleapis.com/Disk" - // - // See [Supported asset - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for more information. - string asset_type = 2; - - // A representation of the resource. - Resource resource = 3; - - // A representation of the Cloud IAM policy set on a Google Cloud resource. - // There can be a maximum of one Cloud IAM policy set on any given resource. - // In addition, Cloud IAM policies inherit their granted access scope from any - // policies set on parent resources in the resource hierarchy. Therefore, the - // effectively policy is the union of both the policy set on this resource - // and each policy set on all of the resource's ancestry resource levels in - // the hierarchy. See - // [this topic](https://cloud.google.com/iam/docs/policies#inheritance) for - // more information. - google.iam.v1.Policy iam_policy = 4; - - // A representation of an [organization - // policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). - // There can be more than one organization policy with different constraints - // set on a given resource. - repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; - - // A representation of an [access - // policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies). - oneof access_context_policy { - google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; - - google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; - - google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = 9; - } - - // The ancestry path of an asset in Google Cloud [resource - // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), - // represented as a list of relative resource names. An ancestry path starts - // with the closest ancestor in the hierarchy and ends at root. If the asset - // is a project, folder, or organization, the ancestry path starts from the - // asset itself. - // - // For example: `["projects/123456789", "folders/5432", "organizations/1234"]` - repeated string ancestors = 10; -} - -// A representation of a Google Cloud resource. -message Resource { - // The API version. For example: "v1" - string version = 1; - - // The URL of the discovery document containing the resource's JSON schema. - // For example: - // "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest" - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_document_uri = 2; - - // The JSON schema name listed in the discovery document. For example: - // "Project" - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_name = 3; - - // The REST URL for accessing the resource. An HTTP `GET` request using this - // URL returns the resource itself. For example: - // "https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123" - // - // This value is unspecified for resources without a REST API. - string resource_url = 4; - - // The full name of the immediate parent of this resource. See - // [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - // - // For Google Cloud assets, this value is the parent resource defined in the - // [Cloud IAM policy - // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - // For example: - // "//cloudresourcemanager.googleapis.com/projects/my_project_123" - // - // For third-party assets, this field may be set differently. - string parent = 5; - - // The content of the resource, in which some sensitive fields are removed - // and may not be present. - google.protobuf.Struct data = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline deleted file mode 100644 index fbd62df6f3f0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline +++ /dev/null @@ -1,315 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.orgpolicy.v1; - -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.OrgPolicy.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1;orgpolicy"; -option java_multiple_files = true; -option java_outer_classname = "OrgPolicyProto"; -option java_package = "com.google.cloud.orgpolicy.v1"; -option php_namespace = "Google\\Cloud\\OrgPolicy\\V1"; -option ruby_package = "Google::Cloud::OrgPolicy::V1"; - -// Defines a Cloud Organization `Policy` which is used to specify `Constraints` -// for configurations of Cloud Platform resources. -message Policy { - // Used in `policy_type` to specify how `list_policy` behaves at this - // resource. - // - // `ListPolicy` can define specific values and subtrees of Cloud Resource - // Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that - // are allowed or denied by setting the `allowed_values` and `denied_values` - // fields. This is achieved by using the `under:` and optional `is:` prefixes. - // The `under:` prefix is used to denote resource subtree values. - // The `is:` prefix is used to denote specific values, and is required only - // if the value contains a ":". Values prefixed with "is:" are treated the - // same as values with no prefix. - // Ancestry subtrees must be in one of the following formats: - // - "projects/", e.g. "projects/tokyo-rain-123" - // - "folders/", e.g. "folders/1234" - // - "organizations/", e.g. "organizations/1234" - // The `supports_under` field of the associated `Constraint` defines whether - // ancestry prefixes can be used. You can set `allowed_values` and - // `denied_values` in the same `Policy` if `all_values` is - // `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all - // values. If `all_values` is set to either `ALLOW` or `DENY`, - // `allowed_values` and `denied_values` must be unset. - message ListPolicy { - // This enum can be used to set `Policies` that apply to all possible - // configuration values rather than specific values in `allowed_values` or - // `denied_values`. - // - // Settting this to `ALLOW` will mean this `Policy` allows all values. - // Similarly, setting it to `DENY` will mean no values are allowed. If - // set to either `ALLOW` or `DENY, `allowed_values` and `denied_values` - // must be unset. Setting this to `ALL_VALUES_UNSPECIFIED` allows for - // setting `allowed_values` and `denied_values`. - enum AllValues { - // Indicates that allowed_values or denied_values must be set. - ALL_VALUES_UNSPECIFIED = 0; - - // A policy with this set allows all values. - ALLOW = 1; - - // A policy with this set denies all values. - DENY = 2; - } - - // List of values allowed at this resource. Can only be set if `all_values` - // is set to `ALL_VALUES_UNSPECIFIED`. - repeated string allowed_values = 1; - - // List of values denied at this resource. Can only be set if `all_values` - // is set to `ALL_VALUES_UNSPECIFIED`. - repeated string denied_values = 2; - - // The policy all_values state. - AllValues all_values = 3; - - // Optional. The Google Cloud Console will try to default to a configuration - // that matches the value specified in this `Policy`. If `suggested_value` - // is not set, it will inherit the value specified higher in the hierarchy, - // unless `inherit_from_parent` is `false`. - string suggested_value = 4; - - // Determines the inheritance behavior for this `Policy`. - // - // By default, a `ListPolicy` set at a resource supercedes any `Policy` set - // anywhere up the resource hierarchy. However, if `inherit_from_parent` is - // set to `true`, then the values from the effective `Policy` of the parent - // resource are inherited, meaning the values set in this `Policy` are - // added to the values inherited up the hierarchy. - // - // Setting `Policy` hierarchies that inherit both allowed values and denied - // values isn't recommended in most circumstances to keep the configuration - // simple and understandable. However, it is possible to set a `Policy` with - // `allowed_values` set that inherits a `Policy` with `denied_values` set. - // In this case, the values that are allowed must be in `allowed_values` and - // not present in `denied_values`. - // - // For example, suppose you have a `Constraint` - // `constraints/serviceuser.services`, which has a `constraint_type` of - // `list_constraint`, and with `constraint_default` set to `ALLOW`. - // Suppose that at the Organization level, a `Policy` is applied that - // restricts the allowed API activations to {`E1`, `E2`}. Then, if a - // `Policy` is applied to a project below the Organization that has - // `inherit_from_parent` set to `false` and field all_values set to DENY, - // then an attempt to activate any API will be denied. - // - // The following examples demonstrate different possible layerings for - // `projects/bar` parented by `organizations/foo`: - // - // Example 1 (no inherited values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has `inherit_from_parent` `false` and values: - // {allowed_values: "E3" allowed_values: "E4"} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are `E3`, and `E4`. - // - // Example 2 (inherited values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has a `Policy` with values: - // {value: "E3" value: "E4" inherit_from_parent: true} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`. - // - // Example 3 (inheriting both allowed and denied values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {denied_values: "E1"} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The value accepted at `projects/bar` is `E2`. - // - // Example 4 (RestoreDefault): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has a `Policy` with values: - // {RestoreDefault: {}} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are either all or none depending on - // the value of `constraint_default` (if `ALLOW`, all; if - // `DENY`, none). - // - // Example 5 (no policy inherits parent policy): - // `organizations/foo` has no `Policy` set. - // `projects/bar` has no `Policy` set. - // The accepted values at both levels are either all or none depending on - // the value of `constraint_default` (if `ALLOW`, all; if - // `DENY`, none). - // - // Example 6 (ListConstraint allowing all): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {all: ALLOW} - // The accepted values at `organizations/foo` are `E1`, E2`. - // Any value is accepted at `projects/bar`. - // - // Example 7 (ListConstraint allowing none): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {all: DENY} - // The accepted values at `organizations/foo` are `E1`, E2`. - // No value is accepted at `projects/bar`. - // - // Example 10 (allowed and denied subtrees of Resource Manager hierarchy): - // Given the following resource hierarchy - // O1->{F1, F2}; F1->{P1}; F2->{P2, P3}, - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "under:organizations/O1"} - // `projects/bar` has a `Policy` with: - // {allowed_values: "under:projects/P3"} - // {denied_values: "under:folders/F2"} - // The accepted values at `organizations/foo` are `organizations/O1`, - // `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`, - // `projects/P3`. - // The accepted values at `projects/bar` are `organizations/O1`, - // `folders/F1`, `projects/P1`. - bool inherit_from_parent = 5; - } - - // Used in `policy_type` to specify how `boolean_policy` will behave at this - // resource. - message BooleanPolicy { - // If `true`, then the `Policy` is enforced. If `false`, then any - // configuration is acceptable. - // - // Suppose you have a `Constraint` - // `constraints/compute.disableSerialPortAccess` with `constraint_default` - // set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following - // behavior: - // - If the `Policy` at this resource has enforced set to `false`, serial - // port connection attempts will be allowed. - // - If the `Policy` at this resource has enforced set to `true`, serial - // port connection attempts will be refused. - // - If the `Policy` at this resource is `RestoreDefault`, serial port - // connection attempts will be allowed. - // - If no `Policy` is set at this resource or anywhere higher in the - // resource hierarchy, serial port connection attempts will be allowed. - // - If no `Policy` is set at this resource, but one exists higher in the - // resource hierarchy, the behavior is as if the`Policy` were set at - // this resource. - // - // The following examples demonstrate the different possible layerings: - // - // Example 1 (nearest `Constraint` wins): - // `organizations/foo` has a `Policy` with: - // {enforced: false} - // `projects/bar` has no `Policy` set. - // The constraint at `projects/bar` and `organizations/foo` will not be - // enforced. - // - // Example 2 (enforcement gets replaced): - // `organizations/foo` has a `Policy` with: - // {enforced: false} - // `projects/bar` has a `Policy` with: - // {enforced: true} - // The constraint at `organizations/foo` is not enforced. - // The constraint at `projects/bar` is enforced. - // - // Example 3 (RestoreDefault): - // `organizations/foo` has a `Policy` with: - // {enforced: true} - // `projects/bar` has a `Policy` with: - // {RestoreDefault: {}} - // The constraint at `organizations/foo` is enforced. - // The constraint at `projects/bar` is not enforced, because - // `constraint_default` for the `Constraint` is `ALLOW`. - bool enforced = 1; - } - - // Ignores policies set above this resource and restores the - // `constraint_default` enforcement behavior of the specific `Constraint` at - // this resource. - // - // Suppose that `constraint_default` is set to `ALLOW` for the - // `Constraint` `constraints/serviceuser.services`. Suppose that organization - // foo.com sets a `Policy` at their Organization resource node that restricts - // the allowed service activations to deny all service activations. They - // could then set a `Policy` with the `policy_type` `restore_default` on - // several experimental projects, restoring the `constraint_default` - // enforcement of the `Constraint` for only those projects, allowing those - // projects to have all services activated. - message RestoreDefault { - - } - - // Version of the `Policy`. Default version is 0; - int32 version = 1; - - // The name of the `Constraint` the `Policy` is configuring, for example, - // `constraints/serviceuser.services`. - // - // Immutable after creation. - string constraint = 2; - - // An opaque tag indicating the current version of the `Policy`, used for - // concurrency control. - // - // When the `Policy` is returned from either a `GetPolicy` or a - // `ListOrgPolicy` request, this `etag` indicates the version of the current - // `Policy` to use when executing a read-modify-write loop. - // - // When the `Policy` is returned from a `GetEffectivePolicy` request, the - // `etag` will be unset. - // - // When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value - // that was returned from a `GetOrgPolicy` request as part of a - // read-modify-write loop for concurrency control. Not setting the `etag`in a - // `SetOrgPolicy` request will result in an unconditional write of the - // `Policy`. - bytes etag = 3; - - // The time stamp the `Policy` was previously updated. This is set by the - // server, not specified by the caller, and represents the last time a call to - // `SetOrgPolicy` was made for that `Policy`. Any value set by the client will - // be ignored. - google.protobuf.Timestamp update_time = 4; - - // The field to populate is based on the `constraint_type` value in the - // `Constraint`. - // `list_constraint` => `list_policy` - // `boolean_constraint` => `boolean_policy` - // - // A `restore_default` message may be used with any `Constraint` type. - // - // Providing a *_policy that is incompatible with the `constraint_type` will - // result in an `invalid_argument` error. - // - // Attempting to set a `Policy` with a `policy_type` not set will result in an - // `invalid_argument` error. - oneof policy_type { - // List of values either allowed or disallowed. - ListPolicy list_policy = 5; - - // For boolean `Constraints`, whether to enforce the `Constraint` or not. - BooleanPolicy boolean_policy = 6; - - // Restores the default behavior of the constraint; independent of - // `Constraint` type. - RestoreDefault restore_default = 7; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline deleted file mode 100644 index f05791033938..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.type; - -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.Type"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type;type"; -option java_package = "com.google.identity.accesscontextmanager.type"; -option java_multiple_files = true; -option java_outer_classname = "TypeProto"; -option php_namespace = "Google\\Identity\\AccessContextManager\\Type"; -option ruby_package = "Google::Identity::AccessContextManager::Type"; - -// The encryption state of the device. -enum DeviceEncryptionStatus { - // The encryption status of the device is not specified or not known. - ENCRYPTION_UNSPECIFIED = 0; - - // The device does not support encryption. - ENCRYPTION_UNSUPPORTED = 1; - - // The device supports encryption, but is currently unencrypted. - UNENCRYPTED = 2; - - // The device is encrypted. - ENCRYPTED = 3; -} - -// The operating system type of the device. -// Next id: 7 -enum OsType { - // The operating system of the device is not specified or not known. - OS_UNSPECIFIED = 0; - - // A desktop Mac operating system. - DESKTOP_MAC = 1; - - // A desktop Windows operating system. - DESKTOP_WINDOWS = 2; - - // A desktop Linux operating system. - DESKTOP_LINUX = 3; - - // A desktop ChromeOS operating system. - DESKTOP_CHROME_OS = 6; - - // An Android operating system. - ANDROID = 4; - - // An iOS operating system. - IOS = 5; -} - -// The degree to which the device is managed by the Cloud organization. -enum DeviceManagementLevel { - // The device's management level is not specified or not known. - MANAGEMENT_UNSPECIFIED = 0; - - // The device is not managed. - NONE = 1; - - // Basic management is enabled, which is generally limited to monitoring and - // wiping the corporate account. - BASIC = 2; - - // Complete device management. This includes more thorough monitoring and the - // ability to directly manage the device (such as remote wiping). This can be - // enabled through the Android Enterprise Platform. - COMPLETE = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline deleted file mode 100644 index 0ebd1936c946..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/identity/accesscontextmanager/type/device_resources.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "AccessLevelProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// An `AccessLevel` is a label that can be applied to requests to Google Cloud -// services, along with a list of requirements necessary for the label to be -// applied. -message AccessLevel { - // Required. Resource name for the Access Level. The `short_name` component - // must begin with a letter and only include alphanumeric and '_'. Format: - // `accessPolicies/{policy_id}/accessLevels/{short_name}`. The maximum length - // of the `short_name` component is 50 characters. - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `AccessLevel` and its use. Does not affect behavior. - string description = 3; - - // Required. Describes the necessary conditions for the level to apply. - oneof level { - // A `BasicLevel` composed of `Conditions`. - BasicLevel basic = 4; - - // A `CustomLevel` written in the Common Expression Language. - CustomLevel custom = 5; - } - - // Output only. Time the `AccessLevel` was created in UTC. - google.protobuf.Timestamp create_time = 6; - - // Output only. Time the `AccessLevel` was updated in UTC. - google.protobuf.Timestamp update_time = 7; -} - -// `BasicLevel` is an `AccessLevel` using a set of recommended features. -message BasicLevel { - // Options for how the `conditions` list should be combined to determine if - // this `AccessLevel` is applied. Default is AND. - enum ConditionCombiningFunction { - // All `Conditions` must be true for the `BasicLevel` to be true. - AND = 0; - - // If at least one `Condition` is true, then the `BasicLevel` is true. - OR = 1; - } - - // Required. A list of requirements for the `AccessLevel` to be granted. - repeated Condition conditions = 1; - - // How the `conditions` list should be combined to determine if a request is - // granted this `AccessLevel`. If AND is used, each `Condition` in - // `conditions` must be satisfied for the `AccessLevel` to be applied. If OR - // is used, at least one `Condition` in `conditions` must be satisfied for the - // `AccessLevel` to be applied. Default behavior is AND. - ConditionCombiningFunction combining_function = 2; -} - -// A condition necessary for an `AccessLevel` to be granted. The Condition is an -// AND over its fields. So a Condition is true if: 1) the request IP is from one -// of the listed subnetworks AND 2) the originating device complies with the -// listed device policy AND 3) all listed access levels are granted AND 4) the -// request was sent at a time allowed by the DateTimeRestriction. -message Condition { - // CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for - // a CIDR IP address block, the specified IP address portion must be properly - // truncated (i.e. all the host bits must be zero) or the input is considered - // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is - // not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas - // "2001:db8::1/32" is not. The originating IP of a request must be in one of - // the listed subnets in order for this Condition to be true. If empty, all IP - // addresses are allowed. - repeated string ip_subnetworks = 1; - - // Device specific restrictions, all restrictions must hold for the - // Condition to be true. If not specified, all devices are allowed. - DevicePolicy device_policy = 2; - - // A list of other access levels defined in the same `Policy`, referenced by - // resource name. Referencing an `AccessLevel` which does not exist is an - // error. All access levels listed must be granted for the Condition - // to be true. Example: - // "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` - repeated string required_access_levels = 3; - - // Whether to negate the Condition. If true, the Condition becomes a NAND over - // its non-empty fields, each field must be false for the Condition overall to - // be satisfied. Defaults to false. - bool negate = 5; - - // The request must be made by one of the provided user or service - // accounts. Groups are not supported. - // Syntax: - // `user:{emailid}` - // `serviceAccount:{emailid}` - // If not specified, a request may come from any user. - repeated string members = 6; - - // The request must originate from one of the provided countries/regions. - // Must be valid ISO 3166-1 alpha-2 codes. - repeated string regions = 7; -} - -// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language -// to represent the necessary conditions for the level to apply to a request. -// See CEL spec at: https://github.com/google/cel-spec -message CustomLevel { - // Required. A Cloud CEL expression evaluating to a boolean. - google.type.Expr expr = 1; -} - -// `DevicePolicy` specifies device specific restrictions necessary to acquire a -// given access level. A `DevicePolicy` specifies requirements for requests from -// devices to be granted access levels, it does not do any enforcement on the -// device. `DevicePolicy` acts as an AND over all specified fields, and each -// repeated field is an OR over its elements. Any unset fields are ignored. For -// example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : -// DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be -// true for requests originating from encrypted Linux desktops and encrypted -// Windows desktops. -message DevicePolicy { - // Whether or not screenlock is required for the DevicePolicy to be true. - // Defaults to `false`. - bool require_screenlock = 1; - - // Allowed encryptions statuses, an empty list allows all statuses. - repeated google.identity.accesscontextmanager.type.DeviceEncryptionStatus allowed_encryption_statuses = 2; - - // Allowed OS versions, an empty list allows all types and all versions. - repeated OsConstraint os_constraints = 3; - - // Allowed device management levels, an empty list allows all management - // levels. - repeated google.identity.accesscontextmanager.type.DeviceManagementLevel allowed_device_management_levels = 6; - - // Whether the device needs to be approved by the customer admin. - bool require_admin_approval = 7; - - // Whether the device needs to be corp owned. - bool require_corp_owned = 8; -} - -// A restriction on the OS type and version of devices making requests. -message OsConstraint { - // Required. The allowed OS type. - google.identity.accesscontextmanager.type.OsType os_type = 1; - - // The minimum allowed OS version. If not set, any version of this OS - // satisfies the constraint. Format: `"major.minor.patch"`. - // Examples: `"10.5.301"`, `"9.2.1"`. - string minimum_version = 2; - - // Only allows requests from devices with a verified Chrome OS. - // Verifications includes requirements that the device is enterprise-managed, - // conformant to domain policies, and the caller has permission to call - // the API targeted by the request. - bool require_verified_chrome_os = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline deleted file mode 100644 index 9ec59d1c1e84..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "PolicyProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// `AccessPolicy` is a container for `AccessLevels` (which define the necessary -// attributes to use Google Cloud services) and `ServicePerimeters` (which -// define regions of services able to freely pass data within a perimeter). An -// access policy is globally visible within an organization, and the -// restrictions it specifies apply to all projects within an organization. -message AccessPolicy { - // Output only. Resource name of the `AccessPolicy`. Format: - // `accessPolicies/{policy_id}` - string name = 1; - - // Required. The parent of this `AccessPolicy` in the Cloud Resource - // Hierarchy. Currently immutable once created. Format: - // `organizations/{organization_id}` - string parent = 2; - - // Required. Human readable title. Does not affect behavior. - string title = 3; - - // Output only. Time the `AccessPolicy` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `AccessPolicy` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Output only. An opaque identifier for the current version of the - // `AccessPolicy`. This will always be a strongly validated etag, meaning that - // two Access Polices will be identical if and only if their etags are - // identical. Clients should not expect this to be in any specific format. - string etag = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline deleted file mode 100644 index 89d76818dd16..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "ServicePerimeterProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// `ServicePerimeter` describes a set of Google Cloud resources which can freely -// import and export data amongst themselves, but not export outside of the -// `ServicePerimeter`. If a request with a source within this `ServicePerimeter` -// has a target outside of the `ServicePerimeter`, the request will be blocked. -// Otherwise the request is allowed. There are two types of Service Perimeter - -// Regular and Bridge. Regular Service Perimeters cannot overlap, a single -// Google Cloud project can only belong to a single regular Service Perimeter. -// Service Perimeter Bridges can contain only Google Cloud projects as members, -// a single Google Cloud project may belong to multiple Service Perimeter -// Bridges. -message ServicePerimeter { - // Specifies the type of the Perimeter. There are two types: regular and - // bridge. Regular Service Perimeter contains resources, access levels, and - // restricted services. Every resource can be in at most ONE - // regular Service Perimeter. - // - // In addition to being in a regular service perimeter, a resource can also - // be in zero or more perimeter bridges. A perimeter bridge only contains - // resources. Cross project operations are permitted if all effected - // resources share some perimeter (whether bridge or regular). Perimeter - // Bridge does not contain access levels or services: those are governed - // entirely by the regular perimeter that resource is in. - // - // Perimeter Bridges are typically useful when building more complex toplogies - // with many independent perimeters that need to share some data with a common - // perimeter, but should not be able to share data among themselves. - enum PerimeterType { - // Regular Perimeter. - PERIMETER_TYPE_REGULAR = 0; - - // Perimeter Bridge. - PERIMETER_TYPE_BRIDGE = 1; - } - - // Required. Resource name for the ServicePerimeter. The `short_name` - // component must begin with a letter and only include alphanumeric and '_'. - // Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `ServicePerimeter` and its use. Does not affect - // behavior. - string description = 3; - - // Output only. Time the `ServicePerimeter` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `ServicePerimeter` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Perimeter type indicator. A single project is - // allowed to be a member of single regular perimeter, but multiple service - // perimeter bridges. A project cannot be a included in a perimeter bridge - // without being included in regular perimeter. For perimeter bridges, - // the restricted service list as well as access level lists must be - // empty. - PerimeterType perimeter_type = 6; - - // Current ServicePerimeter configuration. Specifies sets of resources, - // restricted services and access levels that determine perimeter - // content and boundaries. - ServicePerimeterConfig status = 7; - - // Proposed (or dry run) ServicePerimeter configuration. This configuration - // allows to specify and test ServicePerimeter configuration without enforcing - // actual access restrictions. Only allowed to be set when the - // "use_explicit_dry_run_spec" flag is set. - ServicePerimeterConfig spec = 8; - - // Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly - // exists for all Service Perimeters, and that spec is identical to the - // status for those Service Perimeters. When this flag is set, it inhibits the - // generation of the implicit spec, thereby allowing the user to explicitly - // provide a configuration ("spec") to use in a dry-run version of the Service - // Perimeter. This allows the user to test changes to the enforced config - // ("status") without actually enforcing them. This testing is done through - // analyzing the differences between currently enforced and suggested - // restrictions. use_explicit_dry_run_spec must bet set to True if any of the - // fields in the spec are set to non-default values. - bool use_explicit_dry_run_spec = 9; -} - -// `ServicePerimeterConfig` specifies a set of Google Cloud resources that -// describe specific Service Perimeter configuration. -message ServicePerimeterConfig { - // Specifies how APIs are allowed to communicate within the Service - // Perimeter. - message VpcAccessibleServices { - // Whether to restrict API calls within the Service Perimeter to the list of - // APIs specified in 'allowed_services'. - bool enable_restriction = 1; - - // The list of APIs usable within the Service Perimeter. Must be empty - // unless 'enable_restriction' is True. - repeated string allowed_services = 2; - } - - // A list of Google Cloud resources that are inside of the service perimeter. - // Currently only projects are allowed. Format: `projects/{project_number}` - repeated string resources = 1; - - // A list of `AccessLevel` resource names that allow resources within the - // `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed - // must be in the same policy as this `ServicePerimeter`. Referencing a - // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are - // listed, resources within the perimeter can only be accessed via Google - // Cloud calls with request origins within the perimeter. Example: - // `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. - // For Service Perimeter Bridge, must be empty. - repeated string access_levels = 2; - - // Google Cloud services that are subject to the Service Perimeter - // restrictions. For example, if `storage.googleapis.com` is specified, access - // to the storage buckets inside the perimeter must meet the perimeter's - // access restrictions. - repeated string restricted_services = 4; - - // Configuration for APIs allowed within Perimeter. - VpcAccessibleServices vpc_accessible_services = 10; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline deleted file mode 100644 index b42230c81b77..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - */ - // const parent = 'abc123' - /** - * A list of the full names of the assets. For example: - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * See Resource - * Names (https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and Resource Name - * Format (https://cloud.google.com/asset-inventory/docs/resource-name-format) - * for more info. - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - */ - // const assetNames = ['abc','def'] - /** - * Optional. The content type. - */ - // const contentType = {} - /** - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - */ - // const readTimeWindow = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callBatchGetAssetsHistory() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.batchGetAssetsHistory(request); - console.log(response); - } - - callBatchGetAssetsHistory(); - // [END cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.create_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.create_feed.js.baseline deleted file mode 100644 index 6ba846eeffdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.create_feed.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, feedId, feed) { - // [START cloudasset_v1_generated_AssetService_CreateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project/folder/organization where this feed - * should be created in. It can only be an organization number (such as - * "organizations/123"), a folder number (such as "folders/123"), a project ID - * (such as "projects/my-project-id")", or a project number (such as - * "projects/12345"). - */ - // const parent = 'abc123' - /** - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - */ - // const feedId = 'abc123' - /** - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const feed = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callCreateFeed() { - // Construct request - const request = { - parent, - feedId, - feed, - }; - - // Run request - const response = await assetClient.createFeed(request); - console.log(response); - } - - callCreateFeed(); - // [END cloudasset_v1_generated_AssetService_CreateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.delete_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.delete_feed.js.baseline deleted file mode 100644 index cf735febc807..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.delete_feed.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudasset_v1_generated_AssetService_DeleteFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callDeleteFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.deleteFeed(request); - console.log(response); - } - - callDeleteFeed(); - // [END cloudasset_v1_generated_AssetService_DeleteFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.export_assets.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.export_assets.js.baseline deleted file mode 100644 index 104f0bcde93d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.export_assets.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START cloudasset_v1_generated_AssetService_ExportAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - */ - // const parent = 'abc123' - /** - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - */ - // const readTime = {} - /** - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - */ - // const assetTypes = ['abc','def'] - /** - * Asset content type. If not specified, no content but the asset name will be - * returned. - */ - // const contentType = {} - /** - * Required. Output configuration indicating where the results will be output - * to. All results will be in newline delimited JSON format. - */ - // const outputConfig = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callExportAssets() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await assetClient.exportAssets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAssets(); - // [END cloudasset_v1_generated_AssetService_ExportAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.get_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.get_feed.js.baseline deleted file mode 100644 index b0e9589c85ea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.get_feed.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudasset_v1_generated_AssetService_GetFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callGetFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.getFeed(request); - console.log(response); - } - - callGetFeed(); - // [END cloudasset_v1_generated_AssetService_GetFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.list_feeds.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.list_feeds.js.baseline deleted file mode 100644 index 5516f8da89ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.list_feeds.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudasset_v1_generated_AssetService_ListFeeds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent project/folder/organization whose feeds are to be - * listed. It can only be using project/folder/organization number (such as - * "folders/12345")", or a project ID (such as "projects/my-project-id"). - */ - // const parent = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListFeeds() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.listFeeds(request); - console.log(response); - } - - callListFeeds(); - // [END cloudasset_v1_generated_AssetService_ListFeeds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.update_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.update_feed.js.baseline deleted file mode 100644 index 99faaaa9b498..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/asset_service.update_feed.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(feed, updateMask) { - // [START cloudasset_v1_generated_AssetService_UpdateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - */ - // const feed = {} - /** - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - */ - // const updateMask = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callUpdateFeed() { - // Construct request - const request = { - feed, - updateMask, - }; - - // Run request - const response = await assetClient.updateFeed(request); - console.log(response); - } - - callUpdateFeed(); - // [END cloudasset_v1_generated_AssetService_UpdateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline deleted file mode 100644 index 2726c5c519cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline +++ /dev/null @@ -1,335 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-asset", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.asset.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudasset_v1_generated_AssetService_ExportAssets_async", - "title": "AssetService exportAssets Sample", - "origin": "API_DEFINITION", - "description": " Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep track of the export.", - "canonical": true, - "file": "asset_service.export_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAssets", - "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "asset_types", - "type": "TYPE_STRING[]" - }, - { - "name": "content_type", - "type": ".google.cloud.asset.v1.ContentType" - }, - { - "name": "output_config", - "type": ".google.cloud.asset.v1.OutputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "ExportAssets", - "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async", - "title": "AssetService batchGetAssetsHistory Sample", - "origin": "API_DEFINITION", - "description": " Batch gets the update history of assets that overlap a time window. For RESOURCE content, this API outputs history with asset in both non-delete or deleted status. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.", - "canonical": true, - "file": "asset_service.batch_get_assets_history.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchGetAssetsHistory", - "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "asset_names", - "type": "TYPE_STRING[]" - }, - { - "name": "content_type", - "type": ".google.cloud.asset.v1.ContentType" - }, - { - "name": "read_time_window", - "type": ".google.cloud.asset.v1.TimeWindow" - } - ], - "resultType": ".google.cloud.asset.v1.BatchGetAssetsHistoryResponse", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "BatchGetAssetsHistory", - "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_CreateFeed_async", - "title": "AssetService createFeed Sample", - "origin": "API_DEFINITION", - "description": " Creates a feed in a parent project/folder/organization to listen to its asset updates.", - "canonical": true, - "file": "asset_service.create_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFeed", - "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "feed_id", - "type": "TYPE_STRING" - }, - { - "name": "feed", - "type": ".google.cloud.asset.v1.Feed" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "CreateFeed", - "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_GetFeed_async", - "title": "AssetService getFeed Sample", - "origin": "API_DEFINITION", - "description": " Gets details about an asset feed.", - "canonical": true, - "file": "asset_service.get_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFeed", - "fullName": "google.cloud.asset.v1.AssetService.GetFeed", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "GetFeed", - "fullName": "google.cloud.asset.v1.AssetService.GetFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_ListFeeds_async", - "title": "AssetService listFeeds Sample", - "origin": "API_DEFINITION", - "description": " Lists all asset feeds in a parent project/folder/organization.", - "canonical": true, - "file": "asset_service.list_feeds.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFeeds", - "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.asset.v1.ListFeedsResponse", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "ListFeeds", - "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_UpdateFeed_async", - "title": "AssetService updateFeed Sample", - "origin": "API_DEFINITION", - "description": " Updates an asset feed configuration.", - "canonical": true, - "file": "asset_service.update_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFeed", - "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", - "async": true, - "parameters": [ - { - "name": "feed", - "type": ".google.cloud.asset.v1.Feed" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "UpdateFeed", - "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_DeleteFeed_async", - "title": "AssetService deleteFeed Sample", - "origin": "API_DEFINITION", - "description": " Deletes an asset feed.", - "canonical": true, - "file": "asset_service.delete_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFeed", - "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "DeleteFeed", - "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/asset-esm/webpack.config.cjs.baseline deleted file mode 100644 index 9d42a74b8442..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.OwlBot.yaml.baseline deleted file mode 100644 index e15cb90e8caa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/asset/google-cloud-asset-nodejs - dest: /owl-bot-staging/google-cloud-asset - -api-name: asset \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.jsdoc.js.baseline deleted file mode 100644 index 1837bad4f98e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/asset', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/asset/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/asset/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/asset/README.md.baseline deleted file mode 100644 index 57be2f240e6d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Asset: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/asset.svg)](https://www.npmjs.org/package/@google-cloud/asset) - -Asset client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Asset Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/asset/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Asset API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/asset -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/asset@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudasset.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-asset diff --git a/core/generator/gapic-generator-typescript/baselines/asset/package.json b/core/generator/gapic-generator-typescript/baselines/asset/package.json deleted file mode 100644 index ee6499cbe0c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/asset", - "version": "0.1.0", - "description": "Asset client for Node.js", - "repository": "googleapis/nodejs-asset", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google asset", - "asset", - "asset service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/asset_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/asset_service.proto.baseline deleted file mode 100644 index 9c7b16d036ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/asset_service.proto.baseline +++ /dev/null @@ -1,423 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/asset/v1/assets.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; - -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetServiceProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// Asset service definition. -service AssetService { - option (google.api.default_host) = "cloudasset.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Exports assets with time and resource types to a given Cloud Storage - // location. The output format is newline-delimited JSON. - // This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you - // to keep track of the export. - rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=*/*}:exportAssets" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.asset.v1.ExportAssetsResponse" - metadata_type: "google.cloud.asset.v1.ExportAssetsRequest" - }; - } - - // Batch gets the update history of assets that overlap a time window. - // For RESOURCE content, this API outputs history with asset in both - // non-delete or deleted status. - // For IAM_POLICY content, this API outputs history when the asset and its - // attached IAM POLICY both exist. This can create gaps in the output history. - // If a specified asset does not exist, this API returns an INVALID_ARGUMENT - // error. - rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}:batchGetAssetsHistory" - }; - } - - // Creates a feed in a parent project/folder/organization to listen to its - // asset updates. - rpc CreateFeed(CreateFeedRequest) returns (Feed) { - option (google.api.http) = { - post: "/v1/{parent=*/*}/feeds" - body: "*" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about an asset feed. - rpc GetFeed(GetFeedRequest) returns (Feed) { - option (google.api.http) = { - get: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all asset feeds in a parent project/folder/organization. - rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { - option (google.api.http) = { - get: "/v1/{parent=*/*}/feeds" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an asset feed configuration. - rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { - option (google.api.http) = { - patch: "/v1/{feed.name=*/*/feeds/*}" - body: "*" - }; - option (google.api.method_signature) = "feed"; - } - - // Deletes an asset feed. - rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=*/*/feeds/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Export asset request. -message ExportAssetsRequest { - // Required. The relative name of the root asset. This can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id"), or a project number (such as "projects/12345"), - // or a folder number (such as "folders/123"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // Timestamp to take an asset snapshot. This can only be set to a timestamp - // between the current time and the current time minus 35 days (inclusive). - // If not specified, the current time will be used. Due to delays in resource - // data collection and indexing, there is a volatile window during which - // running the same query may get different results. - google.protobuf.Timestamp read_time = 2; - - // A list of asset types of which to take a snapshot for. For example: - // "compute.googleapis.com/Disk". If specified, only matching assets will be - // returned. See [Introduction to Cloud Asset - // Inventory](https://cloud.google.com/asset-inventory/docs/overview) - // for all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name will be - // returned. - ContentType content_type = 4; - - // Required. Output configuration indicating where the results will be output - // to. All results will be in newline delimited JSON format. - OutputConfig output_config = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// The export asset response. This message is returned by the -// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned -// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. -message ExportAssetsResponse { - // Time the snapshot was taken. - google.protobuf.Timestamp read_time = 1; - - // Output configuration indicating where the results were output to. - // All results are in JSON format. - OutputConfig output_config = 2; -} - -// Batch get assets history request. -message BatchGetAssetsHistoryRequest { - // Required. The relative name of the root asset. It can only be an - // organization number (such as "organizations/123"), a project ID (such as - // "projects/my-project-id")", or a project number (such as "projects/12345"). - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudasset.googleapis.com/Asset" - } - ]; - - // A list of the full names of the assets. For example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // and [Resource Name - // Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - // for more info. - // - // The request becomes a no-op if the asset name list is empty, and the max - // size of the asset name list is 100 in one request. - repeated string asset_names = 2; - - // Optional. The content type. - ContentType content_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time window for the asset history. Both start_time and - // end_time are optional and if set, it must be after the current time minus - // 35 days. If end_time is not set, it is default to current timestamp. - // If start_time is not set, the snapshot of the assets at end_time will be - // returned. The returned results contain all temporal assets whose time - // window overlap with read_time_window. - TimeWindow read_time_window = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Batch get assets history response. -message BatchGetAssetsHistoryResponse { - // A list of assets with valid time windows. - repeated TemporalAsset assets = 1; -} - -// Create asset feed request. -message CreateFeedRequest { - // Required. The name of the project/folder/organization where this feed - // should be created in. It can only be an organization number (such as - // "organizations/123"), a folder number (such as "folders/123"), a project ID - // (such as "projects/my-project-id")", or a project number (such as - // "projects/12345"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. This is the client-assigned asset feed identifier and it needs to - // be unique under a specific parent project/folder/organization. - string feed_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The feed details. The field `name` must be empty and it will be generated - // in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - Feed feed = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Get asset feed request. -message GetFeedRequest { - // Required. The name of the Feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// List asset feeds request. -message ListFeedsRequest { - // Required. The parent project/folder/organization whose feeds are to be - // listed. It can only be using project/folder/organization number (such as - // "folders/12345")", or a project ID (such as "projects/my-project-id"). - string parent = 1 [(google.api.field_behavior) = REQUIRED]; -} - -message ListFeedsResponse { - // A list of feeds. - repeated Feed feeds = 1; -} - -// Update asset feed request. -message UpdateFeedRequest { - // Required. The new values of feed details. It must match an existing feed and the - // field `name` must be in the format of: - // projects/project_number/feeds/feed_id or - // folders/folder_number/feeds/feed_id or - // organizations/organization_number/feeds/feed_id. - Feed feed = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `feed` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message DeleteFeedRequest { - // Required. The name of the feed and it must be in the format of: - // projects/project_number/feeds/feed_id - // folders/folder_number/feeds/feed_id - // organizations/organization_number/feeds/feed_id - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudasset.googleapis.com/Feed" - } - ]; -} - -// Output configuration for export assets destination. -message OutputConfig { - // Asset export destination. - oneof destination { - // Destination on Cloud Storage. - GcsDestination gcs_destination = 1; - - // Destination on BigQuery. The output table stores the fields in asset - // proto as columns in BigQuery. The resource/iam_policy field is converted - // to a record with each field to a column, except metadata to a single JSON - // string. - BigQueryDestination bigquery_destination = 2; - } -} - -// A Cloud Storage location. -message GcsDestination { - // Required. - oneof object_uri { - // The uri of the Cloud Storage object. It's the same uri that is used by - // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and - // Editing Object - // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) - // for more information. - string uri = 1; - - // The uri prefix of all generated Cloud Storage objects. For example: - // "gs://bucket_name/object_name_prefix". Each object uri is in format: - // "gs://bucket_name/object_name_prefix// and only - // contains assets for that type. starts from 0. For example: - // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is - // the first shard of output objects containing all - // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be - // returned if file with the same name "gs://bucket_name/object_name_prefix" - // already exists. - string uri_prefix = 2; - } -} - -// A BigQuery destination. -message BigQueryDestination { - // Required. The BigQuery dataset in format - // "projects/projectId/datasets/datasetId", to which the snapshot result - // should be exported. If this dataset does not exist, the export call returns - // an INVALID_ARGUMENT error. - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table to which the snapshot result should be - // written. If this table does not exist, a new table with the given name - // will be created. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - - // If the destination table already exists and this flag is `TRUE`, the - // table will be overwritten by the contents of assets snapshot. If the flag - // is `FALSE` or unset and the destination table already exists, the export - // call returns an INVALID_ARGUMEMT error. - bool force = 3; -} - -// A Pub/Sub destination. -message PubsubDestination { - // The name of the Pub/Sub topic to publish to. - // For example: `projects/PROJECT_ID/topics/TOPIC_ID`. - string topic = 1; -} - -// Output configuration for asset feed destination. -message FeedOutputConfig { - // Asset feed destination. - oneof destination { - // Destination on Pub/Sub. - PubsubDestination pubsub_destination = 1; - } -} - -// An asset feed used to export asset updates to a destinations. -// An asset feed filter controls what updates are exported. -// The asset feed must be created within a project, organization, or -// folder. Supported destinations are: -// Pub/Sub topics. -message Feed { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Feed" - pattern: "projects/{project}/feeds/{feed}" - pattern: "folders/{folder}/feeds/{feed}" - pattern: "organizations/{organization}/feeds/{feed}" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // Required. The format will be - // projects/{project_number}/feeds/{client-assigned_feed_identifier} or - // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or - // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} - // - // The client-assigned feed identifier must be unique within the parent - // project/folder/organization. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of the full names of the assets to receive updates. You must specify - // either or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. For - // example: - // `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - // See [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more info. - repeated string asset_names = 2; - - // A list of types of the assets to receive updates. You must specify either - // or both of asset_names and asset_types. Only asset updates matching - // specified asset_names and asset_types are exported to the feed. - // For example: `"compute.googleapis.com/Disk"` - // - // See [this - // topic](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for a list of all supported asset types. - repeated string asset_types = 3; - - // Asset content type. If not specified, no content but the asset name and - // type will be returned. - ContentType content_type = 4; - - // Required. Feed output configuration defining where the asset updates are - // published to. - FeedOutputConfig feed_output_config = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// Asset content type. -enum ContentType { - // Unspecified content type. - CONTENT_TYPE_UNSPECIFIED = 0; - - // Resource metadata. - RESOURCE = 1; - - // The actual IAM policy set on a resource. - IAM_POLICY = 2; - - // The Cloud Organization Policy set on an asset. - ORG_POLICY = 4; - - // The Cloud Access context mananger Policy set on an asset. - ACCESS_POLICY = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/assets.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/assets.proto.baseline deleted file mode 100644 index 1e8b40a11d92..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/asset/v1/assets.proto.baseline +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.asset.v1; - -import "google/api/resource.proto"; -import "google/cloud/orgpolicy/v1/orgpolicy.proto"; -import "google/iam/v1/policy.proto"; -import "google/identity/accesscontextmanager/v1/access_level.proto"; -import "google/identity/accesscontextmanager/v1/access_policy.proto"; -import "google/identity/accesscontextmanager/v1/service_perimeter.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Asset.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1;asset"; -option java_multiple_files = true; -option java_outer_classname = "AssetProto"; -option java_package = "com.google.cloud.asset.v1"; -option php_namespace = "Google\\Cloud\\Asset\\V1"; - -// An asset in Google Cloud and its temporal metadata, including the time window -// when it was observed and its status during that window. -message TemporalAsset { - // The time window when the asset data and state was observed. - TimeWindow window = 1; - - // Whether the asset has been deleted or not. - bool deleted = 2; - - // An asset in Google Cloud. - Asset asset = 3; -} - -// A time window specified by its "start_time" and "end_time". -message TimeWindow { - // Start time of the time window (exclusive). - google.protobuf.Timestamp start_time = 1; - - // End time of the time window (inclusive). If not specified, the current - // timestamp is used instead. - google.protobuf.Timestamp end_time = 2; -} - -// An asset in Google Cloud. An asset can be any resource in the Google Cloud -// [resource -// hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), -// a resource outside the Google Cloud resource hierarchy (such as Google -// Kubernetes Engine clusters and objects), or a Cloud IAM policy. -message Asset { - option (google.api.resource) = { - type: "cloudasset.googleapis.com/Asset" - pattern: "*" - }; - - // The full name of the asset. For example: - // "//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1" - // - // See [Resource - // names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - string name = 1; - - // The type of the asset. For example: "compute.googleapis.com/Disk" - // - // See [Supported asset - // types](https://cloud.google.com/asset-inventory/docs/supported-asset-types) - // for more information. - string asset_type = 2; - - // A representation of the resource. - Resource resource = 3; - - // A representation of the Cloud IAM policy set on a Google Cloud resource. - // There can be a maximum of one Cloud IAM policy set on any given resource. - // In addition, Cloud IAM policies inherit their granted access scope from any - // policies set on parent resources in the resource hierarchy. Therefore, the - // effectively policy is the union of both the policy set on this resource - // and each policy set on all of the resource's ancestry resource levels in - // the hierarchy. See - // [this topic](https://cloud.google.com/iam/docs/policies#inheritance) for - // more information. - google.iam.v1.Policy iam_policy = 4; - - // A representation of an [organization - // policy](https://cloud.google.com/resource-manager/docs/organization-policy/overview#organization_policy). - // There can be more than one organization policy with different constraints - // set on a given resource. - repeated google.cloud.orgpolicy.v1.Policy org_policy = 6; - - // A representation of an [access - // policy](https://cloud.google.com/access-context-manager/docs/overview#access-policies). - oneof access_context_policy { - google.identity.accesscontextmanager.v1.AccessPolicy access_policy = 7; - - google.identity.accesscontextmanager.v1.AccessLevel access_level = 8; - - google.identity.accesscontextmanager.v1.ServicePerimeter service_perimeter = 9; - } - - // The ancestry path of an asset in Google Cloud [resource - // hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy), - // represented as a list of relative resource names. An ancestry path starts - // with the closest ancestor in the hierarchy and ends at root. If the asset - // is a project, folder, or organization, the ancestry path starts from the - // asset itself. - // - // For example: `["projects/123456789", "folders/5432", "organizations/1234"]` - repeated string ancestors = 10; -} - -// A representation of a Google Cloud resource. -message Resource { - // The API version. For example: "v1" - string version = 1; - - // The URL of the discovery document containing the resource's JSON schema. - // For example: - // "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest" - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_document_uri = 2; - - // The JSON schema name listed in the discovery document. For example: - // "Project" - // - // This value is unspecified for resources that do not have an API based on a - // discovery document, such as Cloud Bigtable. - string discovery_name = 3; - - // The REST URL for accessing the resource. An HTTP `GET` request using this - // URL returns the resource itself. For example: - // "https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123" - // - // This value is unspecified for resources without a REST API. - string resource_url = 4; - - // The full name of the immediate parent of this resource. See - // [Resource - // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - // for more information. - // - // For Google Cloud assets, this value is the parent resource defined in the - // [Cloud IAM policy - // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). - // For example: - // "//cloudresourcemanager.googleapis.com/projects/my_project_123" - // - // For third-party assets, this field may be set differently. - string parent = 5; - - // The content of the resource, in which some sensitive fields are removed - // and may not be present. - google.protobuf.Struct data = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline deleted file mode 100644 index fbd62df6f3f0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/cloud/orgpolicy/v1/orgpolicy.proto.baseline +++ /dev/null @@ -1,315 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.orgpolicy.v1; - -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.OrgPolicy.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1;orgpolicy"; -option java_multiple_files = true; -option java_outer_classname = "OrgPolicyProto"; -option java_package = "com.google.cloud.orgpolicy.v1"; -option php_namespace = "Google\\Cloud\\OrgPolicy\\V1"; -option ruby_package = "Google::Cloud::OrgPolicy::V1"; - -// Defines a Cloud Organization `Policy` which is used to specify `Constraints` -// for configurations of Cloud Platform resources. -message Policy { - // Used in `policy_type` to specify how `list_policy` behaves at this - // resource. - // - // `ListPolicy` can define specific values and subtrees of Cloud Resource - // Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that - // are allowed or denied by setting the `allowed_values` and `denied_values` - // fields. This is achieved by using the `under:` and optional `is:` prefixes. - // The `under:` prefix is used to denote resource subtree values. - // The `is:` prefix is used to denote specific values, and is required only - // if the value contains a ":". Values prefixed with "is:" are treated the - // same as values with no prefix. - // Ancestry subtrees must be in one of the following formats: - // - "projects/", e.g. "projects/tokyo-rain-123" - // - "folders/", e.g. "folders/1234" - // - "organizations/", e.g. "organizations/1234" - // The `supports_under` field of the associated `Constraint` defines whether - // ancestry prefixes can be used. You can set `allowed_values` and - // `denied_values` in the same `Policy` if `all_values` is - // `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all - // values. If `all_values` is set to either `ALLOW` or `DENY`, - // `allowed_values` and `denied_values` must be unset. - message ListPolicy { - // This enum can be used to set `Policies` that apply to all possible - // configuration values rather than specific values in `allowed_values` or - // `denied_values`. - // - // Settting this to `ALLOW` will mean this `Policy` allows all values. - // Similarly, setting it to `DENY` will mean no values are allowed. If - // set to either `ALLOW` or `DENY, `allowed_values` and `denied_values` - // must be unset. Setting this to `ALL_VALUES_UNSPECIFIED` allows for - // setting `allowed_values` and `denied_values`. - enum AllValues { - // Indicates that allowed_values or denied_values must be set. - ALL_VALUES_UNSPECIFIED = 0; - - // A policy with this set allows all values. - ALLOW = 1; - - // A policy with this set denies all values. - DENY = 2; - } - - // List of values allowed at this resource. Can only be set if `all_values` - // is set to `ALL_VALUES_UNSPECIFIED`. - repeated string allowed_values = 1; - - // List of values denied at this resource. Can only be set if `all_values` - // is set to `ALL_VALUES_UNSPECIFIED`. - repeated string denied_values = 2; - - // The policy all_values state. - AllValues all_values = 3; - - // Optional. The Google Cloud Console will try to default to a configuration - // that matches the value specified in this `Policy`. If `suggested_value` - // is not set, it will inherit the value specified higher in the hierarchy, - // unless `inherit_from_parent` is `false`. - string suggested_value = 4; - - // Determines the inheritance behavior for this `Policy`. - // - // By default, a `ListPolicy` set at a resource supercedes any `Policy` set - // anywhere up the resource hierarchy. However, if `inherit_from_parent` is - // set to `true`, then the values from the effective `Policy` of the parent - // resource are inherited, meaning the values set in this `Policy` are - // added to the values inherited up the hierarchy. - // - // Setting `Policy` hierarchies that inherit both allowed values and denied - // values isn't recommended in most circumstances to keep the configuration - // simple and understandable. However, it is possible to set a `Policy` with - // `allowed_values` set that inherits a `Policy` with `denied_values` set. - // In this case, the values that are allowed must be in `allowed_values` and - // not present in `denied_values`. - // - // For example, suppose you have a `Constraint` - // `constraints/serviceuser.services`, which has a `constraint_type` of - // `list_constraint`, and with `constraint_default` set to `ALLOW`. - // Suppose that at the Organization level, a `Policy` is applied that - // restricts the allowed API activations to {`E1`, `E2`}. Then, if a - // `Policy` is applied to a project below the Organization that has - // `inherit_from_parent` set to `false` and field all_values set to DENY, - // then an attempt to activate any API will be denied. - // - // The following examples demonstrate different possible layerings for - // `projects/bar` parented by `organizations/foo`: - // - // Example 1 (no inherited values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has `inherit_from_parent` `false` and values: - // {allowed_values: "E3" allowed_values: "E4"} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are `E3`, and `E4`. - // - // Example 2 (inherited values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has a `Policy` with values: - // {value: "E3" value: "E4" inherit_from_parent: true} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`. - // - // Example 3 (inheriting both allowed and denied values): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {denied_values: "E1"} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The value accepted at `projects/bar` is `E2`. - // - // Example 4 (RestoreDefault): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values:"E2"} - // `projects/bar` has a `Policy` with values: - // {RestoreDefault: {}} - // The accepted values at `organizations/foo` are `E1`, `E2`. - // The accepted values at `projects/bar` are either all or none depending on - // the value of `constraint_default` (if `ALLOW`, all; if - // `DENY`, none). - // - // Example 5 (no policy inherits parent policy): - // `organizations/foo` has no `Policy` set. - // `projects/bar` has no `Policy` set. - // The accepted values at both levels are either all or none depending on - // the value of `constraint_default` (if `ALLOW`, all; if - // `DENY`, none). - // - // Example 6 (ListConstraint allowing all): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {all: ALLOW} - // The accepted values at `organizations/foo` are `E1`, E2`. - // Any value is accepted at `projects/bar`. - // - // Example 7 (ListConstraint allowing none): - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "E1" allowed_values: "E2"} - // `projects/bar` has a `Policy` with: - // {all: DENY} - // The accepted values at `organizations/foo` are `E1`, E2`. - // No value is accepted at `projects/bar`. - // - // Example 10 (allowed and denied subtrees of Resource Manager hierarchy): - // Given the following resource hierarchy - // O1->{F1, F2}; F1->{P1}; F2->{P2, P3}, - // `organizations/foo` has a `Policy` with values: - // {allowed_values: "under:organizations/O1"} - // `projects/bar` has a `Policy` with: - // {allowed_values: "under:projects/P3"} - // {denied_values: "under:folders/F2"} - // The accepted values at `organizations/foo` are `organizations/O1`, - // `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`, - // `projects/P3`. - // The accepted values at `projects/bar` are `organizations/O1`, - // `folders/F1`, `projects/P1`. - bool inherit_from_parent = 5; - } - - // Used in `policy_type` to specify how `boolean_policy` will behave at this - // resource. - message BooleanPolicy { - // If `true`, then the `Policy` is enforced. If `false`, then any - // configuration is acceptable. - // - // Suppose you have a `Constraint` - // `constraints/compute.disableSerialPortAccess` with `constraint_default` - // set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following - // behavior: - // - If the `Policy` at this resource has enforced set to `false`, serial - // port connection attempts will be allowed. - // - If the `Policy` at this resource has enforced set to `true`, serial - // port connection attempts will be refused. - // - If the `Policy` at this resource is `RestoreDefault`, serial port - // connection attempts will be allowed. - // - If no `Policy` is set at this resource or anywhere higher in the - // resource hierarchy, serial port connection attempts will be allowed. - // - If no `Policy` is set at this resource, but one exists higher in the - // resource hierarchy, the behavior is as if the`Policy` were set at - // this resource. - // - // The following examples demonstrate the different possible layerings: - // - // Example 1 (nearest `Constraint` wins): - // `organizations/foo` has a `Policy` with: - // {enforced: false} - // `projects/bar` has no `Policy` set. - // The constraint at `projects/bar` and `organizations/foo` will not be - // enforced. - // - // Example 2 (enforcement gets replaced): - // `organizations/foo` has a `Policy` with: - // {enforced: false} - // `projects/bar` has a `Policy` with: - // {enforced: true} - // The constraint at `organizations/foo` is not enforced. - // The constraint at `projects/bar` is enforced. - // - // Example 3 (RestoreDefault): - // `organizations/foo` has a `Policy` with: - // {enforced: true} - // `projects/bar` has a `Policy` with: - // {RestoreDefault: {}} - // The constraint at `organizations/foo` is enforced. - // The constraint at `projects/bar` is not enforced, because - // `constraint_default` for the `Constraint` is `ALLOW`. - bool enforced = 1; - } - - // Ignores policies set above this resource and restores the - // `constraint_default` enforcement behavior of the specific `Constraint` at - // this resource. - // - // Suppose that `constraint_default` is set to `ALLOW` for the - // `Constraint` `constraints/serviceuser.services`. Suppose that organization - // foo.com sets a `Policy` at their Organization resource node that restricts - // the allowed service activations to deny all service activations. They - // could then set a `Policy` with the `policy_type` `restore_default` on - // several experimental projects, restoring the `constraint_default` - // enforcement of the `Constraint` for only those projects, allowing those - // projects to have all services activated. - message RestoreDefault { - - } - - // Version of the `Policy`. Default version is 0; - int32 version = 1; - - // The name of the `Constraint` the `Policy` is configuring, for example, - // `constraints/serviceuser.services`. - // - // Immutable after creation. - string constraint = 2; - - // An opaque tag indicating the current version of the `Policy`, used for - // concurrency control. - // - // When the `Policy` is returned from either a `GetPolicy` or a - // `ListOrgPolicy` request, this `etag` indicates the version of the current - // `Policy` to use when executing a read-modify-write loop. - // - // When the `Policy` is returned from a `GetEffectivePolicy` request, the - // `etag` will be unset. - // - // When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value - // that was returned from a `GetOrgPolicy` request as part of a - // read-modify-write loop for concurrency control. Not setting the `etag`in a - // `SetOrgPolicy` request will result in an unconditional write of the - // `Policy`. - bytes etag = 3; - - // The time stamp the `Policy` was previously updated. This is set by the - // server, not specified by the caller, and represents the last time a call to - // `SetOrgPolicy` was made for that `Policy`. Any value set by the client will - // be ignored. - google.protobuf.Timestamp update_time = 4; - - // The field to populate is based on the `constraint_type` value in the - // `Constraint`. - // `list_constraint` => `list_policy` - // `boolean_constraint` => `boolean_policy` - // - // A `restore_default` message may be used with any `Constraint` type. - // - // Providing a *_policy that is incompatible with the `constraint_type` will - // result in an `invalid_argument` error. - // - // Attempting to set a `Policy` with a `policy_type` not set will result in an - // `invalid_argument` error. - oneof policy_type { - // List of values either allowed or disallowed. - ListPolicy list_policy = 5; - - // For boolean `Constraints`, whether to enforce the `Constraint` or not. - BooleanPolicy boolean_policy = 6; - - // Restores the default behavior of the constraint; independent of - // `Constraint` type. - RestoreDefault restore_default = 7; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline deleted file mode 100644 index f05791033938..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/type/device_resources.proto.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.type; - -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.Type"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type;type"; -option java_package = "com.google.identity.accesscontextmanager.type"; -option java_multiple_files = true; -option java_outer_classname = "TypeProto"; -option php_namespace = "Google\\Identity\\AccessContextManager\\Type"; -option ruby_package = "Google::Identity::AccessContextManager::Type"; - -// The encryption state of the device. -enum DeviceEncryptionStatus { - // The encryption status of the device is not specified or not known. - ENCRYPTION_UNSPECIFIED = 0; - - // The device does not support encryption. - ENCRYPTION_UNSUPPORTED = 1; - - // The device supports encryption, but is currently unencrypted. - UNENCRYPTED = 2; - - // The device is encrypted. - ENCRYPTED = 3; -} - -// The operating system type of the device. -// Next id: 7 -enum OsType { - // The operating system of the device is not specified or not known. - OS_UNSPECIFIED = 0; - - // A desktop Mac operating system. - DESKTOP_MAC = 1; - - // A desktop Windows operating system. - DESKTOP_WINDOWS = 2; - - // A desktop Linux operating system. - DESKTOP_LINUX = 3; - - // A desktop ChromeOS operating system. - DESKTOP_CHROME_OS = 6; - - // An Android operating system. - ANDROID = 4; - - // An iOS operating system. - IOS = 5; -} - -// The degree to which the device is managed by the Cloud organization. -enum DeviceManagementLevel { - // The device's management level is not specified or not known. - MANAGEMENT_UNSPECIFIED = 0; - - // The device is not managed. - NONE = 1; - - // Basic management is enabled, which is generally limited to monitoring and - // wiping the corporate account. - BASIC = 2; - - // Complete device management. This includes more thorough monitoring and the - // ability to directly manage the device (such as remote wiping). This can be - // enabled through the Android Enterprise Platform. - COMPLETE = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline deleted file mode 100644 index 0ebd1936c946..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_level.proto.baseline +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/identity/accesscontextmanager/type/device_resources.proto"; -import "google/protobuf/timestamp.proto"; -import "google/type/expr.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "AccessLevelProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// An `AccessLevel` is a label that can be applied to requests to Google Cloud -// services, along with a list of requirements necessary for the label to be -// applied. -message AccessLevel { - // Required. Resource name for the Access Level. The `short_name` component - // must begin with a letter and only include alphanumeric and '_'. Format: - // `accessPolicies/{policy_id}/accessLevels/{short_name}`. The maximum length - // of the `short_name` component is 50 characters. - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `AccessLevel` and its use. Does not affect behavior. - string description = 3; - - // Required. Describes the necessary conditions for the level to apply. - oneof level { - // A `BasicLevel` composed of `Conditions`. - BasicLevel basic = 4; - - // A `CustomLevel` written in the Common Expression Language. - CustomLevel custom = 5; - } - - // Output only. Time the `AccessLevel` was created in UTC. - google.protobuf.Timestamp create_time = 6; - - // Output only. Time the `AccessLevel` was updated in UTC. - google.protobuf.Timestamp update_time = 7; -} - -// `BasicLevel` is an `AccessLevel` using a set of recommended features. -message BasicLevel { - // Options for how the `conditions` list should be combined to determine if - // this `AccessLevel` is applied. Default is AND. - enum ConditionCombiningFunction { - // All `Conditions` must be true for the `BasicLevel` to be true. - AND = 0; - - // If at least one `Condition` is true, then the `BasicLevel` is true. - OR = 1; - } - - // Required. A list of requirements for the `AccessLevel` to be granted. - repeated Condition conditions = 1; - - // How the `conditions` list should be combined to determine if a request is - // granted this `AccessLevel`. If AND is used, each `Condition` in - // `conditions` must be satisfied for the `AccessLevel` to be applied. If OR - // is used, at least one `Condition` in `conditions` must be satisfied for the - // `AccessLevel` to be applied. Default behavior is AND. - ConditionCombiningFunction combining_function = 2; -} - -// A condition necessary for an `AccessLevel` to be granted. The Condition is an -// AND over its fields. So a Condition is true if: 1) the request IP is from one -// of the listed subnetworks AND 2) the originating device complies with the -// listed device policy AND 3) all listed access levels are granted AND 4) the -// request was sent at a time allowed by the DateTimeRestriction. -message Condition { - // CIDR block IP subnetwork specification. May be IPv4 or IPv6. Note that for - // a CIDR IP address block, the specified IP address portion must be properly - // truncated (i.e. all the host bits must be zero) or the input is considered - // malformed. For example, "192.0.2.0/24" is accepted but "192.0.2.1/24" is - // not. Similarly, for IPv6, "2001:db8::/32" is accepted whereas - // "2001:db8::1/32" is not. The originating IP of a request must be in one of - // the listed subnets in order for this Condition to be true. If empty, all IP - // addresses are allowed. - repeated string ip_subnetworks = 1; - - // Device specific restrictions, all restrictions must hold for the - // Condition to be true. If not specified, all devices are allowed. - DevicePolicy device_policy = 2; - - // A list of other access levels defined in the same `Policy`, referenced by - // resource name. Referencing an `AccessLevel` which does not exist is an - // error. All access levels listed must be granted for the Condition - // to be true. Example: - // "`accessPolicies/MY_POLICY/accessLevels/LEVEL_NAME"` - repeated string required_access_levels = 3; - - // Whether to negate the Condition. If true, the Condition becomes a NAND over - // its non-empty fields, each field must be false for the Condition overall to - // be satisfied. Defaults to false. - bool negate = 5; - - // The request must be made by one of the provided user or service - // accounts. Groups are not supported. - // Syntax: - // `user:{emailid}` - // `serviceAccount:{emailid}` - // If not specified, a request may come from any user. - repeated string members = 6; - - // The request must originate from one of the provided countries/regions. - // Must be valid ISO 3166-1 alpha-2 codes. - repeated string regions = 7; -} - -// `CustomLevel` is an `AccessLevel` using the Cloud Common Expression Language -// to represent the necessary conditions for the level to apply to a request. -// See CEL spec at: https://github.com/google/cel-spec -message CustomLevel { - // Required. A Cloud CEL expression evaluating to a boolean. - google.type.Expr expr = 1; -} - -// `DevicePolicy` specifies device specific restrictions necessary to acquire a -// given access level. A `DevicePolicy` specifies requirements for requests from -// devices to be granted access levels, it does not do any enforcement on the -// device. `DevicePolicy` acts as an AND over all specified fields, and each -// repeated field is an OR over its elements. Any unset fields are ignored. For -// example, if the proto is { os_type : DESKTOP_WINDOWS, os_type : -// DESKTOP_LINUX, encryption_status: ENCRYPTED}, then the DevicePolicy will be -// true for requests originating from encrypted Linux desktops and encrypted -// Windows desktops. -message DevicePolicy { - // Whether or not screenlock is required for the DevicePolicy to be true. - // Defaults to `false`. - bool require_screenlock = 1; - - // Allowed encryptions statuses, an empty list allows all statuses. - repeated google.identity.accesscontextmanager.type.DeviceEncryptionStatus allowed_encryption_statuses = 2; - - // Allowed OS versions, an empty list allows all types and all versions. - repeated OsConstraint os_constraints = 3; - - // Allowed device management levels, an empty list allows all management - // levels. - repeated google.identity.accesscontextmanager.type.DeviceManagementLevel allowed_device_management_levels = 6; - - // Whether the device needs to be approved by the customer admin. - bool require_admin_approval = 7; - - // Whether the device needs to be corp owned. - bool require_corp_owned = 8; -} - -// A restriction on the OS type and version of devices making requests. -message OsConstraint { - // Required. The allowed OS type. - google.identity.accesscontextmanager.type.OsType os_type = 1; - - // The minimum allowed OS version. If not set, any version of this OS - // satisfies the constraint. Format: `"major.minor.patch"`. - // Examples: `"10.5.301"`, `"9.2.1"`. - string minimum_version = 2; - - // Only allows requests from devices with a verified Chrome OS. - // Verifications includes requirements that the device is enterprise-managed, - // conformant to domain policies, and the caller has permission to call - // the API targeted by the request. - bool require_verified_chrome_os = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline deleted file mode 100644 index 9ec59d1c1e84..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/access_policy.proto.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "PolicyProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// `AccessPolicy` is a container for `AccessLevels` (which define the necessary -// attributes to use Google Cloud services) and `ServicePerimeters` (which -// define regions of services able to freely pass data within a perimeter). An -// access policy is globally visible within an organization, and the -// restrictions it specifies apply to all projects within an organization. -message AccessPolicy { - // Output only. Resource name of the `AccessPolicy`. Format: - // `accessPolicies/{policy_id}` - string name = 1; - - // Required. The parent of this `AccessPolicy` in the Cloud Resource - // Hierarchy. Currently immutable once created. Format: - // `organizations/{organization_id}` - string parent = 2; - - // Required. Human readable title. Does not affect behavior. - string title = 3; - - // Output only. Time the `AccessPolicy` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `AccessPolicy` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Output only. An opaque identifier for the current version of the - // `AccessPolicy`. This will always be a strongly validated etag, meaning that - // two Access Polices will be identical if and only if their etags are - // identical. Clients should not expect this to be in any specific format. - string etag = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline b/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline deleted file mode 100644 index 89d76818dd16..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/protos/google/identity/accesscontextmanager/v1/service_perimeter.proto.baseline +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.identity.accesscontextmanager.v1; - -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Identity.AccessContextManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1;accesscontextmanager"; -option java_multiple_files = true; -option java_outer_classname = "ServicePerimeterProto"; -option java_package = "com.google.identity.accesscontextmanager.v1"; -option php_namespace = "Google\\Identity\\AccessContextManager\\V1"; -option ruby_package = "Google::Identity::AccessContextManager::V1"; -option objc_class_prefix = "GACM"; - -// `ServicePerimeter` describes a set of Google Cloud resources which can freely -// import and export data amongst themselves, but not export outside of the -// `ServicePerimeter`. If a request with a source within this `ServicePerimeter` -// has a target outside of the `ServicePerimeter`, the request will be blocked. -// Otherwise the request is allowed. There are two types of Service Perimeter - -// Regular and Bridge. Regular Service Perimeters cannot overlap, a single -// Google Cloud project can only belong to a single regular Service Perimeter. -// Service Perimeter Bridges can contain only Google Cloud projects as members, -// a single Google Cloud project may belong to multiple Service Perimeter -// Bridges. -message ServicePerimeter { - // Specifies the type of the Perimeter. There are two types: regular and - // bridge. Regular Service Perimeter contains resources, access levels, and - // restricted services. Every resource can be in at most ONE - // regular Service Perimeter. - // - // In addition to being in a regular service perimeter, a resource can also - // be in zero or more perimeter bridges. A perimeter bridge only contains - // resources. Cross project operations are permitted if all effected - // resources share some perimeter (whether bridge or regular). Perimeter - // Bridge does not contain access levels or services: those are governed - // entirely by the regular perimeter that resource is in. - // - // Perimeter Bridges are typically useful when building more complex toplogies - // with many independent perimeters that need to share some data with a common - // perimeter, but should not be able to share data among themselves. - enum PerimeterType { - // Regular Perimeter. - PERIMETER_TYPE_REGULAR = 0; - - // Perimeter Bridge. - PERIMETER_TYPE_BRIDGE = 1; - } - - // Required. Resource name for the ServicePerimeter. The `short_name` - // component must begin with a letter and only include alphanumeric and '_'. - // Format: `accessPolicies/{policy_id}/servicePerimeters/{short_name}` - string name = 1; - - // Human readable title. Must be unique within the Policy. - string title = 2; - - // Description of the `ServicePerimeter` and its use. Does not affect - // behavior. - string description = 3; - - // Output only. Time the `ServicePerimeter` was created in UTC. - google.protobuf.Timestamp create_time = 4; - - // Output only. Time the `ServicePerimeter` was updated in UTC. - google.protobuf.Timestamp update_time = 5; - - // Perimeter type indicator. A single project is - // allowed to be a member of single regular perimeter, but multiple service - // perimeter bridges. A project cannot be a included in a perimeter bridge - // without being included in regular perimeter. For perimeter bridges, - // the restricted service list as well as access level lists must be - // empty. - PerimeterType perimeter_type = 6; - - // Current ServicePerimeter configuration. Specifies sets of resources, - // restricted services and access levels that determine perimeter - // content and boundaries. - ServicePerimeterConfig status = 7; - - // Proposed (or dry run) ServicePerimeter configuration. This configuration - // allows to specify and test ServicePerimeter configuration without enforcing - // actual access restrictions. Only allowed to be set when the - // "use_explicit_dry_run_spec" flag is set. - ServicePerimeterConfig spec = 8; - - // Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly - // exists for all Service Perimeters, and that spec is identical to the - // status for those Service Perimeters. When this flag is set, it inhibits the - // generation of the implicit spec, thereby allowing the user to explicitly - // provide a configuration ("spec") to use in a dry-run version of the Service - // Perimeter. This allows the user to test changes to the enforced config - // ("status") without actually enforcing them. This testing is done through - // analyzing the differences between currently enforced and suggested - // restrictions. use_explicit_dry_run_spec must bet set to True if any of the - // fields in the spec are set to non-default values. - bool use_explicit_dry_run_spec = 9; -} - -// `ServicePerimeterConfig` specifies a set of Google Cloud resources that -// describe specific Service Perimeter configuration. -message ServicePerimeterConfig { - // Specifies how APIs are allowed to communicate within the Service - // Perimeter. - message VpcAccessibleServices { - // Whether to restrict API calls within the Service Perimeter to the list of - // APIs specified in 'allowed_services'. - bool enable_restriction = 1; - - // The list of APIs usable within the Service Perimeter. Must be empty - // unless 'enable_restriction' is True. - repeated string allowed_services = 2; - } - - // A list of Google Cloud resources that are inside of the service perimeter. - // Currently only projects are allowed. Format: `projects/{project_number}` - repeated string resources = 1; - - // A list of `AccessLevel` resource names that allow resources within the - // `ServicePerimeter` to be accessed from the internet. `AccessLevels` listed - // must be in the same policy as this `ServicePerimeter`. Referencing a - // nonexistent `AccessLevel` is a syntax error. If no `AccessLevel` names are - // listed, resources within the perimeter can only be accessed via Google - // Cloud calls with request origins within the perimeter. Example: - // `"accessPolicies/MY_POLICY/accessLevels/MY_LEVEL"`. - // For Service Perimeter Bridge, must be empty. - repeated string access_levels = 2; - - // Google Cloud services that are subject to the Service Perimeter - // restrictions. For example, if `storage.googleapis.com` is specified, access - // to the storage buckets inside the perimeter must meet the perimeter's - // access restrictions. - repeated string restricted_services = 4; - - // Configuration for APIs allowed within Perimeter. - VpcAccessibleServices vpc_accessible_services = 10; -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline deleted file mode 100644 index b42230c81b77..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.batch_get_assets_history.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - */ - // const parent = 'abc123' - /** - * A list of the full names of the assets. For example: - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * See Resource - * Names (https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and Resource Name - * Format (https://cloud.google.com/asset-inventory/docs/resource-name-format) - * for more info. - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - */ - // const assetNames = ['abc','def'] - /** - * Optional. The content type. - */ - // const contentType = {} - /** - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - */ - // const readTimeWindow = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callBatchGetAssetsHistory() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.batchGetAssetsHistory(request); - console.log(response); - } - - callBatchGetAssetsHistory(); - // [END cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.create_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.create_feed.js.baseline deleted file mode 100644 index 6ba846eeffdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.create_feed.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, feedId, feed) { - // [START cloudasset_v1_generated_AssetService_CreateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project/folder/organization where this feed - * should be created in. It can only be an organization number (such as - * "organizations/123"), a folder number (such as "folders/123"), a project ID - * (such as "projects/my-project-id")", or a project number (such as - * "projects/12345"). - */ - // const parent = 'abc123' - /** - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - */ - // const feedId = 'abc123' - /** - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const feed = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callCreateFeed() { - // Construct request - const request = { - parent, - feedId, - feed, - }; - - // Run request - const response = await assetClient.createFeed(request); - console.log(response); - } - - callCreateFeed(); - // [END cloudasset_v1_generated_AssetService_CreateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.delete_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.delete_feed.js.baseline deleted file mode 100644 index cf735febc807..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.delete_feed.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudasset_v1_generated_AssetService_DeleteFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callDeleteFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.deleteFeed(request); - console.log(response); - } - - callDeleteFeed(); - // [END cloudasset_v1_generated_AssetService_DeleteFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.export_assets.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.export_assets.js.baseline deleted file mode 100644 index 104f0bcde93d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.export_assets.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START cloudasset_v1_generated_AssetService_ExportAssets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - */ - // const parent = 'abc123' - /** - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - */ - // const readTime = {} - /** - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See Introduction to Cloud Asset - * Inventory (https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - */ - // const assetTypes = ['abc','def'] - /** - * Asset content type. If not specified, no content but the asset name will be - * returned. - */ - // const contentType = {} - /** - * Required. Output configuration indicating where the results will be output - * to. All results will be in newline delimited JSON format. - */ - // const outputConfig = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callExportAssets() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await assetClient.exportAssets(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAssets(); - // [END cloudasset_v1_generated_AssetService_ExportAssets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.get_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.get_feed.js.baseline deleted file mode 100644 index b0e9589c85ea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.get_feed.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudasset_v1_generated_AssetService_GetFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_id - */ - // const name = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callGetFeed() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await assetClient.getFeed(request); - console.log(response); - } - - callGetFeed(); - // [END cloudasset_v1_generated_AssetService_GetFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.list_feeds.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.list_feeds.js.baseline deleted file mode 100644 index 5516f8da89ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.list_feeds.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudasset_v1_generated_AssetService_ListFeeds_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent project/folder/organization whose feeds are to be - * listed. It can only be using project/folder/organization number (such as - * "folders/12345")", or a project ID (such as "projects/my-project-id"). - */ - // const parent = 'abc123' - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callListFeeds() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await assetClient.listFeeds(request); - console.log(response); - } - - callListFeeds(); - // [END cloudasset_v1_generated_AssetService_ListFeeds_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.update_feed.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.update_feed.js.baseline deleted file mode 100644 index 99faaaa9b498..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/asset_service.update_feed.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(feed, updateMask) { - // [START cloudasset_v1_generated_AssetService_UpdateFeed_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - */ - // const feed = {} - /** - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - */ - // const updateMask = {} - - // Imports the Asset library - const {AssetServiceClient} = require('@google-cloud/asset').v1; - - // Instantiates a client - const assetClient = new AssetServiceClient(); - - async function callUpdateFeed() { - // Construct request - const request = { - feed, - updateMask, - }; - - // Run request - const response = await assetClient.updateFeed(request); - console.log(response); - } - - callUpdateFeed(); - // [END cloudasset_v1_generated_AssetService_UpdateFeed_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline deleted file mode 100644 index 2726c5c519cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/samples/generated/v1/snippet_metadata_google.cloud.asset.v1.json.baseline +++ /dev/null @@ -1,335 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-asset", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.asset.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudasset_v1_generated_AssetService_ExportAssets_async", - "title": "AssetService exportAssets Sample", - "origin": "API_DEFINITION", - "description": " Exports assets with time and resource types to a given Cloud Storage location. The output format is newline-delimited JSON. This API implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep track of the export.", - "canonical": true, - "file": "asset_service.export_assets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAssets", - "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "asset_types", - "type": "TYPE_STRING[]" - }, - { - "name": "content_type", - "type": ".google.cloud.asset.v1.ContentType" - }, - { - "name": "output_config", - "type": ".google.cloud.asset.v1.OutputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "ExportAssets", - "fullName": "google.cloud.asset.v1.AssetService.ExportAssets", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async", - "title": "AssetService batchGetAssetsHistory Sample", - "origin": "API_DEFINITION", - "description": " Batch gets the update history of assets that overlap a time window. For RESOURCE content, this API outputs history with asset in both non-delete or deleted status. For IAM_POLICY content, this API outputs history when the asset and its attached IAM POLICY both exist. This can create gaps in the output history. If a specified asset does not exist, this API returns an INVALID_ARGUMENT error.", - "canonical": true, - "file": "asset_service.batch_get_assets_history.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchGetAssetsHistory", - "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "asset_names", - "type": "TYPE_STRING[]" - }, - { - "name": "content_type", - "type": ".google.cloud.asset.v1.ContentType" - }, - { - "name": "read_time_window", - "type": ".google.cloud.asset.v1.TimeWindow" - } - ], - "resultType": ".google.cloud.asset.v1.BatchGetAssetsHistoryResponse", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "BatchGetAssetsHistory", - "fullName": "google.cloud.asset.v1.AssetService.BatchGetAssetsHistory", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_CreateFeed_async", - "title": "AssetService createFeed Sample", - "origin": "API_DEFINITION", - "description": " Creates a feed in a parent project/folder/organization to listen to its asset updates.", - "canonical": true, - "file": "asset_service.create_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateFeed", - "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "feed_id", - "type": "TYPE_STRING" - }, - { - "name": "feed", - "type": ".google.cloud.asset.v1.Feed" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "CreateFeed", - "fullName": "google.cloud.asset.v1.AssetService.CreateFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_GetFeed_async", - "title": "AssetService getFeed Sample", - "origin": "API_DEFINITION", - "description": " Gets details about an asset feed.", - "canonical": true, - "file": "asset_service.get_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetFeed", - "fullName": "google.cloud.asset.v1.AssetService.GetFeed", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "GetFeed", - "fullName": "google.cloud.asset.v1.AssetService.GetFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_ListFeeds_async", - "title": "AssetService listFeeds Sample", - "origin": "API_DEFINITION", - "description": " Lists all asset feeds in a parent project/folder/organization.", - "canonical": true, - "file": "asset_service.list_feeds.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListFeeds", - "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.asset.v1.ListFeedsResponse", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "ListFeeds", - "fullName": "google.cloud.asset.v1.AssetService.ListFeeds", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_UpdateFeed_async", - "title": "AssetService updateFeed Sample", - "origin": "API_DEFINITION", - "description": " Updates an asset feed configuration.", - "canonical": true, - "file": "asset_service.update_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateFeed", - "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", - "async": true, - "parameters": [ - { - "name": "feed", - "type": ".google.cloud.asset.v1.Feed" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.asset.v1.Feed", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "UpdateFeed", - "fullName": "google.cloud.asset.v1.AssetService.UpdateFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - }, - { - "regionTag": "cloudasset_v1_generated_AssetService_DeleteFeed_async", - "title": "AssetService deleteFeed Sample", - "origin": "API_DEFINITION", - "description": " Deletes an asset feed.", - "canonical": true, - "file": "asset_service.delete_feed.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteFeed", - "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AssetServiceClient", - "fullName": "google.cloud.asset.v1.AssetServiceClient" - }, - "method": { - "shortName": "DeleteFeed", - "fullName": "google.cloud.asset.v1.AssetService.DeleteFeed", - "service": { - "shortName": "AssetService", - "fullName": "google.cloud.asset.v1.AssetService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/src/index.ts.baseline deleted file mode 100644 index b4c33139479d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const AssetServiceClient = v1.AssetServiceClient; -type AssetServiceClient = v1.AssetServiceClient; -export {v1, AssetServiceClient}; -export default {v1, AssetServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client.ts.baseline deleted file mode 100644 index d46166abe2d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client.ts.baseline +++ /dev/null @@ -1,1243 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/asset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './asset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Asset service definition. - * @class - * @memberof v1 - */ -export class AssetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('asset'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - assetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AssetServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 AssetServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AssetServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudasset.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderFeedPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/feeds/{feed}' - ), - organizationFeedPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/feeds/{feed}' - ), - projectFeedPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/feeds/{feed}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const exportAssetsResponse = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsResponse') as gax.protobuf.Type; - const exportAssetsMetadata = protoFilesRoot.lookup( - '.google.cloud.asset.v1.ExportAssetsRequest') as gax.protobuf.Type; - - this.descriptors.longrunning = { - exportAssets: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAssetsResponse.decode.bind(exportAssetsResponse), - exportAssetsMetadata.decode.bind(exportAssetsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.asset.v1.AssetService', gapicConfig as gax.ClientConfig, - 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.assetServiceStub) { - return this.assetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.asset.v1.AssetService. - this.assetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.asset.v1.AssetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.asset.v1.AssetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const assetServiceStubMethods = - ['exportAssets', 'batchGetAssetsHistory', 'createFeed', 'getFeed', 'listFeeds', 'updateFeed', 'deleteFeed']; - for (const methodName of assetServiceStubMethods) { - const callPromise = this.assetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.assetServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudasset.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Batch gets the update history of assets that overlap a time window. - * For RESOURCE content, this API outputs history with asset in both - * non-delete or deleted status. - * For IAM_POLICY content, this API outputs history when the asset and its - * attached IAM POLICY both exist. This can create gaps in the output history. - * If a specified asset does not exist, this API returns an INVALID_ARGUMENT - * error. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. It can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id")", or a project number (such as "projects/12345"). - * @param {string[]} request.assetNames - * A list of the full names of the assets. For example: - * `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`. - * See [Resource - * Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) - * and [Resource Name - * Format](https://cloud.google.com/asset-inventory/docs/resource-name-format) - * for more info. - * - * The request becomes a no-op if the asset name list is empty, and the max - * size of the asset name list is 100 in one request. - * @param {google.cloud.asset.v1.ContentType} [request.contentType] - * Optional. The content type. - * @param {google.cloud.asset.v1.TimeWindow} [request.readTimeWindow] - * Optional. The time window for the asset history. Both start_time and - * end_time are optional and if set, it must be after the current time minus - * 35 days. If end_time is not set, it is default to current timestamp. - * If start_time is not set, the snapshot of the assets at end_time will be - * returned. The returned results contain all temporal assets whose time - * window overlap with read_time_window. - * @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 {@link protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse|BatchGetAssetsHistoryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.batch_get_assets_history.js - * region_tag:cloudasset_v1_generated_AssetService_BatchGetAssetsHistory_async - */ - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - callback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): void; - batchGetAssetsHistory( - request?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchGetAssetsHistory request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchGetAssetsHistory response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.batchGetAssetsHistory(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse, - protos.google.cloud.asset.v1.IBatchGetAssetsHistoryRequest|undefined, - {}|undefined - ]) => { - this._log.info('batchGetAssetsHistory response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a feed in a parent project/folder/organization to listen to its - * asset updates. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project/folder/organization where this feed - * should be created in. It can only be an organization number (such as - * "organizations/123"), a folder number (such as "folders/123"), a project ID - * (such as "projects/my-project-id")", or a project number (such as - * "projects/12345"). - * @param {string} request.feedId - * Required. This is the client-assigned asset feed identifier and it needs to - * be unique under a specific parent project/folder/organization. - * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The feed details. The field `name` must be empty and it will be generated - * in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.create_feed.js - * region_tag:cloudasset_v1_generated_AssetService_CreateFeed_async - */ - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request: protos.google.cloud.asset.v1.ICreateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): void; - createFeed( - request?: protos.google.cloud.asset.v1.ICreateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createFeed response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.ICreateFeedRequest|undefined, - {}|undefined - ]) => { - this._log.info('createFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets details about an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.get_feed.js - * region_tag:cloudasset_v1_generated_AssetService_GetFeed_async - */ - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request: protos.google.cloud.asset.v1.IGetFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): void; - getFeed( - request?: protos.google.cloud.asset.v1.IGetFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getFeed response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IGetFeedRequest|undefined, - {}|undefined - ]) => { - this._log.info('getFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Lists all asset feeds in a parent project/folder/organization. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent project/folder/organization whose feeds are to be - * listed. It can only be using project/folder/organization number (such as - * "folders/12345")", or a project ID (such as "projects/my-project-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 {@link protos.google.cloud.asset.v1.ListFeedsResponse|ListFeedsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.list_feeds.js - * region_tag:cloudasset_v1_generated_AssetService_ListFeeds_async - */ - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request: protos.google.cloud.asset.v1.IListFeedsRequest, - callback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): void; - listFeeds( - request?: protos.google.cloud.asset.v1.IListFeedsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listFeeds request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listFeeds response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listFeeds(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IListFeedsResponse, - protos.google.cloud.asset.v1.IListFeedsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listFeeds response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an asset feed configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.asset.v1.Feed} request.feed - * Required. The new values of feed details. It must match an existing feed and the - * field `name` must be in the format of: - * projects/project_number/feeds/feed_id or - * folders/folder_number/feeds/feed_id or - * organizations/organization_number/feeds/feed_id. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Only updates the `feed` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that - * are immutable or only set by the server. - * @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 {@link protos.google.cloud.asset.v1.Feed|Feed}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.update_feed.js - * region_tag:cloudasset_v1_generated_AssetService_UpdateFeed_async - */ - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request: protos.google.cloud.asset.v1.IUpdateFeedRequest, - callback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): void; - updateFeed( - request?: protos.google.cloud.asset.v1.IUpdateFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'feed.name': request.feed!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateFeed request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateFeed response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.asset.v1.IFeed, - protos.google.cloud.asset.v1.IUpdateFeedRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an asset feed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the feed and it must be in the format of: - * projects/project_number/feeds/feed_id - * folders/folder_number/feeds/feed_id - * organizations/organization_number/feeds/feed_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.delete_feed.js - * region_tag:cloudasset_v1_generated_AssetService_DeleteFeed_async - */ - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request: protos.google.cloud.asset.v1.IDeleteFeedRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): void; - deleteFeed( - request?: protos.google.cloud.asset.v1.IDeleteFeedRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteFeed request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteFeed response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteFeed(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.asset.v1.IDeleteFeedRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteFeed response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Exports assets with time and resource types to a given Cloud Storage - * location. The output format is newline-delimited JSON. - * This API implements the {@link protos.google.longrunning.Operation|google.longrunning.Operation} API allowing you - * to keep track of the export. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The relative name of the root asset. This can only be an - * organization number (such as "organizations/123"), a project ID (such as - * "projects/my-project-id"), or a project number (such as "projects/12345"), - * or a folder number (such as "folders/123"). - * @param {google.protobuf.Timestamp} request.readTime - * Timestamp to take an asset snapshot. This can only be set to a timestamp - * between the current time and the current time minus 35 days (inclusive). - * If not specified, the current time will be used. Due to delays in resource - * data collection and indexing, there is a volatile window during which - * running the same query may get different results. - * @param {string[]} request.assetTypes - * A list of asset types of which to take a snapshot for. For example: - * "compute.googleapis.com/Disk". If specified, only matching assets will be - * returned. See [Introduction to Cloud Asset - * Inventory](https://cloud.google.com/asset-inventory/docs/overview) - * for all supported asset types. - * @param {google.cloud.asset.v1.ContentType} request.contentType - * Asset content type. If not specified, no content but the asset name will be - * returned. - * @param {google.cloud.asset.v1.OutputConfig} request.outputConfig - * Required. Output configuration indicating where the results will be output - * to. All results will be in newline delimited JSON format. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request: protos.google.cloud.asset.v1.IExportAssetsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAssets( - request?: protos.google.cloud.asset.v1.IExportAssetsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportAssets response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('exportAssets request %j', request); - return this.innerApiCalls.exportAssets(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportAssets response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportAssets()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/asset_service.export_assets.js - * region_tag:cloudasset_v1_generated_AssetService_ExportAssets_async - */ - async checkExportAssetsProgress(name: string): Promise>{ - this._log.info('exportAssets long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAssets, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderFeed resource name string. - * - * @param {string} folder - * @param {string} feed - * @returns {string} Resource name string. - */ - folderFeedPath(folder:string,feed:string) { - return this.pathTemplates.folderFeedPathTemplate.render({ - folder: folder, - feed: feed, - }); - } - - /** - * Parse the folder from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).folder; - } - - /** - * Parse the feed from FolderFeed resource. - * - * @param {string} folderFeedName - * A fully-qualified path representing folder_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromFolderFeedName(folderFeedName: string) { - return this.pathTemplates.folderFeedPathTemplate.match(folderFeedName).feed; - } - - /** - * Return a fully-qualified organizationFeed resource name string. - * - * @param {string} organization - * @param {string} feed - * @returns {string} Resource name string. - */ - organizationFeedPath(organization:string,feed:string) { - return this.pathTemplates.organizationFeedPathTemplate.render({ - organization: organization, - feed: feed, - }); - } - - /** - * Parse the organization from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).organization; - } - - /** - * Parse the feed from OrganizationFeed resource. - * - * @param {string} organizationFeedName - * A fully-qualified path representing organization_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromOrganizationFeedName(organizationFeedName: string) { - return this.pathTemplates.organizationFeedPathTemplate.match(organizationFeedName).feed; - } - - /** - * Return a fully-qualified projectFeed resource name string. - * - * @param {string} project - * @param {string} feed - * @returns {string} Resource name string. - */ - projectFeedPath(project:string,feed:string) { - return this.pathTemplates.projectFeedPathTemplate.render({ - project: project, - feed: feed, - }); - } - - /** - * Parse the project from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).project; - } - - /** - * Parse the feed from ProjectFeed resource. - * - * @param {string} projectFeedName - * A fully-qualified path representing project_feed resource. - * @returns {string} A string representing the feed. - */ - matchFeedFromProjectFeedName(projectFeedName: string) { - return this.pathTemplates.projectFeedPathTemplate.match(projectFeedName).feed; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.assetServiceStub && !this._terminated) { - return this.assetServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client_config.json.baseline deleted file mode 100644 index a58073cc047f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_client_config.json.baseline +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.asset.v1.AssetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ExportAssets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchGetAssetsHistory": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "CreateFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListFeeds": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteFeed": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_proto_list.json.baseline deleted file mode 100644 index 44d0dc0156d4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/asset_service_proto_list.json.baseline +++ /dev/null @@ -1,9 +0,0 @@ -[ - "../../protos/google/cloud/asset/v1/asset_service.proto", - "../../protos/google/cloud/asset/v1/assets.proto", - "../../protos/google/cloud/orgpolicy/v1/orgpolicy.proto", - "../../protos/google/identity/accesscontextmanager/type/device_resources.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_level.proto", - "../../protos/google/identity/accesscontextmanager/v1/access_policy.proto", - "../../protos/google/identity/accesscontextmanager/v1/service_perimeter.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/src/v1/index.ts.baseline deleted file mode 100644 index a104b4e29681..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {AssetServiceClient} from './asset_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index a483c1902590..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const asset = require('@google-cloud/asset'); - -function main() { - const assetServiceClient = new asset.AssetServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 9e97334ff46b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {AssetServiceClient} from '@google-cloud/asset'; - -// check that the client class type name can be used -function doStuffWithAssetServiceClient(client: AssetServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const assetServiceClient = new AssetServiceClient(); - doStuffWithAssetServiceClient(assetServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/test/gapic_asset_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/asset/test/gapic_asset_service_v1.ts.baseline deleted file mode 100644 index 3116b196c337..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/test/gapic_asset_service_v1.ts.baseline +++ /dev/null @@ -1,1153 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as assetserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1.AssetServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath; - assert.strictEqual(servicePath, 'cloudasset.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new assetserviceModule.v1.AssetServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new assetserviceModule.v1.AssetServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new assetserviceModule.v1.AssetServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudasset.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = assetserviceModule.v1.AssetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new assetserviceModule.v1.AssetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - await client.initialize(); - assert(client.assetServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.assetServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.assetServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('batchGetAssetsHistory', () => { - it('invokes batchGetAssetsHistory without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(expectedResponse); - const [response] = await client.batchGetAssetsHistory(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryResponse() - ); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchGetAssetsHistory( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IBatchGetAssetsHistoryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchGetAssetsHistory = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - const actualRequest = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchGetAssetsHistory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchGetAssetsHistory with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.BatchGetAssetsHistoryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.BatchGetAssetsHistoryRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchGetAssetsHistory(request), expectedError); - }); - }); - - describe('createFeed', () => { - it('invokes createFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCall(expectedResponse); - const [response] = await client.createFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.createFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.CreateFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.CreateFeedRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createFeed(request), expectedError); - }); - }); - - describe('getFeed', () => { - it('invokes getFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCall(expectedResponse); - const [response] = await client.getFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.getFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.GetFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.GetFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getFeed(request), expectedError); - }); - }); - - describe('listFeeds', () => { - it('invokes listFeeds without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCall(expectedResponse); - const [response] = await client.listFeeds(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsResponse() - ); - client.innerApiCalls.listFeeds = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listFeeds( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IListFeedsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listFeeds = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listFeeds(request), expectedError); - const actualRequest = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listFeeds as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listFeeds with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ListFeedsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ListFeedsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listFeeds(request), expectedError); - }); - }); - - describe('updateFeed', () => { - it('invokes updateFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCall(expectedResponse); - const [response] = await client.updateFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.asset.v1.Feed() - ); - client.innerApiCalls.updateFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateFeed( - request, - (err?: Error|null, result?: protos.google.cloud.asset.v1.IFeed|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedHeaderRequestParams = `feed.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.UpdateFeedRequest() - ); - request.feed ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.UpdateFeedRequest', ['feed', 'name']); - request.feed.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateFeed(request), expectedError); - }); - }); - - describe('deleteFeed', () => { - it('invokes deleteFeed without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCall(expectedResponse); - const [response] = await client.deleteFeed(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteFeed = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteFeed( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteFeed = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteFeed(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteFeed as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteFeed with closed client', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.DeleteFeedRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.DeleteFeedRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteFeed(request), expectedError); - }); - }); - - describe('exportAssets', () => { - it('invokes exportAssets without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAssets(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets without error using callback', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAssets = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAssets( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with call error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAssets(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAssets with LRO error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.asset.v1.ExportAssetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.asset.v1.ExportAssetsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAssets = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAssets(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAssets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportAssetsProgress without error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAssetsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAssetsProgress with error', async () => { - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAssetsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('folderFeed', async () => { - const fakePath = "/rendered/path/folderFeed"; - const expectedParameters = { - folder: "folderValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderFeedPath', () => { - const result = client.folderFeedPath("folderValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderFeedName', () => { - const result = client.matchFolderFromFolderFeedName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromFolderFeedName', () => { - const result = client.matchFeedFromFolderFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.folderFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationFeed', async () => { - const fakePath = "/rendered/path/organizationFeed"; - const expectedParameters = { - organization: "organizationValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationFeedPath', () => { - const result = client.organizationFeedPath("organizationValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationFeedName', () => { - const result = client.matchOrganizationFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromOrganizationFeedName', () => { - const result = client.matchFeedFromOrganizationFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.organizationFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectFeed', async () => { - const fakePath = "/rendered/path/projectFeed"; - const expectedParameters = { - project: "projectValue", - feed: "feedValue", - }; - const client = new assetserviceModule.v1.AssetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectFeedPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectFeedPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectFeedPath', () => { - const result = client.projectFeedPath("projectValue", "feedValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectFeedPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectFeedName', () => { - const result = client.matchProjectFromProjectFeedName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchFeedFromProjectFeedName', () => { - const result = client.matchFeedFromProjectFeedName(fakePath); - assert.strictEqual(result, "feedValue"); - assert((client.pathTemplates.projectFeedPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/asset/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/asset/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/asset/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/asset/webpack.config.js.baseline deleted file mode 100644 index 9d42a74b8442..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/asset/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'AssetService', - filename: './asset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 7dc2a309c91f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/bigquery/storage/google-cloud-bigquery-storage-nodejs - dest: /owl-bot-staging/google-cloud-bigquery-storage - -api-name: storage \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.jsdoc.cjs.baseline deleted file mode 100644 index e6a034f4bfa5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'storage', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/README.md.baseline deleted file mode 100644 index 70071cc6983e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Storage: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/storage.svg)](https://www.npmjs.org/package/storage) - -Storage client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Storage Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/storage/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Storage API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install storage -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install storage@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquerystorage.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/index.ts.baseline deleted file mode 100644 index 7d8a13d909b7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const BigQueryStorageClient = v1beta1.BigQueryStorageClient; -type BigQueryStorageClient = v1beta1.BigQueryStorageClient; -export {v1beta1, BigQueryStorageClient}; -export default {v1beta1, BigQueryStorageClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client.ts.baseline deleted file mode 100644 index 1cad4002c11d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client.ts.baseline +++ /dev/null @@ -1,976 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import {PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as big_query_storage_client_config from './big_query_storage_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/big_query_storage_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'big_query_storage_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * BigQuery storage API. - * - * The BigQuery storage API can be used to read data stored in BigQuery. - * @class - * @memberof v1beta1 - */ -export class BigQueryStorageClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('storage'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - bigQueryStorageStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BigQueryStorageClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 BigQueryStorageClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BigQueryStorageClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquerystorage.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - readSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sessions/{session}' - ), - streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/streams/{stream}' - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.storage.v1beta1.BigQueryStorage', gapicConfig as gax.ClientConfig, - 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.bigQueryStorageStub) { - return this.bigQueryStorageStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.storage.v1beta1.BigQueryStorage. - this.bigQueryStorageStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.storage.v1beta1.BigQueryStorage') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.storage.v1beta1.BigQueryStorage, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const bigQueryStorageStubMethods = - ['createReadSession', 'readRows', 'batchCreateReadSessionStreams', 'finalizeStream', 'splitReadStream']; - for (const methodName of bigQueryStorageStubMethods) { - const callPromise = this.bigQueryStorageStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.bigQueryStorageStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquerystorage.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquerystorage.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/bigquery.readonly', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new read session. A read session divides the contents of a - * BigQuery table into one or more streams, which can then be used to read - * data from the table. The read session also specifies properties of the - * data to be read, such as a list of columns or a push-down filter describing - * the rows to be returned. - * - * A particular row can be read by at most one stream. When the caller has - * reached the end of each stream in the session, then all the data in the - * table has been read. - * - * Read sessions automatically expire 24 hours after they are created and do - * not require manual clean-up by the caller. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.TableReference} request.tableReference - * Required. Reference to the table to read. - * @param {string} request.parent - * Required. String of the form `projects/{project_id}` indicating the - * project this ReadSession is associated with. This is the project that will - * be billed for usage. - * @param {google.cloud.bigquery.storage.v1beta1.TableModifiers} request.tableModifiers - * Any modifiers to the Table (e.g. snapshot timestamp). - * @param {number} request.requestedStreams - * Initial number of streams. If unset or 0, we will - * provide a value of streams so as to produce reasonable throughput. Must be - * non-negative. The number of streams may be lower than the requested number, - * depending on the amount parallelism that is reasonable for the table and - * the maximum amount of parallelism allowed by the system. - * - * Streams must be read starting from offset 0. - * @param {google.cloud.bigquery.storage.v1beta1.TableReadOptions} request.readOptions - * Read options for this session (e.g. column selection, filters). - * @param {google.cloud.bigquery.storage.v1beta1.DataFormat} request.format - * Data output format. Currently default to Avro. - * @param {google.cloud.bigquery.storage.v1beta1.ShardingStrategy} request.shardingStrategy - * The strategy to use for distributing data among multiple streams. Currently - * defaults to liquid sharding. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.ReadSession|ReadSession}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.create_read_session.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async - */ - createReadSession( - request?: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, {}|undefined - ]>; - createReadSession( - request: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): void; - createReadSession( - request: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): void; - createReadSession( - request?: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'table_reference.project_id': request.tableReference!.projectId?.toString() ?? '', - 'table_reference.dataset_id': request.tableReference!.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createReadSession request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createReadSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createReadSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('createReadSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates additional streams for a ReadSession. This API can be used to - * dynamically adjust the parallelism of a batch processing task upwards by - * adding additional workers. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.ReadSession} request.session - * Required. Must be a non-expired session obtained from a call to - * CreateReadSession. Only the name field needs to be set. - * @param {number} request.requestedStreams - * Required. Number of new streams requested. Must be positive. - * Number of added streams may be less than this, see CreateReadSessionRequest - * for more information. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse|BatchCreateReadSessionStreamsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async - */ - batchCreateReadSessionStreams( - request?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, {}|undefined - ]>; - batchCreateReadSessionStreams( - request: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): void; - batchCreateReadSessionStreams( - request: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): void; - batchCreateReadSessionStreams( - request?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'session.name': request.session!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchCreateReadSessionStreams request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchCreateReadSessionStreams response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.batchCreateReadSessionStreams(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, {}|undefined - ]) => { - this._log.info('batchCreateReadSessionStreams response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Triggers the graceful termination of a single stream in a ReadSession. This - * API can be used to dynamically adjust the parallelism of a batch processing - * task downwards without losing data. - * - * This API does not delete the stream -- it remains visible in the - * ReadSession, and any data processed by the stream is not released to other - * streams. However, no additional data will be assigned to the stream once - * this call completes. Callers must continue reading data on the stream until - * the end of the stream is reached so that data which has already been - * assigned to the stream will be processed. - * - * This method will return an error if there are no other live streams - * in the Session, or if SplitReadStream() has been called on the given - * Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.Stream} request.stream - * Stream to finalize. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.finalize_stream.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async - */ - finalizeStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, {}|undefined - ]>; - finalizeStream( - request: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): void; - finalizeStream( - request: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): void; - finalizeStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream.name': request.stream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('finalizeStream request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('finalizeStream response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.finalizeStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, {}|undefined - ]) => { - this._log.info('finalizeStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Splits a given read stream into two Streams. These streams are referred to - * as the primary and the residual of the split. The original stream can still - * be read from in the same manner as before. Both of the returned streams can - * also be read from, and the total rows return by both child streams will be - * the same as the rows read from the original stream. - * - * Moreover, the two child streams will be allocated back to back in the - * original Stream. Concretely, it is guaranteed that for streams Original, - * Primary, and Residual, that Original[0-j] = Primary[0-j] and - * Original[j-n] = Residual[0-m] once the streams have been read to - * completion. - * - * This method is guaranteed to be idempotent. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.Stream} request.originalStream - * Stream to split. - * @param {number} request.fraction - * A value in the range (0.0, 1.0) that specifies the fractional point at - * which the original stream should be split. The actual split point is - * evaluated on pre-filtered rows, so if a filter is provided, then there is - * no guarantee that the division of the rows between the new child streams - * will be proportional to this fractional value. Additionally, because the - * server-side unit for assigning data is collections of rows, this fraction - * will always map to to a data storage boundary on the server side. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse|SplitReadStreamResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.split_read_stream.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async - */ - splitReadStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, {}|undefined - ]>; - splitReadStream( - request: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): void; - splitReadStream( - request: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): void; - splitReadStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'original_stream.name': request.originalStream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('splitReadStream request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('splitReadStream response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.splitReadStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, {}|undefined - ]) => { - this._log.info('splitReadStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Reads rows from the table in the format prescribed by the read session. - * Each response contains one or more table rows, up to a maximum of 10 MiB - * per response; read requests which attempt to read individual rows larger - * than this will fail. - * - * Each request also returns a set of stream statistics reflecting the - * estimated total number of rows in the read stream. This number is computed - * based on the total table size and the number of active streams in the read - * session, and may change as other streams continue to read data. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.StreamPosition} request.readPosition - * Required. Identifier of the position in the stream to start reading from. - * The offset requested must be less than the last row read from ReadRows. - * Requesting a larger offset is undefined. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse|ReadRowsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.read_rows.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async - */ - readRows( - request?: protos.google.cloud.bigquery.storage.v1beta1.IReadRowsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'read_position.stream.name': request.readPosition!.stream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('readRows stream %j', options); - return this.innerApiCalls.readRows(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified readSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @returns {string} Resource name string. - */ - readSessionPath(project:string,location:string,session:string) { - return this.pathTemplates.readSessionPathTemplate.render({ - project: project, - location: location, - session: session, - }); - } - - /** - * Parse the project from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).project; - } - - /** - * Parse the location from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).location; - } - - /** - * Parse the session from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the session. - */ - matchSessionFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).session; - } - - /** - * Return a fully-qualified stream resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stream - * @returns {string} Resource name string. - */ - streamPath(project:string,location:string,stream:string) { - return this.pathTemplates.streamPathTemplate.render({ - project: project, - location: location, - stream: stream, - }); - } - - /** - * Parse the project from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the project. - */ - matchProjectFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).project; - } - - /** - * Parse the location from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the location. - */ - matchLocationFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).location; - } - - /** - * Parse the stream from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the stream. - */ - matchStreamFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).stream; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.bigQueryStorageStub && !this._terminated) { - return this.bigQueryStorageStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client_config.json.baseline deleted file mode 100644 index d687cae81cab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.storage.v1beta1.BigQueryStorage": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateReadSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReadRows": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateReadSessionStreams": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FinalizeStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SplitReadStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_proto_list.json.baseline deleted file mode 100644 index 0b8010758a65..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/big_query_storage_proto_list.json.baseline +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/storage/v1beta1/arrow.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/avro.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/read_options.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/storage.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index 79017d9fb87b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {BigQueryStorageClient} from './big_query_storage_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 50617ba5a820..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const storage = require('storage'); - -function main() { - const bigQueryStorageClient = new storage.BigQueryStorageClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index cf238c1a734f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as storage from 'storage'; - -function main() { - const bigQueryStorageClient = new storage.BigQueryStorageClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 3e74dfdae58d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {BigQueryStorageClient} from 'storage'; - -// check that the client class type name can be used -function doStuffWithBigQueryStorageClient(client: BigQueryStorageClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const bigQueryStorageClient = new BigQueryStorageClient(); - doStuffWithBigQueryStorageClient(bigQueryStorageClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/test/gapic_big_query_storage_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/test/gapic_big_query_storage_v1beta1.ts.baseline deleted file mode 100644 index 3a822fcad5ad..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/esm/test/gapic_big_query_storage_v1beta1.ts.baseline +++ /dev/null @@ -1,943 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as bigquerystorageModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v1beta1.BigQueryStorageClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquerystorage.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = bigquerystorageModule.v1beta1.BigQueryStorageClient.servicePath; - assert.strictEqual(servicePath, 'bigquerystorage.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = bigquerystorageModule.v1beta1.BigQueryStorageClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquerystorage.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new bigquerystorageModule.v1beta1.BigQueryStorageClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = bigquerystorageModule.v1beta1.BigQueryStorageClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigQueryStorageStub, undefined); - await client.initialize(); - assert(client.bigQueryStorageStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.bigQueryStorageStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigQueryStorageStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createReadSession', () => { - it('invokes createReadSession without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadSession() - ); - client.innerApiCalls.createReadSession = stubSimpleCall(expectedResponse); - const [response] = await client.createReadSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadSession() - ); - client.innerApiCalls.createReadSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReadSession( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.IReadSession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReadSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createReadSession(request), expectedError); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createReadSession(request), expectedError); - }); - }); - - describe('batchCreateReadSessionStreams', () => { - it('invokes batchCreateReadSessionStreams without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse() - ); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateReadSessionStreams(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse() - ); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateReadSessionStreams( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateReadSessionStreams(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchCreateReadSessionStreams(request), expectedError); - }); - }); - - describe('finalizeStream', () => { - it('invokes finalizeStream without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finalizeStream = stubSimpleCall(expectedResponse); - const [response] = await client.finalizeStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finalizeStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.finalizeStream( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.finalizeStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.finalizeStream(request), expectedError); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.finalizeStream(request), expectedError); - }); - }); - - describe('splitReadStream', () => { - it('invokes splitReadStream without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse() - ); - client.innerApiCalls.splitReadStream = stubSimpleCall(expectedResponse); - const [response] = await client.splitReadStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse() - ); - client.innerApiCalls.splitReadStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.splitReadStream( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.splitReadStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.splitReadStream(request), expectedError); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.splitReadStream(request), expectedError); - }); - }); - - describe('readRows', () => { - it('invokes readRows without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse() - ); - client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows without error and gaxServerStreamingRetries enabled', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse() - ); - client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.readRows = stubServerStreamingCall(undefined, expectedError); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.readRows(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('Path templates', () => { - - describe('readSession', () => { - const fakePath = "/rendered/path/readSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - }; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.readSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.readSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('readSessionPath', () => { - const result = client.readSessionPath("projectValue", "locationValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.readSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReadSessionName', () => { - const result = client.matchProjectFromReadSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReadSessionName', () => { - const result = client.matchLocationFromReadSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromReadSessionName', () => { - const result = client.matchSessionFromReadSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('stream', () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stream: "streamValue", - }; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json deleted file mode 100644 index 8a6f9cea3dc2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "storage", - "version": "0.1.0", - "description": "Storage client for Node.js", - "repository": "googleapis/nodejs-storage", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google storage", - "storage", - "big query storage" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline deleted file mode 100644 index 63c6e3e2a1c4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "ArrowProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Arrow schema. -message ArrowSchema { - // IPC serialized Arrow schema. - bytes serialized_schema = 1; -} - -// Arrow RecordBatch. -message ArrowRecordBatch { - // IPC serialized Arrow RecordBatch. - bytes serialized_record_batch = 1; - - // The count of rows in the returning block. - int64 row_count = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline deleted file mode 100644 index be34e03291e3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "AvroProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Avro schema. -message AvroSchema { - // Json serialized schema, as described at - // https://avro.apache.org/docs/1.8.1/spec.html - string schema = 1; -} - -// Avro rows. -message AvroRows { - // Binary serialized rows in a block. - bytes serialized_binary_rows = 1; - - // The count of rows in the returning block. - int64 row_count = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline deleted file mode 100644 index 769a787250af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Options dictating how we read a table. -message TableReadOptions { - // Optional. Names of the fields in the table that should be read. If empty, - // all fields will be read. If the specified field is a nested field, all the - // sub-fields in the field will be selected. The output field order is - // unrelated to the order of fields in selected_fields. - repeated string selected_fields = 1; - - // Optional. SQL text filtering statement, similar to a WHERE clause in - // a query. Currently, only a single predicate that is a comparison between - // a column and a constant value is supported. Aggregates are not supported. - // - // Examples: "int_field > 5" - // "date_field = CAST('2014-9-27' as DATE)" - // "nullable_field is not NULL" - // "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))" - // "numeric_field BETWEEN 1.0 AND 5.0" - string row_restriction = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline deleted file mode 100644 index 37879210dfc5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/storage/v1beta1/arrow.proto"; -import "google/cloud/bigquery/storage/v1beta1/avro.proto"; -import "google/cloud/bigquery/storage/v1beta1/read_options.proto"; -import "google/cloud/bigquery/storage/v1beta1/table_reference.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// BigQuery storage API. -// -// The BigQuery storage API can be used to read data stored in BigQuery. -service BigQueryStorage { - option (google.api.default_host) = "bigquerystorage.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/bigquery.readonly," - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new read session. A read session divides the contents of a - // BigQuery table into one or more streams, which can then be used to read - // data from the table. The read session also specifies properties of the - // data to be read, such as a list of columns or a push-down filter describing - // the rows to be returned. - // - // A particular row can be read by at most one stream. When the caller has - // reached the end of each stream in the session, then all the data in the - // table has been read. - // - // Read sessions automatically expire 24 hours after they are created and do - // not require manual clean-up by the caller. - rpc CreateReadSession(CreateReadSessionRequest) returns (ReadSession) { - option (google.api.http) = { - post: "/v1beta1/{table_reference.project_id=projects/*}" - body: "*" - additional_bindings { - post: "/v1beta1/{table_reference.dataset_id=projects/*/datasets/*}" - body: "*" - } - }; - option (google.api.method_signature) = "table_reference,parent,requested_streams"; - } - - // Reads rows from the table in the format prescribed by the read session. - // Each response contains one or more table rows, up to a maximum of 10 MiB - // per response; read requests which attempt to read individual rows larger - // than this will fail. - // - // Each request also returns a set of stream statistics reflecting the - // estimated total number of rows in the read stream. This number is computed - // based on the total table size and the number of active streams in the read - // session, and may change as other streams continue to read data. - rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { - option (google.api.http) = { - get: "/v1beta1/{read_position.stream.name=projects/*/streams/*}" - }; - option (google.api.method_signature) = "read_position"; - } - - // Creates additional streams for a ReadSession. This API can be used to - // dynamically adjust the parallelism of a batch processing task upwards by - // adding additional workers. - rpc BatchCreateReadSessionStreams(BatchCreateReadSessionStreamsRequest) returns (BatchCreateReadSessionStreamsResponse) { - option (google.api.http) = { - post: "/v1beta1/{session.name=projects/*/sessions/*}" - body: "*" - }; - option (google.api.method_signature) = "session,requested_streams"; - } - - // Triggers the graceful termination of a single stream in a ReadSession. This - // API can be used to dynamically adjust the parallelism of a batch processing - // task downwards without losing data. - // - // This API does not delete the stream -- it remains visible in the - // ReadSession, and any data processed by the stream is not released to other - // streams. However, no additional data will be assigned to the stream once - // this call completes. Callers must continue reading data on the stream until - // the end of the stream is reached so that data which has already been - // assigned to the stream will be processed. - // - // This method will return an error if there are no other live streams - // in the Session, or if SplitReadStream() has been called on the given - // Stream. - rpc FinalizeStream(FinalizeStreamRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{stream.name=projects/*/streams/*}" - body: "*" - }; - option (google.api.method_signature) = "stream"; - } - - // Splits a given read stream into two Streams. These streams are referred to - // as the primary and the residual of the split. The original stream can still - // be read from in the same manner as before. Both of the returned streams can - // also be read from, and the total rows return by both child streams will be - // the same as the rows read from the original stream. - // - // Moreover, the two child streams will be allocated back to back in the - // original Stream. Concretely, it is guaranteed that for streams Original, - // Primary, and Residual, that Original[0-j] = Primary[0-j] and - // Original[j-n] = Residual[0-m] once the streams have been read to - // completion. - // - // This method is guaranteed to be idempotent. - rpc SplitReadStream(SplitReadStreamRequest) returns (SplitReadStreamResponse) { - option (google.api.http) = { - get: "/v1beta1/{original_stream.name=projects/*/streams/*}" - }; - option (google.api.method_signature) = "original_stream"; - } -} - -// Information about a single data stream within a read session. -message Stream { - option (google.api.resource) = { - type: "bigquerystorage.googleapis.com/Stream" - pattern: "projects/{project}/locations/{location}/streams/{stream}" - }; - - // Name of the stream, in the form - // `projects/{project_id}/locations/{location}/streams/{stream_id}`. - string name = 1; -} - -// Expresses a point within a given stream using an offset position. -message StreamPosition { - // Identifier for a given Stream. - Stream stream = 1; - - // Position in the stream. - int64 offset = 2; -} - -// Information returned from a `CreateReadSession` request. -message ReadSession { - option (google.api.resource) = { - type: "bigquerystorage.googleapis.com/ReadSession" - pattern: "projects/{project}/locations/{location}/sessions/{session}" - }; - - // Unique identifier for the session, in the form - // `projects/{project_id}/locations/{location}/sessions/{session_id}`. - string name = 1; - - // Time at which the session becomes invalid. After this time, subsequent - // requests to read this Session will return errors. - google.protobuf.Timestamp expire_time = 2; - - // The schema for the read. If read_options.selected_fields is set, the - // schema may be different from the table schema as it will only contain - // the selected fields. - oneof schema { - // Avro schema. - AvroSchema avro_schema = 5; - - // Arrow schema. - ArrowSchema arrow_schema = 6; - } - - // Streams associated with this session. - repeated Stream streams = 4; - - // Table that this ReadSession is reading from. - TableReference table_reference = 7; - - // Any modifiers which are applied when reading from the specified table. - TableModifiers table_modifiers = 8; - - // The strategy to use for distributing data among the streams. - ShardingStrategy sharding_strategy = 9; -} - -// Creates a new read session, which may include additional options such as -// requested parallelism, projection filters and constraints. -message CreateReadSessionRequest { - // Required. Reference to the table to read. - TableReference table_reference = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. String of the form `projects/{project_id}` indicating the - // project this ReadSession is associated with. This is the project that will - // be billed for usage. - string parent = 6 [(google.api.field_behavior) = REQUIRED]; - - // Any modifiers to the Table (e.g. snapshot timestamp). - TableModifiers table_modifiers = 2; - - // Initial number of streams. If unset or 0, we will - // provide a value of streams so as to produce reasonable throughput. Must be - // non-negative. The number of streams may be lower than the requested number, - // depending on the amount parallelism that is reasonable for the table and - // the maximum amount of parallelism allowed by the system. - // - // Streams must be read starting from offset 0. - int32 requested_streams = 3; - - // Read options for this session (e.g. column selection, filters). - TableReadOptions read_options = 4; - - // Data output format. Currently default to Avro. - DataFormat format = 5; - - // The strategy to use for distributing data among multiple streams. Currently - // defaults to liquid sharding. - ShardingStrategy sharding_strategy = 7; -} - -// Data format for input or output data. -enum DataFormat { - // Data format is unspecified. - DATA_FORMAT_UNSPECIFIED = 0; - - // Avro is a standard open source row based file format. - // See https://avro.apache.org/ for more details. - AVRO = 1; - - ARROW = 3; -} - -// Strategy for distributing data among multiple streams in a read session. -enum ShardingStrategy { - // Same as LIQUID. - SHARDING_STRATEGY_UNSPECIFIED = 0; - - // Assigns data to each stream based on the client's read rate. The faster the - // client reads from a stream, the more data is assigned to the stream. In - // this strategy, it's possible to read all data from a single stream even if - // there are other streams present. - LIQUID = 1; - - // Assigns data to each stream such that roughly the same number of rows can - // be read from each stream. Because the server-side unit for assigning data - // is collections of rows, the API does not guarantee that each stream will - // return the same number or rows. Additionally, the limits are enforced based - // on the number of pre-filtering rows, so some filters can lead to lopsided - // assignments. - BALANCED = 2; -} - -// Requesting row data via `ReadRows` must provide Stream position information. -message ReadRowsRequest { - // Required. Identifier of the position in the stream to start reading from. - // The offset requested must be less than the last row read from ReadRows. - // Requesting a larger offset is undefined. - StreamPosition read_position = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Progress information for a given Stream. -message StreamStatus { - // Number of estimated rows in the current stream. May change over time as - // different readers in the stream progress at rates which are relatively fast - // or slow. - int64 estimated_row_count = 1; - - // A value in the range [0.0, 1.0] that represents the fraction of rows - // assigned to this stream that have been processed by the server. In the - // presence of read filters, the server may process more rows than it returns, - // so this value reflects progress through the pre-filtering rows. - // - // This value is only populated for sessions created through the BALANCED - // sharding strategy. - float fraction_consumed = 2; - - // Represents the progress of the current stream. - // - // Note: This value is under development and should not be used. Use - // `fraction_consumed` instead. - Progress progress = 4; - - // Whether this stream can be split. For sessions that use the LIQUID sharding - // strategy, this value is always false. For BALANCED sessions, this value is - // false when enough data have been read such that no more splits are possible - // at that point or beyond. For small tables or streams that are the result of - // a chain of splits, this value may never be true. - bool is_splittable = 3; -} - -message Progress { - // The fraction of rows assigned to the stream that have been processed by the - // server so far, not including the rows in the current response message. - // - // This value, along with `at_response_end`, can be used to interpolate the - // progress made as the rows in the message are being processed using the - // following formula: `at_response_start + (at_response_end - - // at_response_start) * rows_processed_from_response / rows_in_response`. - // - // Note that if a filter is provided, the `at_response_end` value of the - // previous response may not necessarily be equal to the `at_response_start` - // value of the current response. - float at_response_start = 1; - - // Similar to `at_response_start`, except that this value includes the rows in - // the current response. - float at_response_end = 2; -} - -// Information on if the current connection is being throttled. -message ThrottleStatus { - // How much this connection is being throttled. - // 0 is no throttling, 100 is completely throttled. - int32 throttle_percent = 1; -} - -// Response from calling `ReadRows` may include row data, progress and -// throttling information. -message ReadRowsResponse { - // Row data is returned in format specified during session creation. - oneof rows { - // Serialized row data in AVRO format. - AvroRows avro_rows = 3; - - // Serialized row data in Arrow RecordBatch format. - ArrowRecordBatch arrow_record_batch = 4; - } - - // Number of serialized rows in the rows block. This value is recorded here, - // in addition to the row_count values in the output-specific messages in - // `rows`, so that code which needs to record progress through the stream can - // do so in an output format-independent way. - int64 row_count = 6; - - // Estimated stream statistics. - StreamStatus status = 2; - - // Throttling status. If unset, the latest response still describes - // the current throttling status. - ThrottleStatus throttle_status = 5; -} - -// Information needed to request additional streams for an established read -// session. -message BatchCreateReadSessionStreamsRequest { - // Required. Must be a non-expired session obtained from a call to - // CreateReadSession. Only the name field needs to be set. - ReadSession session = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Number of new streams requested. Must be positive. - // Number of added streams may be less than this, see CreateReadSessionRequest - // for more information. - int32 requested_streams = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The response from `BatchCreateReadSessionStreams` returns the stream -// identifiers for the newly created streams. -message BatchCreateReadSessionStreamsResponse { - // Newly added streams. - repeated Stream streams = 1; -} - -// Request information for invoking `FinalizeStream`. -message FinalizeStreamRequest { - // Stream to finalize. - Stream stream = 2; -} - -// Request information for `SplitReadStream`. -message SplitReadStreamRequest { - // Stream to split. - Stream original_stream = 1; - - // A value in the range (0.0, 1.0) that specifies the fractional point at - // which the original stream should be split. The actual split point is - // evaluated on pre-filtered rows, so if a filter is provided, then there is - // no guarantee that the division of the rows between the new child streams - // will be proportional to this fractional value. Additionally, because the - // server-side unit for assigning data is collections of rows, this fraction - // will always map to to a data storage boundary on the server side. - float fraction = 2; -} - -// Response from `SplitReadStream`. -message SplitReadStreamResponse { - // Primary stream, which contains the beginning portion of - // |original_stream|. An empty value indicates that the original stream can no - // longer be split. - Stream primary_stream = 1; - - // Remainder stream, which contains the tail of |original_stream|. An empty - // value indicates that the original stream can no longer be split. - Stream remainder_stream = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline deleted file mode 100644 index 1f0b04c55693..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "TableReferenceProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Table reference that includes just the 3 strings needed to identify a table. -message TableReference { - // The assigned project ID of the project. - string project_id = 1; - - // The ID of the dataset in the above project. - string dataset_id = 2; - - // The ID of the table in the above dataset. - string table_id = 3; -} - -// All fields in this message optional. -message TableModifiers { - // The snapshot time of the table. If not set, interpreted as now. - google.protobuf.Timestamp snapshot_time = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline deleted file mode 100644 index 38d11a36054d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(session, requestedStreams) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Must be a non-expired session obtained from a call to - * CreateReadSession. Only the name field needs to be set. - */ - // const session = {} - /** - * Required. Number of new streams requested. Must be positive. - * Number of added streams may be less than this, see CreateReadSessionRequest - * for more information. - */ - // const requestedStreams = 1234 - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callBatchCreateReadSessionStreams() { - // Construct request - const request = { - session, - requestedStreams, - }; - - // Run request - const response = await storageClient.batchCreateReadSessionStreams(request); - console.log(response); - } - - callBatchCreateReadSessionStreams(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline deleted file mode 100644 index 5220b5e91fab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(tableReference, parent) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Reference to the table to read. - */ - // const tableReference = {} - /** - * Required. String of the form `projects/{project_id}` indicating the - * project this ReadSession is associated with. This is the project that will - * be billed for usage. - */ - // const parent = 'abc123' - /** - * Any modifiers to the Table (e.g. snapshot timestamp). - */ - // const tableModifiers = {} - /** - * Initial number of streams. If unset or 0, we will - * provide a value of streams so as to produce reasonable throughput. Must be - * non-negative. The number of streams may be lower than the requested number, - * depending on the amount parallelism that is reasonable for the table and - * the maximum amount of parallelism allowed by the system. - * Streams must be read starting from offset 0. - */ - // const requestedStreams = 1234 - /** - * Read options for this session (e.g. column selection, filters). - */ - // const readOptions = {} - /** - * Data output format. Currently default to Avro. - */ - // const format = {} - /** - * The strategy to use for distributing data among multiple streams. Currently - * defaults to liquid sharding. - */ - // const shardingStrategy = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callCreateReadSession() { - // Construct request - const request = { - tableReference, - parent, - }; - - // Run request - const response = await storageClient.createReadSession(request); - console.log(response); - } - - callCreateReadSession(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline deleted file mode 100644 index d62f8481af14..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Stream to finalize. - */ - // const stream = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callFinalizeStream() { - // Construct request - const request = { - }; - - // Run request - const response = await storageClient.finalizeStream(request); - console.log(response); - } - - callFinalizeStream(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline deleted file mode 100644 index fc29d9373418..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(readPosition) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Identifier of the position in the stream to start reading from. - * The offset requested must be less than the last row read from ReadRows. - * Requesting a larger offset is undefined. - */ - // const readPosition = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callReadRows() { - // Construct request - const request = { - readPosition, - }; - - // Run request - const stream = await storageClient.readRows(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callReadRows(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline deleted file mode 100644 index fdfcc15456ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Stream to split. - */ - // const originalStream = {} - /** - * A value in the range (0.0, 1.0) that specifies the fractional point at - * which the original stream should be split. The actual split point is - * evaluated on pre-filtered rows, so if a filter is provided, then there is - * no guarantee that the division of the rows between the new child streams - * will be proportional to this fractional value. Additionally, because the - * server-side unit for assigning data is collections of rows, this fraction - * will always map to to a data storage boundary on the server side. - */ - // const fraction = 1234 - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callSplitReadStream() { - // Construct request - const request = { - }; - - // Run request - const response = await storageClient.splitReadStream(request); - console.log(response); - } - - callSplitReadStream(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline deleted file mode 100644 index 6877e23ccc62..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline +++ /dev/null @@ -1,247 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-storage", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.bigquery.storage.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async", - "title": "BigQueryStorage createReadSession Sample", - "origin": "API_DEFINITION", - "description": " Creates a new read session. A read session divides the contents of a BigQuery table into one or more streams, which can then be used to read data from the table. The read session also specifies properties of the data to be read, such as a list of columns or a push-down filter describing the rows to be returned. A particular row can be read by at most one stream. When the caller has reached the end of each stream in the session, then all the data in the table has been read. Read sessions automatically expire 24 hours after they are created and do not require manual clean-up by the caller.", - "canonical": true, - "file": "big_query_storage.create_read_session.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReadSession", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.CreateReadSession", - "async": true, - "parameters": [ - { - "name": "table_reference", - "type": ".google.cloud.bigquery.storage.v1beta1.TableReference" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "table_modifiers", - "type": ".google.cloud.bigquery.storage.v1beta1.TableModifiers" - }, - { - "name": "requested_streams", - "type": "TYPE_INT32" - }, - { - "name": "read_options", - "type": ".google.cloud.bigquery.storage.v1beta1.TableReadOptions" - }, - { - "name": "format", - "type": ".google.cloud.bigquery.storage.v1beta1.DataFormat" - }, - { - "name": "sharding_strategy", - "type": ".google.cloud.bigquery.storage.v1beta1.ShardingStrategy" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.ReadSession", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "CreateReadSession", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.CreateReadSession", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async", - "title": "BigQueryStorage readRows Sample", - "origin": "API_DEFINITION", - "description": " Reads rows from the table in the format prescribed by the read session. Each response contains one or more table rows, up to a maximum of 10 MiB per response; read requests which attempt to read individual rows larger than this will fail. Each request also returns a set of stream statistics reflecting the estimated total number of rows in the read stream. This number is computed based on the total table size and the number of active streams in the read session, and may change as other streams continue to read data.", - "canonical": true, - "file": "big_query_storage.read_rows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReadRows", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.ReadRows", - "async": true, - "parameters": [ - { - "name": "read_position", - "type": ".google.cloud.bigquery.storage.v1beta1.StreamPosition" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.ReadRowsResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "ReadRows", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.ReadRows", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async", - "title": "BigQueryStorage batchCreateReadSessionStreams Sample", - "origin": "API_DEFINITION", - "description": " Creates additional streams for a ReadSession. This API can be used to dynamically adjust the parallelism of a batch processing task upwards by adding additional workers.", - "canonical": true, - "file": "big_query_storage.batch_create_read_session_streams.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateReadSessionStreams", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.BatchCreateReadSessionStreams", - "async": true, - "parameters": [ - { - "name": "session", - "type": ".google.cloud.bigquery.storage.v1beta1.ReadSession" - }, - { - "name": "requested_streams", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "BatchCreateReadSessionStreams", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.BatchCreateReadSessionStreams", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async", - "title": "BigQueryStorage finalizeStream Sample", - "origin": "API_DEFINITION", - "description": " Triggers the graceful termination of a single stream in a ReadSession. This API can be used to dynamically adjust the parallelism of a batch processing task downwards without losing data. This API does not delete the stream -- it remains visible in the ReadSession, and any data processed by the stream is not released to other streams. However, no additional data will be assigned to the stream once this call completes. Callers must continue reading data on the stream until the end of the stream is reached so that data which has already been assigned to the stream will be processed. This method will return an error if there are no other live streams in the Session, or if SplitReadStream() has been called on the given Stream.", - "canonical": true, - "file": "big_query_storage.finalize_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FinalizeStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.FinalizeStream", - "async": true, - "parameters": [ - { - "name": "stream", - "type": ".google.cloud.bigquery.storage.v1beta1.Stream" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "FinalizeStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.FinalizeStream", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async", - "title": "BigQueryStorage splitReadStream Sample", - "origin": "API_DEFINITION", - "description": " Splits a given read stream into two Streams. These streams are referred to as the primary and the residual of the split. The original stream can still be read from in the same manner as before. Both of the returned streams can also be read from, and the total rows return by both child streams will be the same as the rows read from the original stream. Moreover, the two child streams will be allocated back to back in the original Stream. Concretely, it is guaranteed that for streams Original, Primary, and Residual, that Original[0-j] = Primary[0-j] and Original[j-n] = Residual[0-m] once the streams have been read to completion. This method is guaranteed to be idempotent.", - "canonical": true, - "file": "big_query_storage.split_read_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SplitReadStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.SplitReadStream", - "async": true, - "parameters": [ - { - "name": "original_stream", - "type": ".google.cloud.bigquery.storage.v1beta1.Stream" - }, - { - "name": "fraction", - "type": "TYPE_FLOAT" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "SplitReadStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.SplitReadStream", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/webpack.config.cjs.baseline deleted file mode 100644 index 5f047fa3d9fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'BigQueryStorage', - filename: './big-query-storage.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.OwlBot.yaml.baseline deleted file mode 100644 index 7dc2a309c91f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/bigquery/storage/google-cloud-bigquery-storage-nodejs - dest: /owl-bot-staging/google-cloud-bigquery-storage - -api-name: storage \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.jsdoc.js.baseline deleted file mode 100644 index 741cc4cb028c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'storage', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/README.md.baseline deleted file mode 100644 index 70071cc6983e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Storage: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/storage.svg)](https://www.npmjs.org/package/storage) - -Storage client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Storage Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/storage/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Storage API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install storage -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install storage@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquerystorage.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery-storage diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json deleted file mode 100644 index d7bb5b125abf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "storage", - "version": "0.1.0", - "description": "Storage client for Node.js", - "repository": "googleapis/nodejs-storage", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google storage", - "storage", - "big query storage" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline deleted file mode 100644 index 63c6e3e2a1c4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/arrow.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "ArrowProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Arrow schema. -message ArrowSchema { - // IPC serialized Arrow schema. - bytes serialized_schema = 1; -} - -// Arrow RecordBatch. -message ArrowRecordBatch { - // IPC serialized Arrow RecordBatch. - bytes serialized_record_batch = 1; - - // The count of rows in the returning block. - int64 row_count = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline deleted file mode 100644 index be34e03291e3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/avro.proto.baseline +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "AvroProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Avro schema. -message AvroSchema { - // Json serialized schema, as described at - // https://avro.apache.org/docs/1.8.1/spec.html - string schema = 1; -} - -// Avro rows. -message AvroRows { - // Binary serialized rows in a block. - bytes serialized_binary_rows = 1; - - // The count of rows in the returning block. - int64 row_count = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline deleted file mode 100644 index 769a787250af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/read_options.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Options dictating how we read a table. -message TableReadOptions { - // Optional. Names of the fields in the table that should be read. If empty, - // all fields will be read. If the specified field is a nested field, all the - // sub-fields in the field will be selected. The output field order is - // unrelated to the order of fields in selected_fields. - repeated string selected_fields = 1; - - // Optional. SQL text filtering statement, similar to a WHERE clause in - // a query. Currently, only a single predicate that is a comparison between - // a column and a constant value is supported. Aggregates are not supported. - // - // Examples: "int_field > 5" - // "date_field = CAST('2014-9-27' as DATE)" - // "nullable_field is not NULL" - // "st_equals(geo_field, st_geofromtext("POINT(2, 2)"))" - // "numeric_field BETWEEN 1.0 AND 5.0" - string row_restriction = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline deleted file mode 100644 index 37879210dfc5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/storage.proto.baseline +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/storage/v1beta1/arrow.proto"; -import "google/cloud/bigquery/storage/v1beta1/avro.proto"; -import "google/cloud/bigquery/storage/v1beta1/read_options.proto"; -import "google/cloud/bigquery/storage/v1beta1/table_reference.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// BigQuery storage API. -// -// The BigQuery storage API can be used to read data stored in BigQuery. -service BigQueryStorage { - option (google.api.default_host) = "bigquerystorage.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/bigquery.readonly," - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new read session. A read session divides the contents of a - // BigQuery table into one or more streams, which can then be used to read - // data from the table. The read session also specifies properties of the - // data to be read, such as a list of columns or a push-down filter describing - // the rows to be returned. - // - // A particular row can be read by at most one stream. When the caller has - // reached the end of each stream in the session, then all the data in the - // table has been read. - // - // Read sessions automatically expire 24 hours after they are created and do - // not require manual clean-up by the caller. - rpc CreateReadSession(CreateReadSessionRequest) returns (ReadSession) { - option (google.api.http) = { - post: "/v1beta1/{table_reference.project_id=projects/*}" - body: "*" - additional_bindings { - post: "/v1beta1/{table_reference.dataset_id=projects/*/datasets/*}" - body: "*" - } - }; - option (google.api.method_signature) = "table_reference,parent,requested_streams"; - } - - // Reads rows from the table in the format prescribed by the read session. - // Each response contains one or more table rows, up to a maximum of 10 MiB - // per response; read requests which attempt to read individual rows larger - // than this will fail. - // - // Each request also returns a set of stream statistics reflecting the - // estimated total number of rows in the read stream. This number is computed - // based on the total table size and the number of active streams in the read - // session, and may change as other streams continue to read data. - rpc ReadRows(ReadRowsRequest) returns (stream ReadRowsResponse) { - option (google.api.http) = { - get: "/v1beta1/{read_position.stream.name=projects/*/streams/*}" - }; - option (google.api.method_signature) = "read_position"; - } - - // Creates additional streams for a ReadSession. This API can be used to - // dynamically adjust the parallelism of a batch processing task upwards by - // adding additional workers. - rpc BatchCreateReadSessionStreams(BatchCreateReadSessionStreamsRequest) returns (BatchCreateReadSessionStreamsResponse) { - option (google.api.http) = { - post: "/v1beta1/{session.name=projects/*/sessions/*}" - body: "*" - }; - option (google.api.method_signature) = "session,requested_streams"; - } - - // Triggers the graceful termination of a single stream in a ReadSession. This - // API can be used to dynamically adjust the parallelism of a batch processing - // task downwards without losing data. - // - // This API does not delete the stream -- it remains visible in the - // ReadSession, and any data processed by the stream is not released to other - // streams. However, no additional data will be assigned to the stream once - // this call completes. Callers must continue reading data on the stream until - // the end of the stream is reached so that data which has already been - // assigned to the stream will be processed. - // - // This method will return an error if there are no other live streams - // in the Session, or if SplitReadStream() has been called on the given - // Stream. - rpc FinalizeStream(FinalizeStreamRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{stream.name=projects/*/streams/*}" - body: "*" - }; - option (google.api.method_signature) = "stream"; - } - - // Splits a given read stream into two Streams. These streams are referred to - // as the primary and the residual of the split. The original stream can still - // be read from in the same manner as before. Both of the returned streams can - // also be read from, and the total rows return by both child streams will be - // the same as the rows read from the original stream. - // - // Moreover, the two child streams will be allocated back to back in the - // original Stream. Concretely, it is guaranteed that for streams Original, - // Primary, and Residual, that Original[0-j] = Primary[0-j] and - // Original[j-n] = Residual[0-m] once the streams have been read to - // completion. - // - // This method is guaranteed to be idempotent. - rpc SplitReadStream(SplitReadStreamRequest) returns (SplitReadStreamResponse) { - option (google.api.http) = { - get: "/v1beta1/{original_stream.name=projects/*/streams/*}" - }; - option (google.api.method_signature) = "original_stream"; - } -} - -// Information about a single data stream within a read session. -message Stream { - option (google.api.resource) = { - type: "bigquerystorage.googleapis.com/Stream" - pattern: "projects/{project}/locations/{location}/streams/{stream}" - }; - - // Name of the stream, in the form - // `projects/{project_id}/locations/{location}/streams/{stream_id}`. - string name = 1; -} - -// Expresses a point within a given stream using an offset position. -message StreamPosition { - // Identifier for a given Stream. - Stream stream = 1; - - // Position in the stream. - int64 offset = 2; -} - -// Information returned from a `CreateReadSession` request. -message ReadSession { - option (google.api.resource) = { - type: "bigquerystorage.googleapis.com/ReadSession" - pattern: "projects/{project}/locations/{location}/sessions/{session}" - }; - - // Unique identifier for the session, in the form - // `projects/{project_id}/locations/{location}/sessions/{session_id}`. - string name = 1; - - // Time at which the session becomes invalid. After this time, subsequent - // requests to read this Session will return errors. - google.protobuf.Timestamp expire_time = 2; - - // The schema for the read. If read_options.selected_fields is set, the - // schema may be different from the table schema as it will only contain - // the selected fields. - oneof schema { - // Avro schema. - AvroSchema avro_schema = 5; - - // Arrow schema. - ArrowSchema arrow_schema = 6; - } - - // Streams associated with this session. - repeated Stream streams = 4; - - // Table that this ReadSession is reading from. - TableReference table_reference = 7; - - // Any modifiers which are applied when reading from the specified table. - TableModifiers table_modifiers = 8; - - // The strategy to use for distributing data among the streams. - ShardingStrategy sharding_strategy = 9; -} - -// Creates a new read session, which may include additional options such as -// requested parallelism, projection filters and constraints. -message CreateReadSessionRequest { - // Required. Reference to the table to read. - TableReference table_reference = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. String of the form `projects/{project_id}` indicating the - // project this ReadSession is associated with. This is the project that will - // be billed for usage. - string parent = 6 [(google.api.field_behavior) = REQUIRED]; - - // Any modifiers to the Table (e.g. snapshot timestamp). - TableModifiers table_modifiers = 2; - - // Initial number of streams. If unset or 0, we will - // provide a value of streams so as to produce reasonable throughput. Must be - // non-negative. The number of streams may be lower than the requested number, - // depending on the amount parallelism that is reasonable for the table and - // the maximum amount of parallelism allowed by the system. - // - // Streams must be read starting from offset 0. - int32 requested_streams = 3; - - // Read options for this session (e.g. column selection, filters). - TableReadOptions read_options = 4; - - // Data output format. Currently default to Avro. - DataFormat format = 5; - - // The strategy to use for distributing data among multiple streams. Currently - // defaults to liquid sharding. - ShardingStrategy sharding_strategy = 7; -} - -// Data format for input or output data. -enum DataFormat { - // Data format is unspecified. - DATA_FORMAT_UNSPECIFIED = 0; - - // Avro is a standard open source row based file format. - // See https://avro.apache.org/ for more details. - AVRO = 1; - - ARROW = 3; -} - -// Strategy for distributing data among multiple streams in a read session. -enum ShardingStrategy { - // Same as LIQUID. - SHARDING_STRATEGY_UNSPECIFIED = 0; - - // Assigns data to each stream based on the client's read rate. The faster the - // client reads from a stream, the more data is assigned to the stream. In - // this strategy, it's possible to read all data from a single stream even if - // there are other streams present. - LIQUID = 1; - - // Assigns data to each stream such that roughly the same number of rows can - // be read from each stream. Because the server-side unit for assigning data - // is collections of rows, the API does not guarantee that each stream will - // return the same number or rows. Additionally, the limits are enforced based - // on the number of pre-filtering rows, so some filters can lead to lopsided - // assignments. - BALANCED = 2; -} - -// Requesting row data via `ReadRows` must provide Stream position information. -message ReadRowsRequest { - // Required. Identifier of the position in the stream to start reading from. - // The offset requested must be less than the last row read from ReadRows. - // Requesting a larger offset is undefined. - StreamPosition read_position = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Progress information for a given Stream. -message StreamStatus { - // Number of estimated rows in the current stream. May change over time as - // different readers in the stream progress at rates which are relatively fast - // or slow. - int64 estimated_row_count = 1; - - // A value in the range [0.0, 1.0] that represents the fraction of rows - // assigned to this stream that have been processed by the server. In the - // presence of read filters, the server may process more rows than it returns, - // so this value reflects progress through the pre-filtering rows. - // - // This value is only populated for sessions created through the BALANCED - // sharding strategy. - float fraction_consumed = 2; - - // Represents the progress of the current stream. - // - // Note: This value is under development and should not be used. Use - // `fraction_consumed` instead. - Progress progress = 4; - - // Whether this stream can be split. For sessions that use the LIQUID sharding - // strategy, this value is always false. For BALANCED sessions, this value is - // false when enough data have been read such that no more splits are possible - // at that point or beyond. For small tables or streams that are the result of - // a chain of splits, this value may never be true. - bool is_splittable = 3; -} - -message Progress { - // The fraction of rows assigned to the stream that have been processed by the - // server so far, not including the rows in the current response message. - // - // This value, along with `at_response_end`, can be used to interpolate the - // progress made as the rows in the message are being processed using the - // following formula: `at_response_start + (at_response_end - - // at_response_start) * rows_processed_from_response / rows_in_response`. - // - // Note that if a filter is provided, the `at_response_end` value of the - // previous response may not necessarily be equal to the `at_response_start` - // value of the current response. - float at_response_start = 1; - - // Similar to `at_response_start`, except that this value includes the rows in - // the current response. - float at_response_end = 2; -} - -// Information on if the current connection is being throttled. -message ThrottleStatus { - // How much this connection is being throttled. - // 0 is no throttling, 100 is completely throttled. - int32 throttle_percent = 1; -} - -// Response from calling `ReadRows` may include row data, progress and -// throttling information. -message ReadRowsResponse { - // Row data is returned in format specified during session creation. - oneof rows { - // Serialized row data in AVRO format. - AvroRows avro_rows = 3; - - // Serialized row data in Arrow RecordBatch format. - ArrowRecordBatch arrow_record_batch = 4; - } - - // Number of serialized rows in the rows block. This value is recorded here, - // in addition to the row_count values in the output-specific messages in - // `rows`, so that code which needs to record progress through the stream can - // do so in an output format-independent way. - int64 row_count = 6; - - // Estimated stream statistics. - StreamStatus status = 2; - - // Throttling status. If unset, the latest response still describes - // the current throttling status. - ThrottleStatus throttle_status = 5; -} - -// Information needed to request additional streams for an established read -// session. -message BatchCreateReadSessionStreamsRequest { - // Required. Must be a non-expired session obtained from a call to - // CreateReadSession. Only the name field needs to be set. - ReadSession session = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Number of new streams requested. Must be positive. - // Number of added streams may be less than this, see CreateReadSessionRequest - // for more information. - int32 requested_streams = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The response from `BatchCreateReadSessionStreams` returns the stream -// identifiers for the newly created streams. -message BatchCreateReadSessionStreamsResponse { - // Newly added streams. - repeated Stream streams = 1; -} - -// Request information for invoking `FinalizeStream`. -message FinalizeStreamRequest { - // Stream to finalize. - Stream stream = 2; -} - -// Request information for `SplitReadStream`. -message SplitReadStreamRequest { - // Stream to split. - Stream original_stream = 1; - - // A value in the range (0.0, 1.0) that specifies the fractional point at - // which the original stream should be split. The actual split point is - // evaluated on pre-filtered rows, so if a filter is provided, then there is - // no guarantee that the division of the rows between the new child streams - // will be proportional to this fractional value. Additionally, because the - // server-side unit for assigning data is collections of rows, this fraction - // will always map to to a data storage boundary on the server side. - float fraction = 2; -} - -// Response from `SplitReadStream`. -message SplitReadStreamResponse { - // Primary stream, which contains the beginning portion of - // |original_stream|. An empty value indicates that the original stream can no - // longer be split. - Stream primary_stream = 1; - - // Remainder stream, which contains the tail of |original_stream|. An empty - // value indicates that the original stream can no longer be split. - Stream remainder_stream = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline deleted file mode 100644 index 1f0b04c55693..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto.baseline +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.bigquery.storage.v1beta1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1;storage"; -option java_outer_classname = "TableReferenceProto"; -option java_package = "com.google.cloud.bigquery.storage.v1beta1"; - -// Table reference that includes just the 3 strings needed to identify a table. -message TableReference { - // The assigned project ID of the project. - string project_id = 1; - - // The ID of the dataset in the above project. - string dataset_id = 2; - - // The ID of the table in the above dataset. - string table_id = 3; -} - -// All fields in this message optional. -message TableModifiers { - // The snapshot time of the table. If not set, interpreted as now. - google.protobuf.Timestamp snapshot_time = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline deleted file mode 100644 index 38d11a36054d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(session, requestedStreams) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Must be a non-expired session obtained from a call to - * CreateReadSession. Only the name field needs to be set. - */ - // const session = {} - /** - * Required. Number of new streams requested. Must be positive. - * Number of added streams may be less than this, see CreateReadSessionRequest - * for more information. - */ - // const requestedStreams = 1234 - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callBatchCreateReadSessionStreams() { - // Construct request - const request = { - session, - requestedStreams, - }; - - // Run request - const response = await storageClient.batchCreateReadSessionStreams(request); - console.log(response); - } - - callBatchCreateReadSessionStreams(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline deleted file mode 100644 index 5220b5e91fab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.create_read_session.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(tableReference, parent) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Reference to the table to read. - */ - // const tableReference = {} - /** - * Required. String of the form `projects/{project_id}` indicating the - * project this ReadSession is associated with. This is the project that will - * be billed for usage. - */ - // const parent = 'abc123' - /** - * Any modifiers to the Table (e.g. snapshot timestamp). - */ - // const tableModifiers = {} - /** - * Initial number of streams. If unset or 0, we will - * provide a value of streams so as to produce reasonable throughput. Must be - * non-negative. The number of streams may be lower than the requested number, - * depending on the amount parallelism that is reasonable for the table and - * the maximum amount of parallelism allowed by the system. - * Streams must be read starting from offset 0. - */ - // const requestedStreams = 1234 - /** - * Read options for this session (e.g. column selection, filters). - */ - // const readOptions = {} - /** - * Data output format. Currently default to Avro. - */ - // const format = {} - /** - * The strategy to use for distributing data among multiple streams. Currently - * defaults to liquid sharding. - */ - // const shardingStrategy = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callCreateReadSession() { - // Construct request - const request = { - tableReference, - parent, - }; - - // Run request - const response = await storageClient.createReadSession(request); - console.log(response); - } - - callCreateReadSession(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline deleted file mode 100644 index d62f8481af14..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.finalize_stream.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Stream to finalize. - */ - // const stream = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callFinalizeStream() { - // Construct request - const request = { - }; - - // Run request - const response = await storageClient.finalizeStream(request); - console.log(response); - } - - callFinalizeStream(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline deleted file mode 100644 index fc29d9373418..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.read_rows.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(readPosition) { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Identifier of the position in the stream to start reading from. - * The offset requested must be less than the last row read from ReadRows. - * Requesting a larger offset is undefined. - */ - // const readPosition = {} - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callReadRows() { - // Construct request - const request = { - readPosition, - }; - - // Run request - const stream = await storageClient.readRows(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callReadRows(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline deleted file mode 100644 index fdfcc15456ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/big_query_storage.split_read_stream.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Stream to split. - */ - // const originalStream = {} - /** - * A value in the range (0.0, 1.0) that specifies the fractional point at - * which the original stream should be split. The actual split point is - * evaluated on pre-filtered rows, so if a filter is provided, then there is - * no guarantee that the division of the rows between the new child streams - * will be proportional to this fractional value. Additionally, because the - * server-side unit for assigning data is collections of rows, this fraction - * will always map to to a data storage boundary on the server side. - */ - // const fraction = 1234 - - // Imports the Storage library - const {BigQueryStorageClient} = require('storage').v1beta1; - - // Instantiates a client - const storageClient = new BigQueryStorageClient(); - - async function callSplitReadStream() { - // Construct request - const request = { - }; - - // Run request - const response = await storageClient.splitReadStream(request); - console.log(response); - } - - callSplitReadStream(); - // [END bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline deleted file mode 100644 index 6877e23ccc62..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/samples/generated/v1beta1/snippet_metadata_google.cloud.bigquery.storage.v1beta1.json.baseline +++ /dev/null @@ -1,247 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-storage", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.bigquery.storage.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async", - "title": "BigQueryStorage createReadSession Sample", - "origin": "API_DEFINITION", - "description": " Creates a new read session. A read session divides the contents of a BigQuery table into one or more streams, which can then be used to read data from the table. The read session also specifies properties of the data to be read, such as a list of columns or a push-down filter describing the rows to be returned. A particular row can be read by at most one stream. When the caller has reached the end of each stream in the session, then all the data in the table has been read. Read sessions automatically expire 24 hours after they are created and do not require manual clean-up by the caller.", - "canonical": true, - "file": "big_query_storage.create_read_session.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateReadSession", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.CreateReadSession", - "async": true, - "parameters": [ - { - "name": "table_reference", - "type": ".google.cloud.bigquery.storage.v1beta1.TableReference" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "table_modifiers", - "type": ".google.cloud.bigquery.storage.v1beta1.TableModifiers" - }, - { - "name": "requested_streams", - "type": "TYPE_INT32" - }, - { - "name": "read_options", - "type": ".google.cloud.bigquery.storage.v1beta1.TableReadOptions" - }, - { - "name": "format", - "type": ".google.cloud.bigquery.storage.v1beta1.DataFormat" - }, - { - "name": "sharding_strategy", - "type": ".google.cloud.bigquery.storage.v1beta1.ShardingStrategy" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.ReadSession", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "CreateReadSession", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.CreateReadSession", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async", - "title": "BigQueryStorage readRows Sample", - "origin": "API_DEFINITION", - "description": " Reads rows from the table in the format prescribed by the read session. Each response contains one or more table rows, up to a maximum of 10 MiB per response; read requests which attempt to read individual rows larger than this will fail. Each request also returns a set of stream statistics reflecting the estimated total number of rows in the read stream. This number is computed based on the total table size and the number of active streams in the read session, and may change as other streams continue to read data.", - "canonical": true, - "file": "big_query_storage.read_rows.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReadRows", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.ReadRows", - "async": true, - "parameters": [ - { - "name": "read_position", - "type": ".google.cloud.bigquery.storage.v1beta1.StreamPosition" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.ReadRowsResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "ReadRows", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.ReadRows", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async", - "title": "BigQueryStorage batchCreateReadSessionStreams Sample", - "origin": "API_DEFINITION", - "description": " Creates additional streams for a ReadSession. This API can be used to dynamically adjust the parallelism of a batch processing task upwards by adding additional workers.", - "canonical": true, - "file": "big_query_storage.batch_create_read_session_streams.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchCreateReadSessionStreams", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.BatchCreateReadSessionStreams", - "async": true, - "parameters": [ - { - "name": "session", - "type": ".google.cloud.bigquery.storage.v1beta1.ReadSession" - }, - { - "name": "requested_streams", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "BatchCreateReadSessionStreams", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.BatchCreateReadSessionStreams", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async", - "title": "BigQueryStorage finalizeStream Sample", - "origin": "API_DEFINITION", - "description": " Triggers the graceful termination of a single stream in a ReadSession. This API can be used to dynamically adjust the parallelism of a batch processing task downwards without losing data. This API does not delete the stream -- it remains visible in the ReadSession, and any data processed by the stream is not released to other streams. However, no additional data will be assigned to the stream once this call completes. Callers must continue reading data on the stream until the end of the stream is reached so that data which has already been assigned to the stream will be processed. This method will return an error if there are no other live streams in the Session, or if SplitReadStream() has been called on the given Stream.", - "canonical": true, - "file": "big_query_storage.finalize_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FinalizeStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.FinalizeStream", - "async": true, - "parameters": [ - { - "name": "stream", - "type": ".google.cloud.bigquery.storage.v1beta1.Stream" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "FinalizeStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.FinalizeStream", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - }, - { - "regionTag": "bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async", - "title": "BigQueryStorage splitReadStream Sample", - "origin": "API_DEFINITION", - "description": " Splits a given read stream into two Streams. These streams are referred to as the primary and the residual of the split. The original stream can still be read from in the same manner as before. Both of the returned streams can also be read from, and the total rows return by both child streams will be the same as the rows read from the original stream. Moreover, the two child streams will be allocated back to back in the original Stream. Concretely, it is guaranteed that for streams Original, Primary, and Residual, that Original[0-j] = Primary[0-j] and Original[j-n] = Residual[0-m] once the streams have been read to completion. This method is guaranteed to be idempotent.", - "canonical": true, - "file": "big_query_storage.split_read_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SplitReadStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.SplitReadStream", - "async": true, - "parameters": [ - { - "name": "original_stream", - "type": ".google.cloud.bigquery.storage.v1beta1.Stream" - }, - { - "name": "fraction", - "type": "TYPE_FLOAT" - } - ], - "resultType": ".google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse", - "client": { - "shortName": "BigQueryStorageClient", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorageClient" - }, - "method": { - "shortName": "SplitReadStream", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage.SplitReadStream", - "service": { - "shortName": "BigQueryStorage", - "fullName": "google.cloud.bigquery.storage.v1beta1.BigQueryStorage" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/index.ts.baseline deleted file mode 100644 index 8f4ed7aeba75..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const BigQueryStorageClient = v1beta1.BigQueryStorageClient; -type BigQueryStorageClient = v1beta1.BigQueryStorageClient; -export {v1beta1, BigQueryStorageClient}; -export default {v1beta1, BigQueryStorageClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client.ts.baseline deleted file mode 100644 index 4b8aca2e3545..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client.ts.baseline +++ /dev/null @@ -1,960 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import {PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/big_query_storage_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './big_query_storage_client_config.json'; -const version = require('../../../package.json').version; - -/** - * BigQuery storage API. - * - * The BigQuery storage API can be used to read data stored in BigQuery. - * @class - * @memberof v1beta1 - */ -export class BigQueryStorageClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('storage'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - bigQueryStorageStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BigQueryStorageClient. - * - * @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://cloud.google.com/docs/authentication/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 BigQueryStorageClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BigQueryStorageClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquerystorage.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - readSessionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/sessions/{session}' - ), - streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/streams/{stream}' - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - readRows: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.storage.v1beta1.BigQueryStorage', gapicConfig as gax.ClientConfig, - 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.bigQueryStorageStub) { - return this.bigQueryStorageStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.storage.v1beta1.BigQueryStorage. - this.bigQueryStorageStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.storage.v1beta1.BigQueryStorage') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.storage.v1beta1.BigQueryStorage, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const bigQueryStorageStubMethods = - ['createReadSession', 'readRows', 'batchCreateReadSessionStreams', 'finalizeStream', 'splitReadStream']; - for (const methodName of bigQueryStorageStubMethods) { - const callPromise = this.bigQueryStorageStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.bigQueryStorageStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquerystorage.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquerystorage.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/bigquery.readonly', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new read session. A read session divides the contents of a - * BigQuery table into one or more streams, which can then be used to read - * data from the table. The read session also specifies properties of the - * data to be read, such as a list of columns or a push-down filter describing - * the rows to be returned. - * - * A particular row can be read by at most one stream. When the caller has - * reached the end of each stream in the session, then all the data in the - * table has been read. - * - * Read sessions automatically expire 24 hours after they are created and do - * not require manual clean-up by the caller. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.TableReference} request.tableReference - * Required. Reference to the table to read. - * @param {string} request.parent - * Required. String of the form `projects/{project_id}` indicating the - * project this ReadSession is associated with. This is the project that will - * be billed for usage. - * @param {google.cloud.bigquery.storage.v1beta1.TableModifiers} request.tableModifiers - * Any modifiers to the Table (e.g. snapshot timestamp). - * @param {number} request.requestedStreams - * Initial number of streams. If unset or 0, we will - * provide a value of streams so as to produce reasonable throughput. Must be - * non-negative. The number of streams may be lower than the requested number, - * depending on the amount parallelism that is reasonable for the table and - * the maximum amount of parallelism allowed by the system. - * - * Streams must be read starting from offset 0. - * @param {google.cloud.bigquery.storage.v1beta1.TableReadOptions} request.readOptions - * Read options for this session (e.g. column selection, filters). - * @param {google.cloud.bigquery.storage.v1beta1.DataFormat} request.format - * Data output format. Currently default to Avro. - * @param {google.cloud.bigquery.storage.v1beta1.ShardingStrategy} request.shardingStrategy - * The strategy to use for distributing data among multiple streams. Currently - * defaults to liquid sharding. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.ReadSession|ReadSession}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.create_read_session.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_CreateReadSession_async - */ - createReadSession( - request?: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, {}|undefined - ]>; - createReadSession( - request: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): void; - createReadSession( - request: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): void; - createReadSession( - request?: protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'table_reference.project_id': request.tableReference!.projectId?.toString() ?? '', - 'table_reference.dataset_id': request.tableReference!.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createReadSession request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createReadSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createReadSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.IReadSession, - protos.google.cloud.bigquery.storage.v1beta1.ICreateReadSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createReadSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates additional streams for a ReadSession. This API can be used to - * dynamically adjust the parallelism of a batch processing task upwards by - * adding additional workers. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.ReadSession} request.session - * Required. Must be a non-expired session obtained from a call to - * CreateReadSession. Only the name field needs to be set. - * @param {number} request.requestedStreams - * Required. Number of new streams requested. Must be positive. - * Number of added streams may be less than this, see CreateReadSessionRequest - * for more information. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse|BatchCreateReadSessionStreamsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.batch_create_read_session_streams.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_BatchCreateReadSessionStreams_async - */ - batchCreateReadSessionStreams( - request?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, {}|undefined - ]>; - batchCreateReadSessionStreams( - request: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): void; - batchCreateReadSessionStreams( - request: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): void; - batchCreateReadSessionStreams( - request?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'session.name': request.session!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchCreateReadSessionStreams request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchCreateReadSessionStreams response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.batchCreateReadSessionStreams(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse, - protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsRequest|undefined, - {}|undefined - ]) => { - this._log.info('batchCreateReadSessionStreams response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Triggers the graceful termination of a single stream in a ReadSession. This - * API can be used to dynamically adjust the parallelism of a batch processing - * task downwards without losing data. - * - * This API does not delete the stream -- it remains visible in the - * ReadSession, and any data processed by the stream is not released to other - * streams. However, no additional data will be assigned to the stream once - * this call completes. Callers must continue reading data on the stream until - * the end of the stream is reached so that data which has already been - * assigned to the stream will be processed. - * - * This method will return an error if there are no other live streams - * in the Session, or if SplitReadStream() has been called on the given - * Stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.Stream} request.stream - * Stream to finalize. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.finalize_stream.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_FinalizeStream_async - */ - finalizeStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, {}|undefined - ]>; - finalizeStream( - request: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): void; - finalizeStream( - request: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): void; - finalizeStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream.name': request.stream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('finalizeStream request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('finalizeStream response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.finalizeStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.storage.v1beta1.IFinalizeStreamRequest|undefined, - {}|undefined - ]) => { - this._log.info('finalizeStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Splits a given read stream into two Streams. These streams are referred to - * as the primary and the residual of the split. The original stream can still - * be read from in the same manner as before. Both of the returned streams can - * also be read from, and the total rows return by both child streams will be - * the same as the rows read from the original stream. - * - * Moreover, the two child streams will be allocated back to back in the - * original Stream. Concretely, it is guaranteed that for streams Original, - * Primary, and Residual, that Original[0-j] = Primary[0-j] and - * Original[j-n] = Residual[0-m] once the streams have been read to - * completion. - * - * This method is guaranteed to be idempotent. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.Stream} request.originalStream - * Stream to split. - * @param {number} request.fraction - * A value in the range (0.0, 1.0) that specifies the fractional point at - * which the original stream should be split. The actual split point is - * evaluated on pre-filtered rows, so if a filter is provided, then there is - * no guarantee that the division of the rows between the new child streams - * will be proportional to this fractional value. Additionally, because the - * server-side unit for assigning data is collections of rows, this fraction - * will always map to to a data storage boundary on the server side. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse|SplitReadStreamResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.split_read_stream.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_SplitReadStream_async - */ - splitReadStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, {}|undefined - ]>; - splitReadStream( - request: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): void; - splitReadStream( - request: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - callback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): void; - splitReadStream( - request?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'original_stream.name': request.originalStream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('splitReadStream request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('splitReadStream response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.splitReadStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse, - protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamRequest|undefined, - {}|undefined - ]) => { - this._log.info('splitReadStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Reads rows from the table in the format prescribed by the read session. - * Each response contains one or more table rows, up to a maximum of 10 MiB - * per response; read requests which attempt to read individual rows larger - * than this will fail. - * - * Each request also returns a set of stream statistics reflecting the - * estimated total number of rows in the read stream. This number is computed - * based on the total table size and the number of active streams in the read - * session, and may change as other streams continue to read data. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.bigquery.storage.v1beta1.StreamPosition} request.readPosition - * Required. Identifier of the position in the stream to start reading from. - * The offset requested must be less than the last row read from ReadRows. - * Requesting a larger offset is undefined. - * @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 {@link protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse|ReadRowsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/big_query_storage.read_rows.js - * region_tag:bigquerystorage_v1beta1_generated_BigQueryStorage_ReadRows_async - */ - readRows( - request?: protos.google.cloud.bigquery.storage.v1beta1.IReadRowsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'read_position.stream.name': request.readPosition!.stream!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('readRows stream %j', options); - return this.innerApiCalls.readRows(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified readSession resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} session - * @returns {string} Resource name string. - */ - readSessionPath(project:string,location:string,session:string) { - return this.pathTemplates.readSessionPathTemplate.render({ - project: project, - location: location, - session: session, - }); - } - - /** - * Parse the project from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the project. - */ - matchProjectFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).project; - } - - /** - * Parse the location from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the location. - */ - matchLocationFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).location; - } - - /** - * Parse the session from ReadSession resource. - * - * @param {string} readSessionName - * A fully-qualified path representing ReadSession resource. - * @returns {string} A string representing the session. - */ - matchSessionFromReadSessionName(readSessionName: string) { - return this.pathTemplates.readSessionPathTemplate.match(readSessionName).session; - } - - /** - * Return a fully-qualified stream resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stream - * @returns {string} Resource name string. - */ - streamPath(project:string,location:string,stream:string) { - return this.pathTemplates.streamPathTemplate.render({ - project: project, - location: location, - stream: stream, - }); - } - - /** - * Parse the project from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the project. - */ - matchProjectFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).project; - } - - /** - * Parse the location from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the location. - */ - matchLocationFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).location; - } - - /** - * Parse the stream from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the stream. - */ - matchStreamFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).stream; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.bigQueryStorageStub && !this._terminated) { - return this.bigQueryStorageStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client_config.json.baseline deleted file mode 100644 index d687cae81cab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.storage.v1beta1.BigQueryStorage": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateReadSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReadRows": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchCreateReadSessionStreams": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FinalizeStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SplitReadStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_proto_list.json.baseline deleted file mode 100644 index 0b8010758a65..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/big_query_storage_proto_list.json.baseline +++ /dev/null @@ -1,7 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/storage/v1beta1/arrow.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/avro.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/read_options.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/storage.proto", - "../../protos/google/cloud/bigquery/storage/v1beta1/table_reference.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/index.ts.baseline deleted file mode 100644 index 37968a0737d7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {BigQueryStorageClient} from './big_query_storage_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 518aecc57056..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const storage = require('storage'); - -function main() { - const bigQueryStorageClient = new storage.BigQueryStorageClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index fc714d834fb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {BigQueryStorageClient} from 'storage'; - -// check that the client class type name can be used -function doStuffWithBigQueryStorageClient(client: BigQueryStorageClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const bigQueryStorageClient = new BigQueryStorageClient(); - doStuffWithBigQueryStorageClient(bigQueryStorageClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/test/gapic_big_query_storage_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/test/gapic_big_query_storage_v1beta1.ts.baseline deleted file mode 100644 index 8e2bfb3d9e70..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/test/gapic_big_query_storage_v1beta1.ts.baseline +++ /dev/null @@ -1,935 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as bigquerystorageModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v1beta1.BigQueryStorageClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquerystorage.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = bigquerystorageModule.v1beta1.BigQueryStorageClient.servicePath; - assert.strictEqual(servicePath, 'bigquerystorage.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = bigquerystorageModule.v1beta1.BigQueryStorageClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquerystorage.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquerystorage.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new bigquerystorageModule.v1beta1.BigQueryStorageClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = bigquerystorageModule.v1beta1.BigQueryStorageClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigQueryStorageStub, undefined); - await client.initialize(); - assert(client.bigQueryStorageStub); - }); - - it('has close method for the initialized client', done => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.bigQueryStorageStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.bigQueryStorageStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createReadSession', () => { - it('invokes createReadSession without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadSession() - ); - client.innerApiCalls.createReadSession = stubSimpleCall(expectedResponse); - const [response] = await client.createReadSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadSession() - ); - client.innerApiCalls.createReadSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createReadSession( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.IReadSession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedHeaderRequestParams = `table_reference.project_id=${defaultValue1 ?? '' }&table_reference.dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createReadSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createReadSession(request), expectedError); - const actualRequest = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createReadSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createReadSession with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest() - ); - request.tableReference ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'projectId']); - request.tableReference.projectId = defaultValue1; - request.tableReference ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.CreateReadSessionRequest', ['tableReference', 'datasetId']); - request.tableReference.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createReadSession(request), expectedError); - }); - }); - - describe('batchCreateReadSessionStreams', () => { - it('invokes batchCreateReadSessionStreams without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse() - ); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCall(expectedResponse); - const [response] = await client.batchCreateReadSessionStreams(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsResponse() - ); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchCreateReadSessionStreams( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.IBatchCreateReadSessionStreamsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedHeaderRequestParams = `session.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchCreateReadSessionStreams(request), expectedError); - const actualRequest = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchCreateReadSessionStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchCreateReadSessionStreams with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest() - ); - request.session ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.BatchCreateReadSessionStreamsRequest', ['session', 'name']); - request.session.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchCreateReadSessionStreams(request), expectedError); - }); - }); - - describe('finalizeStream', () => { - it('invokes finalizeStream without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finalizeStream = stubSimpleCall(expectedResponse); - const [response] = await client.finalizeStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.finalizeStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.finalizeStream( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.finalizeStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.finalizeStream(request), expectedError); - const actualRequest = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.finalizeStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes finalizeStream with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.FinalizeStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.finalizeStream(request), expectedError); - }); - }); - - describe('splitReadStream', () => { - it('invokes splitReadStream without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse() - ); - client.innerApiCalls.splitReadStream = stubSimpleCall(expectedResponse); - const [response] = await client.splitReadStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream without error using callback', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamResponse() - ); - client.innerApiCalls.splitReadStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.splitReadStream( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.storage.v1beta1.ISplitReadStreamResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedHeaderRequestParams = `original_stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.splitReadStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.splitReadStream(request), expectedError); - const actualRequest = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.splitReadStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes splitReadStream with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest() - ); - request.originalStream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.SplitReadStreamRequest', ['originalStream', 'name']); - request.originalStream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.splitReadStream(request), expectedError); - }); - }); - - describe('readRows', () => { - it('invokes readRows without error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse() - ); - client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows without error and gaxServerStreamingRetries enabled', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse() - ); - client.innerApiCalls.readRows = stubServerStreamingCall(expectedResponse); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows with error', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedHeaderRequestParams = `read_position.stream.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.readRows = stubServerStreamingCall(undefined, expectedError); - const stream = client.readRows(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.readRows as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes readRows with closed client', async () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest() - ); - request.readPosition ??= {}; - request.readPosition.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.storage.v1beta1.ReadRowsRequest', ['readPosition', 'stream', 'name']); - request.readPosition.stream.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.readRows(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.bigquery.storage.v1beta1.ReadRowsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('Path templates', () => { - - describe('readSession', async () => { - const fakePath = "/rendered/path/readSession"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - session: "sessionValue", - }; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.readSessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.readSessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('readSessionPath', () => { - const result = client.readSessionPath("projectValue", "locationValue", "sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.readSessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromReadSessionName', () => { - const result = client.matchProjectFromReadSessionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromReadSessionName', () => { - const result = client.matchLocationFromReadSessionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSessionFromReadSessionName', () => { - const result = client.matchSessionFromReadSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.readSessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('stream', async () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stream: "streamValue", - }; - const client = new bigquerystorageModule.v1beta1.BigQueryStorageClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-storage/webpack.config.js.baseline deleted file mode 100644 index 5f047fa3d9fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-storage/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'BigQueryStorage', - filename: './big-query-storage.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 071d8b4ff53a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/bigquery/google-cloud-bigquery-nodejs - dest: /owl-bot-staging/google-cloud-bigquery - -api-name: bigquery \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.jsdoc.cjs.baseline deleted file mode 100644 index b3e19f81476d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'bigquery', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/README.md.baseline deleted file mode 100644 index 5ca58630499b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Bigquery: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/bigquery.svg)](https://www.npmjs.org/package/bigquery) - -Bigquery client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Bigquery Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/bigquery/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Bigquery API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install bigquery -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install bigquery@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquery.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/index.ts.baseline deleted file mode 100644 index 8bd334b4ebcb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2/index.js'; -const DatasetServiceClient = v2.DatasetServiceClient; -type DatasetServiceClient = v2.DatasetServiceClient; -const JobServiceClient = v2.JobServiceClient; -type JobServiceClient = v2.JobServiceClient; -const ModelServiceClient = v2.ModelServiceClient; -type ModelServiceClient = v2.ModelServiceClient; -const ProjectServiceClient = v2.ProjectServiceClient; -type ProjectServiceClient = v2.ProjectServiceClient; -const RoutineServiceClient = v2.RoutineServiceClient; -type RoutineServiceClient = v2.RoutineServiceClient; -const RowAccessPolicyServiceClient = v2.RowAccessPolicyServiceClient; -type RowAccessPolicyServiceClient = v2.RowAccessPolicyServiceClient; -const TableServiceClient = v2.TableServiceClient; -type TableServiceClient = v2.TableServiceClient; -export {v2, DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient}; -export default {v2, DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client.ts.baseline deleted file mode 100644 index c04f9dce7bcb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client.ts.baseline +++ /dev/null @@ -1,1204 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as dataset_service_client_config from './dataset_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/dataset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'dataset_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Dataset Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class DatasetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - datasetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DatasetServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 DatasetServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DatasetServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listDatasets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.DatasetService', gapicConfig as gax.ClientConfig, - 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.datasetServiceStub) { - return this.datasetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.DatasetService. - this.datasetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.DatasetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.DatasetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const datasetServiceStubMethods = - ['getDataset', 'insertDataset', 'patchDataset', 'updateDataset', 'deleteDataset', 'listDatasets', 'undeleteDataset']; - for (const methodName of datasetServiceStubMethods) { - const callPromise = this.datasetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.datasetServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns the dataset specified by datasetID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested dataset - * @param {string} request.datasetId - * Required. Dataset ID of the requested dataset - * @param {google.cloud.bigquery.v2.GetDatasetRequest.DatasetView} [request.datasetView] - * Optional. Specifies the view that determines which dataset information is - * returned. By default, metadata and ACL information 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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.get_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_GetDataset_async - */ - getDataset( - request?: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, {}|undefined - ]>; - getDataset( - request: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request?: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('getDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new empty dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new dataset - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource to use for the new dataset - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.insert_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_InsertDataset_async - */ - insertDataset( - request?: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, {}|undefined - ]>; - insertDataset( - request: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): void; - insertDataset( - request: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): void; - insertDataset( - request?: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.insertDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('insertDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing dataset. The update method replaces the - * entire dataset resource, whereas the patch method only replaces fields that - * are provided in the submitted dataset resource. - * This method supports RFC5789 patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being updated - * @param {string} request.datasetId - * Required. Dataset ID of the dataset being updated - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource which will replace or patch the specified - * dataset. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.patch_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_PatchDataset_async - */ - patchDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>; - patchDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - patchDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - patchDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.patchDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('patchDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing dataset. The update method replaces the - * entire dataset resource, whereas the patch method only replaces fields that - * are provided in the submitted dataset resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being updated - * @param {string} request.datasetId - * Required. Dataset ID of the dataset being updated - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource which will replace or patch the specified - * dataset. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.update_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_UpdateDataset_async - */ - updateDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>; - updateDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - updateDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - updateDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('updateDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the dataset specified by the datasetId value. Before you can delete - * a dataset, you must delete all its tables, either manually or by specifying - * deleteContents. Immediately after deletion, you can create another dataset - * with the same name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being deleted - * @param {string} request.datasetId - * Required. Dataset ID of dataset being deleted - * @param {boolean} request.deleteContents - * If True, delete all the tables in the dataset. - * If False and the dataset contains tables, the request will fail. - * Default is False - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.delete_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_DeleteDataset_async - */ - deleteDataset( - request?: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, {}|undefined - ]>; - deleteDataset( - request: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request?: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDataset request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Undeletes a dataset which is within time travel window based on datasetId. - * If a time is specified, the dataset version deleted at that time is - * undeleted, else the last live version is undeleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset to be undeleted - * @param {string} request.datasetId - * Required. Dataset ID of dataset being deleted - * @param {google.protobuf.Timestamp} [request.deletionTime] - * Optional. The exact time when the dataset was deleted. If not specified, - * the most recently deleted version is undeleted. Undeleting a dataset - * using deletion time is not supported. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.undelete_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_UndeleteDataset_async - */ - undeleteDataset( - request?: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, {}|undefined - ]>; - undeleteDataset( - request: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - undeleteDataset( - request: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - undeleteDataset( - request?: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('undeleteDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('undeleteDataset response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.undeleteDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, {}|undefined - ]) => { - this._log.info('undeleteDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all datasets in the specified project to which the user has been - * granted the READER dataset role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDatasetsAsync()` - * 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. - */ - listDatasets( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]>; - listDatasets( - request: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): void; - listDatasets( - request: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): void; - listDatasets( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDatasets values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listDatasets request %j', request); - return this.innerApiCalls - .listDatasets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]) => { - this._log.info('listDatasets values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDatasets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset} 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 `listDatasetsAsync()` - * 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. - */ - listDatasetsStream( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDatasets stream %j', request); - return this.descriptors.page.listDatasets.createStream( - this.innerApiCalls.listDatasets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDatasets`, 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.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset}. 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 include:samples/generated/v2/dataset_service.list_datasets.js - * region_tag:bigquery_v2_generated_DatasetService_ListDatasets_async - */ - listDatasetsAsync( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDatasets iterate %j', request); - return this.descriptors.page.listDatasets.asyncIterate( - this.innerApiCalls['listDatasets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.datasetServiceStub && !this._terminated) { - return this.datasetServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client_config.json.baseline deleted file mode 100644 index 74c64e606036..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.DatasetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDatasets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/dataset_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/index.ts.baseline deleted file mode 100644 index 8c9358de394f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -export {DatasetServiceClient} from './dataset_service_client.js'; -export {JobServiceClient} from './job_service_client.js'; -export {ModelServiceClient} from './model_service_client.js'; -export {ProjectServiceClient} from './project_service_client.js'; -export {RoutineServiceClient} from './routine_service_client.js'; -export {RowAccessPolicyServiceClient} from './row_access_policy_service_client.js'; -export {TableServiceClient} from './table_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client.ts.baseline deleted file mode 100644 index c47ff0af5f57..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client.ts.baseline +++ /dev/null @@ -1,1277 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as job_service_client_config from './job_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/job_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'job_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Job Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class JobServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - jobServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of JobServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 JobServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof JobServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.JobService', gapicConfig as gax.ClientConfig, - 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.jobServiceStub) { - return this.jobServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.JobService. - this.jobServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.JobService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.JobService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const jobServiceStubMethods = - ['cancelJob', 'getJob', 'insertJob', 'deleteJob', 'listJobs', 'getQueryResults', 'query']; - for (const methodName of jobServiceStubMethods) { - const callPromise = this.jobServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.jobServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/devstorage.full_control', - 'https://www.googleapis.com/auth/devstorage.read_only', - 'https://www.googleapis.com/auth/devstorage.read_write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Requests that a job be cancelled. This call will return immediately, and - * the client will need to poll for the job status to see if the cancel - * completed successfully. Cancelled jobs may still incur costs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the job to cancel - * @param {string} request.jobId - * Required. Job ID of the job to cancel - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.cloud.bigquery.v2.JobCancelResponse|JobCancelResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.cancel_job.js - * region_tag:bigquery_v2_generated_JobService_CancelJob_async - */ - cancelJob( - request?: protos.google.cloud.bigquery.v2.ICancelJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, {}|undefined - ]>; - cancelJob( - request: protos.google.cloud.bigquery.v2.ICancelJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request: protos.google.cloud.bigquery.v2.ICancelJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request?: protos.google.cloud.bigquery.v2.ICancelJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('cancelJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancelJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.cancelJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, {}|undefined - ]) => { - this._log.info('cancelJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns information about a specific job. Job information is available for - * a six month period after creation. Requires that you're the person who ran - * the job, or have the Is Owner project role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested job. - * @param {string} request.jobId - * Required. Job ID of the requested job. - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.cloud.bigquery.v2.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.get_job.js - * region_tag:bigquery_v2_generated_JobService_GetJob_async - */ - getJob( - request?: protos.google.cloud.bigquery.v2.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.bigquery.v2.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.bigquery.v2.IGetJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request?: protos.google.cloud.bigquery.v2.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, {}|undefined - ]) => { - this._log.info('getJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Starts a new asynchronous job. - * - * This API has two different kinds of endpoint URIs, as this method supports - * a variety of use cases. - * - * * The *Metadata* URI is used for most interactions, as it accepts the job - * configuration directly. - * * The *Upload* URI is ONLY for the case when you're sending both a load job - * configuration and a data stream together. In this case, the Upload URI - * accepts the job configuration and the data as two distinct multipart MIME - * parts. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of project that will be billed for the job. - * @param {google.cloud.bigquery.v2.Job} request.job - * Jobs resource to insert. - * @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 {@link protos.google.cloud.bigquery.v2.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.insert_job.js - * region_tag:bigquery_v2_generated_JobService_InsertJob_async - */ - insertJob( - request?: protos.google.cloud.bigquery.v2.IInsertJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, {}|undefined - ]>; - insertJob( - request: protos.google.cloud.bigquery.v2.IInsertJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): void; - insertJob( - request: protos.google.cloud.bigquery.v2.IInsertJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): void; - insertJob( - request?: protos.google.cloud.bigquery.v2.IInsertJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.insertJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, {}|undefined - ]) => { - this._log.info('insertJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Requests the deletion of the metadata of a job. This call returns when the - * job's metadata is deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the job for which metadata is to be deleted. - * @param {string} request.jobId - * Required. Job ID of the job for which metadata is to be deleted. If this is - * a parent job which has child jobs, the metadata from all child jobs will be - * deleted as well. Direct deletion of the metadata of child jobs is not - * allowed. - * @param {string} request.location - * The geographic location of the job. Required. - * See details at: - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.delete_job.js - * region_tag:bigquery_v2_generated_JobService_DeleteJob_async - */ - deleteJob( - request?: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request?: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * RPC to get the results of a query job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the query job. - * @param {string} request.jobId - * Required. Job ID of the query job. - * @param {google.protobuf.UInt64Value} request.startIndex - * Zero-based index of the starting row. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.protobuf.UInt32Value} request.maxResults - * Maximum number of results to read. - * @param {google.protobuf.UInt32Value} request.timeoutMs - * Optional: Specifies the maximum amount of time, in milliseconds, that the - * client is willing to wait for the query to complete. By default, this limit - * is 10 seconds (10,000 milliseconds). If the query is complete, the - * jobComplete field in the response is true. If the query has not yet - * completed, jobComplete is false. - * - * You can request a longer timeout period in the timeoutMs field. However, - * the call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * - * If jobComplete is false, you can continue to wait for the query to complete - * by calling the getQueryResults method until the jobComplete field in the - * getQueryResults response is true. - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @param {google.cloud.bigquery.v2.DataFormatOptions} [request.formatOptions] - * Optional. Output format adjustments. - * @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 {@link protos.google.cloud.bigquery.v2.GetQueryResultsResponse|GetQueryResultsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.get_query_results.js - * region_tag:bigquery_v2_generated_JobService_GetQueryResults_async - */ - getQueryResults( - request?: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, {}|undefined - ]>; - getQueryResults( - request: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): void; - getQueryResults( - request: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): void; - getQueryResults( - request?: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getQueryResults request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getQueryResults response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getQueryResults(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, {}|undefined - ]) => { - this._log.info('getQueryResults response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Runs a BigQuery SQL query synchronously and returns query results if the - * query completes within a specified timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the query request. - * @param {google.cloud.bigquery.v2.QueryRequest} request.queryRequest - * The query request body. - * @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 {@link protos.google.cloud.bigquery.v2.QueryResponse|QueryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.query.js - * region_tag:bigquery_v2_generated_JobService_Query_async - */ - query( - request?: protos.google.cloud.bigquery.v2.IPostQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, {}|undefined - ]>; - query( - request: protos.google.cloud.bigquery.v2.IPostQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): void; - query( - request: protos.google.cloud.bigquery.v2.IPostQueryRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): void; - query( - request?: protos.google.cloud.bigquery.v2.IPostQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('query request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('query response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.query(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, {}|undefined - ]) => { - this._log.info('query response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all jobs that you started in the specified project. Job information - * is available for a six month period after creation. The job list is sorted - * in reverse chronological order, by job creation time. Requires the Can View - * project role, or the Is Owner project role if you set the allUsers - * property. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatJob|ListFormatJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * 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. - */ - listJobs( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]>; - listJobs( - request: protos.google.cloud.bigquery.v2.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): void; - listJobs( - request: protos.google.cloud.bigquery.v2.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): void; - listJobs( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listJobs request %j', request); - return this.innerApiCalls - .listJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]) => { - this._log.info('listJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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.cloud.bigquery.v2.ListFormatJob|ListFormatJob} 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 `listJobsAsync()` - * 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. - */ - listJobsStream( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobs stream %j', request); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, 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.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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.cloud.bigquery.v2.ListFormatJob|ListFormatJob}. 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 include:samples/generated/v2/job_service.list_jobs.js - * region_tag:bigquery_v2_generated_JobService_ListJobs_async - */ - listJobsAsync( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobs iterate %j', request); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.jobServiceStub && !this._terminated) { - return this.jobServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client_config.json.baseline deleted file mode 100644 index 7b1d7cc9384f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.JobService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CancelJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetQueryResults": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Query": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/job_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client.ts.baseline deleted file mode 100644 index d8f7e8e28493..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client.ts.baseline +++ /dev/null @@ -1,883 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as model_service_client_config from './model_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/model_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'model_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Model Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class ModelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - modelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ModelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ModelServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ModelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listModels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'models') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.ModelService', gapicConfig as gax.ClientConfig, - 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.modelServiceStub) { - return this.modelServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.ModelService. - this.modelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.ModelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.ModelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const modelServiceStubMethods = - ['getModel', 'listModels', 'patchModel', 'deleteModel']; - for (const methodName of modelServiceStubMethods) { - const callPromise = this.modelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.modelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified model resource by model ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested model. - * @param {string} request.datasetId - * Required. Dataset ID of the requested model. - * @param {string} request.modelId - * Required. Model ID of the requested model. - * @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 {@link protos.google.cloud.bigquery.v2.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.get_model.js - * region_tag:bigquery_v2_generated_ModelService_GetModel_async - */ - getModel( - request?: protos.google.cloud.bigquery.v2.IGetModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, {}|undefined - ]>; - getModel( - request: protos.google.cloud.bigquery.v2.IGetModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request: protos.google.cloud.bigquery.v2.IGetModelRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request?: protos.google.cloud.bigquery.v2.IGetModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, {}|undefined - ]) => { - this._log.info('getModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Patch specific fields in the specified model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the model to patch. - * @param {string} request.datasetId - * Required. Dataset ID of the model to patch. - * @param {string} request.modelId - * Required. Model ID of the model to patch. - * @param {google.cloud.bigquery.v2.Model} request.model - * Required. Patched model. - * Follows RFC5789 patch semantics. Missing fields are not updated. - * To clear a field, explicitly set to default value. - * @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 {@link protos.google.cloud.bigquery.v2.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.patch_model.js - * region_tag:bigquery_v2_generated_ModelService_PatchModel_async - */ - patchModel( - request?: protos.google.cloud.bigquery.v2.IPatchModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, {}|undefined - ]>; - patchModel( - request: protos.google.cloud.bigquery.v2.IPatchModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): void; - patchModel( - request: protos.google.cloud.bigquery.v2.IPatchModelRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): void; - patchModel( - request?: protos.google.cloud.bigquery.v2.IPatchModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.patchModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, {}|undefined - ]) => { - this._log.info('patchModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the model specified by modelId from the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the model to delete. - * @param {string} request.datasetId - * Required. Dataset ID of the model to delete. - * @param {string} request.modelId - * Required. Model ID of the model to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.delete_model.js - * region_tag:bigquery_v2_generated_ModelService_DeleteModel_async - */ - deleteModel( - request?: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, {}|undefined - ]>; - deleteModel( - request: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request?: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteModel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all models in the specified dataset. Requires the READER dataset - * role. After retrieving the list of models, you can get information about a - * particular model by calling the models.get method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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 Array of {@link protos.google.cloud.bigquery.v2.Model|Model}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listModelsAsync()` - * 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. - */ - listModels( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]>; - listModels( - request: protos.google.cloud.bigquery.v2.IListModelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): void; - listModels( - request: protos.google.cloud.bigquery.v2.IListModelsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): void; - listModels( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listModels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listModels request %j', request); - return this.innerApiCalls - .listModels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]) => { - this._log.info('listModels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listModels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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.cloud.bigquery.v2.Model|Model} 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 `listModelsAsync()` - * 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. - */ - listModelsStream( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels stream %j', request); - return this.descriptors.page.listModels.createStream( - this.innerApiCalls.listModels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listModels`, 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.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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.cloud.bigquery.v2.Model|Model}. 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 include:samples/generated/v2/model_service.list_models.js - * region_tag:bigquery_v2_generated_ModelService_ListModels_async - */ - listModelsAsync( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels iterate %j', request); - return this.descriptors.page.listModels.asyncIterate( - this.innerApiCalls['listModels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.modelServiceStub && !this._terminated) { - return this.modelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client_config.json.baseline deleted file mode 100644 index 76a66c9cb1e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_client_config.json.baseline +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.ModelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListModels": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/model_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client.ts.baseline deleted file mode 100644 index c02db6c4f4d5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client.ts.baseline +++ /dev/null @@ -1,454 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as project_service_client_config from './project_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/project_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'project_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Project Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class ProjectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - projectServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProjectServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ProjectServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProjectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.ProjectService', gapicConfig as gax.ClientConfig, - 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.projectServiceStub) { - return this.projectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.ProjectService. - this.projectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.ProjectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.ProjectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const projectServiceStubMethods = - ['getServiceAccount']; - for (const methodName of projectServiceStubMethods) { - const callPromise = this.projectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.projectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * RPC to get the service account for a project used for interactions with - * Google Cloud KMS - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. ID of the project. - * @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 {@link protos.google.cloud.bigquery.v2.GetServiceAccountResponse|GetServiceAccountResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/project_service.get_service_account.js - * region_tag:bigquery_v2_generated_ProjectService_GetServiceAccount_async - */ - getServiceAccount( - request?: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, {}|undefined - ]>; - getServiceAccount( - request: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getServiceAccount( - request: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getServiceAccount( - request?: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServiceAccount request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServiceAccount response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getServiceAccount(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, {}|undefined - ]) => { - this._log.info('getServiceAccount response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.projectServiceStub && !this._terminated) { - return this.projectServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client_config.json.baseline deleted file mode 100644 index 043d875e7d22..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.ProjectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetServiceAccount": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/project_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client.ts.baseline deleted file mode 100644 index fce182d04f3c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client.ts.baseline +++ /dev/null @@ -1,1091 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as routine_service_client_config from './routine_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/routine_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'routine_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Routine Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class RoutineServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - routineServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RoutineServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 RoutineServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RoutineServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listRoutines: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routines') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.RoutineService', gapicConfig as gax.ClientConfig, - 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.routineServiceStub) { - return this.routineServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.RoutineService. - this.routineServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.RoutineService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.RoutineService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const routineServiceStubMethods = - ['getRoutine', 'insertRoutine', 'updateRoutine', 'patchRoutine', 'deleteRoutine', 'listRoutines']; - for (const methodName of routineServiceStubMethods) { - const callPromise = this.routineServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.routineServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified routine resource by routine ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested routine - * @param {string} request.datasetId - * Required. Dataset ID of the requested routine - * @param {string} request.routineId - * Required. Routine ID of the requested routine - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.get_routine.js - * region_tag:bigquery_v2_generated_RoutineService_GetRoutine_async - */ - getRoutine( - request?: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, {}|undefined - ]>; - getRoutine( - request: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): void; - getRoutine( - request: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): void; - getRoutine( - request?: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoutine response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, {}|undefined - ]) => { - this._log.info('getRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new routine in the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new routine - * @param {string} request.datasetId - * Required. Dataset ID of the new routine - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource to insert - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.insert_routine.js - * region_tag:bigquery_v2_generated_RoutineService_InsertRoutine_async - */ - insertRoutine( - request?: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, {}|undefined - ]>; - insertRoutine( - request: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): void; - insertRoutine( - request: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): void; - insertRoutine( - request?: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertRoutine response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.insertRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, {}|undefined - ]) => { - this._log.info('insertRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing routine. The update method replaces the - * entire Routine resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to update - * @param {string} request.datasetId - * Required. Dataset ID of the routine to update - * @param {string} request.routineId - * Required. Routine ID of the routine to update - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource which will replace the specified routine - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.update_routine.js - * region_tag:bigquery_v2_generated_RoutineService_UpdateRoutine_async - */ - updateRoutine( - request?: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, {}|undefined - ]>; - updateRoutine( - request: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): void; - updateRoutine( - request: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): void; - updateRoutine( - request?: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoutine response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, {}|undefined - ]) => { - this._log.info('updateRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Patches information in an existing routine. The patch method does a partial - * update to an existing Routine resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to update - * @param {string} request.datasetId - * Required. Dataset ID of the routine to update - * @param {string} request.routineId - * Required. Routine ID of the routine to update - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource which will be used to partially - * update the specified routine - * @param {google.protobuf.FieldMask} request.fieldMask - * Only the Routine fields in the field mask are updated - * by the given routine. Repeated routine fields will be fully replaced - * if contained in the field mask. - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.patch_routine.js - * region_tag:bigquery_v2_generated_RoutineService_PatchRoutine_async - */ - patchRoutine( - request?: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, {}|undefined - ]>; - patchRoutine( - request: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): void; - patchRoutine( - request: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): void; - patchRoutine( - request?: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('patchRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchRoutine response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.patchRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, {}|undefined - ]) => { - this._log.info('patchRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the routine specified by routineId from the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to delete - * @param {string} request.datasetId - * Required. Dataset ID of the routine to delete - * @param {string} request.routineId - * Required. Routine ID of the routine to delete - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.delete_routine.js - * region_tag:bigquery_v2_generated_RoutineService_DeleteRoutine_async - */ - deleteRoutine( - request?: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, {}|undefined - ]>; - deleteRoutine( - request: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): void; - deleteRoutine( - request: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): void; - deleteRoutine( - request?: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoutine response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all routines in the specified dataset. Requires the READER dataset - * role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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 Array of {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoutinesAsync()` - * 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. - */ - listRoutines( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]>; - listRoutines( - request: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): void; - listRoutines( - request: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): void; - listRoutines( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRoutines values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listRoutines request %j', request); - return this.innerApiCalls - .listRoutines(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]) => { - this._log.info('listRoutines values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRoutines`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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.cloud.bigquery.v2.Routine|Routine} 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 `listRoutinesAsync()` - * 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. - */ - listRoutinesStream( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRoutines']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRoutines stream %j', request); - return this.descriptors.page.listRoutines.createStream( - this.innerApiCalls.listRoutines as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRoutines`, 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.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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.cloud.bigquery.v2.Routine|Routine}. 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 include:samples/generated/v2/routine_service.list_routines.js - * region_tag:bigquery_v2_generated_RoutineService_ListRoutines_async - */ - listRoutinesAsync( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRoutines']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRoutines iterate %j', request); - return this.descriptors.page.listRoutines.asyncIterate( - this.innerApiCalls['listRoutines'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.routineServiceStub && !this._terminated) { - return this.routineServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client_config.json.baseline deleted file mode 100644 index 7d0cea2bae21..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.RoutineService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRoutines": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/routine_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client.ts.baseline deleted file mode 100644 index 580b23c30333..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client.ts.baseline +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as row_access_policy_service_client_config from './row_access_policy_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/row_access_policy_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'row_access_policy_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for interacting with row access policies. - * @class - * @memberof v2 - */ -export class RowAccessPolicyServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - rowAccessPolicyServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RowAccessPolicyServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 RowAccessPolicyServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RowAccessPolicyServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listRowAccessPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rowAccessPolicies') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.RowAccessPolicyService', gapicConfig as gax.ClientConfig, - 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.rowAccessPolicyServiceStub) { - return this.rowAccessPolicyServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.RowAccessPolicyService. - this.rowAccessPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.RowAccessPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.RowAccessPolicyService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const rowAccessPolicyServiceStubMethods = - ['listRowAccessPolicies']; - for (const methodName of rowAccessPolicyServiceStubMethods) { - const callPromise = this.rowAccessPolicyServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.rowAccessPolicyServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Lists all row access policies on the specified table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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 Array of {@link protos.google.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRowAccessPoliciesAsync()` - * 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. - */ - listRowAccessPolicies( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]>; - listRowAccessPolicies( - request: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): void; - listRowAccessPolicies( - request: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): void; - listRowAccessPolicies( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): - Promise<[ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRowAccessPolicies values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listRowAccessPolicies request %j', request); - return this.innerApiCalls - .listRowAccessPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]) => { - this._log.info('listRowAccessPolicies values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRowAccessPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy} 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 `listRowAccessPoliciesAsync()` - * 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. - */ - listRowAccessPoliciesStream( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRowAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRowAccessPolicies stream %j', request); - return this.descriptors.page.listRowAccessPolicies.createStream( - this.innerApiCalls.listRowAccessPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRowAccessPolicies`, 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.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy}. 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 include:samples/generated/v2/row_access_policy_service.list_row_access_policies.js - * region_tag:bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async - */ - listRowAccessPoliciesAsync( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRowAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRowAccessPolicies iterate %j', request); - return this.descriptors.page.listRowAccessPolicies.asyncIterate( - this.innerApiCalls['listRowAccessPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.rowAccessPolicyServiceStub && !this._terminated) { - return this.rowAccessPolicyServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client_config.json.baseline deleted file mode 100644 index 6f88ac20f563..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.RowAccessPolicyService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListRowAccessPolicies": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/row_access_policy_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client.ts.baseline deleted file mode 100644 index 3b8d5a6ed0d2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client.ts.baseline +++ /dev/null @@ -1,1102 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as table_service_client_config from './table_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/table_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'table_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Table Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class TableServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - tableServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TableServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TableServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TableServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listTables: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tables') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.TableService', gapicConfig as gax.ClientConfig, - 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.tableServiceStub) { - return this.tableServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.TableService. - this.tableServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.TableService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.TableService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const tableServiceStubMethods = - ['getTable', 'insertTable', 'patchTable', 'updateTable', 'deleteTable', 'listTables']; - for (const methodName of tableServiceStubMethods) { - const callPromise = this.tableServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.tableServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified table resource by table ID. - * This method does not return the data in the table, it only returns the - * table resource, which describes the structure of this table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested table - * @param {string} request.datasetId - * Required. Dataset ID of the requested table - * @param {string} request.tableId - * Required. Table ID of the requested table - * @param {string} request.selectedFields - * List of table schema fields to return (comma-separated). - * If unspecified, all fields are returned. - * A fieldMask cannot be used here because the fields will automatically be - * converted from camelCase to snake_case and the conversion will fail if - * there are underscores. Since these are fields in BigQuery table schemas, - * underscores are allowed. - * @param {google.cloud.bigquery.v2.GetTableRequest.TableMetadataView} [request.view] - * Optional. Specifies the view that determines which table information is - * returned. By default, basic table information and storage statistics - * (STORAGE_STATS) 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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.get_table.js - * region_tag:bigquery_v2_generated_TableService_GetTable_async - */ - getTable( - request?: protos.google.cloud.bigquery.v2.IGetTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, {}|undefined - ]>; - getTable( - request: protos.google.cloud.bigquery.v2.IGetTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request: protos.google.cloud.bigquery.v2.IGetTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request?: protos.google.cloud.bigquery.v2.IGetTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getTable response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, {}|undefined - ]) => { - this._log.info('getTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new, empty table in the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new table - * @param {string} request.datasetId - * Required. Dataset ID of the new table - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource to insert - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.insert_table.js - * region_tag:bigquery_v2_generated_TableService_InsertTable_async - */ - insertTable( - request?: protos.google.cloud.bigquery.v2.IInsertTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, {}|undefined - ]>; - insertTable( - request: protos.google.cloud.bigquery.v2.IInsertTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): void; - insertTable( - request: protos.google.cloud.bigquery.v2.IInsertTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): void; - insertTable( - request?: protos.google.cloud.bigquery.v2.IInsertTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertTable response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.insertTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, {}|undefined - ]) => { - this._log.info('insertTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing table. The update method replaces the - * entire table resource, whereas the patch method only replaces fields that - * are provided in the submitted table resource. - * This method supports RFC5789 patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to update - * @param {string} request.datasetId - * Required. Dataset ID of the table to update - * @param {string} request.tableId - * Required. Table ID of the table to update - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource which will replace or patch the specified table - * @param {boolean} [request.autodetectSchema] - * Optional. When true will autodetect schema, else will keep original schema. - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.patch_table.js - * region_tag:bigquery_v2_generated_TableService_PatchTable_async - */ - patchTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>; - patchTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - patchTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - patchTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchTable response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.patchTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]) => { - this._log.info('patchTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing table. The update method replaces the - * entire Table resource, whereas the patch method only replaces fields that - * are provided in the submitted Table resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to update - * @param {string} request.datasetId - * Required. Dataset ID of the table to update - * @param {string} request.tableId - * Required. Table ID of the table to update - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource which will replace or patch the specified table - * @param {boolean} [request.autodetectSchema] - * Optional. When true will autodetect schema, else will keep original schema. - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.update_table.js - * region_tag:bigquery_v2_generated_TableService_UpdateTable_async - */ - updateTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>; - updateTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - updateTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - updateTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateTable response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]) => { - this._log.info('updateTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the table specified by tableId from the dataset. - * If the table contains data, all the data will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to delete - * @param {string} request.datasetId - * Required. Dataset ID of the table to delete - * @param {string} request.tableId - * Required. Table ID of the table to delete - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.delete_table.js - * region_tag:bigquery_v2_generated_TableService_DeleteTable_async - */ - deleteTable( - request?: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, {}|undefined - ]>; - deleteTable( - request: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request?: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTable request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTable response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all tables in the specified dataset. Requires the READER dataset - * role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatTable|ListFormatTable}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTablesAsync()` - * 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. - */ - listTables( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]>; - listTables( - request: protos.google.cloud.bigquery.v2.IListTablesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): void; - listTables( - request: protos.google.cloud.bigquery.v2.IListTablesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): void; - listTables( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTables values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listTables request %j', request); - return this.innerApiCalls - .listTables(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]) => { - this._log.info('listTables values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTables`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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.cloud.bigquery.v2.ListFormatTable|ListFormatTable} 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 `listTablesAsync()` - * 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. - */ - listTablesStream( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTables stream %j', request); - return this.descriptors.page.listTables.createStream( - this.innerApiCalls.listTables as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTables`, 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.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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.cloud.bigquery.v2.ListFormatTable|ListFormatTable}. 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 include:samples/generated/v2/table_service.list_tables.js - * region_tag:bigquery_v2_generated_TableService_ListTables_async - */ - listTablesAsync( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTables iterate %j', request); - return this.descriptors.page.listTables.asyncIterate( - this.innerApiCalls['listTables'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.tableServiceStub && !this._terminated) { - return this.tableServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client_config.json.baseline deleted file mode 100644 index 3141de7410a6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.TableService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTables": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/src/v2/table_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 788c2d2a9880..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const bigquery = require('bigquery'); - -function main() { - const datasetServiceClient = new bigquery.DatasetServiceClient(); - const jobServiceClient = new bigquery.JobServiceClient(); - const modelServiceClient = new bigquery.ModelServiceClient(); - const projectServiceClient = new bigquery.ProjectServiceClient(); - const routineServiceClient = new bigquery.RoutineServiceClient(); - const rowAccessPolicyServiceClient = new bigquery.RowAccessPolicyServiceClient(); - const tableServiceClient = new bigquery.TableServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 3e5a9a70a773..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as bigquery from 'bigquery'; - -function main() { - const datasetServiceClient = new bigquery.DatasetServiceClient(); - const jobServiceClient = new bigquery.JobServiceClient(); - const modelServiceClient = new bigquery.ModelServiceClient(); - const projectServiceClient = new bigquery.ProjectServiceClient(); - const routineServiceClient = new bigquery.RoutineServiceClient(); - const rowAccessPolicyServiceClient = new bigquery.RowAccessPolicyServiceClient(); - const tableServiceClient = new bigquery.TableServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 029845840670..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient} from 'bigquery'; - -// check that the client class type name can be used -function doStuffWithDatasetServiceClient(client: DatasetServiceClient) { - client.close(); -} -function doStuffWithJobServiceClient(client: JobServiceClient) { - client.close(); -} -function doStuffWithModelServiceClient(client: ModelServiceClient) { - client.close(); -} -function doStuffWithProjectServiceClient(client: ProjectServiceClient) { - client.close(); -} -function doStuffWithRoutineServiceClient(client: RoutineServiceClient) { - client.close(); -} -function doStuffWithRowAccessPolicyServiceClient(client: RowAccessPolicyServiceClient) { - client.close(); -} -function doStuffWithTableServiceClient(client: TableServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const datasetServiceClient = new DatasetServiceClient(); - doStuffWithDatasetServiceClient(datasetServiceClient); - // check that the client instance can be created - const jobServiceClient = new JobServiceClient(); - doStuffWithJobServiceClient(jobServiceClient); - // check that the client instance can be created - const modelServiceClient = new ModelServiceClient(); - doStuffWithModelServiceClient(modelServiceClient); - // check that the client instance can be created - const projectServiceClient = new ProjectServiceClient(); - doStuffWithProjectServiceClient(projectServiceClient); - // check that the client instance can be created - const routineServiceClient = new RoutineServiceClient(); - doStuffWithRoutineServiceClient(routineServiceClient); - // check that the client instance can be created - const rowAccessPolicyServiceClient = new RowAccessPolicyServiceClient(); - doStuffWithRowAccessPolicyServiceClient(rowAccessPolicyServiceClient); - // check that the client instance can be created - const tableServiceClient = new TableServiceClient(); - doStuffWithTableServiceClient(tableServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_dataset_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_dataset_service_v2.ts.baseline deleted file mode 100644 index acb509629be1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_dataset_service_v2.ts.baseline +++ /dev/null @@ -1,1223 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as datasetserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.DatasetServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = datasetserviceModule.v2.DatasetServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = datasetserviceModule.v2.DatasetServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datasetserviceModule.v2.DatasetServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new datasetserviceModule.v2.DatasetServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = datasetserviceModule.v2.DatasetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datasetServiceStub, undefined); - await client.initialize(); - assert(client.datasetServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.datasetServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datasetServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getDataset', () => { - it('invokes getDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); - const [response] = await client.getDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDataset(request), expectedError); - }); - }); - - describe('insertDataset', () => { - it('invokes insertDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.insertDataset = stubSimpleCall(expectedResponse); - const [response] = await client.insertDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.insertDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertDataset(request), expectedError); - }); - }); - - describe('patchDataset', () => { - it('invokes patchDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.patchDataset = stubSimpleCall(expectedResponse); - const [response] = await client.patchDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.patchDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchDataset(request), expectedError); - }); - }); - - describe('updateDataset', () => { - it('invokes updateDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.updateDataset = stubSimpleCall(expectedResponse); - const [response] = await client.updateDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.updateDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDataset(request), expectedError); - }); - }); - - describe('deleteDataset', () => { - it('invokes deleteDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDataset( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDataset(request), expectedError); - }); - }); - - describe('undeleteDataset', () => { - it('invokes undeleteDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.undeleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.undeleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.undeleteDataset(request), expectedError); - }); - }); - - describe('listDatasets', () => { - it('invokes listDatasets without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); - const [response] = await client.listDatasets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatasets( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatasets(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetsStream without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatDataset[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatDataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDatasetsStream with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatDataset[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatDataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatDataset[] = []; - const iterable = client.listDatasetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatasetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_job_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_job_service_v2.ts.baseline deleted file mode 100644 index 73f32ed3eed7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_job_service_v2.ts.baseline +++ /dev/null @@ -1,1211 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as jobserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.JobServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = jobserviceModule.v2.JobServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = jobserviceModule.v2.JobServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new jobserviceModule.v2.JobServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new jobserviceModule.v2.JobServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new jobserviceModule.v2.JobServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new jobserviceModule.v2.JobServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new jobserviceModule.v2.JobServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = jobserviceModule.v2.JobServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new jobserviceModule.v2.JobServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobServiceStub, undefined); - await client.initialize(); - assert(client.jobServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.jobServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('cancelJob', () => { - it('invokes cancelJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.JobCancelResponse() - ); - client.innerApiCalls.cancelJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.JobCancelResponse() - ); - client.innerApiCalls.cancelJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJobCancelResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelJob(request), expectedError); - }); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getJob(request), expectedError); - }); - }); - - describe('insertJob', () => { - it('invokes insertJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.insertJob = stubSimpleCall(expectedResponse); - const [response] = await client.insertJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.insertJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertJob(request), expectedError); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertJob(request), expectedError); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteJob(request), expectedError); - }); - }); - - describe('getQueryResults', () => { - it('invokes getQueryResults without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsResponse() - ); - client.innerApiCalls.getQueryResults = stubSimpleCall(expectedResponse); - const [response] = await client.getQueryResults(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsResponse() - ); - client.innerApiCalls.getQueryResults = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getQueryResults( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IGetQueryResultsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getQueryResults = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getQueryResults(request), expectedError); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getQueryResults(request), expectedError); - }); - }); - - describe('query', () => { - it('invokes query without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.QueryResponse() - ); - client.innerApiCalls.query = stubSimpleCall(expectedResponse); - const [response] = await client.query(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.QueryResponse() - ); - client.innerApiCalls.query = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.query( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IQueryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.query = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.query(request), expectedError); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.query(request), expectedError); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatJob[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatJob[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_model_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_model_service_v2.ts.baseline deleted file mode 100644 index 661cc4afcc9b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_model_service_v2.ts.baseline +++ /dev/null @@ -1,932 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as modelserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ModelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = modelserviceModule.v2.ModelServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = modelserviceModule.v2.ModelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new modelserviceModule.v2.ModelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new modelserviceModule.v2.ModelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2.ModelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2.ModelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new modelserviceModule.v2.ModelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = modelserviceModule.v2.ModelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - await client.initialize(); - assert(client.modelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.modelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getModel', () => { - it('invokes getModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.getModel = stubSimpleCall(expectedResponse); - const [response] = await client.getModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getModel( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getModel(request), expectedError); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getModel(request), expectedError); - }); - }); - - describe('patchModel', () => { - it('invokes patchModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.patchModel = stubSimpleCall(expectedResponse); - const [response] = await client.patchModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.patchModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchModel( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchModel(request), expectedError); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchModel(request), expectedError); - }); - }); - - describe('deleteModel', () => { - it('invokes deleteModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteModel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteModel(request), expectedError); - }); - }); - - describe('listModels', () => { - it('invokes listModels without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); - const [response] = await client.listModels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listModels( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listModels(request), expectedError); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModelsStream without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Model[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listModelsStream with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Model[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IModel[] = []; - const iterable = client.listModelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listModelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IModel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_project_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_project_service_v2.ts.baseline deleted file mode 100644 index 1c8e45afa4b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_project_service_v2.ts.baseline +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as projectserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2.ProjectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = projectserviceModule.v2.ProjectServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = projectserviceModule.v2.ProjectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2.ProjectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2.ProjectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new projectserviceModule.v2.ProjectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = projectserviceModule.v2.ProjectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - await client.initialize(); - assert(client.projectServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.projectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getServiceAccount', () => { - it('invokes getServiceAccount without error', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountResponse() - ); - client.innerApiCalls.getServiceAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getServiceAccount(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount without error using callback', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountResponse() - ); - client.innerApiCalls.getServiceAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServiceAccount( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IGetServiceAccountResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount with error', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServiceAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServiceAccount(request), expectedError); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount with closed client', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServiceAccount(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_routine_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_routine_service_v2.ts.baseline deleted file mode 100644 index d27f1fedb882..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_routine_service_v2.ts.baseline +++ /dev/null @@ -1,1127 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as routineserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.RoutineServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = routineserviceModule.v2.RoutineServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = routineserviceModule.v2.RoutineServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new routineserviceModule.v2.RoutineServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new routineserviceModule.v2.RoutineServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new routineserviceModule.v2.RoutineServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = routineserviceModule.v2.RoutineServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routineServiceStub, undefined); - await client.initialize(); - assert(client.routineServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.routineServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routineServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getRoutine', () => { - it('invokes getRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.getRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.getRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.getRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoutine(request), expectedError); - }); - }); - - describe('insertRoutine', () => { - it('invokes insertRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.insertRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.insertRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.insertRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertRoutine(request), expectedError); - }); - }); - - describe('updateRoutine', () => { - it('invokes updateRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.updateRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.updateRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoutine(request), expectedError); - }); - }); - - describe('patchRoutine', () => { - it('invokes patchRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.patchRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.patchRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.patchRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.patchRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchRoutine(request), expectedError); - }); - - it('invokes patchRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchRoutine(request), expectedError); - }); - }); - - describe('deleteRoutine', () => { - it('invokes deleteRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoutine( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoutine(request), expectedError); - }); - }); - - describe('listRoutines', () => { - it('invokes listRoutines without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.innerApiCalls.listRoutines = stubSimpleCall(expectedResponse); - const [response] = await client.listRoutines(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutines without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.innerApiCalls.listRoutines = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRoutines( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutines with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRoutines = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRoutines(request), expectedError); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutinesStream without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.descriptors.page.listRoutines.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoutinesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Routine[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Routine) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutines, request)); - assert( - (client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRoutinesStream with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutines.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoutinesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Routine[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Routine) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutines, request)); - assert( - (client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutines without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.descriptors.page.listRoutines.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IRoutine[] = []; - const iterable = client.listRoutinesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutines with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutines.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoutinesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IRoutine[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_row_access_policy_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_row_access_policy_service_v2.ts.baseline deleted file mode 100644 index 3691314bc19e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_row_access_policy_service_v2.ts.baseline +++ /dev/null @@ -1,557 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as rowaccesspolicyserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.RowAccessPolicyServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.rowAccessPolicyServiceStub, undefined); - await client.initialize(); - assert(client.rowAccessPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.rowAccessPolicyServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.rowAccessPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listRowAccessPolicies', () => { - it('invokes listRowAccessPolicies without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.innerApiCalls.listRowAccessPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listRowAccessPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPolicies without error using callback', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.innerApiCalls.listRowAccessPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRowAccessPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRowAccessPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPolicies with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRowAccessPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRowAccessPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPoliciesStream without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.descriptors.page.listRowAccessPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRowAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.RowAccessPolicy[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.RowAccessPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRowAccessPolicies, request)); - assert( - (client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRowAccessPoliciesStream with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRowAccessPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRowAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.RowAccessPolicy[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.RowAccessPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRowAccessPolicies, request)); - assert( - (client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRowAccessPolicies without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.descriptors.page.listRowAccessPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IRowAccessPolicy[] = []; - const iterable = client.listRowAccessPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRowAccessPolicies with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRowAccessPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRowAccessPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IRowAccessPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_table_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_table_service_v2.ts.baseline deleted file mode 100644 index ee2194fd6ce1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/esm/test/gapic_table_service_v2.ts.baseline +++ /dev/null @@ -1,1184 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as tableserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.TableServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = tableserviceModule.v2.TableServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = tableserviceModule.v2.TableServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new tableserviceModule.v2.TableServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new tableserviceModule.v2.TableServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new tableserviceModule.v2.TableServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new tableserviceModule.v2.TableServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new tableserviceModule.v2.TableServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = tableserviceModule.v2.TableServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new tableserviceModule.v2.TableServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tableServiceStub, undefined); - await client.initialize(); - assert(client.tableServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.tableServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tableServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getTable', () => { - it('invokes getTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); - const [response] = await client.getTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.getTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTable(request), expectedError); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTable(request), expectedError); - }); - }); - - describe('insertTable', () => { - it('invokes insertTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.insertTable = stubSimpleCall(expectedResponse); - const [response] = await client.insertTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.insertTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertTable(request), expectedError); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertTable(request), expectedError); - }); - }); - - describe('patchTable', () => { - it('invokes patchTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.patchTable = stubSimpleCall(expectedResponse); - const [response] = await client.patchTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.patchTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchTable(request), expectedError); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchTable(request), expectedError); - }); - }); - - describe('updateTable', () => { - it('invokes updateTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.updateTable = stubSimpleCall(expectedResponse); - const [response] = await client.updateTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.updateTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTable(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateTable(request), expectedError); - }); - }); - - describe('deleteTable', () => { - it('invokes deleteTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTable( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTable(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTable(request), expectedError); - }); - }); - - describe('listTables', () => { - it('invokes listTables without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); - const [response] = await client.listTables(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTables without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.innerApiCalls.listTables = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTables( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatTable[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTables with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTables = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTables(request), expectedError); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTablesStream without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.descriptors.page.listTables.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatTable[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatTable) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTablesStream with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatTable[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatTable) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTables without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatTable[] = []; - const iterable = client.listTablesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTables with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTablesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatTable[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json deleted file mode 100644 index 39b7ea64a005..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "bigquery", - "version": "0.1.0", - "description": "Bigquery client for Node.js", - "repository": "googleapis/nodejs-bigquery", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google bigquery", - "bigquery", - "dataset service", - "job service", - "model service", - "project service", - "routine service", - "row access policy service", - "table service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline deleted file mode 100644 index fd076037b3d6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "BigLakeConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configuration for BigLake managed tables. -message BigLakeConfiguration { - // Supported file formats for BigLake tables. - enum FileFormat { - // Default Value. - FILE_FORMAT_UNSPECIFIED = 0; - - // Apache Parquet format. - PARQUET = 1; - } - - // Supported table formats for BigLake tables. - enum TableFormat { - // Default Value. - TABLE_FORMAT_UNSPECIFIED = 0; - - // Apache Iceberg format. - ICEBERG = 1; - } - - // Required. The connection specifying the credentials to be used to read and - // write to external storage, such as Cloud Storage. The connection_id can - // have the form `{project}.{location}.{connection_id}` or - // `projects/{project}/locations/{location}/connections/{connection_id}". - string connection_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The fully qualified location prefix of the external folder where - // table data is stored. The '*' wildcard character is not allowed. The URI - // should be in the format `gs://bucket/path_to_table/` - string storage_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The file format the table data is stored in. - FileFormat file_format = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The table format the metadata only snapshots are stored in. - TableFormat table_format = 4 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/clustering.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/clustering.proto.baseline deleted file mode 100644 index b871f41ecc02..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/clustering.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ClusteringProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configures table clustering. -message Clustering { - // One or more fields on which data should be clustered. Only top-level, - // non-repeated, simple-type fields are supported. The ordering of the - // clustering fields should be prioritized from most to least important - // for filtering purposes. - // - // Additional information on limitations can be found here: - // https://cloud.google.com/bigquery/docs/creating-clustered-tables#limitations - repeated string fields = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline deleted file mode 100644 index e2c6fb67d897..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DataFormatOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for data format adjustments. -message DataFormatOptions { - // Optional. Output timestamp as usec int64. Default is false. - bool use_int64_timestamp = 1 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset.proto.baseline deleted file mode 100644 index 62968e292edf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset.proto.baseline +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/external_catalog_dataset_options.proto"; -import "google/cloud/bigquery/v2/external_dataset_reference.proto"; -import "google/cloud/bigquery/v2/restriction_config.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DatasetProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Dataset Service. -// -// It should not be relied on for production use cases at this time. -service DatasetService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Returns the dataset specified by datasetID. - rpc GetDataset(GetDatasetRequest) returns (Dataset) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - }; - } - - // Creates a new empty dataset. - rpc InsertDataset(InsertDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets" - body: "dataset" - }; - } - - // Updates information in an existing dataset. The update method replaces the - // entire dataset resource, whereas the patch method only replaces fields that - // are provided in the submitted dataset resource. - // This method supports RFC5789 patch semantics. - rpc PatchDataset(UpdateOrPatchDatasetRequest) returns (Dataset) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - body: "dataset" - }; - } - - // Updates information in an existing dataset. The update method replaces the - // entire dataset resource, whereas the patch method only replaces fields that - // are provided in the submitted dataset resource. - rpc UpdateDataset(UpdateOrPatchDatasetRequest) returns (Dataset) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - body: "dataset" - }; - } - - // Deletes the dataset specified by the datasetId value. Before you can delete - // a dataset, you must delete all its tables, either manually or by specifying - // deleteContents. Immediately after deletion, you can create another dataset - // with the same name. - rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - }; - } - - // Lists all datasets in the specified project to which the user has been - // granted the READER dataset role. - rpc ListDatasets(ListDatasetsRequest) returns (DatasetList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets" - }; - } - - // Undeletes a dataset which is within time travel window based on datasetId. - // If a time is specified, the dataset version deleted at that time is - // undeleted, else the last live version is undeleted. - rpc UndeleteDataset(UndeleteDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}:undelete" - body: "*" - }; - } -} - -// Grants all resources of particular types in a particular dataset read access -// to the current dataset. -// -// Similar to how individually authorized views work, updates to any resource -// granted through its dataset (including creation of new resources) requires -// read permission to referenced resources, plus write permission to the -// authorizing dataset. -message DatasetAccessEntry { - // Indicates the type of resources in a dataset that the entry applies to. - enum TargetType { - // Do not use. You must set a target type explicitly. - TARGET_TYPE_UNSPECIFIED = 0; - - // This entry applies to views in the dataset. - VIEWS = 1; - - // This entry applies to routines in the dataset. - ROUTINES = 2; - } - - // The dataset this entry applies to - DatasetReference dataset = 1; - - // Which resources in the dataset this entry applies to. Currently, only - // views are supported, but additional target types may be added in the - // future. - repeated TargetType target_types = 2; -} - -// An object that defines dataset access for an entity. -message Access { - // An IAM role ID that should be granted to the user, group, - // or domain specified in this access entry. - // The following legacy mappings will be applied: - // - // * `OWNER`: `roles/bigquery.dataOwner` - // * `WRITER`: `roles/bigquery.dataEditor` - // * `READER`: `roles/bigquery.dataViewer` - // - // This field will accept any of the above formats, but will return only - // the legacy format. For example, if you set this field to - // "roles/bigquery.dataOwner", it will be returned back as "OWNER". - string role = 1; - - // [Pick one] An email address of a user to grant access to. For example: - // fred@example.com. Maps to IAM policy member "user:EMAIL" or - // "serviceAccount:EMAIL". - string user_by_email = 2; - - // [Pick one] An email address of a Google Group to grant access to. - // Maps to IAM policy member "group:GROUP". - string group_by_email = 3; - - // [Pick one] A domain to grant access to. Any users signed in with the domain - // specified will be granted the specified access. Example: "example.com". - // Maps to IAM policy member "domain:DOMAIN". - string domain = 4; - - // [Pick one] A special group to grant access to. Possible values include: - // - // * projectOwners: Owners of the enclosing project. - // * projectReaders: Readers of the enclosing project. - // * projectWriters: Writers of the enclosing project. - // * allAuthenticatedUsers: All authenticated BigQuery users. - // - // Maps to similarly-named IAM members. - string special_group = 5; - - // [Pick one] Some other type of member that appears in the IAM Policy but - // isn't a user, group, domain, or special group. - string iam_member = 7; - - // [Pick one] A view from a different dataset to grant access to. Queries - // executed against that view will have read access to views/tables/routines - // in this dataset. - // The role field is not required when this field is set. If that view is - // updated by any user, access to the view needs to be granted again via an - // update operation. - TableReference view = 6; - - // [Pick one] A routine from a different dataset to grant access to. Queries - // executed against that routine will have read access to - // views/tables/routines in this dataset. Only UDF is supported for now. - // The role field is not required when this field is set. If that routine is - // updated by any user, access to the routine needs to be granted again via - // an update operation. - RoutineReference routine = 8; - - // [Pick one] A grant authorizing all resources of a particular type in a - // particular dataset access to this dataset. Only views are supported for - // now. The role field is not required when this field is set. If that dataset - // is deleted and re-created, its access needs to be granted again via an - // update operation. - DatasetAccessEntry dataset = 9; -} - -// Represents a BigQuery dataset. -message Dataset { - // Indicates the billing model that will be applied to the dataset. - enum StorageBillingModel { - // Value not set. - STORAGE_BILLING_MODEL_UNSPECIFIED = 0; - - // Billing for logical bytes. - LOGICAL = 1; - - // Billing for physical bytes. - PHYSICAL = 2; - } - - // Output only. The resource type. - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash of the resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The fully-qualified unique name of the dataset in the format - // projectId:datasetId. The dataset name without the project name is given in - // the datasetId field. When creating a new dataset, leave this field blank, - // and instead specify the datasetId field. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access the resource again. You can - // use this URL in Get or Update requests to the resource. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. A reference that identifies the dataset. - DatasetReference dataset_reference = 5 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A descriptive name for the dataset. - google.protobuf.StringValue friendly_name = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A user-friendly description of the dataset. - google.protobuf.StringValue description = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The default lifetime of all tables in the dataset, in - // milliseconds. The minimum lifetime value is 3600000 milliseconds (one - // hour). To clear an existing default expiration with a PATCH request, set to - // 0. Once this property is set, all newly-created tables in the dataset will - // have an expirationTime property set to the creation time plus the value in - // this property, and changing the value will only affect new tables, not - // existing ones. When the expirationTime for a given table is reached, that - // table will be deleted automatically. - // If a table's expirationTime is modified or removed before the table - // expires, or if you provide an explicit expirationTime when creating a - // table, that value takes precedence over the default expiration time - // indicated by this property. - google.protobuf.Int64Value default_table_expiration_ms = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // This default partition expiration, expressed in milliseconds. - // - // When new time-partitioned tables are created in a dataset where this - // property is set, the table will inherit this value, propagated as the - // `TimePartitioning.expirationMs` property on the new table. If you set - // `TimePartitioning.expirationMs` explicitly when creating a table, - // the `defaultPartitionExpirationMs` of the containing dataset is ignored. - // - // When creating a partitioned table, if `defaultPartitionExpirationMs` - // is set, the `defaultTableExpirationMs` value is ignored and the table - // will not be inherit a table expiration deadline. - google.protobuf.Int64Value default_partition_expiration_ms = 14; - - // The labels associated with this dataset. You can use these - // to organize and group your datasets. - // You can set this property when inserting or updating a dataset. - // See [Creating and Updating Dataset - // Labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#creating_and_updating_dataset_labels) - // for more information. - map labels = 9; - - // Optional. An array of objects that define dataset access for one or more - // entities. You can set this property when inserting or updating a dataset in - // order to control who is allowed to access the data. If unspecified at - // dataset creation time, BigQuery adds default dataset access for the - // following entities: access.specialGroup: projectReaders; access.role: - // READER; access.specialGroup: projectWriters; access.role: WRITER; - // access.specialGroup: projectOwners; access.role: OWNER; - // access.userByEmail: [dataset creator email]; access.role: OWNER; - // If you patch a dataset, then this field is overwritten by the patched - // dataset's access field. To add entities, you must supply the entire - // existing access array in addition to any new entities that you want to add. - repeated Access access = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time when this dataset was created, in milliseconds since - // the epoch. - int64 creation_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The date when this dataset was last modified, in milliseconds - // since the epoch. - int64 last_modified_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The geographic location where the dataset should reside. See - // https://cloud.google.com/bigquery/docs/locations for supported - // locations. - string location = 13; - - // The default encryption key for all tables in the dataset. - // After this property is set, the encryption key of all newly-created tables - // in the dataset is set to this value unless the table creation request or - // query explicitly overrides the key. - EncryptionConfiguration default_encryption_configuration = 16; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Same as `type` in `ListFormatDataset`. - // The type of the dataset, one of: - // - // * DEFAULT - only accessible by owner and authorized accounts, - // * PUBLIC - accessible by everyone, - // * LINKED - linked dataset, - // * EXTERNAL - dataset with definition in external metadata catalog. - string type = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The source dataset reference when the dataset is of type LINKED. - // For all other dataset types it is not set. This field cannot be updated - // once it is set. Any attempt to update this field using Update and Patch API - // Operations will be ignored. - LinkedDatasetSource linked_dataset_source = 19 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Metadata about the LinkedDataset. Filled out when the dataset - // type is LINKED. - LinkedDatasetMetadata linked_dataset_metadata = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Reference to a read-only external dataset defined in data - // catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL. - ExternalDatasetReference external_dataset_reference = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options defining open source compatible datasets living in the - // BigQuery catalog. Contains metadata of open source database, schema or - // namespace represented by the current dataset. - ExternalCatalogDatasetOptions external_catalog_dataset_options = 32 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. TRUE if the dataset and its table names are case-insensitive, - // otherwise FALSE. By default, this is FALSE, which means the dataset and its - // table names are case-sensitive. This field does not affect routine - // references. - google.protobuf.BoolValue is_case_insensitive = 21 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default collation specification of future tables - // created in the dataset. If a table is created in this dataset without - // table-level default collation, then the table inherits the dataset default - // collation, which is applied to the string fields that do not have explicit - // collation specified. A change to this field affects only tables created - // afterwards, and does not alter the existing tables. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue default_collation = 22 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default rounding mode specification of new tables - // created within this dataset. During table creation, if this field is - // specified, the table within this dataset will inherit the default rounding - // mode of the dataset. Setting the default rounding mode on a table overrides - // this option. Existing tables in the dataset are unaffected. - // If columns are defined during that table creation, - // they will immediately inherit the table's default rounding mode, - // unless otherwise specified. - TableFieldSchema.RoundingMode default_rounding_mode = 26 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the time travel window in hours. The value can be from 48 - // to 168 hours (2 to 7 days). The default value is 168 hours if this is not - // set. - google.protobuf.Int64Value max_time_travel_hours = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Tags for the dataset. To provide tags as inputs, use the - // `resourceTags` field. - repeated GcpTag tags = 24 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Updates storage_billing_model for the dataset. - StorageBillingModel storage_billing_model = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Restriction config for all tables and dataset. If - // set, restrict certain accesses on the dataset and all its tables based on - // the config. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RestrictionConfig restrictions = 27 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached - // to this dataset. Tag keys are globally unique. Tag key is expected to be in - // the namespaced format, for example "123456789012/environment" where - // 123456789012 is the ID of the parent organization or project resource for - // this tag key. Tag value is expected to be the short name, for example - // "Production". See [Tag - // definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - // for more details. - map resource_tags = 30 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A global tag managed by Resource Manager. -// https://cloud.google.com/iam/docs/tags-access-control#definitions -message GcpTag { - // Required. The namespaced friendly name of the tag key, e.g. - // "12345/environment" where 12345 is org id. - string tag_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The friendly short name of the tag value, e.g. "production". - string tag_value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A dataset source type which refers to another BigQuery dataset. -message LinkedDatasetSource { - // The source dataset reference contains project numbers and not project ids. - DatasetReference source_dataset = 1; -} - -// Metadata about the Linked Dataset. -message LinkedDatasetMetadata { - // Specifies whether Linked Dataset is currently in a linked state or not. - enum LinkState { - // The default value. - // Default to the LINKED state. - LINK_STATE_UNSPECIFIED = 0; - - // Normal Linked Dataset state. Data is queryable via the Linked Dataset. - LINKED = 1; - - // Data publisher or owner has unlinked this Linked Dataset. It means you - // can no longer query or see the data in the Linked Dataset. - UNLINKED = 2; - } - - // Output only. Specifies whether Linked Dataset is currently in a linked - // state or not. - LinkState link_state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for getting information about a dataset. -message GetDatasetRequest { - // DatasetView specifies which dataset information is returned. - enum DatasetView { - // The default value. - // Default to the FULL view. - DATASET_VIEW_UNSPECIFIED = 0; - - // Includes metadata information for the dataset, such as location, - // etag, lastModifiedTime, etc. - METADATA = 1; - - // Includes ACL information for the dataset, which defines dataset access - // for one or more entities. - ACL = 2; - - // Includes both dataset metadata and ACL information. - FULL = 3; - } - - // Required. Project ID of the requested dataset - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested dataset - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies the view that determines which dataset information is - // returned. By default, metadata and ACL information are returned. - DatasetView dataset_view = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for inserting a dataset. -message InsertDatasetRequest { - // Required. Project ID of the new dataset - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Datasets resource to use for the new dataset - Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for updating or patching a dataset. -message UpdateOrPatchDatasetRequest { - // Required. Project ID of the dataset being updated - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the dataset being updated - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Datasets resource which will replace or patch the specified - // dataset. - Dataset dataset = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for deleting a dataset. -message DeleteDatasetRequest { - // Required. Project ID of the dataset being deleted - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of dataset being deleted - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // If True, delete all the tables in the dataset. - // If False and the dataset contains tables, the request will fail. - // Default is False - bool delete_contents = 3; -} - -message ListDatasetsRequest { - // Required. Project ID of the datasets to be listed - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 2; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 3; - - // Whether to list all datasets, including hidden ones - bool all = 4; - - // An expression for filtering the results of the request by label. - // The syntax is `labels.[:]`. - // Multiple filters can be ANDed together by connecting with a space. - // Example: `labels.department:receiving labels.active`. - // See [Filtering datasets using - // labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - // for details. - string filter = 5; -} - -// A dataset resource with only a subset of fields, to be returned in a list of -// datasets. -message ListFormatDataset { - // The resource type. - // This property always returns the value "bigquery#dataset" - string kind = 1; - - // The fully-qualified, unique, opaque ID of the dataset. - string id = 2; - - // The dataset reference. - // Use this property to access specific parts of the dataset's ID, such as - // project ID or dataset ID. - DatasetReference dataset_reference = 3; - - // The labels associated with this dataset. - // You can use these to organize and group your datasets. - map labels = 4; - - // An alternate name for the dataset. The friendly name is purely - // decorative in nature. - google.protobuf.StringValue friendly_name = 5; - - // The geographic location where the dataset resides. - string location = 6; -} - -// Response format for a page of results when listing datasets. -message DatasetList { - // Output only. The resource type. - // This property always returns the value "bigquery#datasetList" - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash value of the results page. You can use this property to - // determine if the page has changed since the last request. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A token that can be used to request the next results page. This property is - // omitted on the final results page. - string next_page_token = 3; - - // An array of the dataset resources in the project. - // Each resource contains basic information. - // For full information about a particular dataset resource, use the Datasets: - // get method. This property is omitted when there are no datasets in the - // project. - repeated ListFormatDataset datasets = 4; - - // A list of skipped locations that were unreachable. For more information - // about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5" - repeated string unreachable = 5; -} - -// Request format for undeleting a dataset. -message UndeleteDatasetRequest { - // Required. Project ID of the dataset to be undeleted - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of dataset being deleted - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The exact time when the dataset was deleted. If not specified, - // the most recently deleted version is undeleted. Undeleting a dataset - // using deletion time is not supported. - google.protobuf.Timestamp deletion_time = 3 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline deleted file mode 100644 index 03695a4c4bdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DatasetReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Identifier for a dataset. -message DatasetReference { - // Required. A unique ID for this dataset, without the project name. The ID - // must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). - // The maximum length is 1,024 characters. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The ID of the project containing this dataset. - string project_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline deleted file mode 100644 index 72266b110314..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "DecimalTargetTypesProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The data types that could be used as a target type when converting decimal -// values. -enum DecimalTargetType { - // Invalid type. - DECIMAL_TARGET_TYPE_UNSPECIFIED = 0; - - // Decimal values could be converted to NUMERIC - // type. - NUMERIC = 1; - - // Decimal values could be converted to BIGNUMERIC - // type. - BIGNUMERIC = 2; - - // Decimal values could be converted to STRING type. - STRING = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline deleted file mode 100644 index ac7ee167995d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "EncryptionConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configuration for Cloud KMS encryption settings. -message EncryptionConfiguration { - // Optional. Describes the Cloud KMS encryption key that will be used to - // protect destination BigQuery table. The BigQuery Service Account associated - // with your project requires access to this encryption key. - google.protobuf.StringValue kms_key_name = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/error.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/error.proto.baseline deleted file mode 100644 index 9cab21c4f2cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/error.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Error details. -message ErrorProto { - // A short error code that summarizes the error. - string reason = 1; - - // Specifies where the error occurred, if present. - string location = 2; - - // Debugging information. This property is internal to Google and should not - // be used. - string debug_info = 3; - - // A human-readable description of the error. - string message = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline deleted file mode 100644 index 70d0f1f40e27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalCatalogDatasetOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options defining open source compatible datasets living in the BigQuery -// catalog. Contains metadata of open source database, schema -// or namespace represented by the current dataset. -message ExternalCatalogDatasetOptions { - // Optional. A map of key value pairs defining the parameters and properties - // of the open source schema. Maximum size of 2Mib. - map parameters = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The storage location URI for all tables in the dataset. - // Equivalent to hive metastore's database locationUri. Maximum length of 1024 - // characters. - string default_storage_location_uri = 2 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline deleted file mode 100644 index b0833d441f47..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalCatalogTableOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Metadata about open source compatible table. The fields contained in -// these options correspond to hive metastore's table level properties. -message ExternalCatalogTableOptions { - // Optional. A map of key value pairs defining the parameters and properties - // of the open source table. Corresponds with hive meta store table - // parameters. Maximum size of 4Mib. - map parameters = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A storage descriptor containing information about the physical - // storage of this table. - StorageDescriptor storage_descriptor = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The connection specifying the credentials to be used to read - // external storage, such as Azure Blob, Cloud Storage, or S3. The connection - // is needed to read the open source table from BigQuery Engine. The - // connection_id can have the form - // `..` or - // `projects//locations//connections/`. - string connection_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Contains information about how a table's data is stored and accessed by open -// source query engines. -message StorageDescriptor { - // Optional. The physical location of the table - // (e.g. `gs://spark-dataproc-data/pangea-data/case_sensitive/` or - // `gs://spark-dataproc-data/pangea-data/*`). - // The maximum length is 2056 bytes. - string location_uri = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the fully qualified class name of the InputFormat - // (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat"). - // The maximum length is 128 characters. - string input_format = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the fully qualified class name of the OutputFormat - // (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat"). - // The maximum length is 128 characters. - string output_format = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Serializer and deserializer information. - SerDeInfo serde_info = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Serializer and deserializer information. -message SerDeInfo { - // Optional. Name of the SerDe. - // The maximum length is 256 characters. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Specifies a fully-qualified class name of the serialization - // library that is responsible for the translation of data between table - // representation and the underlying low-level input and output format - // structures. The maximum length is 256 characters. - string serialization_library = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Key-value pairs that define the initialization parameters for the - // serialization library. - // Maximum size 10 Kib. - map parameters = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline deleted file mode 100644 index 610af982a5e2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline +++ /dev/null @@ -1,499 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/decimal_target_types.proto"; -import "google/cloud/bigquery/v2/file_set_specification_type.proto"; -import "google/cloud/bigquery/v2/hive_partitioning.proto"; -import "google/cloud/bigquery/v2/json_extension.proto"; -import "google/cloud/bigquery/v2/map_target_type.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ExternalDataConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for external data sources. -message AvroOptions { - // Optional. If sourceFormat is set to "AVRO", indicates whether to interpret - // logical types as the corresponding BigQuery data type (for example, - // TIMESTAMP), instead of using the raw type (for example, INTEGER). - google.protobuf.BoolValue use_avro_logical_types = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Parquet Options for load and make external tables. -message ParquetOptions { - // Optional. Indicates whether to infer Parquet ENUM logical type as STRING - // instead of BYTES by default. - google.protobuf.BoolValue enum_as_string = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether to use schema inference specifically for - // Parquet LIST logical type. - google.protobuf.BoolValue enable_list_inference = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates how to represent a Parquet map if present. - MapTargetType map_target_type = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a CSV data source. -message CsvOptions { - // Optional. The separator character for fields in a CSV file. The separator - // is interpreted as a single byte. For files encoded in ISO-8859-1, any - // single character can be used as a separator. For files encoded in UTF-8, - // characters represented in decimal range 1-127 (U+0001-U+007F) can be used - // without any modification. UTF-8 characters encoded with multiple bytes - // (i.e. U+0080 and above) will have only the first byte used for separating - // fields. The remaining bytes will be treated as a part of the field. - // BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab - // separator. The default value is comma (",", U+002C). - string field_delimiter = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of rows at the top of a CSV file that BigQuery will - // skip when reading the data. The default value is 0. This property is - // useful if you have header rows in the file that should be skipped. - // When autodetect is on, the behavior is the following: - // - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int64Value skip_leading_rows = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The value that is used to quote data sections in a CSV file. - // BigQuery converts the string to ISO-8859-1 encoding, and then uses the - // first byte of the encoded string to split the data in its raw, binary - // state. - // The default value is a double-quote ("). - // If your data does not contain quoted sections, - // set the property value to an empty string. - // If your data contains quoted newline characters, you must also set the - // allowQuotedNewlines property to true. - // To include the specific quote character within a quoted value, precede it - // with an additional matching quote character. For example, if you want to - // escape the default character ' " ', use ' "" '. - google.protobuf.StringValue quote = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should allow quoted data sections that - // contain newline characters in a CSV file. The default value is false. - google.protobuf.BoolValue allow_quoted_newlines = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should accept rows that are missing - // trailing optional columns. If true, BigQuery treats missing trailing - // columns as null values. - // If false, records with missing trailing columns are treated as bad records, - // and if there are too many bad records, an invalid error is returned in the - // job result. The default value is false. - google.protobuf.BoolValue allow_jagged_rows = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The character encoding of the data. - // The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. - // BigQuery decodes the data after the raw, binary data has been split using - // the values of the quote and fieldDelimiter properties. - string encoding = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if the embedded ASCII control characters (the first 32 - // characters in the ASCII-table, from '\x00' to '\x1F') are preserved. - google.protobuf.BoolValue preserve_ascii_control_characters = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a string that represents a null value in a CSV file. - // For example, if you specify "\N", BigQuery interprets "\N" as a null value - // when querying a CSV file. - // The default value is the empty string. If you set this property to a custom - // value, BigQuery throws an error if an empty string is present for all data - // types except for STRING and BYTE. For STRING and BYTE columns, BigQuery - // interprets the empty string as an empty value. - google.protobuf.StringValue null_marker = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Json Options for load and make external tables. -message JsonOptions { - // Optional. The character encoding of the data. - // The supported values are UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. - string encoding = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a Bigtable column. -message BigtableColumn { - // [Required] Qualifier of the column. - // Columns in the parent column family that has this exact qualifier are - // exposed as `.` field. - // If the qualifier is valid UTF-8 string, it can be specified in the - // qualifier_string field. Otherwise, a base-64 encoded value must be set to - // qualifier_encoded. - // The column field name is the same as the column qualifier. However, if the - // qualifier is not a valid BigQuery field identifier i.e. does not match - // [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name. - google.protobuf.BytesValue qualifier_encoded = 1; - - // Qualifier string. - google.protobuf.StringValue qualifier_string = 2; - - // Optional. If the qualifier is not a valid BigQuery field identifier i.e. - // does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided - // as the column field name and is used as field name in queries. - string field_name = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type to convert the value in cells of this column. - // The values are expected to be encoded using HBase Bytes.toBytes function - // when using the BINARY encoding value. - // Following BigQuery types are allowed (case-sensitive): - // - // * BYTES - // * STRING - // * INTEGER - // * FLOAT - // * BOOLEAN - // * JSON - // - // Default type is BYTES. - // 'type' can also be set at the column family level. However, the setting at - // this level takes precedence if 'type' is set at both levels. - string type = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The encoding of the values when the type is not STRING. - // Acceptable encoding values are: - // TEXT - indicates values are alphanumeric text strings. - // BINARY - indicates values are encoded using HBase Bytes.toBytes family of - // functions. - // 'encoding' can also be set at the column family level. However, the setting - // at this level takes precedence if 'encoding' is set at both levels. - string encoding = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is set, only the latest version of value in this column - // are exposed. - // 'onlyReadLatest' can also be set at the column family level. However, the - // setting at this level takes precedence if 'onlyReadLatest' is set at both - // levels. - google.protobuf.BoolValue only_read_latest = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a Bigtable column family. -message BigtableColumnFamily { - // Identifier of the column family. - string family_id = 1; - - // Optional. The type to convert the value in cells of this column family. - // The values are expected to be encoded using HBase Bytes.toBytes function - // when using the BINARY encoding value. - // Following BigQuery types are allowed (case-sensitive): - // - // * BYTES - // * STRING - // * INTEGER - // * FLOAT - // * BOOLEAN - // * JSON - // - // Default type is BYTES. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying a type for it. - string type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The encoding of the values when the type is not STRING. - // Acceptable encoding values are: - // TEXT - indicates values are alphanumeric text strings. - // BINARY - indicates values are encoded using HBase Bytes.toBytes family of - // functions. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying an encoding for it. - string encoding = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lists of columns that should be exposed as individual fields as - // opposed to a list of (column name, value) pairs. - // All columns whose qualifier matches a qualifier in this list can be - // accessed as `.`. - // Other columns can be accessed as a list through - // the `.Column` field. - repeated BigtableColumn columns = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is set only the latest version of value are exposed for - // all columns in this column family. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying a different setting - // for that column. - google.protobuf.BoolValue only_read_latest = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options specific to Google Cloud Bigtable data sources. -message BigtableOptions { - // Optional. List of column families to expose in the table schema along with - // their types. - // This list restricts the column families that can be referenced in queries - // and specifies their value types. - // You can use this list to do type conversions - see the 'type' field for - // more details. - // If you leave this list empty, all column families are present in the table - // schema and their values are read as BYTES. - // During a query only the column families referenced in that query are read - // from Bigtable. - repeated BigtableColumnFamily column_families = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then the column families that are not - // specified in columnFamilies list are not exposed in the table schema. - // Otherwise, they are read with BYTES type values. - // The default value is false. - google.protobuf.BoolValue ignore_unspecified_column_families = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then the rowkey column families will be read - // and converted to string. Otherwise they are read with BYTES type values and - // users need to manually cast them with CAST if necessary. - // The default value is false. - google.protobuf.BoolValue read_rowkey_as_string = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then each column family will be read as a - // single JSON column. Otherwise they are read as a repeated cell structure - // containing timestamp/value tuples. The default value is false. - google.protobuf.BoolValue output_column_families_as_json = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options specific to Google Sheets data sources. -message GoogleSheetsOptions { - // Optional. The number of rows at the top of a sheet that BigQuery will skip - // when reading the data. The default value is 0. This property is useful if - // you have header rows that should be skipped. When autodetect is on, - // the behavior is the following: - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int64Value skip_leading_rows = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Range of a sheet to query from. Only used when non-empty. - // Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id - // For example: sheet1!A1:B20 - string range = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ExternalDataConfiguration { - // Supported Object Metadata Types. - enum ObjectMetadata { - // Unspecified by default. - OBJECT_METADATA_UNSPECIFIED = 0; - - // A synonym for `SIMPLE`. - DIRECTORY = 1; - - // Directory listing of objects. - SIMPLE = 2; - } - - // MetadataCacheMode identifies if the table should use metadata caching for - // files from external source (eg Google Cloud Storage). - enum MetadataCacheMode { - // Unspecified metadata cache mode. - METADATA_CACHE_MODE_UNSPECIFIED = 0; - - // Set this mode to trigger automatic background refresh of metadata cache - // from the external source. Queries will use the latest available cache - // version within the table's maxStaleness interval. - AUTOMATIC = 1; - - // Set this mode to enable triggering manual refresh of the metadata cache - // from external source. Queries will use the latest manually triggered - // cache version within the table's maxStaleness interval. - MANUAL = 2; - } - - // [Required] The fully-qualified URIs that point to your data in Google - // Cloud. For Google Cloud Storage URIs: - // Each URI can contain one '*' wildcard character and it must come after - // the 'bucket' name. - // Size limits related to load jobs apply to external data sources. - // For Google Cloud Bigtable URIs: - // Exactly one URI can be specified and it has be a fully specified and - // valid HTTPS URL for a Google Cloud Bigtable table. - // For Google Cloud Datastore backups, exactly one URI can be specified. Also, - // the '*' wildcard character is not allowed. - repeated string source_uris = 1; - - // Optional. Specifies how source URIs are interpreted for constructing the - // file set to load. By default source URIs are expanded against the - // underlying storage. Other options include specifying manifest files. Only - // applicable to object storage systems. - FileSetSpecType file_set_spec_type = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The schema for the data. - // Schema is required for CSV and JSON formats if autodetect is not on. - // Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, - // Avro, ORC and Parquet formats. - TableSchema schema = 2 [(google.api.field_behavior) = OPTIONAL]; - - // [Required] The data format. - // For CSV files, specify "CSV". - // For Google sheets, specify "GOOGLE_SHEETS". - // For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". - // For Avro files, specify "AVRO". - // For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". - // For Apache Iceberg tables, specify "ICEBERG". - // For ORC files, specify "ORC". - // For Parquet files, specify "PARQUET". - // [Beta] For Google Cloud Bigtable, specify "BIGTABLE". - string source_format = 3; - - // Optional. The maximum number of bad records that BigQuery can ignore when - // reading data. If the number of bad records exceeds this value, an invalid - // error is returned in the job result. The default value is 0, which requires - // that all records are valid. This setting is ignored for Google Cloud - // Bigtable, Google Cloud Datastore backups, Avro, ORC and Parquet formats. - google.protobuf.Int32Value max_bad_records = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Try to detect schema and format options automatically. - // Any option specified explicitly will be honored. - google.protobuf.BoolValue autodetect = 5; - - // Optional. Indicates if BigQuery should allow extra values that are not - // represented in the table schema. - // If true, the extra values are ignored. - // If false, records with extra columns are treated as bad records, and if - // there are too many bad records, an invalid error is returned in the job - // result. - // The default value is false. - // The sourceFormat property determines what BigQuery treats as an extra - // value: - // CSV: Trailing columns - // JSON: Named values that don't match any column names - // Google Cloud Bigtable: This setting is ignored. - // Google Cloud Datastore backups: This setting is ignored. - // Avro: This setting is ignored. - // ORC: This setting is ignored. - // Parquet: This setting is ignored. - google.protobuf.BoolValue ignore_unknown_values = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The compression type of the data source. - // Possible values include GZIP and NONE. The default value is NONE. - // This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore - // backups, Avro, ORC and Parquet - // formats. An empty string is an invalid value. - string compression = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to CSV. - CsvOptions csv_options = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to JSON. - JsonOptions json_options = 26 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional options if sourceFormat is set to BIGTABLE. - BigtableOptions bigtable_options = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional options if sourceFormat is set to GOOGLE_SHEETS. - GoogleSheetsOptions google_sheets_options = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When set, configures hive partitioning support. Not all storage - // formats support hive partitioning -- requesting hive partitioning on an - // unsupported format will lead to an error, as will providing an invalid - // specification. - HivePartitioningOptions hive_partitioning_options = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The connection specifying the credentials to be used to read - // external storage, such as Azure Blob, Cloud Storage, or S3. The - // connection_id can have the form - // `{project_id}.{location_id};{connection_id}` or - // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`. - string connection_id = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Defines the list of possible SQL data types to which the source decimal - // values are converted. This list and the precision and the scale parameters - // of the decimal field determine the target type. In the order of NUMERIC, - // BIGNUMERIC, and STRING, a - // type is picked if it is in the specified list and if it supports the - // precision and the scale. STRING supports all precision and scale values. - // If none of the listed types supports the precision and the scale, the type - // supporting the widest range in the specified list is picked, and if a value - // exceeds the supported range when reading the data, an error will be thrown. - // - // Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. - // If (precision,scale) is: - // - // * (38,9) -> NUMERIC; - // * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); - // * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); - // * (76,38) -> BIGNUMERIC; - // * (77,38) -> BIGNUMERIC (error if value exeeds supported range). - // - // This field cannot contain duplicate types. The order of the types in this - // field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as - // ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over - // BIGNUMERIC. - // - // Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other - // file formats. - repeated DecimalTargetType decimal_target_types = 16; - - // Optional. Additional properties to set if sourceFormat is set to AVRO. - AvroOptions avro_options = 17 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Load option to be used together with source_format - // newline-delimited JSON to indicate that a variant of JSON is being loaded. - // To load newline-delimited GeoJSON, specify GEOJSON (and source_format must - // be set to NEWLINE_DELIMITED_JSON). - JsonExtension json_extension = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to PARQUET. - ParquetOptions parquet_options = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. ObjectMetadata is used to create Object Tables. Object Tables - // contain a listing of objects (with their metadata) found at the - // source_uris. If ObjectMetadata is set, source_format should be omitted. - // - // Currently SIMPLE is the only supported Object Metadata type. - optional ObjectMetadata object_metadata = 22 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When creating an external table, the user can provide a reference - // file with the table schema. This is enabled for the following formats: - // AVRO, PARQUET, ORC. - google.protobuf.StringValue reference_file_schema_uri = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Metadata Cache Mode for the table. Set this to enable caching of - // metadata from external data source. - MetadataCacheMode metadata_cache_mode = 24 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline deleted file mode 100644 index 8d3a3b4c91f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalDatasetReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; -option (google.api.resource_definition) = { - type: "bigqueryconnection.googleapis.com/Connection" - pattern: "projects/{project}/locations/{location}/connections/{connection}" -}; - -// Configures the access a dataset defined in an external metadata storage. -message ExternalDatasetReference { - // Required. External source that backs this dataset. - string external_source = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The connection id that is used to access the external_source. - // - // Format: - // projects/{project_id}/locations/{location_id}/connections/{connection_id} - string connection = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryconnection.googleapis.com/Connection" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline deleted file mode 100644 index 1068d20eb782..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "FileSetSpecificationTypeProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This enum defines how to interpret source URIs for load jobs and external -// tables. -enum FileSetSpecType { - // This option expands source URIs by listing files from the object store. It - // is the default behavior if FileSetSpecType is not set. - FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH = 0; - - // This option indicates that the provided URIs are newline-delimited manifest - // files, with one URI per line. Wildcard URIs are not supported. - FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline deleted file mode 100644 index 76872bd1a026..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "HivePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for configuring hive partitioning detect. -message HivePartitioningOptions { - // Optional. When set, what mode of hive partitioning to use when reading - // data. The following modes are supported: - // - // * AUTO: automatically infer partition key name(s) and type(s). - // - // * STRINGS: automatically infer partition key name(s). All types are - // strings. - // - // * CUSTOM: partition key schema is encoded in the source URI prefix. - // - // Not all storage formats support hive partitioning. Requesting hive - // partitioning on an unsupported format will lead to an error. - // Currently supported formats are: JSON, CSV, ORC, Avro and Parquet. - string mode = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When hive partition detection is requested, a common prefix for - // all source uris must be required. The prefix must end immediately before - // the partition key encoding begins. For example, consider files following - // this data layout: - // - // gs://bucket/path_to_table/dt=2019-06-01/country=USA/id=7/file.avro - // - // gs://bucket/path_to_table/dt=2019-05-31/country=CA/id=3/file.avro - // - // When hive partitioning is requested with either AUTO or STRINGS detection, - // the common prefix can be either of gs://bucket/path_to_table or - // gs://bucket/path_to_table/. - // - // CUSTOM detection requires encoding the partitioning schema immediately - // after the common prefix. For CUSTOM, any of - // - // * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:INTEGER} - // - // * gs://bucket/path_to_table/{dt:STRING}/{country:STRING}/{id:INTEGER} - // - // * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:STRING} - // - // would all be valid source URI prefixes. - string source_uri_prefix = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, queries over this table require a partition - // filter that can be used for partition elimination to be specified. - // - // Note that this field should only be true when creating a permanent - // external table or querying a temporary external table. - // - // Hive-partitioned loads with require_partition_filter explicitly set to - // true will fail. - google.protobuf.BoolValue require_partition_filter = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. For permanent external tables, this field is populated with - // the hive partition keys in the order they were inferred. The types of the - // partition keys can be deduced by checking the table schema (which will - // include the partition keys). Not every API will populate this field in the - // output. For example, Tables.Get will populate it, but Tables.List will not - // contain this field. - repeated string fields = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job.proto.baseline deleted file mode 100644 index b15e1fb428ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job.proto.baseline +++ /dev/null @@ -1,738 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/data_format_options.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/error.proto"; -import "google/cloud/bigquery/v2/job_config.proto"; -import "google/cloud/bigquery/v2/job_creation_reason.proto"; -import "google/cloud/bigquery/v2/job_reference.proto"; -import "google/cloud/bigquery/v2/job_stats.proto"; -import "google/cloud/bigquery/v2/job_status.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/session_info.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Job Service. -// -// It should not be relied on for production use cases at this time. -service JobService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/devstorage.full_control," - "https://www.googleapis.com/auth/devstorage.read_only," - "https://www.googleapis.com/auth/devstorage.read_write"; - - // Requests that a job be cancelled. This call will return immediately, and - // the client will need to poll for the job status to see if the cancel - // completed successfully. Cancelled jobs may still incur costs. - rpc CancelJob(CancelJobRequest) returns (JobCancelResponse) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}/cancel" - }; - } - - // Returns information about a specific job. Job information is available for - // a six month period after creation. Requires that you're the person who ran - // the job, or have the Is Owner project role. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}" - }; - } - - // Starts a new asynchronous job. - // - // This API has two different kinds of endpoint URIs, as this method supports - // a variety of use cases. - // - // * The *Metadata* URI is used for most interactions, as it accepts the job - // configuration directly. - // * The *Upload* URI is ONLY for the case when you're sending both a load job - // configuration and a data stream together. In this case, the Upload URI - // accepts the job configuration and the data as two distinct multipart MIME - // parts. - rpc InsertJob(InsertJobRequest) returns (Job) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/jobs" - body: "job" - }; - } - - // Requests the deletion of the metadata of a job. This call returns when the - // job's metadata is deleted. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}/delete" - }; - } - - // Lists all jobs that you started in the specified project. Job information - // is available for a six month period after creation. The job list is sorted - // in reverse chronological order, by job creation time. Requires the Can View - // project role, or the Is Owner project role if you set the allUsers - // property. - rpc ListJobs(ListJobsRequest) returns (JobList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/jobs" - }; - } - - // RPC to get the results of a query job. - rpc GetQueryResults(GetQueryResultsRequest) - returns (GetQueryResultsResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/queries/{job_id=*}" - }; - } - - // Runs a BigQuery SQL query synchronously and returns query results if the - // query completes within a specified timeout. - rpc Query(PostQueryRequest) returns (QueryResponse) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/queries" - body: "query_request" - }; - } -} - -message Job { - // Output only. The type of the resource. - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash of this resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Opaque ID field of the job. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access the resource again. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who ran the job. - string user_email = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Describes the job configuration. - JobConfiguration configuration = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Reference describing the unique-per-user name of the job. - JobReference job_reference = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Information about the job, including starting time and ending - // time of the job. - JobStatistics statistics = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of this job. Examine this value when polling an - // asynchronous job to see if the job is complete. - JobStatus status = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Full-projection-only] String representation of identity of - // requesting party. Populated for both first- and third-party identities. - // Only present for APIs that support third-party identities. - string principal_subject = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The reason why a Job was created. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationReason job_creation_reason = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes format of a jobs cancellation request. -message CancelJobRequest { - // Required. Project ID of the job to cancel - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the job to cancel - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes format of a jobs cancellation response. -message JobCancelResponse { - // The resource type of the response. - string kind = 1; - - // The final state of the job. - Job job = 2; -} - -// Describes format of a jobs get request. -message GetJobRequest { - // Required. Project ID of the requested job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the requested job. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes format of a job insertion request. -message InsertJobRequest { - // Project ID of project that will be billed for the job. - string project_id = 1; - - // Jobs resource to insert. - Job job = 3; -} - -// Describes the format of a jobs deletion request. -message DeleteJobRequest { - // Required. Project ID of the job for which metadata is to be deleted. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the job for which metadata is to be deleted. If this is - // a parent job which has child jobs, the metadata from all child jobs will be - // deleted as well. Direct deletion of the metadata of child jobs is not - // allowed. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. Required. - // See details at: - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes the format of the list jobs request. -message ListJobsRequest { - // Projection is used to control what job information is returned. - enum Projection { - option allow_alias = true; - - // Does not include the job configuration - minimal = 0; - - // Does not include the job configuration - MINIMAL = 0; - - // Includes all job data - full = 1; - - // Includes all job data - FULL = 1; - } - - // StateFilter allows filtration by job execution state. - enum StateFilter { - option allow_alias = true; - - // Finished jobs - done = 0; - - // Finished jobs - DONE = 0; - - // Pending jobs - pending = 1; - - // Pending jobs - PENDING = 1; - - // Running jobs - running = 2; - - // Running jobs. - RUNNING = 2; - } - - // Project ID of the jobs to list. - string project_id = 1; - - // Whether to display jobs owned by all users in the project. Default False. - bool all_users = 2; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.Int32Value max_results = 3; - - // Min value for job creation time, in milliseconds since the POSIX epoch. - // If set, only jobs created after or at this timestamp are returned. - uint64 min_creation_time = 4; - - // Max value for job creation time, in milliseconds since the POSIX epoch. - // If set, only jobs created before or at this timestamp are returned. - google.protobuf.UInt64Value max_creation_time = 5; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 6; - - // Restrict information returned to a set of selected fields - Projection projection = 7; - - // Filter for job state - repeated StateFilter state_filter = 8; - - // If set, show only child jobs of the specified parent. Otherwise, show all - // top-level jobs. - string parent_job_id = 9; -} - -// ListFormatJob is a partial projection of job information returned as part -// of a jobs.list response. -message ListFormatJob { - // Unique opaque ID of the job. - string id = 1; - - // The resource type. - string kind = 2; - - // Unique opaque ID of the job. - JobReference job_reference = 3; - - // Running state of the job. When the state is DONE, errorResult can be - // checked to determine whether the job succeeded or failed. - string state = 4; - - // A result object that will be present only if the job has failed. - ErrorProto error_result = 5; - - // Output only. Information about the job, including starting time and ending - // time of the job. - JobStatistics statistics = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Describes the job configuration. - JobConfiguration configuration = 7 [(google.api.field_behavior) = REQUIRED]; - - // [Full-projection-only] Describes the status of this job. - JobStatus status = 8; - - // [Full-projection-only] Email address of the user who ran the job. - string user_email = 9; - - // [Full-projection-only] String representation of identity of requesting - // party. Populated for both first- and third-party identities. Only present - // for APIs that support third-party identities. - string principal_subject = 10; -} - -// JobList is the response format for a jobs.list call. -message JobList { - // A hash of this page of results. - string etag = 1; - - // The resource type of the response. - string kind = 2; - - // A token to request the next page of results. - string next_page_token = 3; - - // List of jobs that were requested. - repeated ListFormatJob jobs = 4; - - // A list of skipped locations that were unreachable. For more information - // about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5" - repeated string unreachable = 5; -} - -// Request object of GetQueryResults. -message GetQueryResultsRequest { - // Required. Project ID of the query job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the query job. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Zero-based index of the starting row. - google.protobuf.UInt64Value start_index = 3; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 4; - - // Maximum number of results to read. - google.protobuf.UInt32Value max_results = 5; - - // Optional: Specifies the maximum amount of time, in milliseconds, that the - // client is willing to wait for the query to complete. By default, this limit - // is 10 seconds (10,000 milliseconds). If the query is complete, the - // jobComplete field in the response is true. If the query has not yet - // completed, jobComplete is false. - // - // You can request a longer timeout period in the timeoutMs field. However, - // the call is not guaranteed to wait for the specified timeout; it typically - // returns after around 200 seconds (200,000 milliseconds), even if the query - // is not complete. - // - // If jobComplete is false, you can continue to wait for the query to complete - // by calling the getQueryResults method until the jobComplete field in the - // getQueryResults response is true. - google.protobuf.UInt32Value timeout_ms = 6; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 7; - - // Optional. Output format adjustments. - DataFormatOptions format_options = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response object of GetQueryResults. -message GetQueryResultsResponse { - // The resource type of the response. - string kind = 1; - - // A hash of this response. - string etag = 2; - - // The schema of the results. Present only when the query completes - // successfully. - TableSchema schema = 3; - - // Reference to the BigQuery Job that was created to run the query. This field - // will be present even if the original request timed out, in which case - // GetQueryResults can be used to read the results once the query has - // completed. Since this API only returns the first page of results, - // subsequent pages can be fetched via the same mechanism (GetQueryResults). - JobReference job_reference = 4; - - // The total number of rows in the complete query result set, which can be - // more than the number of rows in this single page of results. Present only - // when the query completes successfully. - google.protobuf.UInt64Value total_rows = 5; - - // A token used for paging results. When this token is non-empty, it - // indicates additional results are available. - string page_token = 6; - - // An object with as many results as can be contained within the maximum - // permitted reply size. To get any additional rows, you can call - // GetQueryResults and specify the jobReference returned above. Present only - // when the query completes successfully. - // - // The REST-based representation of this data leverages a series of - // JSON f,v objects for indicating fields and values. - repeated google.protobuf.Struct rows = 7; - - // The total number of bytes processed for this query. - google.protobuf.Int64Value total_bytes_processed = 8; - - // Whether the query has completed or not. If rows or totalRows are present, - // this will always be true. If this is false, totalRows will not be - // available. - google.protobuf.BoolValue job_complete = 9; - - // Output only. The first errors or warnings encountered during the running - // of the job. The final message includes the number of errors that caused the - // process to stop. Errors here do not necessarily mean that the job has - // completed or was unsuccessful. For more information about error messages, - // see [Error - // messages](https://cloud.google.com/bigquery/docs/error-messages). - repeated ErrorProto errors = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 11; - - // Output only. The number of rows affected by a DML statement. Present only - // for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for the query request. -message PostQueryRequest { - // Required. Project ID of the query request. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The query request body. - QueryRequest query_request = 2; -} - -// Describes the format of the jobs.query request. -message QueryRequest { - // Job Creation Mode provides different options on job creation. - enum JobCreationMode { - // If unspecified JOB_CREATION_REQUIRED is the default. - JOB_CREATION_MODE_UNSPECIFIED = 0; - - // Default. Job creation is always required. - JOB_CREATION_REQUIRED = 1; - - // Job creation is optional. Returning immediate results is prioritized. - // BigQuery will automatically determine if a Job needs to be created. - // The conditions under which BigQuery can decide to not create a Job are - // subject to change. If Job creation is required, JOB_CREATION_REQUIRED - // mode should be used, which is the default. - JOB_CREATION_OPTIONAL = 2; - } - - // The resource type of the request. - string kind = 2; - - // Required. A query string to execute, using Google Standard SQL or legacy - // SQL syntax. Example: "SELECT COUNT(f1) FROM - // myProjectId.myDatasetId.myTableId". - string query = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The maximum number of rows of data to return per page of - // results. Setting this flag to a small value such as 1000 and then paging - // through results might improve reliability when the query result set is - // large. In addition to this limit, responses are also limited to 10 MB. By - // default, there is no maximum row count, and only the byte limit applies. - google.protobuf.UInt32Value max_results = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the default datasetId and projectId to assume for any - // unqualified table names in the query. If not set, all table names in the - // query string must be qualified in the format 'datasetId.tableId'. - DatasetReference default_dataset = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional: Specifies the maximum amount of time, in milliseconds, - // that the client is willing to wait for the query to complete. By default, - // this limit is 10 seconds (10,000 milliseconds). If the query is complete, - // the jobComplete field in the response is true. If the query has not yet - // completed, jobComplete is false. - // - // You can request a longer timeout period in the timeoutMs field. However, - // the call is not guaranteed to wait for the specified timeout; it typically - // returns after around 200 seconds (200,000 milliseconds), even if the query - // is not complete. - // - // If jobComplete is false, you can continue to wait for the query to complete - // by calling the getQueryResults method until the jobComplete field in the - // getQueryResults response is true. - google.protobuf.UInt32Value timeout_ms = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, BigQuery doesn't run the job. Instead, if the - // query is valid, BigQuery returns statistics about the job such as how many - // bytes would be processed. If the query is invalid, an error returns. The - // default value is false. - bool dry_run = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether to look for the result in the query cache. The query - // cache is a best-effort cache that will be flushed whenever tables in the - // query are modified. The default value is true. - google.protobuf.BoolValue use_query_cache = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Specifies whether to use BigQuery's legacy SQL dialect for this query. The - // default value is true. If set to false, the query will use BigQuery's - // GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ When - // useLegacySql is set to false, the value of flattenResults is ignored; query - // will be run as if flattenResults is false. - google.protobuf.BoolValue use_legacy_sql = 10; - - // GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters - // or to NAMED to use named (@myparam) query parameters in this query. - string parameter_mode = 11; - - // Query parameters for GoogleSQL queries. - repeated QueryParameter query_parameters = 12; - - // The geographic location where the job should run. See details at - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 13; - - // Optional. Output format adjustments. - DataFormatOptions format_options = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Connection properties which can modify the query behavior. - repeated ConnectionProperty connection_properties = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels associated with this query. - // Labels can be used to organize and group query jobs. - // Label keys and values can be no longer than 63 characters, can only contain - // lowercase letters, numeric characters, underscores and dashes. - // International characters are allowed. Label keys must start with a letter - // and each label in the list must have a different key. - map labels = 17 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Limits the bytes billed for this query. Queries with - // bytes billed above this limit will fail (without incurring a charge). - // If unspecified, the project default is used. - google.protobuf.Int64Value maximum_bytes_billed = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique user provided identifier to ensure idempotent behavior - // for queries. Note that this is different from the job_id. It has the - // following properties: - // - // 1. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is - // recommended. - // - // 2. Read only queries can ignore this token since they are nullipotent by - // definition. - // - // 3. For the purposes of idempotency ensured by the request_id, a request - // is considered duplicate of another only if they have the same request_id - // and are actually duplicates. When determining whether a request is a - // duplicate of another request, all parameters in the request that - // may affect the result are considered. For example, query, - // connection_properties, query_parameters, use_legacy_sql are parameters - // that affect the result and are considered when determining whether a - // request is a duplicate, but properties like timeout_ms don't - // affect the result and are thus not considered. Dry run query - // requests are never considered duplicate of another request. - // - // 4. When a duplicate mutating query request is detected, it returns: - // a. the results of the mutation if it completes successfully within - // the timeout. - // b. the running operation if it is still in progress at the end of the - // timeout. - // - // 5. Its lifetime is limited to 15 minutes. In other words, if two - // requests are sent with the same request_id, but more than 15 minutes - // apart, idempotency is not guaranteed. - string request_id = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, creates a new session using a randomly generated - // session_id. If false, runs query with an existing session_id passed in - // ConnectionProperty, otherwise runs query in non-session mode. - // - // The session location will be set to QueryRequest.location if it is present, - // otherwise it's set to the default location based on existing routing logic. - google.protobuf.BoolValue create_session = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If not set, jobs are always required. - // - // If set, the query request will follow the behavior described - // JobCreationMode. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationMode job_creation_mode = 22 - [(google.api.field_behavior) = OPTIONAL]; -} - -message QueryResponse { - // The resource type. - string kind = 1; - - // The schema of the results. Present only when the query completes - // successfully. - TableSchema schema = 2; - - // Reference to the Job that was created to run the query. This field will be - // present even if the original request timed out, in which case - // GetQueryResults can be used to read the results once the query has - // completed. Since this API only returns the first page of results, - // subsequent pages can be fetched via the same mechanism (GetQueryResults). - // - // If job_creation_mode was set to `JOB_CREATION_OPTIONAL` and the query - // completes without creating a job, this field will be empty. - JobReference job_reference = 3; - - // Optional. The reason why a Job was created. - // - // Only relevant when a job_reference is present in the response. - // If job_reference is not present it will always be unset. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationReason job_creation_reason = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Auto-generated ID for the query. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - string query_id = 14; - - // The total number of rows in the complete query result set, which can be - // more than the number of rows in this single page of results. - google.protobuf.UInt64Value total_rows = 4; - - // A token used for paging results. A non-empty token indicates that - // additional results are available. To see additional results, - // query the - // [`jobs.getQueryResults`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults) - // method. For more information, see [Paging through table - // data](https://cloud.google.com/bigquery/docs/paging-results). - string page_token = 5; - - // An object with as many results as can be contained within the maximum - // permitted reply size. To get any additional rows, you can call - // GetQueryResults and specify the jobReference returned above. - repeated google.protobuf.Struct rows = 6; - - // The total number of bytes processed for this query. If this query was a dry - // run, this is the number of bytes that would be processed if the query were - // run. - google.protobuf.Int64Value total_bytes_processed = 7; - - // Whether the query has completed or not. If rows or totalRows are present, - // this will always be true. If this is false, totalRows will not be - // available. - google.protobuf.BoolValue job_complete = 8; - - // Output only. The first errors or warnings encountered during the running of - // the job. The final message includes the number of errors that caused the - // process to stop. Errors here do not necessarily mean that the job has - // completed or was unsuccessful. For more information about error messages, - // see [Error - // messages](https://cloud.google.com/bigquery/docs/error-messages). - repeated ErrorProto errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 10; - - // Output only. The number of rows affected by a DML statement. Present only - // for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information of the session if this job is part of one. - SessionInfo session_info = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, - // MERGE or TRUNCATE. - DmlStats dml_stats = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_config.proto.baseline deleted file mode 100644 index 9f42488c8d5a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_config.proto.baseline +++ /dev/null @@ -1,814 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/clustering.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/decimal_target_types.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/external_data_config.proto"; -import "google/cloud/bigquery/v2/file_set_specification_type.proto"; -import "google/cloud/bigquery/v2/hive_partitioning.proto"; -import "google/cloud/bigquery/v2/json_extension.proto"; -import "google/cloud/bigquery/v2/model_reference.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/range_partitioning.proto"; -import "google/cloud/bigquery/v2/system_variable.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/cloud/bigquery/v2/time_partitioning.proto"; -import "google/cloud/bigquery/v2/udf_resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Properties for the destination table. -message DestinationTableProperties { - // Optional. Friendly name for the destination table. If the table already - // exists, it should be same as the existing friendly name. - google.protobuf.StringValue friendly_name = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The description for the destination table. - // This will only be used if the destination table is newly created. - // If the table already exists and a value different than the current - // description is provided, the job will fail. - google.protobuf.StringValue description = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels associated with this table. You can use these to - // organize and group your tables. This will only be used if the destination - // table is newly created. If the table already exists and labels are - // different than the current labels are provided, the job will fail. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A connection-level property to customize query behavior. Under JDBC, these -// correspond directly to connection properties passed to the DriverManager. -// Under ODBC, these correspond to properties in the connection string. -// -// Currently supported connection properties: -// -// * **dataset_project_id**: represents the default project for datasets that -// are used in the query. Setting the -// system variable `@@dataset_project_id` achieves the same behavior. For -// more information about system variables, see: -// https://cloud.google.com/bigquery/docs/reference/system-variables -// -// * **time_zone**: represents the default timezone used to run the query. -// -// * **session_id**: associates the query with a given session. -// -// * **query_label**: associates the query with a given job label. If set, -// all subsequent queries in a script or session will have this label. For the -// format in which a you can specify a query label, see labels -// in the JobConfiguration resource type: -// https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration -// -// * **service_account**: indicates the service account to use to run a -// continuous query. If set, the query job uses the service account to access -// Google Cloud resources. Service account access is bounded by the IAM -// permissions that you have granted to the service account. -// -// Additional properties are allowed, but ignored. Specifying multiple -// connection properties with the same key returns an error. -message ConnectionProperty { - // The key of the property to set. - string key = 1; - - // The value of the property to set. - string value = 2; -} - -// JobConfigurationQuery configures a BigQuery query job. -message JobConfigurationQuery { - // [Required] SQL query text to execute. The useLegacySql field can be used - // to indicate whether the query uses legacy SQL or GoogleSQL. - string query = 1; - - // Optional. Describes the table where the query results should be stored. - // This property must be set for large results that exceed the maximum - // response size. For queries that produce anonymous (cached) results, this - // field will be populated by BigQuery. - TableReference destination_table = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. You can specify external table definitions, which operate as - // ephemeral tables that can be queried. These definitions are configured - // using a JSON map, where the string key represents the table identifier, and - // the value is the corresponding external data configuration object. - map external_table_definitions = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Describes user-defined function resources used in the query. - repeated UserDefinedFunctionResource user_defined_function_resources = 4; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // data, removes the constraints, and uses the schema from the query result. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_EMPTY. Each action is atomic and only occurs if - // BigQuery is able to complete the job successfully. Creation, truncation and - // append actions occur as one atomic update upon job completion. - string write_disposition = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the default dataset to use for unqualified - // table names in the query. This setting does not alter behavior of - // unqualified dataset names. Setting the system variable - // `@@dataset_id` achieves the same behavior. See - // https://cloud.google.com/bigquery/docs/reference/system-variables for more - // information on system variables. - DatasetReference default_dataset = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a priority for the query. Possible values include - // INTERACTIVE and BATCH. The default value is INTERACTIVE. - string priority = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true and query uses legacy SQL dialect, allows the query - // to produce arbitrarily large result tables at a slight cost in performance. - // Requires destinationTable to be set. - // For GoogleSQL queries, this flag is ignored and large results are - // always allowed. However, you must still set destinationTable when result - // size exceeds the allowed maximum response size. - google.protobuf.BoolValue allow_large_results = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether to look for the result in the query cache. The query - // cache is a best-effort cache that will be flushed whenever tables in the - // query are modified. Moreover, the query cache is only available when a - // query does not have a destination table specified. The default value is - // true. - google.protobuf.BoolValue use_query_cache = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true and query uses legacy SQL dialect, flattens all nested - // and repeated fields in the query results. - // allowLargeResults must be true if this is set to false. - // For GoogleSQL queries, this flag is ignored and results are never - // flattened. - google.protobuf.BoolValue flatten_results = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Limits the bytes billed for this job. Queries that will have - // bytes billed beyond this limit will fail (without incurring a charge). - // If unspecified, this will be set to your project default. - google.protobuf.Int64Value maximum_bytes_billed = 14; - - // Optional. Specifies whether to use BigQuery's legacy SQL dialect for this - // query. The default value is true. If set to false, the query will use - // BigQuery's GoogleSQL: - // https://cloud.google.com/bigquery/sql-reference/ - // - // When useLegacySql is set to false, the value of flattenResults is ignored; - // query will be run as if flattenResults is false. - google.protobuf.BoolValue use_legacy_sql = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters - // or to NAMED to use named (@myparam) query parameters in this query. - string parameter_mode = 16; - - // Query parameters for GoogleSQL queries. - repeated QueryParameter query_parameters = 17; - - // Output only. System variables for GoogleSQL queries. A system variable is - // output if the variable is settable and its value differs from the system - // default. - // "@@" prefix is not included in the name of the System variables. - optional SystemVariables system_variables = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows the schema of the destination table to be updated as a side effect - // of the query job. Schema update options are supported in two cases: - // when writeDisposition is WRITE_APPEND; - // when writeDisposition is WRITE_TRUNCATE and the destination table is a - // partition of a table, specified by partition decorators. For normal tables, - // WRITE_TRUNCATE will always overwrite the schema. - // One or more of the following values are specified: - // - // * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. - // * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original - // schema to nullable. - repeated string schema_update_options = 18; - - // Time-based partitioning specification for the destination table. Only one - // of timePartitioning and rangePartitioning should be specified. - TimePartitioning time_partitioning = 19; - - // Range partitioning specification for the destination table. - // Only one of timePartitioning and rangePartitioning should be specified. - RangePartitioning range_partitioning = 22; - - // Clustering specification for the destination table. - Clustering clustering = 20; - - // Custom encryption configuration (e.g., Cloud KMS keys) - EncryptionConfiguration destination_encryption_configuration = 21; - - // Options controlling the execution of scripts. - ScriptOptions script_options = 24; - - // Connection properties which can modify the query behavior. - repeated ConnectionProperty connection_properties = 33; - - // If this property is true, the job creates a new session using a randomly - // generated session_id. To continue using a created session with - // subsequent queries, pass the existing session identifier as a - // `ConnectionProperty` value. The session identifier is returned as part of - // the `SessionInfo` message within the query statistics. - // - // The new session's location will be set to `Job.JobReference.location` if it - // is present, otherwise it's set to the default location based on existing - // routing logic. - google.protobuf.BoolValue create_session = 34; - - // Optional. Whether to run the query as continuous or a regular query. - // Continuous query is currently in experimental stage and not ready for - // general usage. - google.protobuf.BoolValue continuous = 36 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options related to script execution. -message ScriptOptions { - // KeyResultStatementKind controls how the key result is determined. - enum KeyResultStatementKind { - // Default value. - KEY_RESULT_STATEMENT_KIND_UNSPECIFIED = 0; - - // The last result determines the key result. - LAST = 1; - - // The first SELECT statement determines the key result. - FIRST_SELECT = 2; - } - - // Timeout period for each statement in a script. - google.protobuf.Int64Value statement_timeout_ms = 1; - - // Limit on the number of bytes billed per statement. Exceeding this budget - // results in an error. - google.protobuf.Int64Value statement_byte_budget = 2; - - // Determines which statement in the script represents the "key result", - // used to populate the schema and query results of the script job. - // Default is LAST. - KeyResultStatementKind key_result_statement = 4; -} - -// JobConfigurationLoad contains the configuration properties for loading data -// into a destination table. -message JobConfigurationLoad { - // Indicates the character map used for column names. - enum ColumnNameCharacterMap { - // Unspecified column name character map. - COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED = 0; - - // Support flexible column name and reject invalid column names. - STRICT = 1; - - // Support alphanumeric + underscore characters and names must start with a - // letter or underscore. Invalid column names will be normalized. - V1 = 2; - - // Support flexible column name. Invalid column names will be normalized. - V2 = 3; - } - - // [Required] The fully-qualified URIs that point to your data in Google - // Cloud. - // For Google Cloud Storage URIs: - // Each URI can contain one '*' wildcard character and it must come after - // the 'bucket' name. Size limits related to load jobs apply to external - // data sources. - // For Google Cloud Bigtable URIs: - // Exactly one URI can be specified and it has be a fully specified and - // valid HTTPS URL for a Google Cloud Bigtable table. - // For Google Cloud Datastore backups: - // Exactly one URI can be specified. Also, the '*' wildcard character is not - // allowed. - repeated string source_uris = 1; - - // Optional. Specifies how source URIs are interpreted for constructing the - // file set to load. By default, source URIs are expanded against the - // underlying storage. You can also specify manifest files to control how the - // file set is constructed. This option is only applicable to object storage - // systems. - FileSetSpecType file_set_spec_type = 49 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The schema for the destination table. The schema can be - // omitted if the destination table already exists, or if you're loading data - // from Google Cloud Datastore. - TableSchema schema = 2 [(google.api.field_behavior) = OPTIONAL]; - - // [Required] The destination table to load the data into. - TableReference destination_table = 3; - - // Optional. [Experimental] Properties with which to create the destination - // table if it is new. - DestinationTableProperties destination_table_properties = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // data, removes the constraints and uses the schema from the load job. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_APPEND. - // Each action is atomic and only occurs if BigQuery is able to complete the - // job successfully. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string write_disposition = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a string that represents a null value in a CSV file. - // For example, if you specify "\N", BigQuery interprets "\N" as a null value - // when loading a CSV file. - // The default value is the empty string. If you set this property to a custom - // value, BigQuery throws an error if an empty string is present for all data - // types except for STRING and BYTE. For STRING and BYTE columns, BigQuery - // interprets the empty string as an empty value. - google.protobuf.StringValue null_marker = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The separator character for fields in a CSV file. The separator - // is interpreted as a single byte. For files encoded in ISO-8859-1, any - // single character can be used as a separator. For files encoded in UTF-8, - // characters represented in decimal range 1-127 (U+0001-U+007F) can be used - // without any modification. UTF-8 characters encoded with multiple bytes - // (i.e. U+0080 and above) will have only the first byte used for separating - // fields. The remaining bytes will be treated as a part of the field. - // BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab - // separator. The default value is comma (",", U+002C). - string field_delimiter = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of rows at the top of a CSV file that BigQuery will - // skip when loading the data. The default value is 0. This property is useful - // if you have header rows in the file that should be skipped. When autodetect - // is on, the behavior is the following: - // - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int32Value skip_leading_rows = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The character encoding of the data. - // The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. BigQuery decodes the data after - // the raw, binary data has been split using the values of the `quote` and - // `fieldDelimiter` properties. - // - // If you don't specify an encoding, or if you specify a UTF-8 encoding when - // the CSV file is not UTF-8 encoded, BigQuery attempts to convert the data to - // UTF-8. Generally, your data loads successfully, but it may not match - // byte-for-byte what you expect. To avoid this, specify the correct encoding - // by using the `--encoding` flag. - // - // If BigQuery can't convert a character other than the ASCII `0` character, - // BigQuery converts the character to the standard Unicode replacement - // character: �. - string encoding = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The value that is used to quote data sections in a CSV file. - // BigQuery converts the string to ISO-8859-1 encoding, and then uses the - // first byte of the encoded string to split the data in its raw, binary - // state. - // The default value is a double-quote ('"'). - // If your data does not contain quoted sections, set the property value to an - // empty string. - // If your data contains quoted newline characters, you must also set the - // allowQuotedNewlines property to true. - // To include the specific quote character within a quoted value, precede it - // with an additional matching quote character. For example, if you want to - // escape the default character ' " ', use ' "" '. - // @default " - google.protobuf.StringValue quote = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of bad records that BigQuery can ignore when - // running the job. If the number of bad records exceeds this value, an - // invalid error is returned in the job result. - // The default value is 0, which requires that all records are valid. - // This is only supported for CSV and NEWLINE_DELIMITED_JSON file formats. - google.protobuf.Int32Value max_bad_records = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Indicates if BigQuery should allow quoted data sections that contain - // newline characters in a CSV file. The default value is false. - google.protobuf.BoolValue allow_quoted_newlines = 15; - - // Optional. The format of the data files. - // For CSV files, specify "CSV". For datastore backups, - // specify "DATASTORE_BACKUP". For newline-delimited JSON, - // specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". - // For parquet, specify "PARQUET". For orc, specify "ORC". - // The default value is CSV. - string source_format = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Accept rows that are missing trailing optional columns. - // The missing values are treated as nulls. - // If false, records with missing trailing columns are treated as bad records, - // and if there are too many bad records, an invalid error is returned in the - // job result. - // The default value is false. - // Only applicable to CSV, ignored for other formats. - google.protobuf.BoolValue allow_jagged_rows = 17 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should allow extra values that are not - // represented in the table schema. - // If true, the extra values are ignored. - // If false, records with extra columns are treated as bad records, and if - // there are too many bad records, an invalid error is returned in the job - // result. The default value is false. - // The sourceFormat property determines what BigQuery treats as an extra - // value: - // CSV: Trailing columns - // JSON: Named values that don't match any column names in the table schema - // Avro, Parquet, ORC: Fields in the file schema that don't exist in the - // table schema. - google.protobuf.BoolValue ignore_unknown_values = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity - // properties to load into BigQuery from a Cloud Datastore backup. Property - // names are case sensitive and must be top-level properties. If no properties - // are specified, BigQuery loads all properties. If any named property isn't - // found in the Cloud Datastore backup, an invalid error is returned in the - // job result. - repeated string projection_fields = 19; - - // Optional. Indicates if we should automatically infer the options and - // schema for CSV and JSON sources. - google.protobuf.BoolValue autodetect = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Allows the schema of the destination table to be updated as a side effect - // of the load job if a schema is autodetected or supplied in the job - // configuration. - // Schema update options are supported in two cases: - // when writeDisposition is WRITE_APPEND; - // when writeDisposition is WRITE_TRUNCATE and the destination table is a - // partition of a table, specified by partition decorators. For normal tables, - // WRITE_TRUNCATE will always overwrite the schema. - // One or more of the following values are specified: - // - // * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. - // * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original - // schema to nullable. - repeated string schema_update_options = 21; - - // Time-based partitioning specification for the destination table. Only one - // of timePartitioning and rangePartitioning should be specified. - TimePartitioning time_partitioning = 22; - - // Range partitioning specification for the destination table. - // Only one of timePartitioning and rangePartitioning should be specified. - RangePartitioning range_partitioning = 26; - - // Clustering specification for the destination table. - Clustering clustering = 23; - - // Custom encryption configuration (e.g., Cloud KMS keys) - EncryptionConfiguration destination_encryption_configuration = 24; - - // Optional. If sourceFormat is set to "AVRO", indicates whether to interpret - // logical types as the corresponding BigQuery data type (for example, - // TIMESTAMP), instead of using the raw type (for example, INTEGER). - google.protobuf.BoolValue use_avro_logical_types = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The user can provide a reference file with the reader schema. - // This file is only loaded if it is part of source URIs, but is not loaded - // otherwise. It is enabled for the following formats: AVRO, PARQUET, ORC. - google.protobuf.StringValue reference_file_schema_uri = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When set, configures hive partitioning support. - // Not all storage formats support hive partitioning -- requesting hive - // partitioning on an unsupported format will lead to an error, as will - // providing an invalid specification. - HivePartitioningOptions hive_partitioning_options = 37 - [(google.api.field_behavior) = OPTIONAL]; - - // Defines the list of possible SQL data types to which the source decimal - // values are converted. This list and the precision and the scale parameters - // of the decimal field determine the target type. In the order of NUMERIC, - // BIGNUMERIC, and STRING, a - // type is picked if it is in the specified list and if it supports the - // precision and the scale. STRING supports all precision and scale values. - // If none of the listed types supports the precision and the scale, the type - // supporting the widest range in the specified list is picked, and if a value - // exceeds the supported range when reading the data, an error will be thrown. - // - // Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. - // If (precision,scale) is: - // - // * (38,9) -> NUMERIC; - // * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); - // * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); - // * (76,38) -> BIGNUMERIC; - // * (77,38) -> BIGNUMERIC (error if value exeeds supported range). - // - // This field cannot contain duplicate types. The order of the types in this - // field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as - // ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over - // BIGNUMERIC. - // - // Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other - // file formats. - repeated DecimalTargetType decimal_target_types = 39; - - // Optional. Load option to be used together with source_format - // newline-delimited JSON to indicate that a variant of JSON is being loaded. - // To load newline-delimited GeoJSON, specify GEOJSON (and source_format must - // be set to NEWLINE_DELIMITED_JSON). - JsonExtension json_extension = 41 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to PARQUET. - ParquetOptions parquet_options = 42 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When sourceFormat is set to "CSV", this indicates whether the - // embedded ASCII control characters (the first 32 characters in the - // ASCII-table, from - // '\x00' to '\x1F') are preserved. - google.protobuf.BoolValue preserve_ascii_control_characters = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Connection properties which can modify the load job behavior. - // Currently, only the 'session_id' connection property is supported, and is - // used to resolve _SESSION appearing as the dataset id. - repeated ConnectionProperty connection_properties = 46 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this property is true, the job creates a new session using a - // randomly generated session_id. To continue using a created session with - // subsequent queries, pass the existing session identifier as a - // `ConnectionProperty` value. The session identifier is returned as part of - // the `SessionInfo` message within the query statistics. - // - // The new session's location will be set to `Job.JobReference.location` if it - // is present, otherwise it's set to the default location based on existing - // routing logic. - google.protobuf.BoolValue create_session = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Character map supported for column names in CSV/Parquet loads. - // Defaults to STRICT and can be overridden by Project Config Service. Using - // this option with unsupporting load formats will result in an error. - ColumnNameCharacterMap column_name_character_map = 50 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. [Experimental] Configures the load job to copy files directly to - // the destination BigLake managed table, bypassing file content reading and - // rewriting. - // - // Copying files only is supported when all the following are true: - // - // * `source_uris` are located in the same Cloud Storage location as the - // destination table's `storage_uri` location. - // * `source_format` is `PARQUET`. - // * `destination_table` is an existing BigLake managed table. The table's - // schema does not have flexible column names. The table's columns do not - // have type parameters other than precision and scale. - // * No options other than the above are specified. - google.protobuf.BoolValue copy_files_only = 51 - [(google.api.field_behavior) = OPTIONAL]; -} - -// JobConfigurationTableCopy configures a job that copies data from one table -// to another. -// For more information on copying tables, see [Copy a -// table](https://cloud.google.com/bigquery/docs/managing-tables#copy-table). -message JobConfigurationTableCopy { - // Indicates different operation types supported in table copy job. - enum OperationType { - // Unspecified operation type. - OPERATION_TYPE_UNSPECIFIED = 0; - - // The source and destination table have the same table type. - COPY = 1; - - // The source table type is TABLE and - // the destination table type is SNAPSHOT. - SNAPSHOT = 2; - - // The source table type is SNAPSHOT and - // the destination table type is TABLE. - RESTORE = 3; - - // The source and destination table have the same table type, - // but only bill for unique data. - CLONE = 4; - } - - // [Pick one] Source table to copy. - TableReference source_table = 1; - - // [Pick one] Source tables to copy. - repeated TableReference source_tables = 2; - - // [Required] The destination table. - TableReference destination_table = 3; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // table data and uses the schema and table constraints from the source table. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_EMPTY. Each action is atomic and only occurs if - // BigQuery is able to complete the job successfully. Creation, truncation and - // append actions occur as one atomic update upon job completion. - string write_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Custom encryption configuration (e.g., Cloud KMS keys). - EncryptionConfiguration destination_encryption_configuration = 6; - - // Optional. Supported operation types in table copy job. - OperationType operation_type = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time when the destination table expires. Expired tables will - // be deleted and their storage reclaimed. - google.protobuf.Timestamp destination_expiration_time = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -// JobConfigurationExtract configures a job that exports data from a BigQuery -// table into Google Cloud Storage. -message JobConfigurationExtract { - // Options related to model extraction. - message ModelExtractOptions { - // The 1-based ID of the trial to be exported from a hyperparameter tuning - // model. If not specified, the trial with id = - // [Model](https://cloud.google.com/bigquery/docs/reference/rest/v2/models#resource:-model).defaultTrialId - // is exported. This field is ignored for models not trained with - // hyperparameter tuning. - google.protobuf.Int64Value trial_id = 1; - } - - // Required. Source reference for the export. - oneof source { - // A reference to the table being exported. - TableReference source_table = 1; - - // A reference to the model being exported. - ModelReference source_model = 9; - } - - // [Pick one] A list of fully-qualified Google Cloud Storage URIs where the - // extracted table should be written. - repeated string destination_uris = 3; - - // Optional. Whether to print out a header row in the results. - // Default is true. Not applicable when extracting models. - google.protobuf.BoolValue print_header = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When extracting data in CSV format, this defines the - // delimiter to use between fields in the exported data. - // Default is ','. Not applicable when extracting models. - string field_delimiter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The exported file format. Possible values include CSV, - // NEWLINE_DELIMITED_JSON, PARQUET, or AVRO for tables and ML_TF_SAVED_MODEL - // or ML_XGBOOST_BOOSTER for models. The default value for tables is CSV. - // Tables with nested or repeated fields cannot be exported as CSV. The - // default value for models is ML_TF_SAVED_MODEL. - string destination_format = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The compression type to use for exported files. Possible values - // include DEFLATE, GZIP, NONE, SNAPPY, and ZSTD. The default value is NONE. - // Not all compression formats are support for all file formats. DEFLATE is - // only supported for Avro. ZSTD is only supported for Parquet. Not applicable - // when extracting models. - string compression = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Whether to use logical types when extracting to AVRO format. Not applicable - // when extracting models. - google.protobuf.BoolValue use_avro_logical_types = 13; - - // Optional. Model extract options only applicable when extracting models. - ModelExtractOptions model_extract_options = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -message JobConfiguration { - // Output only. The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or - // UNKNOWN. - string job_type = 8; - - // [Pick one] Configures a query job. - JobConfigurationQuery query = 1; - - // [Pick one] Configures a load job. - JobConfigurationLoad load = 2; - - // [Pick one] Copies a table. - JobConfigurationTableCopy copy = 3; - - // [Pick one] Configures an extract job. - JobConfigurationExtract extract = 4; - - // Optional. If set, don't actually run this job. A valid query will return - // a mostly empty response with some processing statistics, while an invalid - // query will return the same error it would if it wasn't a dry run. Behavior - // of non-query jobs is undefined. - google.protobuf.BoolValue dry_run = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job timeout in milliseconds. If this time limit is exceeded, - // BigQuery will attempt to stop a longer job, but may not always succeed in - // canceling it before the job completes. For example, a job that takes more - // than 60 seconds to complete has a better chance of being stopped than a job - // that takes 10 seconds to complete. - google.protobuf.Int64Value job_timeout_ms = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this job. You can use these to organize and - // group your jobs. - // Label keys and values can be no longer than 63 characters, can only contain - // lowercase letters, numeric characters, underscores and dashes. - // International characters are allowed. Label values are optional. Label - // keys must start with a letter and each label in the list must have a - // different key. - map labels = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline deleted file mode 100644 index 0cede032b16c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "JobCreationReasonProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Reason about why a Job was created from a -// [`jobs.query`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query) -// method when used with `JOB_CREATION_OPTIONAL` Job creation mode. -// -// For -// [`jobs.insert`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert) -// method calls it will always be `REQUESTED`. -// -// [Preview](https://cloud.google.com/products/#product-launch-stages) -message JobCreationReason { - // Indicates the high level reason why a job was created. - enum Code { - // Reason is not specified. - CODE_UNSPECIFIED = 0; - - // Job creation was requested. - REQUESTED = 1; - - // The query request ran beyond a system defined timeout specified by the - // [timeoutMs field in the - // QueryRequest](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest). - // As a result it was considered a long running operation for which a job - // was created. - LONG_RUNNING = 2; - - // The results from the query cannot fit in the response. - LARGE_RESULTS = 3; - - // BigQuery has determined that the query needs to be executed as a Job. - OTHER = 4; - } - - // Output only. Specifies the high level reason why a Job was created. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_reference.proto.baseline deleted file mode 100644 index d7f3ece6f7f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_reference.proto.baseline +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// A job reference is a fully qualified identifier for referring to a job. -message JobReference { - // Required. The ID of the project containing this job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the job. The ID must contain only letters (a-z, A-Z), - // numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 - // characters. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The geographic location of the job. The default value is US. - // - // For more information about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations - google.protobuf.StringValue location = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // This field should not be used. - repeated string location_alternative = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_stats.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_stats.proto.baseline deleted file mode 100644 index 877e0039291a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_stats.proto.baseline +++ /dev/null @@ -1,1439 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/model.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/row_access_policy_reference.proto"; -import "google/cloud/bigquery/v2/session_info.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobStatsProto"; -option java_package = "com.google.cloud.bigquery.v2"; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; -option (google.api.resource_definition) = { - type: "storage.googleapis.com/Bucket" - pattern: "*" -}; - -// An operation within a stage. -message ExplainQueryStep { - // Machine-readable operation type. - string kind = 1; - - // Human-readable description of the step(s). - repeated string substeps = 2; -} - -// A single stage of query execution. -message ExplainQueryStage { - // Indicates the type of compute mode. - enum ComputeMode { - // ComputeMode type not specified. - COMPUTE_MODE_UNSPECIFIED = 0; - - // This stage was processed using BigQuery slots. - BIGQUERY = 1; - - // This stage was processed using BI Engine compute. - BI_ENGINE = 2; - } - - // Human-readable name for the stage. - string name = 1; - - // Unique ID for the stage within the plan. - google.protobuf.Int64Value id = 2; - - // Stage start time represented as milliseconds since the epoch. - int64 start_ms = 3; - - // Stage end time represented as milliseconds since the epoch. - int64 end_ms = 4; - - // IDs for stages that are inputs to this stage. - repeated int64 input_stages = 5; - - // Relative amount of time the average shard spent waiting to be - // scheduled. - google.protobuf.DoubleValue wait_ratio_avg = 6; - - // Milliseconds the average shard spent waiting to be scheduled. - google.protobuf.Int64Value wait_ms_avg = 7; - - // Relative amount of time the slowest shard spent waiting to be - // scheduled. - google.protobuf.DoubleValue wait_ratio_max = 8; - - // Milliseconds the slowest shard spent waiting to be scheduled. - google.protobuf.Int64Value wait_ms_max = 9; - - // Relative amount of time the average shard spent reading input. - google.protobuf.DoubleValue read_ratio_avg = 10; - - // Milliseconds the average shard spent reading input. - google.protobuf.Int64Value read_ms_avg = 11; - - // Relative amount of time the slowest shard spent reading input. - google.protobuf.DoubleValue read_ratio_max = 12; - - // Milliseconds the slowest shard spent reading input. - google.protobuf.Int64Value read_ms_max = 13; - - // Relative amount of time the average shard spent on CPU-bound tasks. - google.protobuf.DoubleValue compute_ratio_avg = 14; - - // Milliseconds the average shard spent on CPU-bound tasks. - google.protobuf.Int64Value compute_ms_avg = 15; - - // Relative amount of time the slowest shard spent on CPU-bound tasks. - google.protobuf.DoubleValue compute_ratio_max = 16; - - // Milliseconds the slowest shard spent on CPU-bound tasks. - google.protobuf.Int64Value compute_ms_max = 17; - - // Relative amount of time the average shard spent on writing output. - google.protobuf.DoubleValue write_ratio_avg = 18; - - // Milliseconds the average shard spent on writing output. - google.protobuf.Int64Value write_ms_avg = 19; - - // Relative amount of time the slowest shard spent on writing output. - google.protobuf.DoubleValue write_ratio_max = 20; - - // Milliseconds the slowest shard spent on writing output. - google.protobuf.Int64Value write_ms_max = 21; - - // Total number of bytes written to shuffle. - google.protobuf.Int64Value shuffle_output_bytes = 22; - - // Total number of bytes written to shuffle and spilled to disk. - google.protobuf.Int64Value shuffle_output_bytes_spilled = 23; - - // Number of records read into the stage. - google.protobuf.Int64Value records_read = 24; - - // Number of records written by the stage. - google.protobuf.Int64Value records_written = 25; - - // Number of parallel input segments to be processed - google.protobuf.Int64Value parallel_inputs = 26; - - // Number of parallel input segments completed. - google.protobuf.Int64Value completed_parallel_inputs = 27; - - // Current status for this stage. - string status = 28; - - // List of operations within the stage in dependency order (approximately - // chronological). - repeated ExplainQueryStep steps = 29; - - // Slot-milliseconds used by the stage. - google.protobuf.Int64Value slot_ms = 30; - - // Output only. Compute mode for this stage. - ComputeMode compute_mode = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Summary of the state of query execution at a given time. -message QueryTimelineSample { - // Milliseconds elapsed since the start of query execution. - google.protobuf.Int64Value elapsed_ms = 1; - - // Cumulative slot-ms consumed by the query. - google.protobuf.Int64Value total_slot_ms = 2; - - // Total units of work remaining for the query. This number can be revised - // (increased or decreased) while the query is running. - google.protobuf.Int64Value pending_units = 3; - - // Total parallel units of work completed by this query. - google.protobuf.Int64Value completed_units = 4; - - // Total number of active workers. This does not correspond directly to - // slot usage. This is the largest value observed since the last sample. - google.protobuf.Int64Value active_units = 5; - - // Units of work that can be scheduled immediately. Providing additional slots - // for these units of work will accelerate the query, if no other query in - // the reservation needs additional slots. - google.protobuf.Int64Value estimated_runnable_units = 7; -} - -// The external service cost is a portion of the total cost, these costs are not -// additive with total_bytes_billed. Moreover, this field only track external -// service costs that will show up as BigQuery costs (e.g. training BigQuery -// ML job with google cloud CAIP or Automl Tables services), not other costs -// which may be accrued by running the query (e.g. reading from Bigtable or -// Cloud Storage). The external service costs with different billing sku (e.g. -// CAIP job is charged based on VM usage) are converted to BigQuery -// billed_bytes and slot_ms with equivalent amount of US dollars. Services may -// not directly correlate to these metrics, but these are the equivalents for -// billing purposes. -// Output only. -message ExternalServiceCost { - // External service name. - string external_service = 1; - - // External service cost in terms of bigquery bytes processed. - google.protobuf.Int64Value bytes_processed = 2; - - // External service cost in terms of bigquery bytes billed. - google.protobuf.Int64Value bytes_billed = 3; - - // External service cost in terms of bigquery slot milliseconds. - google.protobuf.Int64Value slot_ms = 4; - - // Non-preemptable reserved slots used for external job. - // For example, reserved slots for Cloua AI Platform job are the VM usages - // converted to BigQuery slot with equivalent mount of price. - int64 reserved_slot_count = 5; -} - -// Statistics for the EXPORT DATA statement as part of Query Job. EXTRACT -// JOB statistics are populated in JobStatistics4. -message ExportDataStatistics { - // Number of destination files generated in case of EXPORT DATA - // statement only. - google.protobuf.Int64Value file_count = 1; - - // [Alpha] Number of destination rows generated in case of EXPORT DATA - // statement only. - google.protobuf.Int64Value row_count = 2; -} - -// Reason why BI Engine didn't accelerate the query (or sub-query). -message BiEngineReason { - // Indicates the high-level reason for no/partial acceleration - enum Code { - // BiEngineReason not specified. - CODE_UNSPECIFIED = 0; - - // No reservation available for BI Engine acceleration. - NO_RESERVATION = 1; - - // Not enough memory available for BI Engine acceleration. - INSUFFICIENT_RESERVATION = 2; - - // This particular SQL text is not supported for acceleration by BI Engine. - UNSUPPORTED_SQL_TEXT = 4; - - // Input too large for acceleration by BI Engine. - INPUT_TOO_LARGE = 5; - - // Catch-all code for all other cases for partial or disabled acceleration. - OTHER_REASON = 6; - - // One or more tables were not eligible for BI Engine acceleration. - TABLE_EXCLUDED = 7; - } - - // Output only. High-level BI Engine reason for partial or disabled - // acceleration - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Free form human-readable reason for partial or disabled - // acceleration. - string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a BI Engine specific query. -// Populated as part of JobStatistics2 -message BiEngineStatistics { - // Indicates the type of BI Engine acceleration. - enum BiEngineMode { - // BiEngineMode type not specified. - ACCELERATION_MODE_UNSPECIFIED = 0; - - // BI Engine disabled the acceleration. bi_engine_reasons - // specifies a more detailed reason. - DISABLED = 1; - - // Part of the query was accelerated using BI Engine. - // See bi_engine_reasons for why parts of the query were not - // accelerated. - PARTIAL = 2; - - // All of the query was accelerated using BI Engine. - FULL = 3; - } - - // Indicates the type of BI Engine acceleration. - enum BiEngineAccelerationMode { - // BiEngineMode type not specified. - BI_ENGINE_ACCELERATION_MODE_UNSPECIFIED = 0; - - // BI Engine acceleration was attempted but disabled. bi_engine_reasons - // specifies a more detailed reason. - BI_ENGINE_DISABLED = 1; - - // Some inputs were accelerated using BI Engine. - // See bi_engine_reasons for why parts of the query were not - // accelerated. - PARTIAL_INPUT = 2; - - // All of the query inputs were accelerated using BI Engine. - FULL_INPUT = 3; - - // All of the query was accelerated using BI Engine. - FULL_QUERY = 4; - } - - // Output only. Specifies which mode of BI Engine acceleration was performed - // (if any). - BiEngineMode bi_engine_mode = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Specifies which mode of BI Engine acceleration was performed - // (if any). - BiEngineAccelerationMode acceleration_mode = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // In case of DISABLED or PARTIAL bi_engine_mode, these contain the - // explanatory reasons as to why BI Engine could not accelerate. - // In case the full query was accelerated, this field is not populated. - repeated BiEngineReason bi_engine_reasons = 2; -} - -// Reason about why no search index was used in the search query (or -// sub-query). -message IndexUnusedReason { - // Indicates the high-level reason for the scenario when no search index was - // used. - enum Code { - // Code not specified. - CODE_UNSPECIFIED = 0; - - // Indicates the search index configuration has not been created. - INDEX_CONFIG_NOT_AVAILABLE = 1; - - // Indicates the search index creation has not been completed. - PENDING_INDEX_CREATION = 2; - - // Indicates the base table has been truncated (rows have been removed - // from table with TRUNCATE TABLE statement) since the last time the search - // index was refreshed. - BASE_TABLE_TRUNCATED = 3; - - // Indicates the search index configuration has been changed since the last - // time the search index was refreshed. - INDEX_CONFIG_MODIFIED = 4; - - // Indicates the search query accesses data at a timestamp before the last - // time the search index was refreshed. - TIME_TRAVEL_QUERY = 5; - - // Indicates the usage of search index will not contribute to any pruning - // improvement for the search function, e.g. when the search predicate is in - // a disjunction with other non-search predicates. - NO_PRUNING_POWER = 6; - - // Indicates the search index does not cover all fields in the search - // function. - UNINDEXED_SEARCH_FIELDS = 7; - - // Indicates the search index does not support the given search query - // pattern. - UNSUPPORTED_SEARCH_PATTERN = 8; - - // Indicates the query has been optimized by using a materialized view. - OPTIMIZED_WITH_MATERIALIZED_VIEW = 9; - - // Indicates the query has been secured by data masking, and thus search - // indexes are not applicable. - SECURED_BY_DATA_MASKING = 11; - - // Indicates that the search index and the search function call do not - // have the same text analyzer. - MISMATCHED_TEXT_ANALYZER = 12; - - // Indicates the base table is too small (below a certain threshold). - // The index does not provide noticeable search performance gains - // when the base table is too small. - BASE_TABLE_TOO_SMALL = 13; - - // Indicates that the total size of indexed base tables in your organization - // exceeds your region's limit and the index is not used in the query. To - // index larger base tables, you can - // use - // your own reservation for index-management jobs. - BASE_TABLE_TOO_LARGE = 14; - - // Indicates that the estimated performance gain from using the search index - // is too low for the given search query. - ESTIMATED_PERFORMANCE_GAIN_TOO_LOW = 15; - - // Indicates that search indexes can not be used for search query with - // STANDARD edition. - NOT_SUPPORTED_IN_STANDARD_EDITION = 17; - - // Indicates that an option in the search function that cannot make use of - // the index has been selected. - INDEX_SUPPRESSED_BY_FUNCTION_OPTION = 18; - - // Indicates that the query was cached, and thus the search index was not - // used. - QUERY_CACHE_HIT = 19; - - // The index cannot be used in the search query because it is stale. - STALE_INDEX = 20; - - // Indicates an internal error that causes the search index to be unused. - INTERNAL_ERROR = 10; - - // Indicates that the reason search indexes cannot be used in the query is - // not covered by any of the other IndexUnusedReason options. - OTHER_REASON = 16; - } - - // Specifies the high-level reason for the scenario when no search index was - // used. - optional Code code = 1; - - // Free form human-readable reason for the scenario when no search index was - // used. - optional string message = 2; - - // Specifies the base table involved in the reason that no search index was - // used. - optional TableReference base_table = 3; - - // Specifies the name of the unused search index, if available. - optional string index_name = 4; -} - -// Statistics for a search query. -// Populated as part of JobStatistics2. -message SearchStatistics { - // Indicates the type of search index usage in the entire search query. - enum IndexUsageMode { - // Index usage mode not specified. - INDEX_USAGE_MODE_UNSPECIFIED = 0; - - // No search indexes were used in the search query. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for detailed reasons. - UNUSED = 1; - - // Part of the search query used search indexes. See [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for why other parts of the query did not use search indexes. - PARTIALLY_USED = 2; - - // The entire search query used search indexes. - FULLY_USED = 4; - } - - // Specifies the index usage mode for the query. - IndexUsageMode index_usage_mode = 1; - - // When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains - // why indexes were not used in all or part of the search query. If - // `indexUsageMode` is `FULLY_USED`, this field is not populated. - repeated IndexUnusedReason index_unused_reasons = 2; -} - -// Statistics for a vector search query. -// Populated as part of JobStatistics2. -message VectorSearchStatistics { - // Indicates the type of vector index usage in the entire vector search query. - enum IndexUsageMode { - // Index usage mode not specified. - INDEX_USAGE_MODE_UNSPECIFIED = 0; - - // No vector indexes were used in the vector search query. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for detailed reasons. - UNUSED = 1; - - // Part of the vector search query used vector indexes. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for why other parts of the query did not use vector indexes. - PARTIALLY_USED = 2; - - // The entire vector search query used vector indexes. - FULLY_USED = 4; - } - - // Specifies the index usage mode for the query. - IndexUsageMode index_usage_mode = 1; - - // When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains - // why indexes were not used in all or part of the vector search query. If - // `indexUsageMode` is `FULLY_USED`, this field is not populated. - repeated IndexUnusedReason index_unused_reasons = 2; -} - -// Query optimization information for a QUERY job. -message QueryInfo { - // Output only. Information about query optimizations. - google.protobuf.Struct optimization_details = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a LOAD query. -message LoadQueryStatistics { - // Output only. Number of source files in a LOAD query. - google.protobuf.Int64Value input_files = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of bytes of source data in a LOAD query. - google.protobuf.Int64Value input_file_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of rows imported in a LOAD query. - // Note that while a LOAD query is in the running state, this value may - // change. - google.protobuf.Int64Value output_rows = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Size of the loaded data in bytes. Note that while a LOAD query - // is in the running state, this value may change. - google.protobuf.Int64Value output_bytes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of bad records encountered while processing a LOAD - // query. Note that if the job has failed because of more bad records - // encountered than the maximum allowed in the load job configuration, then - // this number can be less than the total number of bad records present in the - // input data. - google.protobuf.Int64Value bad_records = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a query job. -message JobStatistics2 { - // Output only. Describes execution plan for the query. - repeated ExplainQueryStage query_plan = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The original estimate of bytes processed for the job. - google.protobuf.Int64Value estimated_bytes_processed = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total number of partitions processed from all partitioned - // tables referenced in the job. - google.protobuf.Int64Value total_partitions_processed = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes processed for the job. - google.protobuf.Int64Value total_bytes_processed = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. For dry-run jobs, totalBytesProcessed is an estimate and this - // field specifies the accuracy of the estimate. Possible values can be: - // UNKNOWN: accuracy of the estimate is unknown. - // PRECISE: estimate is precise. - // LOWER_BOUND: estimate is lower bound of what the query would cost. - // UPPER_BOUND: estimate is upper bound of what the query would cost. - string total_bytes_processed_accuracy = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If the project is configured to use on-demand pricing, - // then this field contains the total bytes billed for the job. - // If the project is configured to use flat-rate pricing, then you are - // not billed for bytes and this field is informational only. - google.protobuf.Int64Value total_bytes_billed = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Billing tier for the job. This is a BigQuery-specific concept - // which is not related to the Google Cloud notion of "free tier". The value - // here is a measure of the query's resource consumption relative to the - // amount of data scanned. For on-demand queries, the limit is 100, and all - // queries within this limit are billed at the standard on-demand rates. - // On-demand queries that exceed this limit will fail with a - // billingTierLimitExceeded error. - google.protobuf.Int32Value billing_tier = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Slot-milliseconds for the job. - google.protobuf.Int64Value total_slot_ms = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced tables for the job. Queries that reference more - // than 50 tables will not have a complete list. - repeated TableReference referenced_tables = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced routines for the job. - repeated RoutineReference referenced_routines = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The schema of the results. Present only for successful dry - // run of non-legacy SQL queries. - TableSchema schema = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of rows affected by a DML statement. Present - // only for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, - // MERGE or TRUNCATE. - DmlStats dml_stats = 32 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. GoogleSQL only: list of undeclared query - // parameters detected during a dry run validation. - repeated QueryParameter undeclared_query_parameters = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of query statement, if valid. - // Possible values: - // - // * `SELECT`: - // [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list) - // statement. - // * `ASSERT`: - // [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert) - // statement. - // * `INSERT`: - // [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement) - // statement. - // * `UPDATE`: - // [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#update_statement) - // statement. - // * `DELETE`: - // [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) - // statement. - // * `MERGE`: - // [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) - // statement. - // * `CREATE_TABLE`: [`CREATE - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement) - // statement, without `AS SELECT`. - // * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS - // SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#query_statement) - // statement. - // * `CREATE_VIEW`: [`CREATE - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement) - // statement. - // * `CREATE_MODEL`: [`CREATE - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement) - // statement. - // * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement) - // statement. - // * `CREATE_FUNCTION`: [`CREATE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement) - // statement. - // * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement) - // statement. - // * `CREATE_PROCEDURE`: [`CREATE - // PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure) - // statement. - // * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS - // POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement) - // statement. - // * `CREATE_SCHEMA`: [`CREATE - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement) - // statement. - // * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement) - // statement. - // * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH - // INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement) - // statement. - // * `DROP_TABLE`: [`DROP - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement) - // statement. - // * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement) - // statement. - // * `DROP_VIEW`: [`DROP - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement) - // statement. - // * `DROP_MODEL`: [`DROP - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model) - // statement. - // * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement) - // statement. - // * `DROP_FUNCTION` : [`DROP - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement) - // statement. - // * `DROP_TABLE_FUNCTION` : [`DROP TABLE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function) - // statement. - // * `DROP_PROCEDURE`: [`DROP - // PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement) - // statement. - // * `DROP_SEARCH_INDEX`: [`DROP SEARCH - // INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index) - // statement. - // * `DROP_SCHEMA`: [`DROP - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement) - // statement. - // * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement) - // statement. - // * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS - // POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement) - // statement. - // * `ALTER_TABLE`: [`ALTER - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement) - // statement. - // * `ALTER_VIEW`: [`ALTER - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement) - // statement. - // * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement) - // statement. - // * `ALTER_SCHEMA`: [`ALTER - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#aalter_schema_set_options_statement) - // statement. - // * `SCRIPT`: - // [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language). - // * `TRUNCATE_TABLE`: [`TRUNCATE - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement) - // statement. - // * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement) - // statement. - // * `EXPORT_DATA`: [`EXPORT - // DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement) - // statement. - // * `EXPORT_MODEL`: [`EXPORT - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model) - // statement. - // * `LOAD_DATA`: [`LOAD - // DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement) - // statement. - // * `CALL`: - // [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call) - // statement. - string statement_type = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL operation performed, possibly - // dependent on the pre-existence of the DDL target. - string ddl_operation_performed = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target table. Present only for - // CREATE/DROP TABLE/VIEW and DROP ALL ROW ACCESS POLICIES queries. - TableReference ddl_target_table = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The table after rename. Present only for ALTER TABLE RENAME TO - // query. - TableReference ddl_destination_table = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target row access policy. Present only for - // CREATE/DROP ROW ACCESS POLICY queries. - RowAccessPolicyReference ddl_target_row_access_policy = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of row access policies affected by a DDL statement. - // Present only for DROP ALL ROW ACCESS POLICIES queries. - google.protobuf.Int64Value ddl_affected_row_access_policy_count = 27 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Beta] The DDL target routine. Present only for - // CREATE/DROP FUNCTION/PROCEDURE queries. - RoutineReference ddl_target_routine = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target dataset. Present only for CREATE/ALTER/DROP - // SCHEMA(dataset) queries. - DatasetReference ddl_target_dataset = 30 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of a BigQuery ML training job. - MlStatistics ml_statistics = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Stats for EXPORT DATA statement. - ExportDataStatistics export_data_statistics = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Job cost breakdown as bigquery internal cost and external - // service costs. - repeated ExternalServiceCost external_service_costs = 28 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. BI Engine specific Statistics. - BiEngineStatistics bi_engine_statistics = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a LOAD query. - LoadQueryStatistics load_query_statistics = 33 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced table for DCL statement. - TableReference dcl_target_table = 34 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced view for DCL statement. - TableReference dcl_target_view = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced dataset for DCL statement. - DatasetReference dcl_target_dataset = 36 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Search query specific statistics. - SearchStatistics search_statistics = 37 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Vector Search query specific statistics. - VectorSearchStatistics vector_search_statistics = 44 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Performance insights. - PerformanceInsights performance_insights = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Query optimization information for a QUERY job. - QueryInfo query_info = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of a Spark procedure job. - SparkStatistics spark_statistics = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes transferred for cross-cloud queries such as Cross - // Cloud Transfer and CREATE TABLE AS SELECT (CTAS). - google.protobuf.Int64Value transferred_bytes = 41 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of materialized views of a query job. - MaterializedViewStatistics materialized_view_statistics = 42 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of metadata cache usage in a query for BigLake - // tables. - MetadataCacheStatistics metadata_cache_statistics = 43 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a load job. -message JobStatistics3 { - // Output only. Number of source files in a load job. - google.protobuf.Int64Value input_files = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of bytes of source data in a load job. - google.protobuf.Int64Value input_file_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of rows imported in a load job. - // Note that while an import job is in the running state, this - // value may change. - google.protobuf.Int64Value output_rows = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Size of the loaded data in bytes. Note - // that while a load job is in the running state, this value may change. - google.protobuf.Int64Value output_bytes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of bad records encountered. Note that if the job - // has failed because of more bad records encountered than the maximum - // allowed in the load job configuration, then this number can be less than - // the total number of bad records present in the input data. - google.protobuf.Int64Value bad_records = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for an extract job. -message JobStatistics4 { - // Output only. Number of files per destination URI or URI pattern - // specified in the extract configuration. These values will be in the same - // order as the URIs specified in the 'destinationUris' field. - repeated int64 destination_uri_file_counts = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of user bytes extracted into the result. This is the - // byte count as computed by BigQuery for billing purposes - // and doesn't have any relationship with the number of actual - // result bytes extracted in the desired format. - google.protobuf.Int64Value input_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a copy job. -message CopyJobStatistics { - // Output only. Number of rows copied to the destination table. - google.protobuf.Int64Value copied_rows = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes copied to the destination table. - google.protobuf.Int64Value copied_logical_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Job statistics specific to a BigQuery ML training job. -message MlStatistics { - // Training type. - enum TrainingType { - // Unspecified training type. - TRAINING_TYPE_UNSPECIFIED = 0; - - // Single training with fixed parameter space. - SINGLE_TRAINING = 1; - - // [Hyperparameter tuning - // training](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview). - HPARAM_TUNING = 2; - } - - // Output only. Maximum number of iterations specified as max_iterations in - // the 'CREATE MODEL' query. The actual number of iterations may be less than - // this number due to early stop. - int64 max_iterations = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Results for all completed iterations. - // Empty for [hyperparameter tuning - // jobs](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview). - repeated Model.TrainingRun.IterationResult iteration_results = 2; - - // Output only. The type of the model that is being trained. - Model.ModelType model_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Training type of the job. - TrainingType training_type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Trials of a [hyperparameter tuning - // job](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // sorted by trial_id. - repeated Model.HparamTuningTrial hparam_trials = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Job statistics specific to the child job of a script. -message ScriptStatistics { - // Describes how the job is evaluated. - enum EvaluationKind { - // Default value. - EVALUATION_KIND_UNSPECIFIED = 0; - - // The statement appears directly in the script. - STATEMENT = 1; - - // The statement evaluates an expression that appears in the script. - EXPRESSION = 2; - } - - // Represents the location of the statement/expression being evaluated. - // Line and column numbers are defined as follows: - // - // - Line and column numbers start with one. That is, line 1 column 1 denotes - // the start of the script. - // - When inside a stored procedure, all line/column numbers are relative - // to the procedure body, not the script in which the procedure was defined. - // - Start/end positions exclude leading/trailing comments and whitespace. - // The end position always ends with a ";", when present. - // - Multi-byte Unicode characters are treated as just one column. - // - If the original script (or procedure definition) contains TAB characters, - // a tab "snaps" the indentation forward to the nearest multiple of 8 - // characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8 - // will advance the next character to column 9. A TAB on column 9, 10, 11, - // 12, 13, 14, 15, or 16 will advance the next character to column 17. - message ScriptStackFrame { - // Output only. One-based start line. - int32 start_line = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based start column. - int32 start_column = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based end line. - int32 end_line = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based end column. - int32 end_column = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the active procedure, empty if in a top-level - // script. - string procedure_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Text of the current statement/expression. - string text = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Whether this child job was a statement or expression. - EvaluationKind evaluation_kind = 1; - - // Stack trace showing the line/column/procedure name of each frame on the - // stack at the point where the current evaluation happened. The leaf frame - // is first, the primary script is last. Never empty. - repeated ScriptStackFrame stack_frames = 2; -} - -// Statistics for row-level security. -message RowLevelSecurityStatistics { - // Whether any accessed data was protected by row access policies. - bool row_level_security_applied = 1; -} - -// Statistics for data-masking. -message DataMaskingStatistics { - // Whether any accessed data was protected by the data masking. - bool data_masking_applied = 1; -} - -// Statistics for a single job execution. -message JobStatistics { - // [Alpha] Information of a multi-statement transaction. - message TransactionInfo { - // Output only. [Alpha] Id of the transaction. - string transaction_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Creation time of this job, in milliseconds since the epoch. - // This field will be present on all jobs. - int64 creation_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Start time of this job, in milliseconds since the epoch. - // This field will be present when the job transitions from the PENDING state - // to either RUNNING or DONE. - int64 start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. End time of this job, in milliseconds since the epoch. This - // field will be present whenever a job is in the DONE state. - int64 end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes processed for the job. - google.protobuf.Int64Value total_bytes_processed = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [TrustedTester] Job progress (0.0 -> 1.0) for LOAD and - // EXTRACT jobs. - google.protobuf.DoubleValue completion_ratio = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Quotas which delayed this job's start time. - repeated string quota_deferments = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a query job. - JobStatistics2 query = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a load job. - JobStatistics3 load = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for an extract job. - JobStatistics4 extract = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a copy job. - CopyJobStatistics copy = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Slot-milliseconds for the job. - google.protobuf.Int64Value total_slot_ms = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the primary reservation assigned to this job. Note - // that this could be different than reservations reported in the reservation - // usage field if parent reservations were used to execute this job. - string reservation_id = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of child jobs executed. - int64 num_child_jobs = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this is a child job, specifies the job ID of the parent. - string parent_job_id = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this a child job of a script, specifies information about - // the context of this job within the script. - ScriptStatistics script_statistics = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for row-level security. Present only for query and - // extract jobs. - RowLevelSecurityStatistics row_level_security_statistics = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for data-masking. Present only for query and - // extract jobs. - DataMaskingStatistics data_masking_statistics = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Alpha] Information of the multi-statement transaction if this - // job is part of one. - // - // This property is only expected on a child job or a job that is in a - // session. A script parent job is not part of the transaction started in the - // script. - TransactionInfo transaction_info = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information of the session if this job is part of one. - SessionInfo session_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The duration in milliseconds of the execution of the final - // attempt of this job, as BigQuery may internally re-attempt to execute the - // job. - int64 final_execution_duration_ms = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of edition corresponding to the reservation for this job - // at the time of this update. - ReservationEdition edition = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Detailed statistics for DML statements -message DmlStats { - // Output only. Number of inserted Rows. Populated by DML INSERT and MERGE - // statements - google.protobuf.Int64Value inserted_row_count = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of deleted Rows. populated by DML DELETE, MERGE and - // TRUNCATE statements. - google.protobuf.Int64Value deleted_row_count = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of updated Rows. Populated by DML UPDATE and MERGE - // statements. - google.protobuf.Int64Value updated_row_count = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Performance insights for the job. -message PerformanceInsights { - // Output only. Average execution ms of previous runs. Indicates the job ran - // slow compared to previous executions. To find previous executions, use - // INFORMATION_SCHEMA tables and filter jobs with same query hash. - int64 avg_previous_execution_ms = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Standalone query stage performance insights, for exploring - // potential improvements. - repeated StagePerformanceStandaloneInsight - stage_performance_standalone_insights = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Query stage performance insights compared to previous runs, - // for diagnosing performance regression. - repeated StagePerformanceChangeInsight stage_performance_change_insights = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Performance insights compared to the previous executions for a specific -// stage. -message StagePerformanceChangeInsight { - // Output only. The stage id that the insight mapped to. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Input data change insight of the query stage. - optional InputDataChange input_data_change = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Details about the input data change insight. -message InputDataChange { - // Output only. Records read difference percentage compared to a previous run. - float records_read_diff_percentage = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Standalone performance insights for a specific stage. -message StagePerformanceStandaloneInsight { - // Output only. The stage id that the insight mapped to. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the stage has a slot contention issue. - optional bool slot_contention = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the stage has insufficient shuffle quota. - optional bool insufficient_shuffle_quota = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If present, the stage had the following reasons for being - // disqualified from BI Engine execution. - repeated BiEngineReason bi_engine_reasons = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. High cardinality joins in the stage. - repeated HighCardinalityJoin high_cardinality_joins = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Partition skew in the stage. - optional PartitionSkew partition_skew = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// High cardinality join detailed information. -message HighCardinalityJoin { - // Output only. Count of left input rows. - int64 left_rows = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Count of right input rows. - int64 right_rows = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Count of the output rows. - int64 output_rows = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The index of the join operator in the ExplainQueryStep lists. - int32 step_index = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Partition skew detailed information. -message PartitionSkew { - // Details about source stages which produce skewed data. - message SkewSource { - // Output only. Stage id of the skew source stage. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Source stages which produce skewed data. - repeated SkewSource skew_sources = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a BigSpark query. -// Populated as part of JobStatistics2 -message SparkStatistics { - // Spark job logs can be filtered by these fields in Cloud Logging. - message LoggingInfo { - // Output only. Resource type used for logging. - string resource_type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Project ID where the Spark logs were written. - string project_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Spark job ID if a Spark job is created successfully. - optional string spark_job_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Location where the Spark job is executed. - // A location is selected by BigQueury for jobs configured to run in a - // multi-region. - optional string spark_job_location = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Endpoints returned from Dataproc. - // Key list: - // - history_server_endpoint: A link to Spark job UI. - map endpoints = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Logging info is used to generate a link to Cloud Logging. - optional LoggingInfo logging_info = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Cloud KMS encryption key that is used to protect the - // resources created by the Spark job. If the Spark procedure uses the invoker - // security mode, the Cloud KMS encryption key is either inferred from the - // provided system variable, - // `@@spark_proc_properties.kms_key_name`, or the default key of the BigQuery - // job's project (if the CMEK organization policy is enforced). Otherwise, the - // Cloud KMS key is either inferred from the Spark connection associated with - // the procedure (if it is provided), or from the default key of the Spark - // connection's project if the CMEK organization policy is enforced. - // - // Example: - // - // * `projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]` - optional string kms_key_name = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Output only. The Google Cloud Storage bucket that is used as the default - // file system by the Spark application. This field is only filled when the - // Spark procedure uses the invoker security mode. The `gcsStagingBucket` - // bucket is inferred from the `@@spark_proc_properties.staging_bucket` system - // variable (if it is provided). Otherwise, BigQuery creates a default staging - // bucket for the job and returns the bucket name in this field. - // - // Example: - // - // * `gs://[bucket_name]` - optional string gcs_staging_bucket = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" } - ]; -} - -// Statistics of materialized views considered in a query job. -message MaterializedViewStatistics { - // Materialized views considered for the query job. Only certain materialized - // views are used. For a detailed list, see the child message. - // - // If many materialized views are considered, then the list might be - // incomplete. - repeated MaterializedView materialized_view = 1; -} - -// A materialized view considered for a query job. -message MaterializedView { - // Reason why a materialized view was not chosen for a query. For more - // information, see [Understand why materialized views were - // rejected](https://cloud.google.com/bigquery/docs/materialized-views-use#understand-rejected). - enum RejectedReason { - // Default unspecified value. - REJECTED_REASON_UNSPECIFIED = 0; - - // View has no cached data because it has not refreshed yet. - NO_DATA = 1; - - // The estimated cost of the view is more expensive than another view or the - // base table. - // - // Note: The estimate cost might not match the billed cost. - COST = 2; - - // View has no cached data because a base table is truncated. - BASE_TABLE_TRUNCATED = 3; - - // View is invalidated because of a data change in one or more base tables. - // It could be any recent change if the - // [`max_staleness`](https://cloud.google.com/bigquery/docs/materialized-views-create#max_staleness) - // option is not set for the view, or otherwise any change outside of the - // staleness window. - BASE_TABLE_DATA_CHANGE = 4; - - // View is invalidated because a base table's partition expiration has - // changed. - BASE_TABLE_PARTITION_EXPIRATION_CHANGE = 5; - - // View is invalidated because a base table's partition has expired. - BASE_TABLE_EXPIRED_PARTITION = 6; - - // View is invalidated because a base table has an incompatible metadata - // change. - BASE_TABLE_INCOMPATIBLE_METADATA_CHANGE = 7; - - // View is invalidated because it was refreshed with a time zone other than - // that of the current job. - TIME_ZONE = 8; - - // View is outside the time travel window. - OUT_OF_TIME_TRAVEL_WINDOW = 9; - - // View is inaccessible to the user because of a fine-grained security - // policy on one of its base tables. - BASE_TABLE_FINE_GRAINED_SECURITY_POLICY = 10; - - // One of the view's base tables is too stale. For example, the cached - // metadata of a BigLake external table needs to be updated. - BASE_TABLE_TOO_STALE = 11; - } - - // The candidate materialized view. - optional TableReference table_reference = 1; - - // Whether the materialized view is chosen for the query. - // - // A materialized view can be chosen to rewrite multiple parts of the same - // query. If a materialized view is chosen to rewrite any part of the query, - // then this field is true, even if the materialized view was not chosen to - // rewrite others parts. - optional bool chosen = 2; - - // If present, specifies a best-effort estimation of the bytes saved by using - // the materialized view rather than its base tables. - optional int64 estimated_bytes_saved = 3; - - // If present, specifies the reason why the materialized view was not chosen - // for the query. - optional RejectedReason rejected_reason = 4; -} - -// Table level detail on the usage of metadata caching. Only set for Metadata -// caching eligible tables referenced in the query. -message TableMetadataCacheUsage { - // Reasons for not using metadata caching. - enum UnusedReason { - // Unused reasons not specified. - UNUSED_REASON_UNSPECIFIED = 0; - - // Metadata cache was outside the table's maxStaleness. - EXCEEDED_MAX_STALENESS = 1; - - // Metadata caching feature is not enabled. [Update BigLake tables] - // (/bigquery/docs/create-cloud-storage-table-biglake#update-biglake-tables) - // to enable the metadata caching. - METADATA_CACHING_NOT_ENABLED = 3; - - // Other unknown reason. - OTHER_REASON = 2; - } - - // Metadata caching eligible table referenced in the query. - optional TableReference table_reference = 1; - - // Reason for not using metadata caching for the table. - optional UnusedReason unused_reason = 2; - - // Free form human-readable reason metadata caching was unused for - // the job. - optional string explanation = 3; - - // Duration since last refresh as of this job for managed tables (indicates - // metadata cache staleness as seen by this job). - google.protobuf.Duration staleness = 5; - - // [Table - // type](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.type). - string table_type = 6; -} - -// Statistics for metadata caching in BigLake tables. -message MetadataCacheStatistics { - // Set for the Metadata caching eligible tables referenced in the query. - repeated TableMetadataCacheUsage table_metadata_cache_usage = 1; -} - -// The type of editions. -// Different features and behaviors are provided to different editions -// Capacity commitments and reservations are linked to editions. -enum ReservationEdition { - // Default value, which will be treated as ENTERPRISE. - RESERVATION_EDITION_UNSPECIFIED = 0; - - // Standard edition. - STANDARD = 1; - - // Enterprise edition. - ENTERPRISE = 2; - - // Enterprise plus edition. - ENTERPRISE_PLUS = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_status.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_status.proto.baseline deleted file mode 100644 index 71f0a33dcb9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/job_status.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/error.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobStatusProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message JobStatus { - // Output only. Final error result of the job. If present, indicates that the - // job has completed and was unsuccessful. - ErrorProto error_result = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The first errors encountered during the running of the job. - // The final message includes the number of errors that caused the process to - // stop. Errors here do not necessarily mean that the job has not completed or - // was unsuccessful. - repeated ErrorProto errors = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Running state of the job. Valid states include 'PENDING', - // 'RUNNING', and 'DONE'. - string state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/json_extension.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/json_extension.proto.baseline deleted file mode 100644 index 49338d7466aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/json_extension.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "JsonExtensionProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Used to indicate that a JSON variant, rather than normal JSON, is being used -// as the source_format. This should only be used in combination with the -// JSON source format. -enum JsonExtension { - // The default if provided value is not one included in the enum, or the value - // is not specified. The source formate is parsed without any modification. - JSON_EXTENSION_UNSPECIFIED = 0; - - // Use GeoJSON variant of JSON. See https://tools.ietf.org/html/rfc7946. - GEOJSON = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline deleted file mode 100644 index 391bd5ae4331..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "LocationMetadataProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// BigQuery-specific metadata about a location. This will be set on -// google.cloud.location.Location.metadata in Cloud Location API -// responses. -message LocationMetadata { - // The legacy BigQuery location ID, e.g. “EU” for the “europe” location. - // This is for any API consumers that need the legacy “US” and “EU” locations. - string legacy_location_id = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline deleted file mode 100644 index dc66e7d7abe8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "MapTargetTypeProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Indicates the map target type. Only applies to parquet maps. -enum MapTargetType { - // In this mode, the map will have the following schema: - // struct map_field_name { repeated struct key_value { key value } }. - MAP_TARGET_TYPE_UNSPECIFIED = 0; - - // In this mode, the map will have the following schema: - // repeated struct map_field_name { key value }. - ARRAY_OF_STRUCT = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model.proto.baseline deleted file mode 100644 index dc3311876100..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model.proto.baseline +++ /dev/null @@ -1,2040 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/model_reference.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ModelProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Model Service. -// -// It should not be relied on for production use cases at this time. -service ModelService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified model resource by model ID. - rpc GetModel(GetModelRequest) returns (Model) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - }; - option (google.api.method_signature) = "project_id,dataset_id,model_id"; - } - - // Lists all models in the specified dataset. Requires the READER dataset - // role. After retrieving the list of models, you can get information about a - // particular model by calling the models.get method. - rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models" - }; - option (google.api.method_signature) = "project_id,dataset_id,max_results"; - } - - // Patch specific fields in the specified model. - rpc PatchModel(PatchModelRequest) returns (Model) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - body: "model" - }; - option (google.api.method_signature) = - "project_id,dataset_id,model_id,model"; - } - - // Deletes the model specified by modelId from the dataset. - rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - }; - option (google.api.method_signature) = "project_id,dataset_id,model_id"; - } -} - -// Remote Model Info -message RemoteModelInfo { - // Supported service type for remote model. - enum RemoteServiceType { - // Unspecified remote service type. - REMOTE_SERVICE_TYPE_UNSPECIFIED = 0; - - // V3 Cloud AI Translation API. See more details at [Cloud Translation API] - // (https://cloud.google.com/translate/docs/reference/rest). - CLOUD_AI_TRANSLATE_V3 = 1; - - // V1 Cloud AI Vision API See more details at [Cloud Vision API] - // (https://cloud.google.com/vision/docs/reference/rest). - CLOUD_AI_VISION_V1 = 2; - - // V1 Cloud AI Natural Language API. See more details at [REST Resource: - // documents](https://cloud.google.com/natural-language/docs/reference/rest/v1/documents). - CLOUD_AI_NATURAL_LANGUAGE_V1 = 3; - - // V2 Speech-to-Text API. See more details at [Google Cloud Speech-to-Text - // V2 API](https://cloud.google.com/speech-to-text/v2/docs) - CLOUD_AI_SPEECH_TO_TEXT_V2 = 7; - } - - // Remote services are services outside of BigQuery used by remote models for - // predictions. A remote service is backed by either an arbitrary endpoint or - // a selected remote service type, but not both. - oneof remote_service { - // Output only. The endpoint for remote model. - string endpoint = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The remote service type for remote model. - RemoteServiceType remote_service_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Fully qualified name of the user-provided connection object of - // the remote model. Format: - // ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"``` - string connection = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Max number of rows in each batch sent to the remote service. - // If unset, the number of rows in each batch is set dynamically. - int64 max_batching_rows = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The model version for LLM. - string remote_model_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the speech recognizer to use for speech - // recognition. The expected format is - // `projects/{project}/locations/{location}/recognizers/{recognizer}`. - // Customers can specify this field at model creation. If not specified, a - // default recognizer `projects/{model - // project}/locations/global/recognizers/_` will be used. See more details at - // [recognizers](https://cloud.google.com/speech-to-text/v2/docs/reference/rest/v2/projects.locations.recognizers) - string speech_recognizer = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about a single transform column. -message TransformColumn { - // Output only. Name of the column. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Data type of the column after the transform. - StandardSqlDataType type = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The SQL expression used in the column transform. - string transform_sql = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message Model { - // Indicates the type of the Model. - enum ModelType { - // Default value. - MODEL_TYPE_UNSPECIFIED = 0; - - // Linear regression model. - LINEAR_REGRESSION = 1; - - // Logistic regression based classification model. - LOGISTIC_REGRESSION = 2; - - // K-means clustering model. - KMEANS = 3; - - // Matrix factorization model. - MATRIX_FACTORIZATION = 4; - - // DNN classifier model. - DNN_CLASSIFIER = 5; - - // An imported TensorFlow model. - TENSORFLOW = 6; - - // DNN regressor model. - DNN_REGRESSOR = 7; - - // An imported XGBoost model. - XGBOOST = 8; - - // Boosted tree regressor model. - BOOSTED_TREE_REGRESSOR = 9; - - // Boosted tree classifier model. - BOOSTED_TREE_CLASSIFIER = 10; - - // ARIMA model. - ARIMA = 11; - - // AutoML Tables regression model. - AUTOML_REGRESSOR = 12; - - // AutoML Tables classification model. - AUTOML_CLASSIFIER = 13; - - // Prinpical Component Analysis model. - PCA = 14; - - // Wide-and-deep classifier model. - DNN_LINEAR_COMBINED_CLASSIFIER = 16; - - // Wide-and-deep regressor model. - DNN_LINEAR_COMBINED_REGRESSOR = 17; - - // Autoencoder model. - AUTOENCODER = 18; - - // New name for the ARIMA model. - ARIMA_PLUS = 19; - - // ARIMA with external regressors. - ARIMA_PLUS_XREG = 23; - - // Random forest regressor model. - RANDOM_FOREST_REGRESSOR = 24; - - // Random forest classifier model. - RANDOM_FOREST_CLASSIFIER = 25; - - // An imported TensorFlow Lite model. - TENSORFLOW_LITE = 26; - - // An imported ONNX model. - ONNX = 28; - - // Model to capture the columns and logic in the TRANSFORM clause along with - // statistics useful for ML analytic functions. - TRANSFORM_ONLY = 29; - } - - // Loss metric to evaluate model training performance. - enum LossType { - // Default value. - LOSS_TYPE_UNSPECIFIED = 0; - - // Mean squared loss, used for linear regression. - MEAN_SQUARED_LOSS = 1; - - // Mean log loss, used for logistic regression. - MEAN_LOG_LOSS = 2; - } - - // Distance metric used to compute the distance between two points. - enum DistanceType { - // Default value. - DISTANCE_TYPE_UNSPECIFIED = 0; - - // Eculidean distance. - EUCLIDEAN = 1; - - // Cosine distance. - COSINE = 2; - } - - // Indicates the method to split input data into multiple tables. - enum DataSplitMethod { - // Default value. - DATA_SPLIT_METHOD_UNSPECIFIED = 0; - - // Splits data randomly. - RANDOM = 1; - - // Splits data with the user provided tags. - CUSTOM = 2; - - // Splits data sequentially. - SEQUENTIAL = 3; - - // Data split will be skipped. - NO_SPLIT = 4; - - // Splits data automatically: Uses NO_SPLIT if the data size is small. - // Otherwise uses RANDOM. - AUTO_SPLIT = 5; - } - - // Type of supported data frequency for time series forecasting models. - enum DataFrequency { - // Default value. - DATA_FREQUENCY_UNSPECIFIED = 0; - - // Automatically inferred from timestamps. - AUTO_FREQUENCY = 1; - - // Yearly data. - YEARLY = 2; - - // Quarterly data. - QUARTERLY = 3; - - // Monthly data. - MONTHLY = 4; - - // Weekly data. - WEEKLY = 5; - - // Daily data. - DAILY = 6; - - // Hourly data. - HOURLY = 7; - - // Per-minute data. - PER_MINUTE = 8; - } - - // Type of supported holiday regions for time series forecasting models. - enum HolidayRegion { - // Holiday region unspecified. - HOLIDAY_REGION_UNSPECIFIED = 0; - - // Global. - GLOBAL = 1; - - // North America. - NA = 2; - - // Japan and Asia Pacific: Korea, Greater China, India, Australia, and New - // Zealand. - JAPAC = 3; - - // Europe, the Middle East and Africa. - EMEA = 4; - - // Latin America and the Caribbean. - LAC = 5; - - // United Arab Emirates - AE = 6; - - // Argentina - AR = 7; - - // Austria - AT = 8; - - // Australia - AU = 9; - - // Belgium - BE = 10; - - // Brazil - BR = 11; - - // Canada - CA = 12; - - // Switzerland - CH = 13; - - // Chile - CL = 14; - - // China - CN = 15; - - // Colombia - CO = 16; - - // Czechoslovakia - CS = 17; - - // Czech Republic - CZ = 18; - - // Germany - DE = 19; - - // Denmark - DK = 20; - - // Algeria - DZ = 21; - - // Ecuador - EC = 22; - - // Estonia - EE = 23; - - // Egypt - EG = 24; - - // Spain - ES = 25; - - // Finland - FI = 26; - - // France - FR = 27; - - // Great Britain (United Kingdom) - GB = 28; - - // Greece - GR = 29; - - // Hong Kong - HK = 30; - - // Hungary - HU = 31; - - // Indonesia - ID = 32; - - // Ireland - IE = 33; - - // Israel - IL = 34; - - // India - IN = 35; - - // Iran - IR = 36; - - // Italy - IT = 37; - - // Japan - JP = 38; - - // Korea (South) - KR = 39; - - // Latvia - LV = 40; - - // Morocco - MA = 41; - - // Mexico - MX = 42; - - // Malaysia - MY = 43; - - // Nigeria - NG = 44; - - // Netherlands - NL = 45; - - // Norway - NO = 46; - - // New Zealand - NZ = 47; - - // Peru - PE = 48; - - // Philippines - PH = 49; - - // Pakistan - PK = 50; - - // Poland - PL = 51; - - // Portugal - PT = 52; - - // Romania - RO = 53; - - // Serbia - RS = 54; - - // Russian Federation - RU = 55; - - // Saudi Arabia - SA = 56; - - // Sweden - SE = 57; - - // Singapore - SG = 58; - - // Slovenia - SI = 59; - - // Slovakia - SK = 60; - - // Thailand - TH = 61; - - // Turkey - TR = 62; - - // Taiwan - TW = 63; - - // Ukraine - UA = 64; - - // United States - US = 65; - - // Venezuela - VE = 66; - - // Viet Nam - VN = 67; - - // South Africa - ZA = 68; - } - - // Enums for seasonal period. - message SeasonalPeriod { - // Seasonal period type. - enum SeasonalPeriodType { - // Unspecified seasonal period. - SEASONAL_PERIOD_TYPE_UNSPECIFIED = 0; - - // No seasonality - NO_SEASONALITY = 1; - - // Daily period, 24 hours. - DAILY = 2; - - // Weekly period, 7 days. - WEEKLY = 3; - - // Monthly period, 30 days or irregular. - MONTHLY = 4; - - // Quarterly period, 90 days or irregular. - QUARTERLY = 5; - - // Yearly period, 365 days or irregular. - YEARLY = 6; - } - } - - // Enums for color space, used for processing images in Object Table. - // See more details at - // https://www.tensorflow.org/io/tutorials/colorspace. - enum ColorSpace { - // Unspecified color space - COLOR_SPACE_UNSPECIFIED = 0; - - // RGB - RGB = 1; - - // HSV - HSV = 2; - - // YIQ - YIQ = 3; - - // YUV - YUV = 4; - - // GRAYSCALE - GRAYSCALE = 5; - } - - // Enums for kmeans model type. - message KmeansEnums { - // Indicates the method used to initialize the centroids for KMeans - // clustering algorithm. - enum KmeansInitializationMethod { - // Unspecified initialization method. - KMEANS_INITIALIZATION_METHOD_UNSPECIFIED = 0; - - // Initializes the centroids randomly. - RANDOM = 1; - - // Initializes the centroids using data specified in - // kmeans_initialization_column. - CUSTOM = 2; - - // Initializes with kmeans++. - KMEANS_PLUS_PLUS = 3; - } - } - - // Enums for XGBoost model type. - message BoostedTreeOptionEnums { - // Booster types supported. Refer to booster parameter in XGBoost. - enum BoosterType { - // Unspecified booster type. - BOOSTER_TYPE_UNSPECIFIED = 0; - - // Gbtree booster. - GBTREE = 1; - - // Dart booster. - DART = 2; - } - - // Type of normalization algorithm for boosted tree models using dart - // booster. Refer to normalize_type in XGBoost. - enum DartNormalizeType { - // Unspecified dart normalize type. - DART_NORMALIZE_TYPE_UNSPECIFIED = 0; - - // New trees have the same weight of each of dropped trees. - TREE = 1; - - // New trees have the same weight of sum of dropped trees. - FOREST = 2; - } - - // Tree construction algorithm used in boosted tree models. - // Refer to tree_method in XGBoost. - enum TreeMethod { - // Unspecified tree method. - TREE_METHOD_UNSPECIFIED = 0; - - // Use heuristic to choose the fastest method. - AUTO = 1; - - // Exact greedy algorithm. - EXACT = 2; - - // Approximate greedy algorithm using quantile sketch and gradient - // histogram. - APPROX = 3; - - // Fast histogram optimized approximate greedy algorithm. - HIST = 4; - } - } - - // Enums for hyperparameter tuning. - message HparamTuningEnums { - // Available evaluation metrics used as hyperparameter tuning objectives. - enum HparamTuningObjective { - // Unspecified evaluation metric. - HPARAM_TUNING_OBJECTIVE_UNSPECIFIED = 0; - - // Mean absolute error. - // mean_absolute_error = AVG(ABS(label - predicted)) - MEAN_ABSOLUTE_ERROR = 1; - - // Mean squared error. - // mean_squared_error = AVG(POW(label - predicted, 2)) - MEAN_SQUARED_ERROR = 2; - - // Mean squared log error. - // mean_squared_log_error = AVG(POW(LN(1 + label) - LN(1 + predicted), 2)) - MEAN_SQUARED_LOG_ERROR = 3; - - // Mean absolute error. - // median_absolute_error = APPROX_QUANTILES(absolute_error, 2)[OFFSET(1)] - MEDIAN_ABSOLUTE_ERROR = 4; - - // R^2 score. This corresponds to r2_score in ML.EVALUATE. - // r_squared = 1 - SUM(squared_error)/(COUNT(label)*VAR_POP(label)) - R_SQUARED = 5; - - // Explained variance. - // explained_variance = 1 - VAR_POP(label_error)/VAR_POP(label) - EXPLAINED_VARIANCE = 6; - - // Precision is the fraction of actual positive predictions that had - // positive actual labels. For multiclass this is a macro-averaged metric - // treating each class as a binary classifier. - PRECISION = 7; - - // Recall is the fraction of actual positive labels that were given a - // positive prediction. For multiclass this is a macro-averaged metric. - RECALL = 8; - - // Accuracy is the fraction of predictions given the correct label. For - // multiclass this is a globally micro-averaged metric. - ACCURACY = 9; - - // The F1 score is an average of recall and precision. For multiclass this - // is a macro-averaged metric. - F1_SCORE = 10; - - // Logorithmic Loss. For multiclass this is a macro-averaged metric. - LOG_LOSS = 11; - - // Area Under an ROC Curve. For multiclass this is a macro-averaged - // metric. - ROC_AUC = 12; - - // Davies-Bouldin Index. - DAVIES_BOULDIN_INDEX = 13; - - // Mean Average Precision. - MEAN_AVERAGE_PRECISION = 14; - - // Normalized Discounted Cumulative Gain. - NORMALIZED_DISCOUNTED_CUMULATIVE_GAIN = 15; - - // Average Rank. - AVERAGE_RANK = 16; - } - } - - // Indicates the learning rate optimization strategy to use. - enum LearnRateStrategy { - // Default value. - LEARN_RATE_STRATEGY_UNSPECIFIED = 0; - - // Use line search to determine learning rate. - LINE_SEARCH = 1; - - // Use a constant learning rate. - CONSTANT = 2; - } - - // Indicates the optimization strategy used for training. - enum OptimizationStrategy { - // Default value. - OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; - - // Uses an iterative batch gradient descent algorithm. - BATCH_GRADIENT_DESCENT = 1; - - // Uses a normal equation to solve linear regression problem. - NORMAL_EQUATION = 2; - } - - // Indicates the training algorithm to use for matrix factorization models. - enum FeedbackType { - // Default value. - FEEDBACK_TYPE_UNSPECIFIED = 0; - - // Use weighted-als for implicit feedback problems. - IMPLICIT = 1; - - // Use nonweighted-als for explicit feedback problems. - EXPLICIT = 2; - } - - // Evaluation metrics for regression and explicit feedback type matrix - // factorization models. - message RegressionMetrics { - // Mean absolute error. - google.protobuf.DoubleValue mean_absolute_error = 1; - - // Mean squared error. - google.protobuf.DoubleValue mean_squared_error = 2; - - // Mean squared log error. - google.protobuf.DoubleValue mean_squared_log_error = 3; - - // Median absolute error. - google.protobuf.DoubleValue median_absolute_error = 4; - - // R^2 score. This corresponds to r2_score in ML.EVALUATE. - google.protobuf.DoubleValue r_squared = 5; - } - - // Aggregate metrics for classification/classifier models. For multi-class - // models, the metrics are either macro-averaged or micro-averaged. When - // macro-averaged, the metrics are calculated for each label and then an - // unweighted average is taken of those values. When micro-averaged, the - // metric is calculated globally by counting the total number of correctly - // predicted rows. - message AggregateClassificationMetrics { - // Precision is the fraction of actual positive predictions that had - // positive actual labels. For multiclass this is a macro-averaged - // metric treating each class as a binary classifier. - google.protobuf.DoubleValue precision = 1; - - // Recall is the fraction of actual positive labels that were given a - // positive prediction. For multiclass this is a macro-averaged metric. - google.protobuf.DoubleValue recall = 2; - - // Accuracy is the fraction of predictions given the correct label. For - // multiclass this is a micro-averaged metric. - google.protobuf.DoubleValue accuracy = 3; - - // Threshold at which the metrics are computed. For binary - // classification models this is the positive class threshold. - // For multi-class classfication models this is the confidence - // threshold. - google.protobuf.DoubleValue threshold = 4; - - // The F1 score is an average of recall and precision. For multiclass - // this is a macro-averaged metric. - google.protobuf.DoubleValue f1_score = 5; - - // Logarithmic Loss. For multiclass this is a macro-averaged metric. - google.protobuf.DoubleValue log_loss = 6; - - // Area Under a ROC Curve. For multiclass this is a macro-averaged - // metric. - google.protobuf.DoubleValue roc_auc = 7; - } - - // Evaluation metrics for binary classification/classifier models. - message BinaryClassificationMetrics { - // Confusion matrix for binary classification models. - message BinaryConfusionMatrix { - // Threshold value used when computing each of the following metric. - google.protobuf.DoubleValue positive_class_threshold = 1; - - // Number of true samples predicted as true. - google.protobuf.Int64Value true_positives = 2; - - // Number of false samples predicted as true. - google.protobuf.Int64Value false_positives = 3; - - // Number of true samples predicted as false. - google.protobuf.Int64Value true_negatives = 4; - - // Number of false samples predicted as false. - google.protobuf.Int64Value false_negatives = 5; - - // The fraction of actual positive predictions that had positive actual - // labels. - google.protobuf.DoubleValue precision = 6; - - // The fraction of actual positive labels that were given a positive - // prediction. - google.protobuf.DoubleValue recall = 7; - - // The equally weighted average of recall and precision. - google.protobuf.DoubleValue f1_score = 8; - - // The fraction of predictions given the correct label. - google.protobuf.DoubleValue accuracy = 9; - } - - // Aggregate classification metrics. - AggregateClassificationMetrics aggregate_classification_metrics = 1; - - // Binary confusion matrix at multiple thresholds. - repeated BinaryConfusionMatrix binary_confusion_matrix_list = 2; - - // Label representing the positive class. - string positive_label = 3; - - // Label representing the negative class. - string negative_label = 4; - } - - // Evaluation metrics for multi-class classification/classifier models. - message MultiClassClassificationMetrics { - // Confusion matrix for multi-class classification models. - message ConfusionMatrix { - // A single entry in the confusion matrix. - message Entry { - // The predicted label. For confidence_threshold > 0, we will - // also add an entry indicating the number of items under the - // confidence threshold. - string predicted_label = 1; - - // Number of items being predicted as this label. - google.protobuf.Int64Value item_count = 2; - } - - // A single row in the confusion matrix. - message Row { - // The original label of this row. - string actual_label = 1; - - // Info describing predicted label distribution. - repeated Entry entries = 2; - } - - // Confidence threshold used when computing the entries of the - // confusion matrix. - google.protobuf.DoubleValue confidence_threshold = 1; - - // One row per actual label. - repeated Row rows = 2; - } - - // Aggregate classification metrics. - AggregateClassificationMetrics aggregate_classification_metrics = 1; - - // Confusion matrix at different thresholds. - repeated ConfusionMatrix confusion_matrix_list = 2; - } - - // Evaluation metrics for clustering models. - message ClusteringMetrics { - // Message containing the information about one cluster. - message Cluster { - // Representative value of a single feature within the cluster. - message FeatureValue { - // Representative value of a categorical feature. - message CategoricalValue { - // Represents the count of a single category within the cluster. - message CategoryCount { - // The name of category. - string category = 1; - - // The count of training samples matching the category within the - // cluster. - google.protobuf.Int64Value count = 2; - } - - // Counts of all categories for the categorical feature. If there are - // more than ten categories, we return top ten (by count) and return - // one more CategoryCount with category "_OTHER_" and count as - // aggregate counts of remaining categories. - repeated CategoryCount category_counts = 1; - } - - // The feature column name. - string feature_column = 1; - - // Value. - oneof value { - // The numerical feature value. This is the centroid value for this - // feature. - google.protobuf.DoubleValue numerical_value = 2; - - // The categorical feature value. - CategoricalValue categorical_value = 3; - } - } - - // Centroid id. - int64 centroid_id = 1; - - // Values of highly variant features for this cluster. - repeated FeatureValue feature_values = 2; - - // Count of training data rows that were assigned to this cluster. - google.protobuf.Int64Value count = 3; - } - - // Davies-Bouldin index. - google.protobuf.DoubleValue davies_bouldin_index = 1; - - // Mean of squared distances between each sample to its cluster centroid. - google.protobuf.DoubleValue mean_squared_distance = 2; - - // Information for all clusters. - repeated Cluster clusters = 3; - } - - // Evaluation metrics used by weighted-ALS models specified by - // feedback_type=implicit. - message RankingMetrics { - // Calculates a precision per user for all the items by ranking them and - // then averages all the precisions across all the users. - google.protobuf.DoubleValue mean_average_precision = 1; - - // Similar to the mean squared error computed in regression and explicit - // recommendation models except instead of computing the rating directly, - // the output from evaluate is computed against a preference which is 1 or 0 - // depending on if the rating exists or not. - google.protobuf.DoubleValue mean_squared_error = 2; - - // A metric to determine the goodness of a ranking calculated from the - // predicted confidence by comparing it to an ideal rank measured by the - // original ratings. - google.protobuf.DoubleValue normalized_discounted_cumulative_gain = 3; - - // Determines the goodness of a ranking by computing the percentile rank - // from the predicted confidence and dividing it by the original rank. - google.protobuf.DoubleValue average_rank = 4; - } - - // Model evaluation metrics for ARIMA forecasting models. - message ArimaForecastingMetrics { - // Model evaluation metrics for a single ARIMA forecasting model. - message ArimaSingleModelForecastingMetrics { - // Non-seasonal order. - ArimaOrder non_seasonal_order = 1; - - // Arima fitting metrics. - ArimaFittingMetrics arima_fitting_metrics = 2; - - // Is arima model fitted with drift or not. It is always false when d - // is not 1. - google.protobuf.BoolValue has_drift = 3; - - // The time_series_id value for this time series. It will be one of - // the unique values from the time_series_id_column specified during - // ARIMA model training. Only present when time_series_id_column - // training option was used. - string time_series_id = 4; - - // The tuple of time_series_ids identifying this time series. It will - // be one of the unique tuples of values present in the - // time_series_id_columns specified during ARIMA model training. Only - // present when time_series_id_columns training option was used and - // the order of values here are same as the order of - // time_series_id_columns. - repeated string time_series_ids = 9; - - // Seasonal periods. Repeated because multiple periods are supported - // for one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 5; - - // If true, holiday_effect is a part of time series decomposition result. - google.protobuf.BoolValue has_holiday_effect = 6; - - // If true, spikes_and_dips is a part of time series decomposition result. - google.protobuf.BoolValue has_spikes_and_dips = 7; - - // If true, step_changes is a part of time series decomposition result. - google.protobuf.BoolValue has_step_changes = 8; - } - - // Repeated as there can be many metric sets (one for each model) in - // auto-arima and the large-scale case. - repeated ArimaSingleModelForecastingMetrics - arima_single_model_forecasting_metrics = 6; - } - - // Model evaluation metrics for dimensionality reduction models. - message DimensionalityReductionMetrics { - // Total percentage of variance explained by the selected principal - // components. - google.protobuf.DoubleValue total_explained_variance_ratio = 1; - } - - // Evaluation metrics of a model. These are either computed on all training - // data or just the eval data based on whether eval data was used during - // training. These are not present for imported models. - message EvaluationMetrics { - // Metrics. - oneof metrics { - // Populated for regression models and explicit feedback type matrix - // factorization models. - RegressionMetrics regression_metrics = 1; - - // Populated for binary classification/classifier models. - BinaryClassificationMetrics binary_classification_metrics = 2; - - // Populated for multi-class classification/classifier models. - MultiClassClassificationMetrics multi_class_classification_metrics = 3; - - // Populated for clustering models. - ClusteringMetrics clustering_metrics = 4; - - // Populated for implicit feedback type matrix factorization models. - RankingMetrics ranking_metrics = 5; - - // Populated for ARIMA models. - ArimaForecastingMetrics arima_forecasting_metrics = 6; - - // Evaluation metrics when the model is a dimensionality reduction model, - // which currently includes PCA. - DimensionalityReductionMetrics dimensionality_reduction_metrics = 7; - } - } - - // Data split result. This contains references to the training and evaluation - // data tables that were used to train the model. - message DataSplitResult { - // Table reference of the training data after split. - TableReference training_table = 1; - - // Table reference of the evaluation data after split. - TableReference evaluation_table = 2; - - // Table reference of the test data after split. - TableReference test_table = 3; - } - - // Arima order, can be used for both non-seasonal and seasonal parts. - message ArimaOrder { - // Order of the autoregressive part. - google.protobuf.Int64Value p = 1; - - // Order of the differencing part. - google.protobuf.Int64Value d = 2; - - // Order of the moving-average part. - google.protobuf.Int64Value q = 3; - } - - // ARIMA model fitting metrics. - message ArimaFittingMetrics { - // Log-likelihood. - google.protobuf.DoubleValue log_likelihood = 1; - - // AIC. - google.protobuf.DoubleValue aic = 2; - - // Variance. - google.protobuf.DoubleValue variance = 3; - } - - // Global explanations containing the top most important features - // after training. - message GlobalExplanation { - // Explanation for a single feature. - message Explanation { - // The full feature name. For non-numerical features, will be formatted - // like `.`. Overall size of feature - // name will always be truncated to first 120 characters. - string feature_name = 1; - - // Attribution of feature. - google.protobuf.DoubleValue attribution = 2; - } - - // A list of the top global explanations. Sorted by absolute value of - // attribution in descending order. - repeated Explanation explanations = 1; - - // Class label for this set of global explanations. Will be empty/null for - // binary logistic and linear regression models. Sorted alphabetically in - // descending order. - string class_label = 2; - } - - // Encoding methods for categorical features. - message CategoryEncodingMethod { - // Supported encoding methods for categorical features. - enum EncodingMethod { - // Unspecified encoding method. - ENCODING_METHOD_UNSPECIFIED = 0; - - // Applies one-hot encoding. - ONE_HOT_ENCODING = 1; - - // Applies label encoding. - LABEL_ENCODING = 2; - - // Applies dummy encoding. - DUMMY_ENCODING = 3; - } - } - - // PCA solver options. - message PcaSolverOptionEnums { - // Enums for supported PCA solvers. - enum PcaSolver { - // Default value. - UNSPECIFIED = 0; - - // Full eigen-decoposition. - FULL = 1; - - // Randomized SVD. - RANDOMIZED = 2; - - // Auto. - AUTO = 3; - } - } - - // Model registry options. - message ModelRegistryOptionEnums { - // Enums for supported model registries. - enum ModelRegistry { - // Default value. - MODEL_REGISTRY_UNSPECIFIED = 0; - - // Vertex AI. - VERTEX_AI = 1; - } - } - - // Information about a single training query run for the model. - message TrainingRun { - // Options used in model training. - message TrainingOptions { - // The maximum number of iterations in training. Used only for iterative - // training algorithms. - int64 max_iterations = 1; - - // Type of loss function used during training run. - LossType loss_type = 2; - - // Learning rate in training. Used only for iterative training algorithms. - double learn_rate = 3; - - // L1 regularization coefficient. - google.protobuf.DoubleValue l1_regularization = 4; - - // L2 regularization coefficient. - google.protobuf.DoubleValue l2_regularization = 5; - - // When early_stop is true, stops training when accuracy improvement is - // less than 'min_relative_progress'. Used only for iterative training - // algorithms. - google.protobuf.DoubleValue min_relative_progress = 6; - - // Whether to train a model from the last checkpoint. - google.protobuf.BoolValue warm_start = 7; - - // Whether to stop early when the loss doesn't improve significantly - // any more (compared to min_relative_progress). Used only for iterative - // training algorithms. - google.protobuf.BoolValue early_stop = 8; - - // Name of input label columns in training data. - repeated string input_label_columns = 9; - - // The data split type for training and evaluation, e.g. RANDOM. - DataSplitMethod data_split_method = 10; - - // The fraction of evaluation data over the whole input data. The rest - // of data will be used as training data. The format should be double. - // Accurate to two decimal places. - // Default value is 0.2. - double data_split_eval_fraction = 11; - - // The column to split data with. This column won't be used as a - // feature. - // 1. When data_split_method is CUSTOM, the corresponding column should - // be boolean. The rows with true value tag are eval data, and the false - // are training data. - // 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION - // rows (from smallest to largest) in the corresponding column are used - // as training data, and the rest are eval data. It respects the order - // in Orderable data types: - // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties - string data_split_column = 12; - - // The strategy to determine learn rate for the current iteration. - LearnRateStrategy learn_rate_strategy = 13; - - // Specifies the initial learning rate for the line search learn rate - // strategy. - double initial_learn_rate = 16; - - // Weights associated with each label class, for rebalancing the - // training data. Only applicable for classification models. - map label_class_weights = 17; - - // User column specified for matrix factorization models. - string user_column = 18; - - // Item column specified for matrix factorization models. - string item_column = 19; - - // Distance type for clustering models. - DistanceType distance_type = 20; - - // Number of clusters for clustering models. - int64 num_clusters = 21; - - // Google Cloud Storage URI from which the model was imported. Only - // applicable for imported models. - string model_uri = 22; - - // Optimization strategy for training linear regression models. - OptimizationStrategy optimization_strategy = 23; - - // Hidden units for dnn models. - repeated int64 hidden_units = 24; - - // Batch size for dnn models. - int64 batch_size = 25; - - // Dropout probability for dnn models. - google.protobuf.DoubleValue dropout = 26; - - // Maximum depth of a tree for boosted tree models. - int64 max_tree_depth = 27; - - // Subsample fraction of the training data to grow tree to prevent - // overfitting for boosted tree models. - double subsample = 28; - - // Minimum split loss for boosted tree models. - google.protobuf.DoubleValue min_split_loss = 29; - - // Booster type for boosted tree models. - BoostedTreeOptionEnums.BoosterType booster_type = 60; - - // Number of parallel trees constructed during each iteration for boosted - // tree models. - google.protobuf.Int64Value num_parallel_tree = 61; - - // Type of normalization algorithm for boosted tree models using - // dart booster. - BoostedTreeOptionEnums.DartNormalizeType dart_normalize_type = 62; - - // Tree construction algorithm for boosted tree models. - BoostedTreeOptionEnums.TreeMethod tree_method = 63; - - // Minimum sum of instance weight needed in a child for boosted tree - // models. - google.protobuf.Int64Value min_tree_child_weight = 64; - - // Subsample ratio of columns when constructing each tree for boosted tree - // models. - google.protobuf.DoubleValue colsample_bytree = 65; - - // Subsample ratio of columns for each level for boosted tree models. - google.protobuf.DoubleValue colsample_bylevel = 66; - - // Subsample ratio of columns for each node(split) for boosted tree - // models. - google.protobuf.DoubleValue colsample_bynode = 67; - - // Num factors specified for matrix factorization models. - int64 num_factors = 30; - - // Feedback type that specifies which algorithm to run for matrix - // factorization. - FeedbackType feedback_type = 31; - - // Hyperparameter for matrix factoration when implicit feedback type is - // specified. - google.protobuf.DoubleValue wals_alpha = 32; - - // The method used to initialize the centroids for kmeans algorithm. - KmeansEnums.KmeansInitializationMethod kmeans_initialization_method = 33; - - // The column used to provide the initial centroids for kmeans algorithm - // when kmeans_initialization_method is CUSTOM. - string kmeans_initialization_column = 34; - - // Column to be designated as time series timestamp for ARIMA model. - string time_series_timestamp_column = 35; - - // Column to be designated as time series data for ARIMA model. - string time_series_data_column = 36; - - // Whether to enable auto ARIMA or not. - google.protobuf.BoolValue auto_arima = 37; - - // A specification of the non-seasonal part of the ARIMA model: the three - // components (p, d, q) are the AR order, the degree of differencing, and - // the MA order. - ArimaOrder non_seasonal_order = 38; - - // The data frequency of a time series. - DataFrequency data_frequency = 39; - - // Whether or not p-value test should be computed for this model. Only - // available for linear and logistic regression models. - google.protobuf.BoolValue calculate_p_values = 40; - - // Include drift when fitting an ARIMA model. - google.protobuf.BoolValue include_drift = 41; - - // The geographical region based on which the holidays are considered in - // time series modeling. If a valid value is specified, then holiday - // effects modeling is enabled. - HolidayRegion holiday_region = 42; - - // A list of geographical regions that are used for time series modeling. - repeated HolidayRegion holiday_regions = 71; - - // The time series id column that was used during ARIMA model training. - string time_series_id_column = 43; - - // The time series id columns that were used during ARIMA model training. - repeated string time_series_id_columns = 51; - - // The number of periods ahead that need to be forecasted. - int64 horizon = 44; - - // The max value of the sum of non-seasonal p and q. - int64 auto_arima_max_order = 46; - - // The min value of the sum of non-seasonal p and q. - int64 auto_arima_min_order = 83; - - // Number of trials to run this hyperparameter tuning job. - int64 num_trials = 47; - - // Maximum number of trials to run in parallel. - int64 max_parallel_trials = 48; - - // The target evaluation metrics to optimize the hyperparameters for. - repeated HparamTuningEnums.HparamTuningObjective - hparam_tuning_objectives = 54; - - // If true, perform decompose time series and save the results. - google.protobuf.BoolValue decompose_time_series = 50; - - // If true, clean spikes and dips in the input time series. - google.protobuf.BoolValue clean_spikes_and_dips = 52; - - // If true, detect step changes and make data adjustment in the input time - // series. - google.protobuf.BoolValue adjust_step_changes = 53; - - // If true, enable global explanation during training. - google.protobuf.BoolValue enable_global_explain = 55; - - // Number of paths for the sampled Shapley explain method. - int64 sampled_shapley_num_paths = 56; - - // Number of integral steps for the integrated gradients explain method. - int64 integrated_gradients_num_steps = 57; - - // Categorical feature encoding method. - CategoryEncodingMethod.EncodingMethod category_encoding_method = 58; - - // Based on the selected TF version, the corresponding docker image is - // used to train external models. - string tf_version = 70; - - // Enums for color space, used for processing images in Object Table. - // See more details at - // https://www.tensorflow.org/io/tutorials/colorspace. - ColorSpace color_space = 72; - - // Name of the instance weight column for training data. - // This column isn't be used as a feature. - string instance_weight_column = 73; - - // Smoothing window size for the trend component. When a positive value is - // specified, a center moving average smoothing is applied on the history - // trend. When the smoothing window is out of the boundary at the - // beginning or the end of the trend, the first element or the last - // element is padded to fill the smoothing window before the average is - // applied. - int64 trend_smoothing_window_size = 74; - - // The fraction of the interpolated length of the time series that's used - // to model the time series trend component. All of the time points of the - // time series are used to model the non-trend component. This training - // option accelerates modeling training without sacrificing much - // forecasting accuracy. You can use this option with - // `minTimeSeriesLength` but not with `maxTimeSeriesLength`. - double time_series_length_fraction = 75; - - // The minimum number of time points in a time series that are used in - // modeling the trend component of the time series. If you use this option - // you must also set the `timeSeriesLengthFraction` option. This training - // option ensures that enough time points are available when you use - // `timeSeriesLengthFraction` in trend modeling. This is particularly - // important when forecasting multiple time series in a single query using - // `timeSeriesIdColumn`. If the total number of time points is less than - // the `minTimeSeriesLength` value, then the query uses all available time - // points. - int64 min_time_series_length = 76; - - // The maximum number of time points in a time series that can be used in - // modeling the trend component of the time series. Don't use this option - // with the `timeSeriesLengthFraction` or `minTimeSeriesLength` options. - int64 max_time_series_length = 77; - - // User-selected XGBoost versions for training of XGBoost models. - string xgboost_version = 78; - - // Whether to use approximate feature contribution method in XGBoost model - // explanation for global explain. - google.protobuf.BoolValue approx_global_feature_contrib = 84; - - // Whether the model should include intercept during model training. - google.protobuf.BoolValue fit_intercept = 85; - - // Number of principal components to keep in the PCA model. Must be <= the - // number of features. - int64 num_principal_components = 86; - - // The minimum ratio of cumulative explained variance that needs to be - // given by the PCA model. - double pca_explained_variance_ratio = 87; - - // If true, scale the feature values by dividing the feature standard - // deviation. Currently only apply to PCA. - google.protobuf.BoolValue scale_features = 88; - - // The solver for PCA. - PcaSolverOptionEnums.PcaSolver pca_solver = 89; - - // Whether to calculate class weights automatically based on the - // popularity of each label. - google.protobuf.BoolValue auto_class_weights = 90; - - // Activation function of the neural nets. - string activation_fn = 91; - - // Optimizer used for training the neural nets. - string optimizer = 92; - - // Budget in hours for AutoML training. - double budget_hours = 93; - - // Whether to standardize numerical features. Default to true. - google.protobuf.BoolValue standardize_features = 94; - - // L1 regularization coefficient to activations. - double l1_reg_activation = 95; - - // The model registry. - ModelRegistryOptionEnums.ModelRegistry model_registry = 96; - - // The version aliases to apply in Vertex AI model registry. Always - // overwrite if the version aliases exists in a existing model. - repeated string vertex_ai_model_version_aliases = 97; - } - - // Information about a single iteration of the training run. - message IterationResult { - // Information about a single cluster for clustering model. - message ClusterInfo { - // Centroid id. - int64 centroid_id = 1; - - // Cluster radius, the average distance from centroid - // to each point assigned to the cluster. - google.protobuf.DoubleValue cluster_radius = 2; - - // Cluster size, the total number of points assigned to the cluster. - google.protobuf.Int64Value cluster_size = 3; - } - - // (Auto-)arima fitting result. Wrap everything in ArimaResult for easier - // refactoring if we want to use model-specific iteration results. - message ArimaResult { - // Arima coefficients. - message ArimaCoefficients { - // Auto-regressive coefficients, an array of double. - repeated double auto_regressive_coefficients = 1; - - // Moving-average coefficients, an array of double. - repeated double moving_average_coefficients = 2; - - // Intercept coefficient, just a double not an array. - google.protobuf.DoubleValue intercept_coefficient = 3; - } - - // Arima model information. - message ArimaModelInfo { - // Non-seasonal order. - ArimaOrder non_seasonal_order = 1; - - // Arima coefficients. - ArimaCoefficients arima_coefficients = 2; - - // Arima fitting metrics. - ArimaFittingMetrics arima_fitting_metrics = 3; - - // Whether Arima model fitted with drift or not. It is always false - // when d is not 1. - google.protobuf.BoolValue has_drift = 4; - - // The time_series_id value for this time series. It will be one of - // the unique values from the time_series_id_column specified during - // ARIMA model training. Only present when time_series_id_column - // training option was used. - string time_series_id = 5; - - // The tuple of time_series_ids identifying this time series. It will - // be one of the unique tuples of values present in the - // time_series_id_columns specified during ARIMA model training. Only - // present when time_series_id_columns training option was used and - // the order of values here are same as the order of - // time_series_id_columns. - repeated string time_series_ids = 10; - - // Seasonal periods. Repeated because multiple periods are supported - // for one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 6; - - // If true, holiday_effect is a part of time series decomposition - // result. - google.protobuf.BoolValue has_holiday_effect = 7; - - // If true, spikes_and_dips is a part of time series decomposition - // result. - google.protobuf.BoolValue has_spikes_and_dips = 8; - - // If true, step_changes is a part of time series decomposition - // result. - google.protobuf.BoolValue has_step_changes = 9; - } - - // This message is repeated because there are multiple arima models - // fitted in auto-arima. For non-auto-arima model, its size is one. - repeated ArimaModelInfo arima_model_info = 1; - - // Seasonal periods. Repeated because multiple periods are supported for - // one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 2; - } - - // Principal component infos, used only for eigen decomposition based - // models, e.g., PCA. Ordered by explained_variance in the descending - // order. - message PrincipalComponentInfo { - // Id of the principal component. - google.protobuf.Int64Value principal_component_id = 1; - - // Explained variance by this principal component, which is simply the - // eigenvalue. - google.protobuf.DoubleValue explained_variance = 2; - - // Explained_variance over the total explained variance. - google.protobuf.DoubleValue explained_variance_ratio = 3; - - // The explained_variance is pre-ordered in the descending order to - // compute the cumulative explained variance ratio. - google.protobuf.DoubleValue cumulative_explained_variance_ratio = 4; - } - - // Index of the iteration, 0 based. - google.protobuf.Int32Value index = 1; - - // Time taken to run the iteration in milliseconds. - google.protobuf.Int64Value duration_ms = 4; - - // Loss computed on the training data at the end of iteration. - google.protobuf.DoubleValue training_loss = 5; - - // Loss computed on the eval data at the end of iteration. - google.protobuf.DoubleValue eval_loss = 6; - - // Learn rate used for this iteration. - double learn_rate = 7; - - // Information about top clusters for clustering models. - repeated ClusterInfo cluster_infos = 8; - - // Arima result. - ArimaResult arima_result = 9; - - // The information of the principal components. - repeated PrincipalComponentInfo principal_component_infos = 10; - } - - // Output only. Options that were used for this training run, includes - // user specified and default options that were used. - TrainingOptions training_options = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The start time of this training run. - google.protobuf.Timestamp start_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Output of each iteration run, results.size() <= - // max_iterations. - repeated IterationResult results = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The evaluation metrics over training/eval data that were - // computed at the end of training. - EvaluationMetrics evaluation_metrics = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Data split result of the training run. Only set when the - // input data is actually split. - DataSplitResult data_split_result = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Global explanation contains the explanation of top features - // on the model level. Applies to both regression and classification models. - GlobalExplanation model_level_global_explanation = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Global explanation contains the explanation of top features - // on the class level. Applies to classification models only. - repeated GlobalExplanation class_level_global_explanations = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The model id in the [Vertex AI Model - // Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) - // for this training run. - string vertex_ai_model_id = 14; - - // Output only. The model version in the [Vertex AI Model - // Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) - // for this training run. - string vertex_ai_model_version = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Search space for a double hyperparameter. - message DoubleHparamSearchSpace { - // Range of a double hyperparameter. - message DoubleRange { - // Min value of the double parameter. - google.protobuf.DoubleValue min = 1; - - // Max value of the double parameter. - google.protobuf.DoubleValue max = 2; - } - - // Discrete candidates of a double hyperparameter. - message DoubleCandidates { - // Candidates for the double parameter in increasing order. - repeated google.protobuf.DoubleValue candidates = 1; - } - - // Search space. - oneof search_space { - // Range of the double hyperparameter. - DoubleRange range = 1; - - // Candidates of the double hyperparameter. - DoubleCandidates candidates = 2; - } - } - - // Search space for an int hyperparameter. - message IntHparamSearchSpace { - // Range of an int hyperparameter. - message IntRange { - // Min value of the int parameter. - google.protobuf.Int64Value min = 1; - - // Max value of the int parameter. - google.protobuf.Int64Value max = 2; - } - - // Discrete candidates of an int hyperparameter. - message IntCandidates { - // Candidates for the int parameter in increasing order. - repeated google.protobuf.Int64Value candidates = 1; - } - - // Search space. - oneof search_space { - // Range of the int hyperparameter. - IntRange range = 1; - - // Candidates of the int hyperparameter. - IntCandidates candidates = 2; - } - } - - // Search space for string and enum. - message StringHparamSearchSpace { - // Canididates for the string or enum parameter in lower case. - repeated string candidates = 1; - } - - // Search space for int array. - message IntArrayHparamSearchSpace { - // An array of int. - message IntArray { - // Elements in the int array. - repeated int64 elements = 1; - } - - // Candidates for the int array parameter. - repeated IntArray candidates = 1; - } - - // Hyperparameter search spaces. - // These should be a subset of training_options. - message HparamSearchSpaces { - // Learning rate of training jobs. - DoubleHparamSearchSpace learn_rate = 2; - - // L1 regularization coefficient. - DoubleHparamSearchSpace l1_reg = 3; - - // L2 regularization coefficient. - DoubleHparamSearchSpace l2_reg = 4; - - // Number of clusters for k-means. - IntHparamSearchSpace num_clusters = 26; - - // Number of latent factors to train on. - IntHparamSearchSpace num_factors = 31; - - // Hidden units for neural network models. - IntArrayHparamSearchSpace hidden_units = 34; - - // Mini batch sample size. - IntHparamSearchSpace batch_size = 37; - - // Dropout probability for dnn model training and boosted tree models - // using dart booster. - DoubleHparamSearchSpace dropout = 38; - - // Maximum depth of a tree for boosted tree models. - IntHparamSearchSpace max_tree_depth = 41; - - // Subsample the training data to grow tree to prevent overfitting for - // boosted tree models. - DoubleHparamSearchSpace subsample = 42; - - // Minimum split loss for boosted tree models. - DoubleHparamSearchSpace min_split_loss = 43; - - // Hyperparameter for matrix factoration when implicit feedback type is - // specified. - DoubleHparamSearchSpace wals_alpha = 49; - - // Booster type for boosted tree models. - StringHparamSearchSpace booster_type = 56; - - // Number of parallel trees for boosted tree models. - IntHparamSearchSpace num_parallel_tree = 57; - - // Dart normalization type for boosted tree models. - StringHparamSearchSpace dart_normalize_type = 58; - - // Tree construction algorithm for boosted tree models. - StringHparamSearchSpace tree_method = 59; - - // Minimum sum of instance weight needed in a child for boosted tree models. - IntHparamSearchSpace min_tree_child_weight = 60; - - // Subsample ratio of columns when constructing each tree for boosted tree - // models. - DoubleHparamSearchSpace colsample_bytree = 61; - - // Subsample ratio of columns for each level for boosted tree models. - DoubleHparamSearchSpace colsample_bylevel = 62; - - // Subsample ratio of columns for each node(split) for boosted tree models. - DoubleHparamSearchSpace colsample_bynode = 63; - - // Activation functions of neural network models. - StringHparamSearchSpace activation_fn = 67; - - // Optimizer of TF models. - StringHparamSearchSpace optimizer = 68; - } - - // Training info of a trial in [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models. - message HparamTuningTrial { - // Current status of the trial. - enum TrialStatus { - // Default value. - TRIAL_STATUS_UNSPECIFIED = 0; - - // Scheduled but not started. - NOT_STARTED = 1; - - // Running state. - RUNNING = 2; - - // The trial succeeded. - SUCCEEDED = 3; - - // The trial failed. - FAILED = 4; - - // The trial is infeasible due to the invalid params. - INFEASIBLE = 5; - - // Trial stopped early because it's not promising. - STOPPED_EARLY = 6; - } - - // 1-based index of the trial. - int64 trial_id = 1; - - // Starting time of the trial. - int64 start_time_ms = 2; - - // Ending time of the trial. - int64 end_time_ms = 3; - - // The hyperprameters selected for this trial. - TrainingRun.TrainingOptions hparams = 4; - - // Evaluation metrics of this trial calculated on the test data. - // Empty in Job API. - EvaluationMetrics evaluation_metrics = 5; - - // The status of the trial. - TrialStatus status = 6; - - // Error message for FAILED and INFEASIBLE trial. - string error_message = 7; - - // Loss computed on the training data at the end of trial. - google.protobuf.DoubleValue training_loss = 8; - - // Loss computed on the eval data at the end of trial. - google.protobuf.DoubleValue eval_loss = 9; - - // Hyperparameter tuning evaluation metrics of this trial calculated on the - // eval data. Unlike evaluation_metrics, only the fields corresponding to - // the hparam_tuning_objectives are set. - EvaluationMetrics hparam_tuning_evaluation_metrics = 10; - } - - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Unique identifier for this model. - ModelReference model_reference = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this model was created, in millisecs since the - // epoch. - int64 creation_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this model was last modified, in millisecs since - // the epoch. - int64 last_modified_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. A user-friendly description of this model. - string description = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A descriptive name for this model. - string friendly_name = 14 [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this model. You can use these to organize - // and group your models. Label keys and values can be no longer - // than 63 characters, can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter and each - // label in the list must have a different key. - map labels = 15; - - // Optional. The time when this model expires, in milliseconds since the - // epoch. If not present, the model will persist indefinitely. Expired models - // will be deleted and their storage reclaimed. The defaultTableExpirationMs - // property of the encapsulating dataset can be used to set a default - // expirationTime on newly created models. - int64 expiration_time = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The geographic location where the model resides. This value - // is inherited from the dataset. - string location = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Custom encryption configuration (e.g., Cloud KMS keys). This shows the - // encryption configuration of the model data while stored in BigQuery - // storage. This field can be used with PatchModel to update encryption key - // for an already encrypted model. - EncryptionConfiguration encryption_configuration = 17; - - // Output only. Type of the model resource. - ModelType model_type = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Information for all training runs in increasing order of start_time. - repeated TrainingRun training_runs = 9; - - // Output only. Input feature columns for the model inference. If the model is - // trained with TRANSFORM clause, these are the input of the TRANSFORM clause. - repeated StandardSqlField feature_columns = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Label columns that were used to train this model. - // The output of the model will have a "predicted_" prefix to these columns. - repeated StandardSqlField label_columns = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This field will be populated if a TRANSFORM clause was used to - // train a model. TRANSFORM clause (if used) takes feature_columns as input - // and outputs transform_columns. transform_columns then are used to train the - // model. - repeated TransformColumn transform_columns = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. All hyperparameter search spaces in this model. - HparamSearchSpaces hparam_search_spaces = 18 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The default trial_id to use in TVFs when the trial_id is not - // passed in. For single-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, this is the best trial ID. For multi-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, this is the smallest trial ID among all Pareto optimal trials. - int64 default_trial_id = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Trials of a [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // model sorted by trial_id. - repeated HparamTuningTrial hparam_trials = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. For single-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, it only contains the best trial. For multi-objective - // [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, it contains all Pareto optimal trials sorted by trial_id. - repeated int64 optimal_trial_ids = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Remote model info - RemoteModelInfo remote_model_info = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for getting information about a BigQuery ML model. -message GetModelRequest { - // Required. Project ID of the requested model. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested model. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the requested model. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -message PatchModelRequest { - // Required. Project ID of the model to patch. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the model to patch. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the model to patch. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Patched model. - // Follows RFC5789 patch semantics. Missing fields are not updated. - // To clear a field, explicitly set to default value. - Model model = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for deleting BigQuery ML models. -message DeleteModelRequest { - // Required. Project ID of the model to delete. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the model to delete. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the model to delete. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for listing BigQuery ML models. -message ListModelsRequest { - // Required. Project ID of the models to list. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the models to list. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call to request the next page of - // results - string page_token = 4; -} - -// Response format for a single page when listing BigQuery ML models. -message ListModelsResponse { - // Models in the requested dataset. Only the following fields are populated: - // model_reference, model_type, creation_time, last_modified_time and - // labels. - repeated Model models = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model_reference.proto.baseline deleted file mode 100644 index 9f190254e792..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/model_reference.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ModelReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a model. -message ModelReference { - // Required. The ID of the project containing this model. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this model. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the model. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 1,024 characters. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline deleted file mode 100644 index f331cb56ac05..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "PartitioningDefinitionProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The partitioning information, which includes managed table, external table -// and metastore partitioned table partition information. -message PartitioningDefinition { - // Optional. Details about each partitioning column. This field is output only - // for all partitioning types other than metastore partitioned tables. - // BigQuery native tables only support 1 partitioning column. Other table - // types may support 0, 1 or more partitioning columns. - // For metastore partitioned tables, the order must match the definition order - // in the Hive Metastore, where it must match the physical layout of the - // table. For example, - // - // CREATE TABLE a_table(id BIGINT, name STRING) - // PARTITIONED BY (city STRING, state STRING). - // - // In this case the values must be ['city', 'state'] in that order. - repeated PartitionedColumn partitioned_column = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The partitioning column information. -message PartitionedColumn { - // Required. The name of the partition column. - optional string field = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline deleted file mode 100644 index 35f40a0a00df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "PrivacyPolicyProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Represents privacy policy associated with "aggregation threshold" method. -message AggregationThresholdPolicy { - // Optional. The threshold for the "aggregation threshold" policy. - optional int64 threshold = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The privacy unit column(s) associated with this policy. - // For now, only one column per data source object (table, view) is allowed as - // a privacy unit column. - // Representing as a repeated field in metadata for extensibility to - // multiple columns in future. - // Duplicates and Repeated struct fields are not allowed. - // For nested fields, use dot notation ("outer.inner") - repeated string privacy_unit_columns = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents privacy policy associated with "differential privacy" method. -message DifferentialPrivacyPolicy { - // Optional. The maximum epsilon value that a query can consume. If the - // subscriber specifies epsilon as a parameter in a SELECT query, it must be - // less than or equal to this value. The epsilon parameter controls the amount - // of noise that is added to the groups — a higher epsilon means less noise. - optional double max_epsilon_per_query = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The delta value that is used per query. Delta represents the - // probability that any row will fail to be epsilon differentially private. - // Indicates the risk associated with exposing aggregate rows in the result of - // a query. - optional double delta_per_query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum groups contributed value that is used per query. - // Represents the maximum number of groups to which each protected entity can - // contribute. Changing this value does not improve or worsen privacy. The - // best value for accuracy and utility depends on the query and data. - optional int64 max_groups_contributed = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The privacy unit column associated with this policy. Differential - // privacy policies can only have one privacy unit column per data source - // object (table, view). - optional string privacy_unit_column = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The total epsilon budget for all queries against the - // privacy-protected view. Each subscriber query against this view charges the - // amount of epsilon they request in their query. If there is sufficient - // budget, then the subscriber query attempts to complete. It might still fail - // due to other reasons, in which case the charge is refunded. If there is - // insufficient budget the query is rejected. There might be multiple charge - // attempts if a single query references multiple views. In this case there - // must be sufficient budget for all charges or the query is rejected and - // charges are refunded in best effort. The budget does not have a refresh - // policy and can only be updated via ALTER VIEW or circumvented by creating a - // new view that can be queried with a fresh budget. - optional double epsilon_budget = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The total delta budget for all queries against the - // privacy-protected view. Each subscriber query against this view charges the - // amount of delta that is pre-defined by the contributor through the privacy - // policy delta_per_query field. If there is sufficient budget, then the - // subscriber query attempts to complete. It might still fail due to other - // reasons, in which case the charge is refunded. If there is insufficient - // budget the query is rejected. There might be multiple charge attempts if a - // single query references multiple views. In this case there must be - // sufficient budget for all charges or the query is rejected and charges are - // refunded in best effort. The budget does not have a refresh policy and can - // only be updated via ALTER VIEW or circumvented by creating a new view that - // can be queried with a fresh budget. - optional double delta_budget = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The epsilon budget remaining. If budget is exhausted, no more - // queries are allowed. Note that the budget for queries that are in progress - // is deducted before the query executes. If the query fails or is cancelled - // then the budget is refunded. In this case the amount of budget remaining - // can increase. - optional double epsilon_budget_remaining = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The delta budget remaining. If budget is exhausted, no more - // queries are allowed. Note that the budget for queries that are in progress - // is deducted before the query executes. If the query fails or is cancelled - // then the budget is refunded. In this case the amount of budget remaining - // can increase. - optional double delta_budget_remaining = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents privacy policy associated with "join restrictions". Join -// restriction gives data providers the ability to enforce joins on the -// 'join_allowed_columns' when data is queried from a privacy protected view. -message JoinRestrictionPolicy { - // Enum for Join Restrictions policy. - enum JoinCondition { - // A join is neither required nor restricted on any column. Default value. - JOIN_CONDITION_UNSPECIFIED = 0; - - // A join is required on at least one of the specified columns. - JOIN_ANY = 1; - - // A join is required on all specified columns. - JOIN_ALL = 2; - - // A join is not required, but if present it is only permitted on - // 'join_allowed_columns' - JOIN_NOT_REQUIRED = 3; - - // Joins are blocked for all queries. - JOIN_BLOCKED = 4; - } - - // Optional. Specifies if a join is required or not on queries for the view. - // Default is JOIN_CONDITION_UNSPECIFIED. - optional JoinCondition join_condition = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The only columns that joins are allowed on. - // This field is must be specified for join_conditions JOIN_ANY and JOIN_ALL - // and it cannot be set for JOIN_BLOCKED. - repeated string join_allowed_columns = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents privacy policy that contains the privacy requirements specified by -// the data owner. Currently, this is only supported on views. -message PrivacyPolicy { - // Privacy policy associated with this requirement specification. Only one of - // the privacy methods is allowed per data source object. - oneof privacy_policy { - // Optional. Policy used for aggregation thresholds. - AggregationThresholdPolicy aggregation_threshold_policy = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Policy used for differential privacy. - DifferentialPrivacyPolicy differential_privacy_policy = 3 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Join restriction policy is outside of the one of policies, since - // this policy can be set along with other policies. This policy gives data - // providers the ability to enforce joins on the 'join_allowed_columns' when - // data is queried from a privacy protected view. - optional JoinRestrictionPolicy join_restriction_policy = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/project.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/project.proto.baseline deleted file mode 100644 index f04d3962efb6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/project.proto.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ProjectProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Project Service. -// -// It should not be relied on for production use cases at this time. -service ProjectService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // RPC to get the service account for a project used for interactions with - // Google Cloud KMS - rpc GetServiceAccount(GetServiceAccountRequest) - returns (GetServiceAccountResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/serviceAccount" - }; - } -} - -// Request object of GetServiceAccount -message GetServiceAccountRequest { - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response object of GetServiceAccount -message GetServiceAccountResponse { - // The resource type of the response. - string kind = 1; - - // The service account email address. - string email = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline deleted file mode 100644 index e65a95b80bed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "QueryParameterProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The type of a struct parameter. -message QueryParameterStructType { - // Optional. The name of this field. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The type of this field. - QueryParameterType type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Human-oriented description of the field. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The type of a query parameter. -message QueryParameterType { - // Required. The top level type of this field. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The type of the array's elements, if this is an array. - QueryParameterType array_type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The types of the fields of this struct, in order, if this is a - // struct. - repeated QueryParameterStructType struct_types = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The element type of the range, if this is a range. - QueryParameterType range_element_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the value of a range. -message RangeValue { - // Optional. The start value of the range. A missing value represents an - // unbounded start. - QueryParameterValue start = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The end value of the range. A missing value represents an - // unbounded end. - QueryParameterValue end = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The value of a query parameter. -message QueryParameterValue { - // Optional. The value of this value, if a simple scalar type. - google.protobuf.StringValue value = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The array values, if this is an array type. - repeated QueryParameterValue array_values = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // The struct field values. - map struct_values = 3; - - // Optional. The range value, if this is a range type. - RangeValue range_value = 6 [(google.api.field_behavior) = OPTIONAL]; - - // This field should not be used. - repeated google.protobuf.Value alt_struct_values = 5; -} - -// A parameter given to a query. -message QueryParameter { - // Optional. If unset, this is a positional parameter. Otherwise, should be - // unique within a query. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The type of this parameter. - QueryParameterType parameter_type = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The value of this parameter. - QueryParameterValue parameter_value = 3 - [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline deleted file mode 100644 index 1cfded0c9dc7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RangePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message RangePartitioning { - // Defines the ranges for range partitioning. - message Range { - // Required. The start of range partitioning, inclusive. This field is an - // INT64 value represented as a string. - string start = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The end of range partitioning, exclusive. This field is an - // INT64 value represented as a string. - string end = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The width of each interval. This field is an INT64 value - // represented as a string. - string interval = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The name of the column to partition the table on. It must be a - // top-level, INT64 column whose mode is NULLABLE or REQUIRED. - string field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Defines the ranges for range partitioning. - Range range = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline deleted file mode 100644 index 5d9422db323b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RestrictionConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message RestrictionConfig { - // RestrictionType specifies the type of dataset/table restriction. - enum RestrictionType { - // Should never be used. - RESTRICTION_TYPE_UNSPECIFIED = 0; - - // Restrict data egress. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RESTRICTED_DATA_EGRESS = 1; - } - - // Output only. Specifies the type of dataset/table restriction. - RestrictionType type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine.proto.baseline deleted file mode 100644 index 352b74524159..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine.proto.baseline +++ /dev/null @@ -1,540 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RoutineProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Routine Service. -// -// It should not be relied on for production use cases at this time. -service RoutineService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified routine resource by routine ID. - rpc GetRoutine(GetRoutineRequest) returns (Routine) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - }; - } - - // Creates a new routine in the dataset. - rpc InsertRoutine(InsertRoutineRequest) returns (Routine) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines" - body: "routine" - }; - } - - // Updates information in an existing routine. The update method replaces the - // entire Routine resource. - rpc UpdateRoutine(UpdateRoutineRequest) returns (Routine) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - body: "routine" - }; - } - - // Patches information in an existing routine. The patch method does a partial - // update to an existing Routine resource. - rpc PatchRoutine(PatchRoutineRequest) returns (Routine) {} - - // Deletes the routine specified by routineId from the dataset. - rpc DeleteRoutine(DeleteRoutineRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - }; - } - - // Lists all routines in the specified dataset. Requires the READER dataset - // role. - rpc ListRoutines(ListRoutinesRequest) returns (ListRoutinesResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines" - }; - } -} - -// A user-defined function or a stored procedure. -message Routine { - // The fine-grained type of the routine. - enum RoutineType { - // Default value. - ROUTINE_TYPE_UNSPECIFIED = 0; - - // Non-built-in persistent scalar function. - SCALAR_FUNCTION = 1; - - // Stored procedure. - PROCEDURE = 2; - - // Non-built-in persistent TVF. - TABLE_VALUED_FUNCTION = 3; - - // Non-built-in persistent aggregate function. - AGGREGATE_FUNCTION = 4; - } - - // The language of the routine. - enum Language { - // Default value. - LANGUAGE_UNSPECIFIED = 0; - - // SQL language. - SQL = 1; - - // JavaScript language. - JAVASCRIPT = 2; - - // Python language. - PYTHON = 3; - - // Java language. - JAVA = 4; - - // Scala language. - SCALA = 5; - } - - // Input/output argument of a function or a stored procedure. - message Argument { - // Represents the kind of a given argument. - enum ArgumentKind { - // Default value. - ARGUMENT_KIND_UNSPECIFIED = 0; - - // The argument is a variable with fully specified type, which can be a - // struct or an array, but not a table. - FIXED_TYPE = 1; - - // The argument is any type, including struct or array, but not a table. - // To be added: FIXED_TABLE, ANY_TABLE - ANY_TYPE = 2; - } - - // The input/output mode of the argument. - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // The argument is input-only. - IN = 1; - - // The argument is output-only. - OUT = 2; - - // The argument is both an input and an output. - INOUT = 3; - } - - // Optional. The name of this argument. Can be absent for function return - // argument. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defaults to FIXED_TYPE. - ArgumentKind argument_kind = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether the argument is input or output. - // Can be set for procedures only. - Mode mode = 3; - - // Required unless argument_kind = ANY_TYPE. - StandardSqlDataType data_type = 4; - - // Optional. Whether the argument is an aggregate function parameter. - // Must be Unset for routine types other than AGGREGATE_FUNCTION. - // For AGGREGATE_FUNCTION, if set to false, it is equivalent to adding "NOT - // AGGREGATE" clause in DDL; Otherwise, it is equivalent to omitting "NOT - // AGGREGATE" clause in DDL. - google.protobuf.BoolValue is_aggregate = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // JavaScript UDF determinism levels. - // - // If all JavaScript UDFs are DETERMINISTIC, the query result is - // potentially cachable (see below). If any JavaScript UDF is - // NOT_DETERMINISTIC, the query result is not cacheable. - // - // Even if a JavaScript UDF is deterministic, many other factors can prevent - // usage of cached query results. Example factors include but not limited to: - // DDL/DML, non-deterministic SQL function calls, update of referenced - // tables/views/UDFs or imported JavaScript libraries. - // - // SQL UDFs cannot have determinism specified. Their determinism is - // automatically determined. - enum DeterminismLevel { - // The determinism of the UDF is unspecified. - DETERMINISM_LEVEL_UNSPECIFIED = 0; - - // The UDF is deterministic, meaning that 2 function calls with the same - // inputs always produce the same result, even across 2 query runs. - DETERMINISTIC = 1; - - // The UDF is not deterministic. - NOT_DETERMINISTIC = 2; - } - - // Security mode. - enum SecurityMode { - // The security mode of the routine is unspecified. - SECURITY_MODE_UNSPECIFIED = 0; - - // The routine is to be executed with the privileges of the user who - // defines it. - DEFINER = 1; - - // The routine is to be executed with the privileges of the user who - // invokes it. - INVOKER = 2; - } - - // Options for a remote user-defined function. - message RemoteFunctionOptions { - // Endpoint of the user-provided remote service, e.g. - // ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add``` - string endpoint = 1; - - // Fully qualified name of the user-provided connection object which holds - // the authentication information to send requests to the remote service. - // Format: - // ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"``` - string connection = 2; - - // User-defined context as a set of key/value pairs, which will be sent as - // function invocation context together with batched arguments in the - // requests to the remote service. The total number of bytes of keys and - // values must be less than 8KB. - map user_defined_context = 3; - - // Max number of rows in each batch sent to the remote service. - // If absent or if 0, BigQuery dynamically decides the number of rows in a - // batch. - int64 max_batching_rows = 4; - } - - // Data governance type values. Only supports `DATA_MASKING`. - enum DataGovernanceType { - // The data governance type is unspecified. - DATA_GOVERNANCE_TYPE_UNSPECIFIED = 0; - - // The data governance type is data masking. - DATA_MASKING = 1; - } - - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this routine. - RoutineReference routine_reference = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of routine. - RoutineType routine_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this routine was created, in milliseconds since - // the epoch. - int64 creation_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this routine was last modified, in milliseconds - // since the epoch. - int64 last_modified_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Defaults to "SQL" if remote_function_options field is absent, not - // set otherwise. - Language language = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. - repeated Argument arguments = 7; - - // Optional if language = "SQL"; required otherwise. - // Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". - // - // If absent, the return type is inferred from definition_body at query time - // in each query that references this routine. If present, then the evaluated - // result will be cast to the specified returned type at query time. - // - // For example, for the functions created with the following statements: - // - // * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` - // - // * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` - // - // * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` - // - // The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and - // is absent for `Increment` (inferred as FLOAT64 at query time). - // - // Suppose the function `Add` is replaced by - // `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` - // - // Then the inferred return type of `Increment` is automatically changed to - // INT64 at query time, while the return type of `Decrement` remains FLOAT64. - StandardSqlDataType return_type = 10; - - // Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". - // - // If absent, the return table type is inferred from definition_body at query - // time in each query that references this routine. If present, then the - // columns in the evaluated table result will be cast to match the column - // types specified in return table type, at query time. - StandardSqlTableType return_table_type = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If language = "JAVASCRIPT", this field stores the path of the - // imported JAVASCRIPT libraries. - repeated string imported_libraries = 8; - - // Required. The body of the routine. - // - // For functions, this is the expression in the AS clause. - // - // If language=SQL, it is the substring inside (but excluding) the - // parentheses. For example, for the function created with the following - // statement: - // - // `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` - // - // The definition_body is `concat(x, "\n", y)` (\n is not replaced with - // linebreak). - // - // If language=JAVASCRIPT, it is the evaluated string in the AS clause. - // For example, for the function created with the following statement: - // - // `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` - // - // The definition_body is - // - // `return "\n";\n` - // - // Note that both \n are replaced with linebreaks. - string definition_body = 9; - - // Optional. The description of the routine, if defined. - string description = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The determinism level of the JavaScript UDF, if defined. - DeterminismLevel determinism_level = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The security mode of the routine, if defined. If not defined, the - // security mode is automatically determined from the routine's configuration. - SecurityMode security_mode = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Use this option to catch many common errors. Error checking is - // not exhaustive, and successfully creating a procedure doesn't guarantee - // that the procedure will successfully execute at runtime. If `strictMode` is - // set to `TRUE`, the procedure body is further checked for errors such as - // non-existent tables or columns. The `CREATE PROCEDURE` statement fails if - // the body fails any of these checks. - // - // If `strictMode` is set to `FALSE`, the procedure body is checked only for - // syntax. For procedures that invoke themselves recursively, specify - // `strictMode=FALSE` to avoid non-existent procedure errors during - // validation. - // - // Default value is `TRUE`. - google.protobuf.BoolValue strict_mode = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Remote function specific options. - RemoteFunctionOptions remote_function_options = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Spark specific options. - SparkOptions spark_options = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `DATA_MASKING`, the function is validated and made - // available as a masking function. For more information, see [Create custom - // masking - // routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask). - DataGovernanceType data_governance_type = 17 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options for a user-defined Spark routine. -message SparkOptions { - // Fully qualified name of the user-provided Spark connection object. Format: - // ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"``` - string connection = 1; - - // Runtime version. If not specified, the default runtime version is used. - string runtime_version = 2; - - // Custom container image for the runtime environment. - string container_image = 3; - - // Configuration properties as a set of key/value pairs, which will be passed - // on to the Spark application. For more information, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html) and the - // [procedure option - // list](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#procedure_option_list). - map properties = 4; - - // The main file/jar URI of the Spark application. Exactly one of the - // definition_body field and the main_file_uri field must be set for Python. - // Exactly one of main_class and main_file_uri field - // should be set for Java/Scala language type. - string main_file_uri = 5; - - // Python files to be placed on the PYTHONPATH for PySpark application. - // Supported file types: `.py`, `.egg`, and `.zip`. For more information - // about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string py_file_uris = 6; - - // JARs to include on the driver and executor CLASSPATH. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string jar_uris = 7; - - // Files to be placed in the working directory of each executor. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string file_uris = 8; - - // Archive files to be extracted into the working directory of each executor. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string archive_uris = 9; - - // The fully qualified name of a class in jar_uris, for example, - // com.example.wordcount. Exactly one of main_class and main_jar_uri field - // should be set for Java/Scala language type. - string main_class = 10; -} - -// Describes the format for getting information about a routine. -message GetRoutineRequest { - // Required. Project ID of the requested routine - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested routine - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the requested routine - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for inserting a routine. -message InsertRoutineRequest { - // Required. Project ID of the new routine - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the new routine - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource to insert - Routine routine = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for updating a routine. -message UpdateRoutineRequest { - // Required. Project ID of the routine to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to update - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource which will replace the specified routine - Routine routine = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for the partial update (patch) of a routine. -message PatchRoutineRequest { - // Required. Project ID of the routine to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to update - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource which will be used to partially - // update the specified routine - Routine routine = 4 [(google.api.field_behavior) = REQUIRED]; - - // Only the Routine fields in the field mask are updated - // by the given routine. Repeated routine fields will be fully replaced - // if contained in the field mask. - google.protobuf.FieldMask field_mask = 5; -} - -// Describes the format for deleting a routine. -message DeleteRoutineRequest { - // Required. Project ID of the routine to delete - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to delete - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to delete - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for listing routines. -message ListRoutinesRequest { - // Required. Project ID of the routines to list - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routines to list - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 4; - - // If set, then only the Routines matching this filter are returned. - // The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - // is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - string filter = 6; -} - -// Describes the format of a single result page when listing routines. -message ListRoutinesResponse { - // Routines in the requested dataset. Unless read_mask is set in the request, - // only the following fields are populated: - // etag, project_id, dataset_id, routine_id, routine_type, creation_time, - // last_modified_time, language, and remote_function_options. - repeated Routine routines = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline deleted file mode 100644 index 65ab1ae8df6d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RoutineReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a routine. -message RoutineReference { - // Required. The ID of the project containing this routine. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this routine. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the routine. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 256 characters. - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline deleted file mode 100644 index c6eb2e9b7d9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/row_access_policy_reference.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RowAccessPolicyProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Service for interacting with row access policies. -service RowAccessPolicyService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Lists all row access policies on the specified table. - rpc ListRowAccessPolicies(ListRowAccessPoliciesRequest) - returns (ListRowAccessPoliciesResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}/rowAccessPolicies" - }; - } -} - -// Request message for the ListRowAccessPolicies method. -message ListRowAccessPoliciesRequest { - // Required. Project ID of the row access policies to list. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of row access policies to list. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to list row access policies. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 4; - - // The maximum number of results to return in a single response page. Leverage - // the page tokens to iterate through the entire collection. - int32 page_size = 5; -} - -// Response message for the ListRowAccessPolicies method. -message ListRowAccessPoliciesResponse { - // Row access policies on the requested table. - repeated RowAccessPolicy row_access_policies = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} - -// Represents access on a subset of rows on the specified table, defined by its -// filter predicate. Access to the subset of rows is controlled by its IAM -// policy. -message RowAccessPolicy { - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this row access policy. - RowAccessPolicyReference row_access_policy_reference = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A SQL boolean expression that represents the rows defined by this - // row access policy, similar to the boolean expression in a WHERE clause of a - // SELECT query on a table. - // References to other tables, routines, and temporary functions are not - // supported. - // - // Examples: region="EU" - // date_field = CAST('2019-9-27' as DATE) - // nullable_field is not NULL - // numeric_field BETWEEN 1.0 AND 5.0 - string filter_predicate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this row access policy was created, in - // milliseconds since the epoch. - google.protobuf.Timestamp creation_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this row access policy was last modified, in - // milliseconds since the epoch. - google.protobuf.Timestamp last_modified_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline deleted file mode 100644 index 28028dab0ec6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RowAccessPolicyReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a row access policy. -message RowAccessPolicyReference { - // Required. The ID of the project containing this row access policy. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this row access policy. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the table containing this row access policy. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the row access policy. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 256 characters. - string policy_id = 4 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/session_info.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/session_info.proto.baseline deleted file mode 100644 index 333ab3b7edd2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/session_info.proto.baseline +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "SessionInfoProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// [Preview] Information related to sessions. -message SessionInfo { - // Output only. The id of the session. - string session_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline deleted file mode 100644 index 0f63b2d5f597..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "StandardSqlProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The data type of a variable such as a function argument. -// Examples include: -// -// * INT64: `{"typeKind": "INT64"}` -// -// * ARRAY: -// -// { -// "typeKind": "ARRAY", -// "arrayElementType": {"typeKind": "STRING"} -// } -// -// * STRUCT>: -// -// { -// "typeKind": "STRUCT", -// "structType": -// { -// "fields": -// [ -// { -// "name": "x", -// "type": {"typeKind": "STRING"} -// }, -// { -// "name": "y", -// "type": -// { -// "typeKind": "ARRAY", -// "arrayElementType": {"typeKind": "DATE"} -// } -// } -// ] -// } -// } -// -// * RANGE: -// -// { -// "typeKind": "RANGE", -// "rangeElementType": {"typeKind": "DATE"} -// } -message StandardSqlDataType { - // The kind of the datatype. - enum TypeKind { - // Invalid type. - TYPE_KIND_UNSPECIFIED = 0; - - // Encoded as a string in decimal format. - INT64 = 2; - - // Encoded as a boolean "false" or "true". - BOOL = 5; - - // Encoded as a number, or string "NaN", "Infinity" or "-Infinity". - FLOAT64 = 7; - - // Encoded as a string value. - STRING = 8; - - // Encoded as a base64 string per RFC 4648, section 4. - BYTES = 9; - - // Encoded as an RFC 3339 timestamp with mandatory "Z" time zone string: - // 1985-04-12T23:20:50.52Z - TIMESTAMP = 19; - - // Encoded as RFC 3339 full-date format string: 1985-04-12 - DATE = 10; - - // Encoded as RFC 3339 partial-time format string: 23:20:50.52 - TIME = 20; - - // Encoded as RFC 3339 full-date "T" partial-time: 1985-04-12T23:20:50.52 - DATETIME = 21; - - // Encoded as fully qualified 3 part: 0-5 15 2:30:45.6 - INTERVAL = 26; - - // Encoded as WKT - GEOGRAPHY = 22; - - // Encoded as a decimal string. - NUMERIC = 23; - - // Encoded as a decimal string. - BIGNUMERIC = 24; - - // Encoded as a string. - JSON = 25; - - // Encoded as a list with types matching Type.array_type. - ARRAY = 16; - - // Encoded as a list with fields of type Type.struct_type[i]. List is used - // because a JSON object cannot have duplicate field names. - STRUCT = 17; - - // Encoded as a pair with types matching range_element_type. Pairs must - // begin with "[", end with ")", and be separated by ", ". - RANGE = 29; - } - - // Required. The top level type of this field. - // Can be any GoogleSQL data type (e.g., "INT64", "DATE", "ARRAY"). - TypeKind type_kind = 1 [(google.api.field_behavior) = REQUIRED]; - - // For complex types, the sub type information. - oneof sub_type { - // The type of the array's elements, if type_kind = "ARRAY". - StandardSqlDataType array_element_type = 2; - - // The fields of this struct, in order, if type_kind = "STRUCT". - StandardSqlStructType struct_type = 3; - - // The type of the range's elements, if type_kind = "RANGE". - StandardSqlDataType range_element_type = 4; - } -} - -// A field or a column. -message StandardSqlField { - // Optional. The name of this field. Can be absent for struct fields. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of this parameter. Absent if not explicitly - // specified (e.g., CREATE FUNCTION statement can omit the return type; - // in this case the output parameter does not have this "type" field). - StandardSqlDataType type = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The representation of a SQL STRUCT type. -message StandardSqlStructType { - // Fields within the struct. - repeated StandardSqlField fields = 1; -} - -// A table type -message StandardSqlTableType { - // The columns in this table type - repeated StandardSqlField columns = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/system_variable.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/system_variable.proto.baseline deleted file mode 100644 index 4437f0f4e2cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/system_variable.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/protobuf/struct.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "SystemVariableProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// System variables given to a query. -message SystemVariables { - // Output only. Data type for each system variable. - map types = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Value for each system variable. - google.protobuf.Struct values = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table.proto.baseline deleted file mode 100644 index 9f93ae5df6df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table.proto.baseline +++ /dev/null @@ -1,730 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/biglake_config.proto"; -import "google/cloud/bigquery/v2/clustering.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/error.proto"; -import "google/cloud/bigquery/v2/external_catalog_table_options.proto"; -import "google/cloud/bigquery/v2/external_data_config.proto"; -import "google/cloud/bigquery/v2/partitioning_definition.proto"; -import "google/cloud/bigquery/v2/privacy_policy.proto"; -import "google/cloud/bigquery/v2/range_partitioning.proto"; -import "google/cloud/bigquery/v2/restriction_config.proto"; -import "google/cloud/bigquery/v2/table_constraints.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/cloud/bigquery/v2/time_partitioning.proto"; -import "google/cloud/bigquery/v2/udf_resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Table Service. -// -// It should not be relied on for production use cases at this time. -service TableService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified table resource by table ID. - // This method does not return the data in the table, it only returns the - // table resource, which describes the structure of this table. - rpc GetTable(GetTableRequest) returns (Table) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - }; - } - - // Creates a new, empty table in the dataset. - rpc InsertTable(InsertTableRequest) returns (Table) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables" - body: "table" - }; - } - - // Updates information in an existing table. The update method replaces the - // entire table resource, whereas the patch method only replaces fields that - // are provided in the submitted table resource. - // This method supports RFC5789 patch semantics. - rpc PatchTable(UpdateOrPatchTableRequest) returns (Table) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - body: "table" - }; - } - - // Updates information in an existing table. The update method replaces the - // entire Table resource, whereas the patch method only replaces fields that - // are provided in the submitted Table resource. - rpc UpdateTable(UpdateOrPatchTableRequest) returns (Table) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - body: "table" - }; - } - - // Deletes the table specified by tableId from the dataset. - // If the table contains data, all the data will be deleted. - rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - }; - } - - // Lists all tables in the specified dataset. Requires the READER dataset - // role. - rpc ListTables(ListTablesRequest) returns (TableList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables" - }; - } -} - -// Replication info of a table created using `AS REPLICA` DDL like: -// `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` -message TableReplicationInfo { - // Replication status of the table created using `AS REPLICA` like: - // `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` - enum ReplicationStatus { - // Default value. - REPLICATION_STATUS_UNSPECIFIED = 0; - - // Replication is Active with no errors. - ACTIVE = 1; - - // Source object is deleted. - SOURCE_DELETED = 2; - - // Source revoked replication permissions. - PERMISSION_DENIED = 3; - - // Source configuration doesn’t allow replication. - UNSUPPORTED_CONFIGURATION = 4; - } - - // Required. Source table reference that is replicated. - TableReference source_table = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies the interval at which the source table is polled for - // updates. - // It's Optional. If not specified, default replication interval would be - // applied. - int64 replication_interval_ms = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. If source is a materialized view, this field - // signifies the last refresh time of the source. - int64 replicated_source_last_refresh_time = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Output only. Replication status of configured replication. - ReplicationStatus replication_status = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Output only. Replication error that will permanently stopped - // table replication. - ErrorProto replication_error = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// Describes the definition of a logical view. -message ViewDefinition { - // Required. A query that BigQuery executes when the view is referenced. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Describes user-defined function resources used in the query. - repeated UserDefinedFunctionResource user_defined_function_resources = 2; - - // Specifies whether to use BigQuery's legacy SQL for this view. - // The default value is true. If set to false, the view will use - // BigQuery's GoogleSQL: - // https://cloud.google.com/bigquery/sql-reference/ - // - // Queries and views that reference this view must use the same flag value. - // A wrapper is used here because the default value is True. - google.protobuf.BoolValue use_legacy_sql = 3; - - // True if the column names are explicitly specified. For example by using the - // 'CREATE VIEW v(c1, c2) AS ...' syntax. - // Can only be set for GoogleSQL views. - bool use_explicit_column_names = 4; - - // Optional. Specifices the privacy policy for the view. - PrivacyPolicy privacy_policy = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Foreign view representations. - repeated ForeignViewDefinition foreign_definitions = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A view can be represented in multiple ways. Each representation has its own -// dialect. This message stores the metadata required for these representations. -message ForeignViewDefinition { - // Required. The query that defines the view. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Represents the dialect of the query. - string dialect = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Definition and configuration of a materialized view. -message MaterializedViewDefinition { - // Required. A query whose results are persisted. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this materialized view was last refreshed, in - // milliseconds since the epoch. - int64 last_refresh_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Enable automatic refresh of the materialized view when the base - // table is updated. The default value is "true". - google.protobuf.BoolValue enable_refresh = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum frequency at which this materialized view will be - // refreshed. The default value is "1800000" (30 minutes). - google.protobuf.UInt64Value refresh_interval_ms = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This option declares the intention to construct a materialized - // view that isn't refreshed incrementally. - google.protobuf.BoolValue allow_non_incremental_definition = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Status of a materialized view. -// The last refresh timestamp status is omitted here, but is present in the -// MaterializedViewDefinition message. -message MaterializedViewStatus { - // Output only. Refresh watermark of materialized view. The base tables' data - // were collected into the materialized view cache until this time. - google.protobuf.Timestamp refresh_watermark = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Error result of the last automatic refresh. If present, - // indicates that the last automatic refresh was unsuccessful. - ErrorProto last_refresh_status = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about base table and snapshot time of the snapshot. -message SnapshotDefinition { - // Required. Reference describing the ID of the table that was snapshot. - TableReference base_table_reference = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the base table was snapshot. This value is - // reported in the JSON response using RFC3339 format. - google.protobuf.Timestamp snapshot_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Information about base table and clone time of a table clone. -message CloneDefinition { - // Required. Reference describing the ID of the table that was cloned. - TableReference base_table_reference = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the base table was cloned. This value is - // reported in the JSON response using RFC3339 format. - google.protobuf.Timestamp clone_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -message Streamingbuffer { - // Output only. A lower-bound estimate of the number of bytes currently in - // the streaming buffer. - uint64 estimated_bytes = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A lower-bound estimate of the number of rows currently in the - // streaming buffer. - uint64 estimated_rows = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains the timestamp of the oldest entry in the streaming - // buffer, in milliseconds since the epoch, if the streaming buffer is - // available. - fixed64 oldest_entry_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message Table { - // The type of resource ID. - string kind = 1; - - // Output only. A hash of this resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An opaque ID uniquely identifying the table. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access this resource again. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this table. - TableReference table_reference = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A descriptive name for this table. - google.protobuf.StringValue friendly_name = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A user-friendly description of this table. - google.protobuf.StringValue description = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this table. You can use these to organize and - // group your tables. Label keys and values can be no longer than 63 - // characters, can only contain lowercase letters, numeric characters, - // underscores and dashes. International characters are allowed. Label values - // are optional. Label keys must start with a letter and each label in the - // list must have a different key. - map labels = 8; - - // Optional. Describes the schema of this table. - TableSchema schema = 9 [(google.api.field_behavior) = OPTIONAL]; - - // If specified, configures time-based partitioning for this table. - TimePartitioning time_partitioning = 10; - - // If specified, configures range partitioning for this table. - RangePartitioning range_partitioning = 27; - - // Clustering specification for the table. Must be specified with time-based - // partitioning, data in the table will be first partitioned and subsequently - // clustered. - Clustering clustering = 23; - - // Optional. If set to true, queries over this table require - // a partition filter that can be used for partition elimination to be - // specified. - google.protobuf.BoolValue require_partition_filter = 28 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The partition information for all table formats, including - // managed partitioned tables, hive partitioned tables, iceberg partitioned, - // and metastore partitioned tables. This field is only populated for - // metastore partitioned tables. For other table formats, this is an output - // only field. - optional PartitioningDefinition partition_definition = 51 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The size of this table in logical bytes, excluding any data in - // the streaming buffer. - google.protobuf.Int64Value num_bytes = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The physical size of this table in bytes. This includes - // storage used for time travel. - google.protobuf.Int64Value num_physical_bytes = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of logical bytes in the table that are considered - // "long-term storage". - google.protobuf.Int64Value num_long_term_bytes = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of rows of data in this table, excluding any data - // in the streaming buffer. - google.protobuf.UInt64Value num_rows = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this table was created, in milliseconds since - // the epoch. - int64 creation_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The time when this table expires, in milliseconds since the - // epoch. If not present, the table will persist indefinitely. Expired tables - // will be deleted and their storage reclaimed. The defaultTableExpirationMs - // property of the encapsulating dataset can be used to set a default - // expirationTime on newly created tables. - google.protobuf.Int64Value expiration_time = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time when this table was last modified, in milliseconds - // since the epoch. - fixed64 last_modified_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes the table type. The following values are supported: - // - // * `TABLE`: A normal BigQuery table. - // * `VIEW`: A virtual table defined by a SQL query. - // * `EXTERNAL`: A table that references data stored in an external storage - // system, such as Google Cloud Storage. - // * `MATERIALIZED_VIEW`: A precomputed view defined by a SQL query. - // * `SNAPSHOT`: An immutable BigQuery table that preserves the contents of a - // base table at a particular time. See additional information on - // [table - // snapshots](https://cloud.google.com/bigquery/docs/table-snapshots-intro). - // - // The default value is `TABLE`. - string type = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The view definition. - ViewDefinition view = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The materialized view definition. - MaterializedViewDefinition materialized_view = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The materialized view status. - MaterializedViewStatus materialized_view_status = 42 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Describes the data format, location, and other properties of - // a table stored outside of BigQuery. By defining these properties, the data - // source can then be queried as if it were a standard BigQuery table. - ExternalDataConfiguration external_data_configuration = 19 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the configuration of a BigLake managed table. - BigLakeConfiguration biglake_configuration = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The geographic location where the table resides. This value - // is inherited from the dataset. - string location = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains information regarding this table's streaming buffer, - // if one is present. This field will be absent if the table is not being - // streamed to or if there is no data in the streaming buffer. - Streamingbuffer streaming_buffer = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Custom encryption configuration (e.g., Cloud KMS keys). - EncryptionConfiguration encryption_configuration = 22; - - // Output only. Contains information about the snapshot. This value is set via - // snapshot creation. - SnapshotDefinition snapshot_definition = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Defines the default collation specification of new STRING fields - // in the table. During table creation or update, if a STRING field is added - // to this table without explicit collation specified, then the table inherits - // the table default collation. A change to this field affects only fields - // added afterwards, and does not alter the existing fields. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue default_collation = 30 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default rounding mode specification of new decimal - // fields (NUMERIC OR BIGNUMERIC) in the table. During table creation or - // update, if a decimal field is added to this table without an explicit - // rounding mode specified, then the field inherits the table default - // rounding mode. Changing this field doesn't affect existing fields. - TableFieldSchema.RoundingMode default_rounding_mode = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Contains information about the clone. This value is set via - // the clone operation. - CloneDefinition clone_definition = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes used by time travel storage (deleted - // or changed data). This data is not kept in real time, and might be delayed - // by a few seconds to a few minutes. - google.protobuf.Int64Value num_time_travel_physical_bytes = 33 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total number of logical bytes in the table or materialized - // view. - google.protobuf.Int64Value num_total_logical_bytes = 34 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes that are less than 90 days old. - google.protobuf.Int64Value num_active_logical_bytes = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes that are more than 90 days old. - google.protobuf.Int64Value num_long_term_logical_bytes = 36 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes used by current live data storage. - // This data is not kept in real time, and might be delayed by a few seconds - // to a few minutes. - google.protobuf.Int64Value num_current_physical_bytes = 53 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The physical size of this table in bytes. This also includes - // storage used for time travel. This data is not kept in real time, and might - // be delayed by a few seconds to a few minutes. - google.protobuf.Int64Value num_total_physical_bytes = 37 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes less than 90 days old. This data is - // not kept in real time, and might be delayed by a few seconds to a few - // minutes. - google.protobuf.Int64Value num_active_physical_bytes = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes more than 90 days old. - // This data is not kept in real time, and might be delayed by a few seconds - // to a few minutes. - google.protobuf.Int64Value num_long_term_physical_bytes = 39 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of partitions present in the table or materialized - // view. This data is not kept in real time, and might be delayed by a few - // seconds to a few minutes. - google.protobuf.Int64Value num_partitions = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The maximum staleness of data that could be returned when the - // table (or stale MV) is queried. Staleness encoded as a string encoding - // of sql IntervalValue type. - string max_staleness = 41 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Restriction config for table. If set, restrict - // certain accesses on the table based on the config. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RestrictionConfig restrictions = 46 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Tables Primary Key and Foreign Key information - TableConstraints table_constraints = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached - // to this table. Tag keys are globally unique. Tag key is expected to be in - // the namespaced format, for example "123456789012/environment" where - // 123456789012 is the ID of the parent organization or project resource for - // this tag key. Tag value is expected to be the short name, for example - // "Production". See [Tag - // definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - // for more details. - map resource_tags = 48 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Table replication info for table created `AS REPLICA` DDL like: - // `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` - TableReplicationInfo table_replication_info = 49 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Table references of all replicas currently active on - // the table. - repeated TableReference replicas = 50 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Options defining open source compatible table. - ExternalCatalogTableOptions external_catalog_table_options = 54 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for getting table metadata. -message GetTableRequest { - // TableMetadataView specifies which table information is returned. - enum TableMetadataView { - // The default value. - // Default to the STORAGE_STATS view. - TABLE_METADATA_VIEW_UNSPECIFIED = 0; - - // Includes basic table information including schema and - // partitioning specification. This view does not include storage statistics - // such as numRows or numBytes. This view is significantly more efficient - // and should be used to support high query rates. - BASIC = 1; - - // Includes all information in the BASIC view as well as storage statistics - // (numBytes, numLongTermBytes, numRows and lastModifiedTime). - STORAGE_STATS = 2; - - // Includes all table information, including storage statistics. - // It returns same information as STORAGE_STATS view, but may contain - // additional information in the future. - FULL = 3; - } - - // Required. Project ID of the requested table - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested table - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the requested table - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // List of table schema fields to return (comma-separated). - // If unspecified, all fields are returned. - // A fieldMask cannot be used here because the fields will automatically be - // converted from camelCase to snake_case and the conversion will fail if - // there are underscores. Since these are fields in BigQuery table schemas, - // underscores are allowed. - string selected_fields = 4; - - // Optional. Specifies the view that determines which table information is - // returned. By default, basic table information and storage statistics - // (STORAGE_STATS) are returned. - TableMetadataView view = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for inserting table metadata. -message InsertTableRequest { - // Required. Project ID of the new table - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the new table - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A tables resource to insert - Table table = 4 [(google.api.field_behavior) = REQUIRED]; -} - -message UpdateOrPatchTableRequest { - // Required. Project ID of the table to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the table to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to update - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A tables resource which will replace or patch the specified table - Table table = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. When true will autodetect schema, else will keep original schema. - bool autodetect_schema = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for deleting a table. -message DeleteTableRequest { - // Required. Project ID of the table to delete - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the table to delete - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to delete - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for enumerating tables. -message ListTablesRequest { - // Required. Project ID of the tables to list - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the tables to list - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 4; -} - -// Information about a logical view. -message ListFormatView { - // True if view is defined in legacy SQL dialect, - // false if in GoogleSQL. - google.protobuf.BoolValue use_legacy_sql = 1; - - // Specifices the privacy policy for the view. - PrivacyPolicy privacy_policy = 2; -} - -message ListFormatTable { - // The resource type. - string kind = 1; - - // An opaque ID of the table. - string id = 2; - - // A reference uniquely identifying table. - TableReference table_reference = 3; - - // The user-friendly name for this table. - google.protobuf.StringValue friendly_name = 4; - - // The type of table. - string type = 5; - - // The time-based partitioning for this table. - TimePartitioning time_partitioning = 6; - - // The range partitioning for this table. - RangePartitioning range_partitioning = 12; - - // Clustering specification for this table, if configured. - Clustering clustering = 11; - - // The labels associated with this table. You can use these to organize - // and group your tables. - map labels = 7; - - // Additional details for a view. - ListFormatView view = 8; - - // Output only. The time when this table was created, in milliseconds since - // the epoch. - int64 creation_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time when this table expires, in milliseconds since the - // epoch. If not present, the table will persist indefinitely. Expired tables - // will be deleted and their storage reclaimed. - int64 expiration_time = 10; - - // Optional. If set to true, queries including this table must specify a - // partition filter. This filter is used for partition elimination. - google.protobuf.BoolValue require_partition_filter = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Partial projection of the metadata for a given table in a list response. -message TableList { - // The type of list. - string kind = 1; - - // A hash of this page of results. - string etag = 2; - - // A token to request the next page of results. - string next_page_token = 3; - - // Tables in the requested dataset. - repeated ListFormatTable tables = 4; - - // The total number of tables in the dataset. - google.protobuf.Int32Value total_items = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline deleted file mode 100644 index 13edc6bb905d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableConstraintsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Represents the primary key constraint on a table's columns. -message PrimaryKey { - // Required. The columns that are composed of the primary key constraint. - repeated string columns = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The pair of the foreign key column and primary key column. -message ColumnReference { - // Required. The column that composes the foreign key. - string referencing_column = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The column in the primary key that are referenced by the - // referencing_column. - string referenced_column = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Represents a foreign key constraint on a table's columns. -message ForeignKey { - // Optional. Set only if the foreign key constraint is named. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The table that holds the primary key and is referenced by this - // foreign key. - TableReference referenced_table = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The columns that compose the foreign key. - repeated ColumnReference column_references = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// The TableConstraints defines the primary key and foreign key. -message TableConstraints { - // Optional. Represents a primary key constraint on a table's columns. - // Present only if the table has a primary key. - // The primary key is not enforced. - PrimaryKey primary_key = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Present only if the table has a foreign key. - // The foreign key is not enforced. - repeated ForeignKey foreign_keys = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_reference.proto.baseline deleted file mode 100644 index e6e9a1b35d1b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_reference.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message TableReference { - // Required. The ID of the project containing this table. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this table. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the table. The ID can contain Unicode characters in - // category L (letter), M (mark), N (number), Pc (connector, including - // underscore), Pd (dash), and Zs (space). For more information, see [General - // Category](https://wikipedia.org/wiki/Unicode_character_property#General_Category). - // The maximum length is 1,024 characters. Certain operations allow suffixing - // of the table ID with a partition decorator, such as - // `sample_table$20190123`. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_schema.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_schema.proto.baseline deleted file mode 100644 index 8a56f8e8720b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/table_schema.proto.baseline +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableSchemaProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Schema of a table -message TableSchema { - // Describes the fields in a table. - repeated TableFieldSchema fields = 1; - - // Optional. Specifies metadata of the foreign data type definition in field - // schema - // ([TableFieldSchema.foreign_type_definition][google.cloud.bigquery.v2.TableFieldSchema.foreign_type_definition]). - ForeignTypeInfo foreign_type_info = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata about the foreign data type definition such as the system -// in which the type is defined. -message ForeignTypeInfo { - // External systems, such as query engines or table formats, that have their - // own data types. - enum TypeSystem { - // TypeSystem not specified. - TYPE_SYSTEM_UNSPECIFIED = 0; - - // Represents Hive data types. - HIVE = 1; - } - - // Required. Specifies the system which defines the foreign data type. - TypeSystem type_system = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Data policy option proto, it currently supports name only, will support -// precedence later. -message DataPolicyOption { - // Data policy resource name in the form of - // projects/project_id/locations/location_id/dataPolicies/data_policy_id. - optional string name = 1; -} - -// A field in TableSchema -message TableFieldSchema { - message PolicyTagList { - // A list of policy tag resource names. For example, - // "projects/1/locations/eu/taxonomies/2/policyTags/3". At most 1 policy tag - // is currently allowed. - repeated string names = 1; - } - - // Rounding mode options that can be used when storing NUMERIC - // or BIGNUMERIC values. - enum RoundingMode { - // Unspecified will default to using ROUND_HALF_AWAY_FROM_ZERO. - ROUNDING_MODE_UNSPECIFIED = 0; - - // ROUND_HALF_AWAY_FROM_ZERO rounds half values away from zero - // when applying precision and scale upon writing of NUMERIC and BIGNUMERIC - // values. - // For Scale: 0 - // 1.1, 1.2, 1.3, 1.4 => 1 - // 1.5, 1.6, 1.7, 1.8, 1.9 => 2 - ROUND_HALF_AWAY_FROM_ZERO = 1; - - // ROUND_HALF_EVEN rounds half values to the nearest even value - // when applying precision and scale upon writing of NUMERIC and BIGNUMERIC - // values. - // For Scale: 0 - // 1.1, 1.2, 1.3, 1.4 => 1 - // 1.5 => 2 - // 1.6, 1.7, 1.8, 1.9 => 2 - // 2.5 => 2 - ROUND_HALF_EVEN = 2; - } - - // Represents the type of a field element. - message FieldElementType { - // Required. The type of a field element. For more information, see - // [TableFieldSchema.type][google.cloud.bigquery.v2.TableFieldSchema.type]. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The field name. The name must contain only letters (a-z, A-Z), - // numbers (0-9), or underscores (_), and must start with a letter or - // underscore. The maximum length is 300 characters. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The field data type. Possible values include: - // - // * STRING - // * BYTES - // * INTEGER (or INT64) - // * FLOAT (or FLOAT64) - // * BOOLEAN (or BOOL) - // * TIMESTAMP - // * DATE - // * TIME - // * DATETIME - // * GEOGRAPHY - // * NUMERIC - // * BIGNUMERIC - // * JSON - // * RECORD (or STRUCT) - // * RANGE - // - // Use of RECORD/STRUCT indicates that the field contains a nested schema. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The field mode. Possible values include NULLABLE, REQUIRED and - // REPEATED. The default value is NULLABLE. - string mode = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the nested schema fields if the type property is set - // to RECORD. - repeated TableFieldSchema fields = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The field description. The maximum length is 1,024 characters. - google.protobuf.StringValue description = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The policy tags attached to this field, used for field-level - // access control. If not set, defaults to empty policy_tags. - PolicyTagList policy_tags = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Data policy options, will replace the data_policies. - repeated DataPolicyOption data_policies = 21 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Maximum length of values of this field for STRINGS or BYTES. - // - // If max_length is not specified, no maximum length constraint is imposed - // on this field. - // - // If type = "STRING", then max_length represents the maximum UTF-8 - // length of strings in this field. - // - // If type = "BYTES", then max_length represents the maximum number of - // bytes in this field. - // - // It is invalid to set this field if type ≠ "STRING" and ≠ "BYTES". - int64 max_length = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Precision (maximum number of total digits in base 10) and scale - // (maximum number of digits in the fractional part in base 10) constraints - // for values of this field for NUMERIC or BIGNUMERIC. - // - // It is invalid to set precision or scale if type ≠ "NUMERIC" and ≠ - // "BIGNUMERIC". - // - // If precision and scale are not specified, no value range constraint is - // imposed on this field insofar as values are permitted by the type. - // - // Values of this NUMERIC or BIGNUMERIC field must be in this range when: - // - // * Precision (P) and scale (S) are specified: - // [-10P-S + 10-S, - // 10P-S - 10-S] - // * Precision (P) is specified but not scale (and thus scale is - // interpreted to be equal to zero): - // [-10P + 1, 10P - 1]. - // - // Acceptable values for precision and scale if both are specified: - // - // * If type = "NUMERIC": - // 1 ≤ precision - scale ≤ 29 and 0 ≤ scale ≤ 9. - // * If type = "BIGNUMERIC": - // 1 ≤ precision - scale ≤ 38 and 0 ≤ scale ≤ 38. - // - // Acceptable values for precision if only precision is specified but not - // scale (and thus scale is interpreted to be equal to zero): - // - // * If type = "NUMERIC": 1 ≤ precision ≤ 29. - // * If type = "BIGNUMERIC": 1 ≤ precision ≤ 38. - // - // If scale is specified but not precision, then it is invalid. - int64 precision = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. See documentation for precision. - int64 scale = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the rounding mode to be used when storing values of - // NUMERIC and BIGNUMERIC type. - RoundingMode rounding_mode = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field collation can be set only when the type of field is STRING. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue collation = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A SQL expression to specify the [default value] - // (https://cloud.google.com/bigquery/docs/default-values) for this field. - google.protobuf.StringValue default_value_expression = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The subtype of the RANGE, if the type of this field is RANGE. If - // the type is RANGE, this field is required. Values for the field element - // type can be the following: - // - // * DATE - // * DATETIME - // * TIMESTAMP - FieldElementType range_element_type = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Definition of the foreign data type. - // Only valid for top-level schema fields (not nested fields). - // If the type is FOREIGN, this field is required. - string foreign_type_definition = 23 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline deleted file mode 100644 index 440a209830b8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TimePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message TimePartitioning { - // Required. The supported types are DAY, HOUR, MONTH, and YEAR, which will - // generate one partition per day, hour, month, and year, respectively. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Number of milliseconds for which to keep the storage for a - // partition. - // A wrapper is used here because 0 is an invalid value. - google.protobuf.Int64Value expiration_ms = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If not set, the table is partitioned by pseudo - // column '_PARTITIONTIME'; if set, the table is partitioned by this field. - // The field must be a top-level TIMESTAMP or DATE field. Its mode must be - // NULLABLE or REQUIRED. - // A wrapper is used here because an empty string is an invalid value. - google.protobuf.StringValue field = 3 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline deleted file mode 100644 index d630bf9c7f17..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "UdfProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// -// This is used for defining User Defined Function (UDF) resources only when -// using legacy SQL. Users of GoogleSQL should leverage either DDL (e.g. -// CREATE [TEMPORARY] FUNCTION ... ) or the Routines API to define UDF -// resources. -// -// For additional information on migrating, see: -// https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions -message UserDefinedFunctionResource { - // [Pick one] A code resource to load from a Google Cloud Storage URI - // (gs://bucket/path). - google.protobuf.StringValue resource_uri = 1; - - // [Pick one] An inline resource that contains code for a user-defined - // function (UDF). Providing a inline code resource is equivalent to providing - // a URI for a file containing the same code. - google.protobuf.StringValue inline_code = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.delete_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.delete_dataset.js.baseline deleted file mode 100644 index 238da08214ee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.delete_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_DeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being deleted - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of dataset being deleted - */ - // const datasetId = 'abc123' - /** - * If True, delete all the tables in the dataset. - * If False and the dataset contains tables, the request will fail. - * Default is False - */ - // const deleteContents = true - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callDeleteDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.deleteDataset(request); - console.log(response); - } - - callDeleteDataset(); - // [END bigquery_v2_generated_DatasetService_DeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.get_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.get_dataset.js.baseline deleted file mode 100644 index 82f91e2e4e14..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.get_dataset.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_GetDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested dataset - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested dataset - */ - // const datasetId = 'abc123' - /** - * Optional. Specifies the view that determines which dataset information is - * returned. By default, metadata and ACL information are returned. - */ - // const datasetView = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callGetDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.getDataset(request); - console.log(response); - } - - callGetDataset(); - // [END bigquery_v2_generated_DatasetService_GetDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.insert_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.insert_dataset.js.baseline deleted file mode 100644 index 4129b357c313..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.insert_dataset.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, dataset) { - // [START bigquery_v2_generated_DatasetService_InsertDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new dataset - */ - // const projectId = 'abc123' - /** - * Required. Datasets resource to use for the new dataset - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callInsertDataset() { - // Construct request - const request = { - projectId, - dataset, - }; - - // Run request - const response = await bigqueryClient.insertDataset(request); - console.log(response); - } - - callInsertDataset(); - // [END bigquery_v2_generated_DatasetService_InsertDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.list_datasets.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.list_datasets.js.baseline deleted file mode 100644 index c68ec12c82b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.list_datasets.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_DatasetService_ListDatasets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the datasets to be listed - */ - // const projectId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - /** - * Whether to list all datasets, including hidden ones - */ - // const all = true - /** - * An expression for filtering the results of the request by label. - * The syntax is `labels.:`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See Filtering datasets using - * labels (https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - */ - // const filter = 'abc123' - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callListDatasets() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = bigqueryClient.listDatasetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDatasets(); - // [END bigquery_v2_generated_DatasetService_ListDatasets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.patch_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.patch_dataset.js.baseline deleted file mode 100644 index ecc28dcc98e7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.patch_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, dataset) { - // [START bigquery_v2_generated_DatasetService_PatchDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being updated - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the dataset being updated - */ - // const datasetId = 'abc123' - /** - * Required. Datasets resource which will replace or patch the specified - * dataset. - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callPatchDataset() { - // Construct request - const request = { - projectId, - datasetId, - dataset, - }; - - // Run request - const response = await bigqueryClient.patchDataset(request); - console.log(response); - } - - callPatchDataset(); - // [END bigquery_v2_generated_DatasetService_PatchDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.undelete_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.undelete_dataset.js.baseline deleted file mode 100644 index b0446a20a9c5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.undelete_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_UndeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset to be undeleted - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of dataset being deleted - */ - // const datasetId = 'abc123' - /** - * Optional. The exact time when the dataset was deleted. If not specified, - * the most recently deleted version is undeleted. Undeleting a dataset - * using deletion time is not supported. - */ - // const deletionTime = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callUndeleteDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.undeleteDataset(request); - console.log(response); - } - - callUndeleteDataset(); - // [END bigquery_v2_generated_DatasetService_UndeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.update_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.update_dataset.js.baseline deleted file mode 100644 index 177f1b4f757f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/dataset_service.update_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, dataset) { - // [START bigquery_v2_generated_DatasetService_UpdateDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being updated - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the dataset being updated - */ - // const datasetId = 'abc123' - /** - * Required. Datasets resource which will replace or patch the specified - * dataset. - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callUpdateDataset() { - // Construct request - const request = { - projectId, - datasetId, - dataset, - }; - - // Run request - const response = await bigqueryClient.updateDataset(request); - console.log(response); - } - - callUpdateDataset(); - // [END bigquery_v2_generated_DatasetService_UpdateDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.cancel_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.cancel_job.js.baseline deleted file mode 100644 index bb7e65573e6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.cancel_job.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_CancelJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the job to cancel - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the job to cancel - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callCancelJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.cancelJob(request); - console.log(response); - } - - callCancelJob(); - // [END bigquery_v2_generated_JobService_CancelJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.delete_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.delete_job.js.baseline deleted file mode 100644 index 64762ca58c85..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.delete_job.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_DeleteJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the job for which metadata is to be deleted. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the job for which metadata is to be deleted. If this is - * a parent job which has child jobs, the metadata from all child jobs will be - * deleted as well. Direct deletion of the metadata of child jobs is not - * allowed. - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. Required. - * See details at: - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callDeleteJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.deleteJob(request); - console.log(response); - } - - callDeleteJob(); - // [END bigquery_v2_generated_JobService_DeleteJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_job.js.baseline deleted file mode 100644 index 8f2fb6cdad2f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_job.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_GetJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested job. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the requested job. - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callGetJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.getJob(request); - console.log(response); - } - - callGetJob(); - // [END bigquery_v2_generated_JobService_GetJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_query_results.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_query_results.js.baseline deleted file mode 100644 index 56ba4ae0d05f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.get_query_results.js.baseline +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_GetQueryResults_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the query job. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the query job. - */ - // const jobId = 'abc123' - /** - * Zero-based index of the starting row. - */ - // const startIndex = {} - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * Maximum number of results to read. - */ - // const maxResults = {} - /** - * Optional: Specifies the maximum amount of time, in milliseconds, that the - * client is willing to wait for the query to complete. By default, this limit - * is 10 seconds (10,000 milliseconds). If the query is complete, the - * jobComplete field in the response is true. If the query has not yet - * completed, jobComplete is false. - * You can request a longer timeout period in the timeoutMs field. However, - * the call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * If jobComplete is false, you can continue to wait for the query to complete - * by calling the getQueryResults method until the jobComplete field in the - * getQueryResults response is true. - */ - // const timeoutMs = {} - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - /** - * Optional. Output format adjustments. - */ - // const formatOptions = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callGetQueryResults() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.getQueryResults(request); - console.log(response); - } - - callGetQueryResults(); - // [END bigquery_v2_generated_JobService_GetQueryResults_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.insert_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.insert_job.js.baseline deleted file mode 100644 index 03acfa0aa770..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.insert_job.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquery_v2_generated_JobService_InsertJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of project that will be billed for the job. - */ - // const projectId = 'abc123' - /** - * Jobs resource to insert. - */ - // const job = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callInsertJob() { - // Construct request - const request = { - }; - - // Run request - const response = await bigqueryClient.insertJob(request); - console.log(response); - } - - callInsertJob(); - // [END bigquery_v2_generated_JobService_InsertJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.list_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.list_jobs.js.baseline deleted file mode 100644 index 776cb0834aaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.list_jobs.js.baseline +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquery_v2_generated_JobService_ListJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the jobs to list. - */ - // const projectId = 'abc123' - /** - * Whether to display jobs owned by all users in the project. Default False. - */ - // const allUsers = true - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - */ - // const minCreationTime = 1234 - /** - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - */ - // const maxCreationTime = {} - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * Restrict information returned to a set of selected fields - */ - // const projection = {} - /** - * Filter for job state - */ - // const stateFilter = [1,2,3,4] - /** - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - */ - // const parentJobId = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callListJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = bigqueryClient.listJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobs(); - // [END bigquery_v2_generated_JobService_ListJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.query.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.query.js.baseline deleted file mode 100644 index 41f3b31453ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/job_service.query.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_JobService_Query_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the query request. - */ - // const projectId = 'abc123' - /** - * The query request body. - */ - // const queryRequest = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callQuery() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await bigqueryClient.query(request); - console.log(response); - } - - callQuery(); - // [END bigquery_v2_generated_JobService_Query_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.delete_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.delete_model.js.baseline deleted file mode 100644 index 97aad90d382b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.delete_model.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId) { - // [START bigquery_v2_generated_ModelService_DeleteModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the model to delete. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the model to delete. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the model to delete. - */ - // const modelId = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callDeleteModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - }; - - // Run request - const response = await bigqueryClient.deleteModel(request); - console.log(response); - } - - callDeleteModel(); - // [END bigquery_v2_generated_ModelService_DeleteModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.get_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.get_model.js.baseline deleted file mode 100644 index 51254b03e66b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.get_model.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId) { - // [START bigquery_v2_generated_ModelService_GetModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested model. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested model. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the requested model. - */ - // const modelId = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callGetModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - }; - - // Run request - const response = await bigqueryClient.getModel(request); - console.log(response); - } - - callGetModel(); - // [END bigquery_v2_generated_ModelService_GetModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.list_models.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.list_models.js.baseline deleted file mode 100644 index c24e2d03490a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.list_models.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_ModelService_ListModels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the models to list. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the models to list. - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call to request the next page of - * results - */ - // const pageToken = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callListModels() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listModelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListModels(); - // [END bigquery_v2_generated_ModelService_ListModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.patch_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.patch_model.js.baseline deleted file mode 100644 index 4e8ae1c2eba4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/model_service.patch_model.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId, model) { - // [START bigquery_v2_generated_ModelService_PatchModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the model to patch. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the model to patch. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the model to patch. - */ - // const modelId = 'abc123' - /** - * Required. Patched model. - * Follows RFC5789 patch semantics. Missing fields are not updated. - * To clear a field, explicitly set to default value. - */ - // const model = {} - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callPatchModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - model, - }; - - // Run request - const response = await bigqueryClient.patchModel(request); - console.log(response); - } - - callPatchModel(); - // [END bigquery_v2_generated_ModelService_PatchModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/project_service.get_service_account.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/project_service.get_service_account.js.baseline deleted file mode 100644 index 748f98e96437..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/project_service.get_service_account.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_ProjectService_GetServiceAccount_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - - // Imports the Bigquery library - const {ProjectServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ProjectServiceClient(); - - async function callGetServiceAccount() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await bigqueryClient.getServiceAccount(request); - console.log(response); - } - - callGetServiceAccount(); - // [END bigquery_v2_generated_ProjectService_GetServiceAccount_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.delete_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.delete_routine.js.baseline deleted file mode 100644 index 4a57bda38967..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.delete_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId) { - // [START bigquery_v2_generated_RoutineService_DeleteRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to delete - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to delete - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to delete - */ - // const routineId = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callDeleteRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - }; - - // Run request - const response = await bigqueryClient.deleteRoutine(request); - console.log(response); - } - - callDeleteRoutine(); - // [END bigquery_v2_generated_RoutineService_DeleteRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.get_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.get_routine.js.baseline deleted file mode 100644 index 040bc638f184..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.get_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId) { - // [START bigquery_v2_generated_RoutineService_GetRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested routine - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested routine - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the requested routine - */ - // const routineId = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callGetRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - }; - - // Run request - const response = await bigqueryClient.getRoutine(request); - console.log(response); - } - - callGetRoutine(); - // [END bigquery_v2_generated_RoutineService_GetRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.insert_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.insert_routine.js.baseline deleted file mode 100644 index 310794b14e75..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.insert_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routine) { - // [START bigquery_v2_generated_RoutineService_InsertRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new routine - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the new routine - */ - // const datasetId = 'abc123' - /** - * Required. A routine resource to insert - */ - // const routine = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callInsertRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routine, - }; - - // Run request - const response = await bigqueryClient.insertRoutine(request); - console.log(response); - } - - callInsertRoutine(); - // [END bigquery_v2_generated_RoutineService_InsertRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.list_routines.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.list_routines.js.baseline deleted file mode 100644 index ceda506e7f46..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.list_routines.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_RoutineService_ListRoutines_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routines to list - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routines to list - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - /** - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - */ - // const filter = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callListRoutines() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listRoutinesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRoutines(); - // [END bigquery_v2_generated_RoutineService_ListRoutines_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.patch_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.patch_routine.js.baseline deleted file mode 100644 index 7049a548cc67..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.patch_routine.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId, routine) { - // [START bigquery_v2_generated_RoutineService_PatchRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to update - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to update - */ - // const routineId = 'abc123' - /** - * Required. A routine resource which will be used to partially - * update the specified routine - */ - // const routine = {} - /** - * Only the Routine fields in the field mask are updated - * by the given routine. Repeated routine fields will be fully replaced - * if contained in the field mask. - */ - // const fieldMask = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callPatchRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - routine, - }; - - // Run request - const response = await bigqueryClient.patchRoutine(request); - console.log(response); - } - - callPatchRoutine(); - // [END bigquery_v2_generated_RoutineService_PatchRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.update_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.update_routine.js.baseline deleted file mode 100644 index 4845980a9f85..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/routine_service.update_routine.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId, routine) { - // [START bigquery_v2_generated_RoutineService_UpdateRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to update - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to update - */ - // const routineId = 'abc123' - /** - * Required. A routine resource which will replace the specified routine - */ - // const routine = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callUpdateRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - routine, - }; - - // Run request - const response = await bigqueryClient.updateRoutine(request); - console.log(response); - } - - callUpdateRoutine(); - // [END bigquery_v2_generated_RoutineService_UpdateRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline deleted file mode 100644 index 3dc03f52949e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the row access policies to list. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of row access policies to list. - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to list row access policies. - */ - // const tableId = 'abc123' - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - */ - // const pageSize = 1234 - - // Imports the Bigquery library - const {RowAccessPolicyServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RowAccessPolicyServiceClient(); - - async function callListRowAccessPolicies() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const iterable = bigqueryClient.listRowAccessPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRowAccessPolicies(); - // [END bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline deleted file mode 100644 index 917111d47b08..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline +++ /dev/null @@ -1,1647 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-bigquery", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.bigquery.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "bigquery_v2_generated_DatasetService_GetDataset_async", - "title": "DatasetService getDataset Sample", - "origin": "API_DEFINITION", - "description": " Returns the dataset specified by datasetID.", - "canonical": true, - "file": "dataset_service.get_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.GetDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_view", - "type": ".google.cloud.bigquery.v2.GetDatasetRequest.DatasetView" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "GetDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.GetDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_InsertDataset_async", - "title": "DatasetService insertDataset Sample", - "origin": "API_DEFINITION", - "description": " Creates a new empty dataset.", - "canonical": true, - "file": "dataset_service.insert_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.InsertDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "InsertDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.InsertDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_PatchDataset_async", - "title": "DatasetService patchDataset Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics.", - "canonical": true, - "file": "dataset_service.patch_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.PatchDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "PatchDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.PatchDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_UpdateDataset_async", - "title": "DatasetService updateDataset Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.", - "canonical": true, - "file": "dataset_service.update_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "UpdateDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_DeleteDataset_async", - "title": "DatasetService deleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.", - "canonical": true, - "file": "dataset_service.delete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.DeleteDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "delete_contents", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "DeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.DeleteDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_ListDatasets_async", - "title": "DatasetService listDatasets Sample", - "origin": "API_DEFINITION", - "description": " Lists all datasets in the specified project to which the user has been granted the READER dataset role.", - "canonical": true, - "file": "dataset_service.list_datasets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDatasets", - "fullName": "google.cloud.bigquery.v2.DatasetService.ListDatasets", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "all", - "type": "TYPE_BOOL" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.DatasetList", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "ListDatasets", - "fullName": "google.cloud.bigquery.v2.DatasetService.ListDatasets", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_UndeleteDataset_async", - "title": "DatasetService undeleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a dataset which is within time travel window based on datasetId. If a time is specified, the dataset version deleted at that time is undeleted, else the last live version is undeleted.", - "canonical": true, - "file": "dataset_service.undelete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UndeleteDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "deletion_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "UndeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UndeleteDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_CancelJob_async", - "title": "DatasetService cancelJob Sample", - "origin": "API_DEFINITION", - "description": " Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.", - "canonical": true, - "file": "job_service.cancel_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelJob", - "fullName": "google.cloud.bigquery.v2.JobService.CancelJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.JobCancelResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "CancelJob", - "fullName": "google.cloud.bigquery.v2.JobService.CancelJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_GetJob_async", - "title": "DatasetService getJob Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.", - "canonical": true, - "file": "job_service.get_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJob", - "fullName": "google.cloud.bigquery.v2.JobService.GetJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Job", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "GetJob", - "fullName": "google.cloud.bigquery.v2.JobService.GetJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_InsertJob_async", - "title": "DatasetService insertJob Sample", - "origin": "API_DEFINITION", - "description": " Starts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The *Metadata* URI is used for most interactions, as it accepts the job configuration directly. * The *Upload* URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.", - "canonical": true, - "file": "job_service.insert_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertJob", - "fullName": "google.cloud.bigquery.v2.JobService.InsertJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.bigquery.v2.Job" - } - ], - "resultType": ".google.cloud.bigquery.v2.Job", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "InsertJob", - "fullName": "google.cloud.bigquery.v2.JobService.InsertJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_DeleteJob_async", - "title": "DatasetService deleteJob Sample", - "origin": "API_DEFINITION", - "description": " Requests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.", - "canonical": true, - "file": "job_service.delete_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJob", - "fullName": "google.cloud.bigquery.v2.JobService.DeleteJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "DeleteJob", - "fullName": "google.cloud.bigquery.v2.JobService.DeleteJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_ListJobs_async", - "title": "DatasetService listJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.", - "canonical": true, - "file": "job_service.list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 91, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobs", - "fullName": "google.cloud.bigquery.v2.JobService.ListJobs", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "all_users", - "type": "TYPE_BOOL" - }, - { - "name": "max_results", - "type": ".google.protobuf.Int32Value" - }, - { - "name": "min_creation_time", - "type": "TYPE_UINT64" - }, - { - "name": "max_creation_time", - "type": ".google.protobuf.UInt64Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "projection", - "type": ".google.cloud.bigquery.v2.ListJobsRequest.Projection" - }, - { - "name": "state_filter", - "type": "TYPE_ENUM[]" - }, - { - "name": "parent_job_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.JobList", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "ListJobs", - "fullName": "google.cloud.bigquery.v2.JobService.ListJobs", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_GetQueryResults_async", - "title": "DatasetService getQueryResults Sample", - "origin": "API_DEFINITION", - "description": " RPC to get the results of a query job.", - "canonical": true, - "file": "job_service.get_query_results.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 101, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetQueryResults", - "fullName": "google.cloud.bigquery.v2.JobService.GetQueryResults", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "start_index", - "type": ".google.protobuf.UInt64Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "timeout_ms", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "format_options", - "type": ".google.cloud.bigquery.v2.DataFormatOptions" - } - ], - "resultType": ".google.cloud.bigquery.v2.GetQueryResultsResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "GetQueryResults", - "fullName": "google.cloud.bigquery.v2.JobService.GetQueryResults", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_Query_async", - "title": "DatasetService query Sample", - "origin": "API_DEFINITION", - "description": " Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.", - "canonical": true, - "file": "job_service.query.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Query", - "fullName": "google.cloud.bigquery.v2.JobService.Query", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "query_request", - "type": ".google.cloud.bigquery.v2.QueryRequest" - } - ], - "resultType": ".google.cloud.bigquery.v2.QueryResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "Query", - "fullName": "google.cloud.bigquery.v2.JobService.Query", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_GetModel_async", - "title": "DatasetService getModel Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified model resource by model ID.", - "canonical": true, - "file": "model_service.get_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetModel", - "fullName": "google.cloud.bigquery.v2.ModelService.GetModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "GetModel", - "fullName": "google.cloud.bigquery.v2.ModelService.GetModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_ListModels_async", - "title": "DatasetService listModels Sample", - "origin": "API_DEFINITION", - "description": " Lists all models in the specified dataset. Requires the READER dataset role. After retrieving the list of models, you can get information about a particular model by calling the models.get method.", - "canonical": true, - "file": "model_service.list_models.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListModels", - "fullName": "google.cloud.bigquery.v2.ModelService.ListModels", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListModelsResponse", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "ListModels", - "fullName": "google.cloud.bigquery.v2.ModelService.ListModels", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_PatchModel_async", - "title": "DatasetService patchModel Sample", - "origin": "API_DEFINITION", - "description": " Patch specific fields in the specified model.", - "canonical": true, - "file": "model_service.patch_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchModel", - "fullName": "google.cloud.bigquery.v2.ModelService.PatchModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": ".google.cloud.bigquery.v2.Model" - } - ], - "resultType": ".google.cloud.bigquery.v2.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "PatchModel", - "fullName": "google.cloud.bigquery.v2.ModelService.PatchModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_DeleteModel_async", - "title": "DatasetService deleteModel Sample", - "origin": "API_DEFINITION", - "description": " Deletes the model specified by modelId from the dataset.", - "canonical": true, - "file": "model_service.delete_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteModel", - "fullName": "google.cloud.bigquery.v2.ModelService.DeleteModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "DeleteModel", - "fullName": "google.cloud.bigquery.v2.ModelService.DeleteModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ProjectService_GetServiceAccount_async", - "title": "DatasetService getServiceAccount Sample", - "origin": "API_DEFINITION", - "description": " RPC to get the service account for a project used for interactions with Google Cloud KMS", - "canonical": true, - "file": "project_service.get_service_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServiceAccount", - "fullName": "google.cloud.bigquery.v2.ProjectService.GetServiceAccount", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.GetServiceAccountResponse", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.bigquery.v2.ProjectServiceClient" - }, - "method": { - "shortName": "GetServiceAccount", - "fullName": "google.cloud.bigquery.v2.ProjectService.GetServiceAccount", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.bigquery.v2.ProjectService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_GetRoutine_async", - "title": "DatasetService getRoutine Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified routine resource by routine ID.", - "canonical": true, - "file": "routine_service.get_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.GetRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "GetRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.GetRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_InsertRoutine_async", - "title": "DatasetService insertRoutine Sample", - "origin": "API_DEFINITION", - "description": " Creates a new routine in the dataset.", - "canonical": true, - "file": "routine_service.insert_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.InsertRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "InsertRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.InsertRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_UpdateRoutine_async", - "title": "DatasetService updateRoutine Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing routine. The update method replaces the entire Routine resource.", - "canonical": true, - "file": "routine_service.update_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.UpdateRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "UpdateRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.UpdateRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_PatchRoutine_async", - "title": "DatasetService patchRoutine Sample", - "origin": "API_DEFINITION", - "description": " Patches information in an existing routine. The patch method does a partial update to an existing Routine resource.", - "canonical": true, - "file": "routine_service.patch_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.PatchRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "PatchRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.PatchRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_DeleteRoutine_async", - "title": "DatasetService deleteRoutine Sample", - "origin": "API_DEFINITION", - "description": " Deletes the routine specified by routineId from the dataset.", - "canonical": true, - "file": "routine_service.delete_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.DeleteRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "DeleteRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.DeleteRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_ListRoutines_async", - "title": "DatasetService listRoutines Sample", - "origin": "API_DEFINITION", - "description": " Lists all routines in the specified dataset. Requires the READER dataset role.", - "canonical": true, - "file": "routine_service.list_routines.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRoutines", - "fullName": "google.cloud.bigquery.v2.RoutineService.ListRoutines", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListRoutinesResponse", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "ListRoutines", - "fullName": "google.cloud.bigquery.v2.RoutineService.ListRoutines", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async", - "title": "DatasetService listRowAccessPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists all row access policies on the specified table.", - "canonical": true, - "file": "row_access_policy_service.list_row_access_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRowAccessPolicies", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService.ListRowAccessPolicies", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListRowAccessPoliciesResponse", - "client": { - "shortName": "RowAccessPolicyServiceClient", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyServiceClient" - }, - "method": { - "shortName": "ListRowAccessPolicies", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService.ListRowAccessPolicies", - "service": { - "shortName": "RowAccessPolicyService", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_GetTable_async", - "title": "DatasetService getTable Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.", - "canonical": true, - "file": "table_service.get_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTable", - "fullName": "google.cloud.bigquery.v2.TableService.GetTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "selected_fields", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.bigquery.v2.GetTableRequest.TableMetadataView" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "GetTable", - "fullName": "google.cloud.bigquery.v2.TableService.GetTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_InsertTable_async", - "title": "DatasetService insertTable Sample", - "origin": "API_DEFINITION", - "description": " Creates a new, empty table in the dataset.", - "canonical": true, - "file": "table_service.insert_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertTable", - "fullName": "google.cloud.bigquery.v2.TableService.InsertTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "InsertTable", - "fullName": "google.cloud.bigquery.v2.TableService.InsertTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_PatchTable_async", - "title": "DatasetService patchTable Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports RFC5789 patch semantics.", - "canonical": true, - "file": "table_service.patch_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchTable", - "fullName": "google.cloud.bigquery.v2.TableService.PatchTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - }, - { - "name": "autodetect_schema", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "PatchTable", - "fullName": "google.cloud.bigquery.v2.TableService.PatchTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_UpdateTable_async", - "title": "DatasetService updateTable Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing table. The update method replaces the entire Table resource, whereas the patch method only replaces fields that are provided in the submitted Table resource.", - "canonical": true, - "file": "table_service.update_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTable", - "fullName": "google.cloud.bigquery.v2.TableService.UpdateTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - }, - { - "name": "autodetect_schema", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "UpdateTable", - "fullName": "google.cloud.bigquery.v2.TableService.UpdateTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_DeleteTable_async", - "title": "DatasetService deleteTable Sample", - "origin": "API_DEFINITION", - "description": " Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.", - "canonical": true, - "file": "table_service.delete_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTable", - "fullName": "google.cloud.bigquery.v2.TableService.DeleteTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "DeleteTable", - "fullName": "google.cloud.bigquery.v2.TableService.DeleteTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_ListTables_async", - "title": "DatasetService listTables Sample", - "origin": "API_DEFINITION", - "description": " Lists all tables in the specified dataset. Requires the READER dataset role.", - "canonical": true, - "file": "table_service.list_tables.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTables", - "fullName": "google.cloud.bigquery.v2.TableService.ListTables", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.TableList", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "ListTables", - "fullName": "google.cloud.bigquery.v2.TableService.ListTables", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.delete_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.delete_table.js.baseline deleted file mode 100644 index 2becfa09b578..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.delete_table.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_TableService_DeleteTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to delete - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to delete - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to delete - */ - // const tableId = 'abc123' - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callDeleteTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const response = await bigqueryClient.deleteTable(request); - console.log(response); - } - - callDeleteTable(); - // [END bigquery_v2_generated_TableService_DeleteTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.get_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.get_table.js.baseline deleted file mode 100644 index 40670c75158c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.get_table.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_TableService_GetTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested table - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested table - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the requested table - */ - // const tableId = 'abc123' - /** - * List of table schema fields to return (comma-separated). - * If unspecified, all fields are returned. - * A fieldMask cannot be used here because the fields will automatically be - * converted from camelCase to snake_case and the conversion will fail if - * there are underscores. Since these are fields in BigQuery table schemas, - * underscores are allowed. - */ - // const selectedFields = 'abc123' - /** - * Optional. Specifies the view that determines which table information is - * returned. By default, basic table information and storage statistics - * (STORAGE_STATS) are returned. - */ - // const view = {} - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callGetTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const response = await bigqueryClient.getTable(request); - console.log(response); - } - - callGetTable(); - // [END bigquery_v2_generated_TableService_GetTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.insert_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.insert_table.js.baseline deleted file mode 100644 index e91288f6a105..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.insert_table.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, table) { - // [START bigquery_v2_generated_TableService_InsertTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new table - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the new table - */ - // const datasetId = 'abc123' - /** - * Required. A tables resource to insert - */ - // const table = {} - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callInsertTable() { - // Construct request - const request = { - projectId, - datasetId, - table, - }; - - // Run request - const response = await bigqueryClient.insertTable(request); - console.log(response); - } - - callInsertTable(); - // [END bigquery_v2_generated_TableService_InsertTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.list_tables.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.list_tables.js.baseline deleted file mode 100644 index ac8d9d6dfcf8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.list_tables.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_TableService_ListTables_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the tables to list - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the tables to list - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callListTables() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listTablesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTables(); - // [END bigquery_v2_generated_TableService_ListTables_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.patch_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.patch_table.js.baseline deleted file mode 100644 index c3f7e333d181..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.patch_table.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId, table) { - // [START bigquery_v2_generated_TableService_PatchTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to update - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to update - */ - // const tableId = 'abc123' - /** - * Required. A tables resource which will replace or patch the specified table - */ - // const table = {} - /** - * Optional. When true will autodetect schema, else will keep original schema. - */ - // const autodetectSchema = true - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callPatchTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - table, - }; - - // Run request - const response = await bigqueryClient.patchTable(request); - console.log(response); - } - - callPatchTable(); - // [END bigquery_v2_generated_TableService_PatchTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.update_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.update_table.js.baseline deleted file mode 100644 index 639401eb936d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/samples/generated/v2/table_service.update_table.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId, table) { - // [START bigquery_v2_generated_TableService_UpdateTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to update - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to update - */ - // const tableId = 'abc123' - /** - * Required. A tables resource which will replace or patch the specified table - */ - // const table = {} - /** - * Optional. When true will autodetect schema, else will keep original schema. - */ - // const autodetectSchema = true - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callUpdateTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - table, - }; - - // Run request - const response = await bigqueryClient.updateTable(request); - console.log(response); - } - - callUpdateTable(); - // [END bigquery_v2_generated_TableService_UpdateTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/webpack.config.cjs.baseline deleted file mode 100644 index f4947d41e6bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DatasetService', - filename: './dataset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.OwlBot.yaml.baseline deleted file mode 100644 index 071d8b4ff53a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/bigquery/google-cloud-bigquery-nodejs - dest: /owl-bot-staging/google-cloud-bigquery - -api-name: bigquery \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.jsdoc.js.baseline deleted file mode 100644 index a6cf395f4663..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'bigquery', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/README.md.baseline deleted file mode 100644 index 5ca58630499b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Bigquery: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/bigquery.svg)](https://www.npmjs.org/package/bigquery) - -Bigquery client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Bigquery Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/bigquery/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Bigquery API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install bigquery -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install bigquery@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=bigquery.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-bigquery diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json deleted file mode 100644 index d4c98eed0cc8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "bigquery", - "version": "0.1.0", - "description": "Bigquery client for Node.js", - "repository": "googleapis/nodejs-bigquery", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google bigquery", - "bigquery", - "dataset service", - "job service", - "model service", - "project service", - "routine service", - "row access policy service", - "table service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline deleted file mode 100644 index fd076037b3d6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/biglake_config.proto.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "BigLakeConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configuration for BigLake managed tables. -message BigLakeConfiguration { - // Supported file formats for BigLake tables. - enum FileFormat { - // Default Value. - FILE_FORMAT_UNSPECIFIED = 0; - - // Apache Parquet format. - PARQUET = 1; - } - - // Supported table formats for BigLake tables. - enum TableFormat { - // Default Value. - TABLE_FORMAT_UNSPECIFIED = 0; - - // Apache Iceberg format. - ICEBERG = 1; - } - - // Required. The connection specifying the credentials to be used to read and - // write to external storage, such as Cloud Storage. The connection_id can - // have the form `{project}.{location}.{connection_id}` or - // `projects/{project}/locations/{location}/connections/{connection_id}". - string connection_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The fully qualified location prefix of the external folder where - // table data is stored. The '*' wildcard character is not allowed. The URI - // should be in the format `gs://bucket/path_to_table/` - string storage_uri = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The file format the table data is stored in. - FileFormat file_format = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The table format the metadata only snapshots are stored in. - TableFormat table_format = 4 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/clustering.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/clustering.proto.baseline deleted file mode 100644 index b871f41ecc02..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/clustering.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ClusteringProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configures table clustering. -message Clustering { - // One or more fields on which data should be clustered. Only top-level, - // non-repeated, simple-type fields are supported. The ordering of the - // clustering fields should be prioritized from most to least important - // for filtering purposes. - // - // Additional information on limitations can be found here: - // https://cloud.google.com/bigquery/docs/creating-clustered-tables#limitations - repeated string fields = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline deleted file mode 100644 index e2c6fb67d897..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/data_format_options.proto.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DataFormatOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for data format adjustments. -message DataFormatOptions { - // Optional. Output timestamp as usec int64. Default is false. - bool use_int64_timestamp = 1 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset.proto.baseline deleted file mode 100644 index 62968e292edf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset.proto.baseline +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/external_catalog_dataset_options.proto"; -import "google/cloud/bigquery/v2/external_dataset_reference.proto"; -import "google/cloud/bigquery/v2/restriction_config.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DatasetProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Dataset Service. -// -// It should not be relied on for production use cases at this time. -service DatasetService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Returns the dataset specified by datasetID. - rpc GetDataset(GetDatasetRequest) returns (Dataset) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - }; - } - - // Creates a new empty dataset. - rpc InsertDataset(InsertDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets" - body: "dataset" - }; - } - - // Updates information in an existing dataset. The update method replaces the - // entire dataset resource, whereas the patch method only replaces fields that - // are provided in the submitted dataset resource. - // This method supports RFC5789 patch semantics. - rpc PatchDataset(UpdateOrPatchDatasetRequest) returns (Dataset) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - body: "dataset" - }; - } - - // Updates information in an existing dataset. The update method replaces the - // entire dataset resource, whereas the patch method only replaces fields that - // are provided in the submitted dataset resource. - rpc UpdateDataset(UpdateOrPatchDatasetRequest) returns (Dataset) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - body: "dataset" - }; - } - - // Deletes the dataset specified by the datasetId value. Before you can delete - // a dataset, you must delete all its tables, either manually or by specifying - // deleteContents. Immediately after deletion, you can create another dataset - // with the same name. - rpc DeleteDataset(DeleteDatasetRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}" - }; - } - - // Lists all datasets in the specified project to which the user has been - // granted the READER dataset role. - rpc ListDatasets(ListDatasetsRequest) returns (DatasetList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets" - }; - } - - // Undeletes a dataset which is within time travel window based on datasetId. - // If a time is specified, the dataset version deleted at that time is - // undeleted, else the last live version is undeleted. - rpc UndeleteDataset(UndeleteDatasetRequest) returns (Dataset) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}:undelete" - body: "*" - }; - } -} - -// Grants all resources of particular types in a particular dataset read access -// to the current dataset. -// -// Similar to how individually authorized views work, updates to any resource -// granted through its dataset (including creation of new resources) requires -// read permission to referenced resources, plus write permission to the -// authorizing dataset. -message DatasetAccessEntry { - // Indicates the type of resources in a dataset that the entry applies to. - enum TargetType { - // Do not use. You must set a target type explicitly. - TARGET_TYPE_UNSPECIFIED = 0; - - // This entry applies to views in the dataset. - VIEWS = 1; - - // This entry applies to routines in the dataset. - ROUTINES = 2; - } - - // The dataset this entry applies to - DatasetReference dataset = 1; - - // Which resources in the dataset this entry applies to. Currently, only - // views are supported, but additional target types may be added in the - // future. - repeated TargetType target_types = 2; -} - -// An object that defines dataset access for an entity. -message Access { - // An IAM role ID that should be granted to the user, group, - // or domain specified in this access entry. - // The following legacy mappings will be applied: - // - // * `OWNER`: `roles/bigquery.dataOwner` - // * `WRITER`: `roles/bigquery.dataEditor` - // * `READER`: `roles/bigquery.dataViewer` - // - // This field will accept any of the above formats, but will return only - // the legacy format. For example, if you set this field to - // "roles/bigquery.dataOwner", it will be returned back as "OWNER". - string role = 1; - - // [Pick one] An email address of a user to grant access to. For example: - // fred@example.com. Maps to IAM policy member "user:EMAIL" or - // "serviceAccount:EMAIL". - string user_by_email = 2; - - // [Pick one] An email address of a Google Group to grant access to. - // Maps to IAM policy member "group:GROUP". - string group_by_email = 3; - - // [Pick one] A domain to grant access to. Any users signed in with the domain - // specified will be granted the specified access. Example: "example.com". - // Maps to IAM policy member "domain:DOMAIN". - string domain = 4; - - // [Pick one] A special group to grant access to. Possible values include: - // - // * projectOwners: Owners of the enclosing project. - // * projectReaders: Readers of the enclosing project. - // * projectWriters: Writers of the enclosing project. - // * allAuthenticatedUsers: All authenticated BigQuery users. - // - // Maps to similarly-named IAM members. - string special_group = 5; - - // [Pick one] Some other type of member that appears in the IAM Policy but - // isn't a user, group, domain, or special group. - string iam_member = 7; - - // [Pick one] A view from a different dataset to grant access to. Queries - // executed against that view will have read access to views/tables/routines - // in this dataset. - // The role field is not required when this field is set. If that view is - // updated by any user, access to the view needs to be granted again via an - // update operation. - TableReference view = 6; - - // [Pick one] A routine from a different dataset to grant access to. Queries - // executed against that routine will have read access to - // views/tables/routines in this dataset. Only UDF is supported for now. - // The role field is not required when this field is set. If that routine is - // updated by any user, access to the routine needs to be granted again via - // an update operation. - RoutineReference routine = 8; - - // [Pick one] A grant authorizing all resources of a particular type in a - // particular dataset access to this dataset. Only views are supported for - // now. The role field is not required when this field is set. If that dataset - // is deleted and re-created, its access needs to be granted again via an - // update operation. - DatasetAccessEntry dataset = 9; -} - -// Represents a BigQuery dataset. -message Dataset { - // Indicates the billing model that will be applied to the dataset. - enum StorageBillingModel { - // Value not set. - STORAGE_BILLING_MODEL_UNSPECIFIED = 0; - - // Billing for logical bytes. - LOGICAL = 1; - - // Billing for physical bytes. - PHYSICAL = 2; - } - - // Output only. The resource type. - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash of the resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The fully-qualified unique name of the dataset in the format - // projectId:datasetId. The dataset name without the project name is given in - // the datasetId field. When creating a new dataset, leave this field blank, - // and instead specify the datasetId field. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access the resource again. You can - // use this URL in Get or Update requests to the resource. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. A reference that identifies the dataset. - DatasetReference dataset_reference = 5 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A descriptive name for the dataset. - google.protobuf.StringValue friendly_name = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A user-friendly description of the dataset. - google.protobuf.StringValue description = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The default lifetime of all tables in the dataset, in - // milliseconds. The minimum lifetime value is 3600000 milliseconds (one - // hour). To clear an existing default expiration with a PATCH request, set to - // 0. Once this property is set, all newly-created tables in the dataset will - // have an expirationTime property set to the creation time plus the value in - // this property, and changing the value will only affect new tables, not - // existing ones. When the expirationTime for a given table is reached, that - // table will be deleted automatically. - // If a table's expirationTime is modified or removed before the table - // expires, or if you provide an explicit expirationTime when creating a - // table, that value takes precedence over the default expiration time - // indicated by this property. - google.protobuf.Int64Value default_table_expiration_ms = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // This default partition expiration, expressed in milliseconds. - // - // When new time-partitioned tables are created in a dataset where this - // property is set, the table will inherit this value, propagated as the - // `TimePartitioning.expirationMs` property on the new table. If you set - // `TimePartitioning.expirationMs` explicitly when creating a table, - // the `defaultPartitionExpirationMs` of the containing dataset is ignored. - // - // When creating a partitioned table, if `defaultPartitionExpirationMs` - // is set, the `defaultTableExpirationMs` value is ignored and the table - // will not be inherit a table expiration deadline. - google.protobuf.Int64Value default_partition_expiration_ms = 14; - - // The labels associated with this dataset. You can use these - // to organize and group your datasets. - // You can set this property when inserting or updating a dataset. - // See [Creating and Updating Dataset - // Labels](https://cloud.google.com/bigquery/docs/creating-managing-labels#creating_and_updating_dataset_labels) - // for more information. - map labels = 9; - - // Optional. An array of objects that define dataset access for one or more - // entities. You can set this property when inserting or updating a dataset in - // order to control who is allowed to access the data. If unspecified at - // dataset creation time, BigQuery adds default dataset access for the - // following entities: access.specialGroup: projectReaders; access.role: - // READER; access.specialGroup: projectWriters; access.role: WRITER; - // access.specialGroup: projectOwners; access.role: OWNER; - // access.userByEmail: [dataset creator email]; access.role: OWNER; - // If you patch a dataset, then this field is overwritten by the patched - // dataset's access field. To add entities, you must supply the entire - // existing access array in addition to any new entities that you want to add. - repeated Access access = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time when this dataset was created, in milliseconds since - // the epoch. - int64 creation_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The date when this dataset was last modified, in milliseconds - // since the epoch. - int64 last_modified_time = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The geographic location where the dataset should reside. See - // https://cloud.google.com/bigquery/docs/locations for supported - // locations. - string location = 13; - - // The default encryption key for all tables in the dataset. - // After this property is set, the encryption key of all newly-created tables - // in the dataset is set to this value unless the table creation request or - // query explicitly overrides the key. - EncryptionConfiguration default_encryption_configuration = 16; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Same as `type` in `ListFormatDataset`. - // The type of the dataset, one of: - // - // * DEFAULT - only accessible by owner and authorized accounts, - // * PUBLIC - accessible by everyone, - // * LINKED - linked dataset, - // * EXTERNAL - dataset with definition in external metadata catalog. - string type = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The source dataset reference when the dataset is of type LINKED. - // For all other dataset types it is not set. This field cannot be updated - // once it is set. Any attempt to update this field using Update and Patch API - // Operations will be ignored. - LinkedDatasetSource linked_dataset_source = 19 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Metadata about the LinkedDataset. Filled out when the dataset - // type is LINKED. - LinkedDatasetMetadata linked_dataset_metadata = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Reference to a read-only external dataset defined in data - // catalogs outside of BigQuery. Filled out when the dataset type is EXTERNAL. - ExternalDatasetReference external_dataset_reference = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options defining open source compatible datasets living in the - // BigQuery catalog. Contains metadata of open source database, schema or - // namespace represented by the current dataset. - ExternalCatalogDatasetOptions external_catalog_dataset_options = 32 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. TRUE if the dataset and its table names are case-insensitive, - // otherwise FALSE. By default, this is FALSE, which means the dataset and its - // table names are case-sensitive. This field does not affect routine - // references. - google.protobuf.BoolValue is_case_insensitive = 21 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default collation specification of future tables - // created in the dataset. If a table is created in this dataset without - // table-level default collation, then the table inherits the dataset default - // collation, which is applied to the string fields that do not have explicit - // collation specified. A change to this field affects only tables created - // afterwards, and does not alter the existing tables. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue default_collation = 22 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default rounding mode specification of new tables - // created within this dataset. During table creation, if this field is - // specified, the table within this dataset will inherit the default rounding - // mode of the dataset. Setting the default rounding mode on a table overrides - // this option. Existing tables in the dataset are unaffected. - // If columns are defined during that table creation, - // they will immediately inherit the table's default rounding mode, - // unless otherwise specified. - TableFieldSchema.RoundingMode default_rounding_mode = 26 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the time travel window in hours. The value can be from 48 - // to 168 hours (2 to 7 days). The default value is 168 hours if this is not - // set. - google.protobuf.Int64Value max_time_travel_hours = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Tags for the dataset. To provide tags as inputs, use the - // `resourceTags` field. - repeated GcpTag tags = 24 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Updates storage_billing_model for the dataset. - StorageBillingModel storage_billing_model = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Restriction config for all tables and dataset. If - // set, restrict certain accesses on the dataset and all its tables based on - // the config. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RestrictionConfig restrictions = 27 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached - // to this dataset. Tag keys are globally unique. Tag key is expected to be in - // the namespaced format, for example "123456789012/environment" where - // 123456789012 is the ID of the parent organization or project resource for - // this tag key. Tag value is expected to be the short name, for example - // "Production". See [Tag - // definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - // for more details. - map resource_tags = 30 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A global tag managed by Resource Manager. -// https://cloud.google.com/iam/docs/tags-access-control#definitions -message GcpTag { - // Required. The namespaced friendly name of the tag key, e.g. - // "12345/environment" where 12345 is org id. - string tag_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The friendly short name of the tag value, e.g. "production". - string tag_value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// A dataset source type which refers to another BigQuery dataset. -message LinkedDatasetSource { - // The source dataset reference contains project numbers and not project ids. - DatasetReference source_dataset = 1; -} - -// Metadata about the Linked Dataset. -message LinkedDatasetMetadata { - // Specifies whether Linked Dataset is currently in a linked state or not. - enum LinkState { - // The default value. - // Default to the LINKED state. - LINK_STATE_UNSPECIFIED = 0; - - // Normal Linked Dataset state. Data is queryable via the Linked Dataset. - LINKED = 1; - - // Data publisher or owner has unlinked this Linked Dataset. It means you - // can no longer query or see the data in the Linked Dataset. - UNLINKED = 2; - } - - // Output only. Specifies whether Linked Dataset is currently in a linked - // state or not. - LinkState link_state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for getting information about a dataset. -message GetDatasetRequest { - // DatasetView specifies which dataset information is returned. - enum DatasetView { - // The default value. - // Default to the FULL view. - DATASET_VIEW_UNSPECIFIED = 0; - - // Includes metadata information for the dataset, such as location, - // etag, lastModifiedTime, etc. - METADATA = 1; - - // Includes ACL information for the dataset, which defines dataset access - // for one or more entities. - ACL = 2; - - // Includes both dataset metadata and ACL information. - FULL = 3; - } - - // Required. Project ID of the requested dataset - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested dataset - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies the view that determines which dataset information is - // returned. By default, metadata and ACL information are returned. - DatasetView dataset_view = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for inserting a dataset. -message InsertDatasetRequest { - // Required. Project ID of the new dataset - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Datasets resource to use for the new dataset - Dataset dataset = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Message for updating or patching a dataset. -message UpdateOrPatchDatasetRequest { - // Required. Project ID of the dataset being updated - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the dataset being updated - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Datasets resource which will replace or patch the specified - // dataset. - Dataset dataset = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for deleting a dataset. -message DeleteDatasetRequest { - // Required. Project ID of the dataset being deleted - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of dataset being deleted - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // If True, delete all the tables in the dataset. - // If False and the dataset contains tables, the request will fail. - // Default is False - bool delete_contents = 3; -} - -message ListDatasetsRequest { - // Required. Project ID of the datasets to be listed - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 2; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 3; - - // Whether to list all datasets, including hidden ones - bool all = 4; - - // An expression for filtering the results of the request by label. - // The syntax is `labels.[:]`. - // Multiple filters can be ANDed together by connecting with a space. - // Example: `labels.department:receiving labels.active`. - // See [Filtering datasets using - // labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - // for details. - string filter = 5; -} - -// A dataset resource with only a subset of fields, to be returned in a list of -// datasets. -message ListFormatDataset { - // The resource type. - // This property always returns the value "bigquery#dataset" - string kind = 1; - - // The fully-qualified, unique, opaque ID of the dataset. - string id = 2; - - // The dataset reference. - // Use this property to access specific parts of the dataset's ID, such as - // project ID or dataset ID. - DatasetReference dataset_reference = 3; - - // The labels associated with this dataset. - // You can use these to organize and group your datasets. - map labels = 4; - - // An alternate name for the dataset. The friendly name is purely - // decorative in nature. - google.protobuf.StringValue friendly_name = 5; - - // The geographic location where the dataset resides. - string location = 6; -} - -// Response format for a page of results when listing datasets. -message DatasetList { - // Output only. The resource type. - // This property always returns the value "bigquery#datasetList" - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash value of the results page. You can use this property to - // determine if the page has changed since the last request. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A token that can be used to request the next results page. This property is - // omitted on the final results page. - string next_page_token = 3; - - // An array of the dataset resources in the project. - // Each resource contains basic information. - // For full information about a particular dataset resource, use the Datasets: - // get method. This property is omitted when there are no datasets in the - // project. - repeated ListFormatDataset datasets = 4; - - // A list of skipped locations that were unreachable. For more information - // about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5" - repeated string unreachable = 5; -} - -// Request format for undeleting a dataset. -message UndeleteDatasetRequest { - // Required. Project ID of the dataset to be undeleted - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of dataset being deleted - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The exact time when the dataset was deleted. If not specified, - // the most recently deleted version is undeleted. Undeleting a dataset - // using deletion time is not supported. - google.protobuf.Timestamp deletion_time = 3 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline deleted file mode 100644 index 03695a4c4bdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/dataset_reference.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "DatasetReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Identifier for a dataset. -message DatasetReference { - // Required. A unique ID for this dataset, without the project name. The ID - // must contain only letters (a-z, A-Z), numbers (0-9), or underscores (_). - // The maximum length is 1,024 characters. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The ID of the project containing this dataset. - string project_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline deleted file mode 100644 index 72266b110314..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/decimal_target_types.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "DecimalTargetTypesProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The data types that could be used as a target type when converting decimal -// values. -enum DecimalTargetType { - // Invalid type. - DECIMAL_TARGET_TYPE_UNSPECIFIED = 0; - - // Decimal values could be converted to NUMERIC - // type. - NUMERIC = 1; - - // Decimal values could be converted to BIGNUMERIC - // type. - BIGNUMERIC = 2; - - // Decimal values could be converted to STRING type. - STRING = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline deleted file mode 100644 index ac7ee167995d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/encryption_config.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "EncryptionConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Configuration for Cloud KMS encryption settings. -message EncryptionConfiguration { - // Optional. Describes the Cloud KMS encryption key that will be used to - // protect destination BigQuery table. The BigQuery Service Account associated - // with your project requires access to this encryption key. - google.protobuf.StringValue kms_key_name = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/error.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/error.proto.baseline deleted file mode 100644 index 9cab21c4f2cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/error.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Error details. -message ErrorProto { - // A short error code that summarizes the error. - string reason = 1; - - // Specifies where the error occurred, if present. - string location = 2; - - // Debugging information. This property is internal to Google and should not - // be used. - string debug_info = 3; - - // A human-readable description of the error. - string message = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline deleted file mode 100644 index 70d0f1f40e27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto.baseline +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalCatalogDatasetOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options defining open source compatible datasets living in the BigQuery -// catalog. Contains metadata of open source database, schema -// or namespace represented by the current dataset. -message ExternalCatalogDatasetOptions { - // Optional. A map of key value pairs defining the parameters and properties - // of the open source schema. Maximum size of 2Mib. - map parameters = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The storage location URI for all tables in the dataset. - // Equivalent to hive metastore's database locationUri. Maximum length of 1024 - // characters. - string default_storage_location_uri = 2 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline deleted file mode 100644 index b0833d441f47..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_catalog_table_options.proto.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalCatalogTableOptionsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Metadata about open source compatible table. The fields contained in -// these options correspond to hive metastore's table level properties. -message ExternalCatalogTableOptions { - // Optional. A map of key value pairs defining the parameters and properties - // of the open source table. Corresponds with hive meta store table - // parameters. Maximum size of 4Mib. - map parameters = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A storage descriptor containing information about the physical - // storage of this table. - StorageDescriptor storage_descriptor = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The connection specifying the credentials to be used to read - // external storage, such as Azure Blob, Cloud Storage, or S3. The connection - // is needed to read the open source table from BigQuery Engine. The - // connection_id can have the form - // `..` or - // `projects//locations//connections/`. - string connection_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Contains information about how a table's data is stored and accessed by open -// source query engines. -message StorageDescriptor { - // Optional. The physical location of the table - // (e.g. `gs://spark-dataproc-data/pangea-data/case_sensitive/` or - // `gs://spark-dataproc-data/pangea-data/*`). - // The maximum length is 2056 bytes. - string location_uri = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the fully qualified class name of the InputFormat - // (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcInputFormat"). - // The maximum length is 128 characters. - string input_format = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the fully qualified class name of the OutputFormat - // (e.g. "org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat"). - // The maximum length is 128 characters. - string output_format = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Serializer and deserializer information. - SerDeInfo serde_info = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Serializer and deserializer information. -message SerDeInfo { - // Optional. Name of the SerDe. - // The maximum length is 256 characters. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Specifies a fully-qualified class name of the serialization - // library that is responsible for the translation of data between table - // representation and the underlying low-level input and output format - // structures. The maximum length is 256 characters. - string serialization_library = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Key-value pairs that define the initialization parameters for the - // serialization library. - // Maximum size 10 Kib. - map parameters = 3 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline deleted file mode 100644 index 610af982a5e2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_data_config.proto.baseline +++ /dev/null @@ -1,499 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/decimal_target_types.proto"; -import "google/cloud/bigquery/v2/file_set_specification_type.proto"; -import "google/cloud/bigquery/v2/hive_partitioning.proto"; -import "google/cloud/bigquery/v2/json_extension.proto"; -import "google/cloud/bigquery/v2/map_target_type.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ExternalDataConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for external data sources. -message AvroOptions { - // Optional. If sourceFormat is set to "AVRO", indicates whether to interpret - // logical types as the corresponding BigQuery data type (for example, - // TIMESTAMP), instead of using the raw type (for example, INTEGER). - google.protobuf.BoolValue use_avro_logical_types = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Parquet Options for load and make external tables. -message ParquetOptions { - // Optional. Indicates whether to infer Parquet ENUM logical type as STRING - // instead of BYTES by default. - google.protobuf.BoolValue enum_as_string = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether to use schema inference specifically for - // Parquet LIST logical type. - google.protobuf.BoolValue enable_list_inference = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates how to represent a Parquet map if present. - MapTargetType map_target_type = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a CSV data source. -message CsvOptions { - // Optional. The separator character for fields in a CSV file. The separator - // is interpreted as a single byte. For files encoded in ISO-8859-1, any - // single character can be used as a separator. For files encoded in UTF-8, - // characters represented in decimal range 1-127 (U+0001-U+007F) can be used - // without any modification. UTF-8 characters encoded with multiple bytes - // (i.e. U+0080 and above) will have only the first byte used for separating - // fields. The remaining bytes will be treated as a part of the field. - // BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab - // separator. The default value is comma (",", U+002C). - string field_delimiter = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of rows at the top of a CSV file that BigQuery will - // skip when reading the data. The default value is 0. This property is - // useful if you have header rows in the file that should be skipped. - // When autodetect is on, the behavior is the following: - // - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int64Value skip_leading_rows = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The value that is used to quote data sections in a CSV file. - // BigQuery converts the string to ISO-8859-1 encoding, and then uses the - // first byte of the encoded string to split the data in its raw, binary - // state. - // The default value is a double-quote ("). - // If your data does not contain quoted sections, - // set the property value to an empty string. - // If your data contains quoted newline characters, you must also set the - // allowQuotedNewlines property to true. - // To include the specific quote character within a quoted value, precede it - // with an additional matching quote character. For example, if you want to - // escape the default character ' " ', use ' "" '. - google.protobuf.StringValue quote = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should allow quoted data sections that - // contain newline characters in a CSV file. The default value is false. - google.protobuf.BoolValue allow_quoted_newlines = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should accept rows that are missing - // trailing optional columns. If true, BigQuery treats missing trailing - // columns as null values. - // If false, records with missing trailing columns are treated as bad records, - // and if there are too many bad records, an invalid error is returned in the - // job result. The default value is false. - google.protobuf.BoolValue allow_jagged_rows = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The character encoding of the data. - // The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. - // BigQuery decodes the data after the raw, binary data has been split using - // the values of the quote and fieldDelimiter properties. - string encoding = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if the embedded ASCII control characters (the first 32 - // characters in the ASCII-table, from '\x00' to '\x1F') are preserved. - google.protobuf.BoolValue preserve_ascii_control_characters = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a string that represents a null value in a CSV file. - // For example, if you specify "\N", BigQuery interprets "\N" as a null value - // when querying a CSV file. - // The default value is the empty string. If you set this property to a custom - // value, BigQuery throws an error if an empty string is present for all data - // types except for STRING and BYTE. For STRING and BYTE columns, BigQuery - // interprets the empty string as an empty value. - google.protobuf.StringValue null_marker = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Json Options for load and make external tables. -message JsonOptions { - // Optional. The character encoding of the data. - // The supported values are UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. - string encoding = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a Bigtable column. -message BigtableColumn { - // [Required] Qualifier of the column. - // Columns in the parent column family that has this exact qualifier are - // exposed as `.` field. - // If the qualifier is valid UTF-8 string, it can be specified in the - // qualifier_string field. Otherwise, a base-64 encoded value must be set to - // qualifier_encoded. - // The column field name is the same as the column qualifier. However, if the - // qualifier is not a valid BigQuery field identifier i.e. does not match - // [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided as field_name. - google.protobuf.BytesValue qualifier_encoded = 1; - - // Qualifier string. - google.protobuf.StringValue qualifier_string = 2; - - // Optional. If the qualifier is not a valid BigQuery field identifier i.e. - // does not match [a-zA-Z][a-zA-Z0-9_]*, a valid identifier must be provided - // as the column field name and is used as field name in queries. - string field_name = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type to convert the value in cells of this column. - // The values are expected to be encoded using HBase Bytes.toBytes function - // when using the BINARY encoding value. - // Following BigQuery types are allowed (case-sensitive): - // - // * BYTES - // * STRING - // * INTEGER - // * FLOAT - // * BOOLEAN - // * JSON - // - // Default type is BYTES. - // 'type' can also be set at the column family level. However, the setting at - // this level takes precedence if 'type' is set at both levels. - string type = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The encoding of the values when the type is not STRING. - // Acceptable encoding values are: - // TEXT - indicates values are alphanumeric text strings. - // BINARY - indicates values are encoded using HBase Bytes.toBytes family of - // functions. - // 'encoding' can also be set at the column family level. However, the setting - // at this level takes precedence if 'encoding' is set at both levels. - string encoding = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is set, only the latest version of value in this column - // are exposed. - // 'onlyReadLatest' can also be set at the column family level. However, the - // setting at this level takes precedence if 'onlyReadLatest' is set at both - // levels. - google.protobuf.BoolValue only_read_latest = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Information related to a Bigtable column family. -message BigtableColumnFamily { - // Identifier of the column family. - string family_id = 1; - - // Optional. The type to convert the value in cells of this column family. - // The values are expected to be encoded using HBase Bytes.toBytes function - // when using the BINARY encoding value. - // Following BigQuery types are allowed (case-sensitive): - // - // * BYTES - // * STRING - // * INTEGER - // * FLOAT - // * BOOLEAN - // * JSON - // - // Default type is BYTES. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying a type for it. - string type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The encoding of the values when the type is not STRING. - // Acceptable encoding values are: - // TEXT - indicates values are alphanumeric text strings. - // BINARY - indicates values are encoded using HBase Bytes.toBytes family of - // functions. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying an encoding for it. - string encoding = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Lists of columns that should be exposed as individual fields as - // opposed to a list of (column name, value) pairs. - // All columns whose qualifier matches a qualifier in this list can be - // accessed as `.`. - // Other columns can be accessed as a list through - // the `.Column` field. - repeated BigtableColumn columns = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this is set only the latest version of value are exposed for - // all columns in this column family. - // This can be overridden for a specific column by listing that column in - // 'columns' and specifying a different setting - // for that column. - google.protobuf.BoolValue only_read_latest = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options specific to Google Cloud Bigtable data sources. -message BigtableOptions { - // Optional. List of column families to expose in the table schema along with - // their types. - // This list restricts the column families that can be referenced in queries - // and specifies their value types. - // You can use this list to do type conversions - see the 'type' field for - // more details. - // If you leave this list empty, all column families are present in the table - // schema and their values are read as BYTES. - // During a query only the column families referenced in that query are read - // from Bigtable. - repeated BigtableColumnFamily column_families = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then the column families that are not - // specified in columnFamilies list are not exposed in the table schema. - // Otherwise, they are read with BYTES type values. - // The default value is false. - google.protobuf.BoolValue ignore_unspecified_column_families = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then the rowkey column families will be read - // and converted to string. Otherwise they are read with BYTES type values and - // users need to manually cast them with CAST if necessary. - // The default value is false. - google.protobuf.BoolValue read_rowkey_as_string = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If field is true, then each column family will be read as a - // single JSON column. Otherwise they are read as a repeated cell structure - // containing timestamp/value tuples. The default value is false. - google.protobuf.BoolValue output_column_families_as_json = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options specific to Google Sheets data sources. -message GoogleSheetsOptions { - // Optional. The number of rows at the top of a sheet that BigQuery will skip - // when reading the data. The default value is 0. This property is useful if - // you have header rows that should be skipped. When autodetect is on, - // the behavior is the following: - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int64Value skip_leading_rows = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Range of a sheet to query from. Only used when non-empty. - // Typical format: sheet_name!top_left_cell_id:bottom_right_cell_id - // For example: sheet1!A1:B20 - string range = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ExternalDataConfiguration { - // Supported Object Metadata Types. - enum ObjectMetadata { - // Unspecified by default. - OBJECT_METADATA_UNSPECIFIED = 0; - - // A synonym for `SIMPLE`. - DIRECTORY = 1; - - // Directory listing of objects. - SIMPLE = 2; - } - - // MetadataCacheMode identifies if the table should use metadata caching for - // files from external source (eg Google Cloud Storage). - enum MetadataCacheMode { - // Unspecified metadata cache mode. - METADATA_CACHE_MODE_UNSPECIFIED = 0; - - // Set this mode to trigger automatic background refresh of metadata cache - // from the external source. Queries will use the latest available cache - // version within the table's maxStaleness interval. - AUTOMATIC = 1; - - // Set this mode to enable triggering manual refresh of the metadata cache - // from external source. Queries will use the latest manually triggered - // cache version within the table's maxStaleness interval. - MANUAL = 2; - } - - // [Required] The fully-qualified URIs that point to your data in Google - // Cloud. For Google Cloud Storage URIs: - // Each URI can contain one '*' wildcard character and it must come after - // the 'bucket' name. - // Size limits related to load jobs apply to external data sources. - // For Google Cloud Bigtable URIs: - // Exactly one URI can be specified and it has be a fully specified and - // valid HTTPS URL for a Google Cloud Bigtable table. - // For Google Cloud Datastore backups, exactly one URI can be specified. Also, - // the '*' wildcard character is not allowed. - repeated string source_uris = 1; - - // Optional. Specifies how source URIs are interpreted for constructing the - // file set to load. By default source URIs are expanded against the - // underlying storage. Other options include specifying manifest files. Only - // applicable to object storage systems. - FileSetSpecType file_set_spec_type = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The schema for the data. - // Schema is required for CSV and JSON formats if autodetect is not on. - // Schema is disallowed for Google Cloud Bigtable, Cloud Datastore backups, - // Avro, ORC and Parquet formats. - TableSchema schema = 2 [(google.api.field_behavior) = OPTIONAL]; - - // [Required] The data format. - // For CSV files, specify "CSV". - // For Google sheets, specify "GOOGLE_SHEETS". - // For newline-delimited JSON, specify "NEWLINE_DELIMITED_JSON". - // For Avro files, specify "AVRO". - // For Google Cloud Datastore backups, specify "DATASTORE_BACKUP". - // For Apache Iceberg tables, specify "ICEBERG". - // For ORC files, specify "ORC". - // For Parquet files, specify "PARQUET". - // [Beta] For Google Cloud Bigtable, specify "BIGTABLE". - string source_format = 3; - - // Optional. The maximum number of bad records that BigQuery can ignore when - // reading data. If the number of bad records exceeds this value, an invalid - // error is returned in the job result. The default value is 0, which requires - // that all records are valid. This setting is ignored for Google Cloud - // Bigtable, Google Cloud Datastore backups, Avro, ORC and Parquet formats. - google.protobuf.Int32Value max_bad_records = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Try to detect schema and format options automatically. - // Any option specified explicitly will be honored. - google.protobuf.BoolValue autodetect = 5; - - // Optional. Indicates if BigQuery should allow extra values that are not - // represented in the table schema. - // If true, the extra values are ignored. - // If false, records with extra columns are treated as bad records, and if - // there are too many bad records, an invalid error is returned in the job - // result. - // The default value is false. - // The sourceFormat property determines what BigQuery treats as an extra - // value: - // CSV: Trailing columns - // JSON: Named values that don't match any column names - // Google Cloud Bigtable: This setting is ignored. - // Google Cloud Datastore backups: This setting is ignored. - // Avro: This setting is ignored. - // ORC: This setting is ignored. - // Parquet: This setting is ignored. - google.protobuf.BoolValue ignore_unknown_values = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The compression type of the data source. - // Possible values include GZIP and NONE. The default value is NONE. - // This setting is ignored for Google Cloud Bigtable, Google Cloud Datastore - // backups, Avro, ORC and Parquet - // formats. An empty string is an invalid value. - string compression = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to CSV. - CsvOptions csv_options = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to JSON. - JsonOptions json_options = 26 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional options if sourceFormat is set to BIGTABLE. - BigtableOptions bigtable_options = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional options if sourceFormat is set to GOOGLE_SHEETS. - GoogleSheetsOptions google_sheets_options = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When set, configures hive partitioning support. Not all storage - // formats support hive partitioning -- requesting hive partitioning on an - // unsupported format will lead to an error, as will providing an invalid - // specification. - HivePartitioningOptions hive_partitioning_options = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The connection specifying the credentials to be used to read - // external storage, such as Azure Blob, Cloud Storage, or S3. The - // connection_id can have the form - // `{project_id}.{location_id};{connection_id}` or - // `projects/{project_id}/locations/{location_id}/connections/{connection_id}`. - string connection_id = 14 [(google.api.field_behavior) = OPTIONAL]; - - // Defines the list of possible SQL data types to which the source decimal - // values are converted. This list and the precision and the scale parameters - // of the decimal field determine the target type. In the order of NUMERIC, - // BIGNUMERIC, and STRING, a - // type is picked if it is in the specified list and if it supports the - // precision and the scale. STRING supports all precision and scale values. - // If none of the listed types supports the precision and the scale, the type - // supporting the widest range in the specified list is picked, and if a value - // exceeds the supported range when reading the data, an error will be thrown. - // - // Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. - // If (precision,scale) is: - // - // * (38,9) -> NUMERIC; - // * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); - // * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); - // * (76,38) -> BIGNUMERIC; - // * (77,38) -> BIGNUMERIC (error if value exeeds supported range). - // - // This field cannot contain duplicate types. The order of the types in this - // field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as - // ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over - // BIGNUMERIC. - // - // Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other - // file formats. - repeated DecimalTargetType decimal_target_types = 16; - - // Optional. Additional properties to set if sourceFormat is set to AVRO. - AvroOptions avro_options = 17 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Load option to be used together with source_format - // newline-delimited JSON to indicate that a variant of JSON is being loaded. - // To load newline-delimited GeoJSON, specify GEOJSON (and source_format must - // be set to NEWLINE_DELIMITED_JSON). - JsonExtension json_extension = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to PARQUET. - ParquetOptions parquet_options = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. ObjectMetadata is used to create Object Tables. Object Tables - // contain a listing of objects (with their metadata) found at the - // source_uris. If ObjectMetadata is set, source_format should be omitted. - // - // Currently SIMPLE is the only supported Object Metadata type. - optional ObjectMetadata object_metadata = 22 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When creating an external table, the user can provide a reference - // file with the table schema. This is enabled for the following formats: - // AVRO, PARQUET, ORC. - google.protobuf.StringValue reference_file_schema_uri = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Metadata Cache Mode for the table. Set this to enable caching of - // metadata from external data source. - MetadataCacheMode metadata_cache_mode = 24 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline deleted file mode 100644 index 8d3a3b4c91f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/external_dataset_reference.proto.baseline +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "ExternalDatasetReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; -option (google.api.resource_definition) = { - type: "bigqueryconnection.googleapis.com/Connection" - pattern: "projects/{project}/locations/{location}/connections/{connection}" -}; - -// Configures the access a dataset defined in an external metadata storage. -message ExternalDatasetReference { - // Required. External source that backs this dataset. - string external_source = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The connection id that is used to access the external_source. - // - // Format: - // projects/{project_id}/locations/{location_id}/connections/{connection_id} - string connection = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "bigqueryconnection.googleapis.com/Connection" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline deleted file mode 100644 index 1068d20eb782..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/file_set_specification_type.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "FileSetSpecificationTypeProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This enum defines how to interpret source URIs for load jobs and external -// tables. -enum FileSetSpecType { - // This option expands source URIs by listing files from the object store. It - // is the default behavior if FileSetSpecType is not set. - FILE_SET_SPEC_TYPE_FILE_SYSTEM_MATCH = 0; - - // This option indicates that the provided URIs are newline-delimited manifest - // files, with one URI per line. Wildcard URIs are not supported. - FILE_SET_SPEC_TYPE_NEW_LINE_DELIMITED_MANIFEST = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline deleted file mode 100644 index 76872bd1a026..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/hive_partitioning.proto.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "HivePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Options for configuring hive partitioning detect. -message HivePartitioningOptions { - // Optional. When set, what mode of hive partitioning to use when reading - // data. The following modes are supported: - // - // * AUTO: automatically infer partition key name(s) and type(s). - // - // * STRINGS: automatically infer partition key name(s). All types are - // strings. - // - // * CUSTOM: partition key schema is encoded in the source URI prefix. - // - // Not all storage formats support hive partitioning. Requesting hive - // partitioning on an unsupported format will lead to an error. - // Currently supported formats are: JSON, CSV, ORC, Avro and Parquet. - string mode = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When hive partition detection is requested, a common prefix for - // all source uris must be required. The prefix must end immediately before - // the partition key encoding begins. For example, consider files following - // this data layout: - // - // gs://bucket/path_to_table/dt=2019-06-01/country=USA/id=7/file.avro - // - // gs://bucket/path_to_table/dt=2019-05-31/country=CA/id=3/file.avro - // - // When hive partitioning is requested with either AUTO or STRINGS detection, - // the common prefix can be either of gs://bucket/path_to_table or - // gs://bucket/path_to_table/. - // - // CUSTOM detection requires encoding the partitioning schema immediately - // after the common prefix. For CUSTOM, any of - // - // * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:INTEGER} - // - // * gs://bucket/path_to_table/{dt:STRING}/{country:STRING}/{id:INTEGER} - // - // * gs://bucket/path_to_table/{dt:DATE}/{country:STRING}/{id:STRING} - // - // would all be valid source URI prefixes. - string source_uri_prefix = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, queries over this table require a partition - // filter that can be used for partition elimination to be specified. - // - // Note that this field should only be true when creating a permanent - // external table or querying a temporary external table. - // - // Hive-partitioned loads with require_partition_filter explicitly set to - // true will fail. - google.protobuf.BoolValue require_partition_filter = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. For permanent external tables, this field is populated with - // the hive partition keys in the order they were inferred. The types of the - // partition keys can be deduced by checking the table schema (which will - // include the partition keys). Not every API will populate this field in the - // output. For example, Tables.Get will populate it, but Tables.List will not - // contain this field. - repeated string fields = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job.proto.baseline deleted file mode 100644 index b15e1fb428ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job.proto.baseline +++ /dev/null @@ -1,738 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/data_format_options.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/error.proto"; -import "google/cloud/bigquery/v2/job_config.proto"; -import "google/cloud/bigquery/v2/job_creation_reason.proto"; -import "google/cloud/bigquery/v2/job_reference.proto"; -import "google/cloud/bigquery/v2/job_stats.proto"; -import "google/cloud/bigquery/v2/job_status.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/session_info.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Job Service. -// -// It should not be relied on for production use cases at this time. -service JobService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/devstorage.full_control," - "https://www.googleapis.com/auth/devstorage.read_only," - "https://www.googleapis.com/auth/devstorage.read_write"; - - // Requests that a job be cancelled. This call will return immediately, and - // the client will need to poll for the job status to see if the cancel - // completed successfully. Cancelled jobs may still incur costs. - rpc CancelJob(CancelJobRequest) returns (JobCancelResponse) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}/cancel" - }; - } - - // Returns information about a specific job. Job information is available for - // a six month period after creation. Requires that you're the person who ran - // the job, or have the Is Owner project role. - rpc GetJob(GetJobRequest) returns (Job) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}" - }; - } - - // Starts a new asynchronous job. - // - // This API has two different kinds of endpoint URIs, as this method supports - // a variety of use cases. - // - // * The *Metadata* URI is used for most interactions, as it accepts the job - // configuration directly. - // * The *Upload* URI is ONLY for the case when you're sending both a load job - // configuration and a data stream together. In this case, the Upload URI - // accepts the job configuration and the data as two distinct multipart MIME - // parts. - rpc InsertJob(InsertJobRequest) returns (Job) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/jobs" - body: "job" - }; - } - - // Requests the deletion of the metadata of a job. This call returns when the - // job's metadata is deleted. - rpc DeleteJob(DeleteJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/jobs/{job_id=*}/delete" - }; - } - - // Lists all jobs that you started in the specified project. Job information - // is available for a six month period after creation. The job list is sorted - // in reverse chronological order, by job creation time. Requires the Can View - // project role, or the Is Owner project role if you set the allUsers - // property. - rpc ListJobs(ListJobsRequest) returns (JobList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/jobs" - }; - } - - // RPC to get the results of a query job. - rpc GetQueryResults(GetQueryResultsRequest) - returns (GetQueryResultsResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/queries/{job_id=*}" - }; - } - - // Runs a BigQuery SQL query synchronously and returns query results if the - // query completes within a specified timeout. - rpc Query(PostQueryRequest) returns (QueryResponse) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/queries" - body: "query_request" - }; - } -} - -message Job { - // Output only. The type of the resource. - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A hash of this resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Opaque ID field of the job. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access the resource again. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Email address of the user who ran the job. - string user_email = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Describes the job configuration. - JobConfiguration configuration = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Reference describing the unique-per-user name of the job. - JobReference job_reference = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Information about the job, including starting time and ending - // time of the job. - JobStatistics statistics = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of this job. Examine this value when polling an - // asynchronous job to see if the job is complete. - JobStatus status = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Full-projection-only] String representation of identity of - // requesting party. Populated for both first- and third-party identities. - // Only present for APIs that support third-party identities. - string principal_subject = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The reason why a Job was created. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationReason job_creation_reason = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Describes format of a jobs cancellation request. -message CancelJobRequest { - // Required. Project ID of the job to cancel - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the job to cancel - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes format of a jobs cancellation response. -message JobCancelResponse { - // The resource type of the response. - string kind = 1; - - // The final state of the job. - Job job = 2; -} - -// Describes format of a jobs get request. -message GetJobRequest { - // Required. Project ID of the requested job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the requested job. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes format of a job insertion request. -message InsertJobRequest { - // Project ID of project that will be billed for the job. - string project_id = 1; - - // Jobs resource to insert. - Job job = 3; -} - -// Describes the format of a jobs deletion request. -message DeleteJobRequest { - // Required. Project ID of the job for which metadata is to be deleted. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the job for which metadata is to be deleted. If this is - // a parent job which has child jobs, the metadata from all child jobs will be - // deleted as well. Direct deletion of the metadata of child jobs is not - // allowed. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The geographic location of the job. Required. - // See details at: - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 3; -} - -// Describes the format of the list jobs request. -message ListJobsRequest { - // Projection is used to control what job information is returned. - enum Projection { - option allow_alias = true; - - // Does not include the job configuration - minimal = 0; - - // Does not include the job configuration - MINIMAL = 0; - - // Includes all job data - full = 1; - - // Includes all job data - FULL = 1; - } - - // StateFilter allows filtration by job execution state. - enum StateFilter { - option allow_alias = true; - - // Finished jobs - done = 0; - - // Finished jobs - DONE = 0; - - // Pending jobs - pending = 1; - - // Pending jobs - PENDING = 1; - - // Running jobs - running = 2; - - // Running jobs. - RUNNING = 2; - } - - // Project ID of the jobs to list. - string project_id = 1; - - // Whether to display jobs owned by all users in the project. Default False. - bool all_users = 2; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.Int32Value max_results = 3; - - // Min value for job creation time, in milliseconds since the POSIX epoch. - // If set, only jobs created after or at this timestamp are returned. - uint64 min_creation_time = 4; - - // Max value for job creation time, in milliseconds since the POSIX epoch. - // If set, only jobs created before or at this timestamp are returned. - google.protobuf.UInt64Value max_creation_time = 5; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 6; - - // Restrict information returned to a set of selected fields - Projection projection = 7; - - // Filter for job state - repeated StateFilter state_filter = 8; - - // If set, show only child jobs of the specified parent. Otherwise, show all - // top-level jobs. - string parent_job_id = 9; -} - -// ListFormatJob is a partial projection of job information returned as part -// of a jobs.list response. -message ListFormatJob { - // Unique opaque ID of the job. - string id = 1; - - // The resource type. - string kind = 2; - - // Unique opaque ID of the job. - JobReference job_reference = 3; - - // Running state of the job. When the state is DONE, errorResult can be - // checked to determine whether the job succeeded or failed. - string state = 4; - - // A result object that will be present only if the job has failed. - ErrorProto error_result = 5; - - // Output only. Information about the job, including starting time and ending - // time of the job. - JobStatistics statistics = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Describes the job configuration. - JobConfiguration configuration = 7 [(google.api.field_behavior) = REQUIRED]; - - // [Full-projection-only] Describes the status of this job. - JobStatus status = 8; - - // [Full-projection-only] Email address of the user who ran the job. - string user_email = 9; - - // [Full-projection-only] String representation of identity of requesting - // party. Populated for both first- and third-party identities. Only present - // for APIs that support third-party identities. - string principal_subject = 10; -} - -// JobList is the response format for a jobs.list call. -message JobList { - // A hash of this page of results. - string etag = 1; - - // The resource type of the response. - string kind = 2; - - // A token to request the next page of results. - string next_page_token = 3; - - // List of jobs that were requested. - repeated ListFormatJob jobs = 4; - - // A list of skipped locations that were unreachable. For more information - // about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations. Example: "europe-west5" - repeated string unreachable = 5; -} - -// Request object of GetQueryResults. -message GetQueryResultsRequest { - // Required. Project ID of the query job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Job ID of the query job. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Zero-based index of the starting row. - google.protobuf.UInt64Value start_index = 3; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 4; - - // Maximum number of results to read. - google.protobuf.UInt32Value max_results = 5; - - // Optional: Specifies the maximum amount of time, in milliseconds, that the - // client is willing to wait for the query to complete. By default, this limit - // is 10 seconds (10,000 milliseconds). If the query is complete, the - // jobComplete field in the response is true. If the query has not yet - // completed, jobComplete is false. - // - // You can request a longer timeout period in the timeoutMs field. However, - // the call is not guaranteed to wait for the specified timeout; it typically - // returns after around 200 seconds (200,000 milliseconds), even if the query - // is not complete. - // - // If jobComplete is false, you can continue to wait for the query to complete - // by calling the getQueryResults method until the jobComplete field in the - // getQueryResults response is true. - google.protobuf.UInt32Value timeout_ms = 6; - - // The geographic location of the job. You must specify the location to run - // the job for the following scenarios: - // - // * If the location to run a job is not in the `us` or - // the `eu` multi-regional location - // * If the job's location is in a single region (for example, - // `us-central1`) - // - // For more information, see - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 7; - - // Optional. Output format adjustments. - DataFormatOptions format_options = 8 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response object of GetQueryResults. -message GetQueryResultsResponse { - // The resource type of the response. - string kind = 1; - - // A hash of this response. - string etag = 2; - - // The schema of the results. Present only when the query completes - // successfully. - TableSchema schema = 3; - - // Reference to the BigQuery Job that was created to run the query. This field - // will be present even if the original request timed out, in which case - // GetQueryResults can be used to read the results once the query has - // completed. Since this API only returns the first page of results, - // subsequent pages can be fetched via the same mechanism (GetQueryResults). - JobReference job_reference = 4; - - // The total number of rows in the complete query result set, which can be - // more than the number of rows in this single page of results. Present only - // when the query completes successfully. - google.protobuf.UInt64Value total_rows = 5; - - // A token used for paging results. When this token is non-empty, it - // indicates additional results are available. - string page_token = 6; - - // An object with as many results as can be contained within the maximum - // permitted reply size. To get any additional rows, you can call - // GetQueryResults and specify the jobReference returned above. Present only - // when the query completes successfully. - // - // The REST-based representation of this data leverages a series of - // JSON f,v objects for indicating fields and values. - repeated google.protobuf.Struct rows = 7; - - // The total number of bytes processed for this query. - google.protobuf.Int64Value total_bytes_processed = 8; - - // Whether the query has completed or not. If rows or totalRows are present, - // this will always be true. If this is false, totalRows will not be - // available. - google.protobuf.BoolValue job_complete = 9; - - // Output only. The first errors or warnings encountered during the running - // of the job. The final message includes the number of errors that caused the - // process to stop. Errors here do not necessarily mean that the job has - // completed or was unsuccessful. For more information about error messages, - // see [Error - // messages](https://cloud.google.com/bigquery/docs/error-messages). - repeated ErrorProto errors = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 11; - - // Output only. The number of rows affected by a DML statement. Present only - // for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for the query request. -message PostQueryRequest { - // Required. Project ID of the query request. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The query request body. - QueryRequest query_request = 2; -} - -// Describes the format of the jobs.query request. -message QueryRequest { - // Job Creation Mode provides different options on job creation. - enum JobCreationMode { - // If unspecified JOB_CREATION_REQUIRED is the default. - JOB_CREATION_MODE_UNSPECIFIED = 0; - - // Default. Job creation is always required. - JOB_CREATION_REQUIRED = 1; - - // Job creation is optional. Returning immediate results is prioritized. - // BigQuery will automatically determine if a Job needs to be created. - // The conditions under which BigQuery can decide to not create a Job are - // subject to change. If Job creation is required, JOB_CREATION_REQUIRED - // mode should be used, which is the default. - JOB_CREATION_OPTIONAL = 2; - } - - // The resource type of the request. - string kind = 2; - - // Required. A query string to execute, using Google Standard SQL or legacy - // SQL syntax. Example: "SELECT COUNT(f1) FROM - // myProjectId.myDatasetId.myTableId". - string query = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The maximum number of rows of data to return per page of - // results. Setting this flag to a small value such as 1000 and then paging - // through results might improve reliability when the query result set is - // large. In addition to this limit, responses are also limited to 10 MB. By - // default, there is no maximum row count, and only the byte limit applies. - google.protobuf.UInt32Value max_results = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the default datasetId and projectId to assume for any - // unqualified table names in the query. If not set, all table names in the - // query string must be qualified in the format 'datasetId.tableId'. - DatasetReference default_dataset = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional: Specifies the maximum amount of time, in milliseconds, - // that the client is willing to wait for the query to complete. By default, - // this limit is 10 seconds (10,000 milliseconds). If the query is complete, - // the jobComplete field in the response is true. If the query has not yet - // completed, jobComplete is false. - // - // You can request a longer timeout period in the timeoutMs field. However, - // the call is not guaranteed to wait for the specified timeout; it typically - // returns after around 200 seconds (200,000 milliseconds), even if the query - // is not complete. - // - // If jobComplete is false, you can continue to wait for the query to complete - // by calling the getQueryResults method until the jobComplete field in the - // getQueryResults response is true. - google.protobuf.UInt32Value timeout_ms = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, BigQuery doesn't run the job. Instead, if the - // query is valid, BigQuery returns statistics about the job such as how many - // bytes would be processed. If the query is invalid, an error returns. The - // default value is false. - bool dry_run = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether to look for the result in the query cache. The query - // cache is a best-effort cache that will be flushed whenever tables in the - // query are modified. The default value is true. - google.protobuf.BoolValue use_query_cache = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Specifies whether to use BigQuery's legacy SQL dialect for this query. The - // default value is true. If set to false, the query will use BigQuery's - // GoogleSQL: https://cloud.google.com/bigquery/sql-reference/ When - // useLegacySql is set to false, the value of flattenResults is ignored; query - // will be run as if flattenResults is false. - google.protobuf.BoolValue use_legacy_sql = 10; - - // GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters - // or to NAMED to use named (@myparam) query parameters in this query. - string parameter_mode = 11; - - // Query parameters for GoogleSQL queries. - repeated QueryParameter query_parameters = 12; - - // The geographic location where the job should run. See details at - // https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - string location = 13; - - // Optional. Output format adjustments. - DataFormatOptions format_options = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Connection properties which can modify the query behavior. - repeated ConnectionProperty connection_properties = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels associated with this query. - // Labels can be used to organize and group query jobs. - // Label keys and values can be no longer than 63 characters, can only contain - // lowercase letters, numeric characters, underscores and dashes. - // International characters are allowed. Label keys must start with a letter - // and each label in the list must have a different key. - map labels = 17 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Limits the bytes billed for this query. Queries with - // bytes billed above this limit will fail (without incurring a charge). - // If unspecified, the project default is used. - google.protobuf.Int64Value maximum_bytes_billed = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique user provided identifier to ensure idempotent behavior - // for queries. Note that this is different from the job_id. It has the - // following properties: - // - // 1. It is case-sensitive, limited to up to 36 ASCII characters. A UUID is - // recommended. - // - // 2. Read only queries can ignore this token since they are nullipotent by - // definition. - // - // 3. For the purposes of idempotency ensured by the request_id, a request - // is considered duplicate of another only if they have the same request_id - // and are actually duplicates. When determining whether a request is a - // duplicate of another request, all parameters in the request that - // may affect the result are considered. For example, query, - // connection_properties, query_parameters, use_legacy_sql are parameters - // that affect the result and are considered when determining whether a - // request is a duplicate, but properties like timeout_ms don't - // affect the result and are thus not considered. Dry run query - // requests are never considered duplicate of another request. - // - // 4. When a duplicate mutating query request is detected, it returns: - // a. the results of the mutation if it completes successfully within - // the timeout. - // b. the running operation if it is still in progress at the end of the - // timeout. - // - // 5. Its lifetime is limited to 15 minutes. In other words, if two - // requests are sent with the same request_id, but more than 15 minutes - // apart, idempotency is not guaranteed. - string request_id = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, creates a new session using a randomly generated - // session_id. If false, runs query with an existing session_id passed in - // ConnectionProperty, otherwise runs query in non-session mode. - // - // The session location will be set to QueryRequest.location if it is present, - // otherwise it's set to the default location based on existing routing logic. - google.protobuf.BoolValue create_session = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If not set, jobs are always required. - // - // If set, the query request will follow the behavior described - // JobCreationMode. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationMode job_creation_mode = 22 - [(google.api.field_behavior) = OPTIONAL]; -} - -message QueryResponse { - // The resource type. - string kind = 1; - - // The schema of the results. Present only when the query completes - // successfully. - TableSchema schema = 2; - - // Reference to the Job that was created to run the query. This field will be - // present even if the original request timed out, in which case - // GetQueryResults can be used to read the results once the query has - // completed. Since this API only returns the first page of results, - // subsequent pages can be fetched via the same mechanism (GetQueryResults). - // - // If job_creation_mode was set to `JOB_CREATION_OPTIONAL` and the query - // completes without creating a job, this field will be empty. - JobReference job_reference = 3; - - // Optional. The reason why a Job was created. - // - // Only relevant when a job_reference is present in the response. - // If job_reference is not present it will always be unset. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - JobCreationReason job_creation_reason = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Auto-generated ID for the query. - // [Preview](https://cloud.google.com/products/#product-launch-stages) - string query_id = 14; - - // The total number of rows in the complete query result set, which can be - // more than the number of rows in this single page of results. - google.protobuf.UInt64Value total_rows = 4; - - // A token used for paging results. A non-empty token indicates that - // additional results are available. To see additional results, - // query the - // [`jobs.getQueryResults`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/getQueryResults) - // method. For more information, see [Paging through table - // data](https://cloud.google.com/bigquery/docs/paging-results). - string page_token = 5; - - // An object with as many results as can be contained within the maximum - // permitted reply size. To get any additional rows, you can call - // GetQueryResults and specify the jobReference returned above. - repeated google.protobuf.Struct rows = 6; - - // The total number of bytes processed for this query. If this query was a dry - // run, this is the number of bytes that would be processed if the query were - // run. - google.protobuf.Int64Value total_bytes_processed = 7; - - // Whether the query has completed or not. If rows or totalRows are present, - // this will always be true. If this is false, totalRows will not be - // available. - google.protobuf.BoolValue job_complete = 8; - - // Output only. The first errors or warnings encountered during the running of - // the job. The final message includes the number of errors that caused the - // process to stop. Errors here do not necessarily mean that the job has - // completed or was unsuccessful. For more information about error messages, - // see [Error - // messages](https://cloud.google.com/bigquery/docs/error-messages). - repeated ErrorProto errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 10; - - // Output only. The number of rows affected by a DML statement. Present only - // for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information of the session if this job is part of one. - SessionInfo session_info = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, - // MERGE or TRUNCATE. - DmlStats dml_stats = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_config.proto.baseline deleted file mode 100644 index 9f42488c8d5a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_config.proto.baseline +++ /dev/null @@ -1,814 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/clustering.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/decimal_target_types.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/external_data_config.proto"; -import "google/cloud/bigquery/v2/file_set_specification_type.proto"; -import "google/cloud/bigquery/v2/hive_partitioning.proto"; -import "google/cloud/bigquery/v2/json_extension.proto"; -import "google/cloud/bigquery/v2/model_reference.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/range_partitioning.proto"; -import "google/cloud/bigquery/v2/system_variable.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/cloud/bigquery/v2/time_partitioning.proto"; -import "google/cloud/bigquery/v2/udf_resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Properties for the destination table. -message DestinationTableProperties { - // Optional. Friendly name for the destination table. If the table already - // exists, it should be same as the existing friendly name. - google.protobuf.StringValue friendly_name = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The description for the destination table. - // This will only be used if the destination table is newly created. - // If the table already exists and a value different than the current - // description is provided, the job will fail. - google.protobuf.StringValue description = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels associated with this table. You can use these to - // organize and group your tables. This will only be used if the destination - // table is newly created. If the table already exists and labels are - // different than the current labels are provided, the job will fail. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// A connection-level property to customize query behavior. Under JDBC, these -// correspond directly to connection properties passed to the DriverManager. -// Under ODBC, these correspond to properties in the connection string. -// -// Currently supported connection properties: -// -// * **dataset_project_id**: represents the default project for datasets that -// are used in the query. Setting the -// system variable `@@dataset_project_id` achieves the same behavior. For -// more information about system variables, see: -// https://cloud.google.com/bigquery/docs/reference/system-variables -// -// * **time_zone**: represents the default timezone used to run the query. -// -// * **session_id**: associates the query with a given session. -// -// * **query_label**: associates the query with a given job label. If set, -// all subsequent queries in a script or session will have this label. For the -// format in which a you can specify a query label, see labels -// in the JobConfiguration resource type: -// https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration -// -// * **service_account**: indicates the service account to use to run a -// continuous query. If set, the query job uses the service account to access -// Google Cloud resources. Service account access is bounded by the IAM -// permissions that you have granted to the service account. -// -// Additional properties are allowed, but ignored. Specifying multiple -// connection properties with the same key returns an error. -message ConnectionProperty { - // The key of the property to set. - string key = 1; - - // The value of the property to set. - string value = 2; -} - -// JobConfigurationQuery configures a BigQuery query job. -message JobConfigurationQuery { - // [Required] SQL query text to execute. The useLegacySql field can be used - // to indicate whether the query uses legacy SQL or GoogleSQL. - string query = 1; - - // Optional. Describes the table where the query results should be stored. - // This property must be set for large results that exceed the maximum - // response size. For queries that produce anonymous (cached) results, this - // field will be populated by BigQuery. - TableReference destination_table = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. You can specify external table definitions, which operate as - // ephemeral tables that can be queried. These definitions are configured - // using a JSON map, where the string key represents the table identifier, and - // the value is the corresponding external data configuration object. - map external_table_definitions = 23 - [(google.api.field_behavior) = OPTIONAL]; - - // Describes user-defined function resources used in the query. - repeated UserDefinedFunctionResource user_defined_function_resources = 4; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // data, removes the constraints, and uses the schema from the query result. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_EMPTY. Each action is atomic and only occurs if - // BigQuery is able to complete the job successfully. Creation, truncation and - // append actions occur as one atomic update upon job completion. - string write_disposition = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the default dataset to use for unqualified - // table names in the query. This setting does not alter behavior of - // unqualified dataset names. Setting the system variable - // `@@dataset_id` achieves the same behavior. See - // https://cloud.google.com/bigquery/docs/reference/system-variables for more - // information on system variables. - DatasetReference default_dataset = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a priority for the query. Possible values include - // INTERACTIVE and BATCH. The default value is INTERACTIVE. - string priority = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true and query uses legacy SQL dialect, allows the query - // to produce arbitrarily large result tables at a slight cost in performance. - // Requires destinationTable to be set. - // For GoogleSQL queries, this flag is ignored and large results are - // always allowed. However, you must still set destinationTable when result - // size exceeds the allowed maximum response size. - google.protobuf.BoolValue allow_large_results = 10 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether to look for the result in the query cache. The query - // cache is a best-effort cache that will be flushed whenever tables in the - // query are modified. Moreover, the query cache is only available when a - // query does not have a destination table specified. The default value is - // true. - google.protobuf.BoolValue use_query_cache = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true and query uses legacy SQL dialect, flattens all nested - // and repeated fields in the query results. - // allowLargeResults must be true if this is set to false. - // For GoogleSQL queries, this flag is ignored and results are never - // flattened. - google.protobuf.BoolValue flatten_results = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Limits the bytes billed for this job. Queries that will have - // bytes billed beyond this limit will fail (without incurring a charge). - // If unspecified, this will be set to your project default. - google.protobuf.Int64Value maximum_bytes_billed = 14; - - // Optional. Specifies whether to use BigQuery's legacy SQL dialect for this - // query. The default value is true. If set to false, the query will use - // BigQuery's GoogleSQL: - // https://cloud.google.com/bigquery/sql-reference/ - // - // When useLegacySql is set to false, the value of flattenResults is ignored; - // query will be run as if flattenResults is false. - google.protobuf.BoolValue use_legacy_sql = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // GoogleSQL only. Set to POSITIONAL to use positional (?) query parameters - // or to NAMED to use named (@myparam) query parameters in this query. - string parameter_mode = 16; - - // Query parameters for GoogleSQL queries. - repeated QueryParameter query_parameters = 17; - - // Output only. System variables for GoogleSQL queries. A system variable is - // output if the variable is settable and its value differs from the system - // default. - // "@@" prefix is not included in the name of the System variables. - optional SystemVariables system_variables = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Allows the schema of the destination table to be updated as a side effect - // of the query job. Schema update options are supported in two cases: - // when writeDisposition is WRITE_APPEND; - // when writeDisposition is WRITE_TRUNCATE and the destination table is a - // partition of a table, specified by partition decorators. For normal tables, - // WRITE_TRUNCATE will always overwrite the schema. - // One or more of the following values are specified: - // - // * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. - // * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original - // schema to nullable. - repeated string schema_update_options = 18; - - // Time-based partitioning specification for the destination table. Only one - // of timePartitioning and rangePartitioning should be specified. - TimePartitioning time_partitioning = 19; - - // Range partitioning specification for the destination table. - // Only one of timePartitioning and rangePartitioning should be specified. - RangePartitioning range_partitioning = 22; - - // Clustering specification for the destination table. - Clustering clustering = 20; - - // Custom encryption configuration (e.g., Cloud KMS keys) - EncryptionConfiguration destination_encryption_configuration = 21; - - // Options controlling the execution of scripts. - ScriptOptions script_options = 24; - - // Connection properties which can modify the query behavior. - repeated ConnectionProperty connection_properties = 33; - - // If this property is true, the job creates a new session using a randomly - // generated session_id. To continue using a created session with - // subsequent queries, pass the existing session identifier as a - // `ConnectionProperty` value. The session identifier is returned as part of - // the `SessionInfo` message within the query statistics. - // - // The new session's location will be set to `Job.JobReference.location` if it - // is present, otherwise it's set to the default location based on existing - // routing logic. - google.protobuf.BoolValue create_session = 34; - - // Optional. Whether to run the query as continuous or a regular query. - // Continuous query is currently in experimental stage and not ready for - // general usage. - google.protobuf.BoolValue continuous = 36 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options related to script execution. -message ScriptOptions { - // KeyResultStatementKind controls how the key result is determined. - enum KeyResultStatementKind { - // Default value. - KEY_RESULT_STATEMENT_KIND_UNSPECIFIED = 0; - - // The last result determines the key result. - LAST = 1; - - // The first SELECT statement determines the key result. - FIRST_SELECT = 2; - } - - // Timeout period for each statement in a script. - google.protobuf.Int64Value statement_timeout_ms = 1; - - // Limit on the number of bytes billed per statement. Exceeding this budget - // results in an error. - google.protobuf.Int64Value statement_byte_budget = 2; - - // Determines which statement in the script represents the "key result", - // used to populate the schema and query results of the script job. - // Default is LAST. - KeyResultStatementKind key_result_statement = 4; -} - -// JobConfigurationLoad contains the configuration properties for loading data -// into a destination table. -message JobConfigurationLoad { - // Indicates the character map used for column names. - enum ColumnNameCharacterMap { - // Unspecified column name character map. - COLUMN_NAME_CHARACTER_MAP_UNSPECIFIED = 0; - - // Support flexible column name and reject invalid column names. - STRICT = 1; - - // Support alphanumeric + underscore characters and names must start with a - // letter or underscore. Invalid column names will be normalized. - V1 = 2; - - // Support flexible column name. Invalid column names will be normalized. - V2 = 3; - } - - // [Required] The fully-qualified URIs that point to your data in Google - // Cloud. - // For Google Cloud Storage URIs: - // Each URI can contain one '*' wildcard character and it must come after - // the 'bucket' name. Size limits related to load jobs apply to external - // data sources. - // For Google Cloud Bigtable URIs: - // Exactly one URI can be specified and it has be a fully specified and - // valid HTTPS URL for a Google Cloud Bigtable table. - // For Google Cloud Datastore backups: - // Exactly one URI can be specified. Also, the '*' wildcard character is not - // allowed. - repeated string source_uris = 1; - - // Optional. Specifies how source URIs are interpreted for constructing the - // file set to load. By default, source URIs are expanded against the - // underlying storage. You can also specify manifest files to control how the - // file set is constructed. This option is only applicable to object storage - // systems. - FileSetSpecType file_set_spec_type = 49 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The schema for the destination table. The schema can be - // omitted if the destination table already exists, or if you're loading data - // from Google Cloud Datastore. - TableSchema schema = 2 [(google.api.field_behavior) = OPTIONAL]; - - // [Required] The destination table to load the data into. - TableReference destination_table = 3; - - // Optional. [Experimental] Properties with which to create the destination - // table if it is new. - DestinationTableProperties destination_table_properties = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // data, removes the constraints and uses the schema from the load job. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_APPEND. - // Each action is atomic and only occurs if BigQuery is able to complete the - // job successfully. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string write_disposition = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies a string that represents a null value in a CSV file. - // For example, if you specify "\N", BigQuery interprets "\N" as a null value - // when loading a CSV file. - // The default value is the empty string. If you set this property to a custom - // value, BigQuery throws an error if an empty string is present for all data - // types except for STRING and BYTE. For STRING and BYTE columns, BigQuery - // interprets the empty string as an empty value. - google.protobuf.StringValue null_marker = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The separator character for fields in a CSV file. The separator - // is interpreted as a single byte. For files encoded in ISO-8859-1, any - // single character can be used as a separator. For files encoded in UTF-8, - // characters represented in decimal range 1-127 (U+0001-U+007F) can be used - // without any modification. UTF-8 characters encoded with multiple bytes - // (i.e. U+0080 and above) will have only the first byte used for separating - // fields. The remaining bytes will be treated as a part of the field. - // BigQuery also supports the escape sequence "\t" (U+0009) to specify a tab - // separator. The default value is comma (",", U+002C). - string field_delimiter = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The number of rows at the top of a CSV file that BigQuery will - // skip when loading the data. The default value is 0. This property is useful - // if you have header rows in the file that should be skipped. When autodetect - // is on, the behavior is the following: - // - // * skipLeadingRows unspecified - Autodetect tries to detect headers in the - // first row. If they are not detected, the row is read as data. Otherwise - // data is read starting from the second row. - // * skipLeadingRows is 0 - Instructs autodetect that there are no headers and - // data should be read starting from the first row. - // * skipLeadingRows = N > 0 - Autodetect skips N-1 rows and tries to detect - // headers in row N. If headers are not detected, row N is just skipped. - // Otherwise row N is used to extract column names for the detected schema. - google.protobuf.Int32Value skip_leading_rows = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The character encoding of the data. - // The supported values are UTF-8, ISO-8859-1, UTF-16BE, UTF-16LE, UTF-32BE, - // and UTF-32LE. The default value is UTF-8. BigQuery decodes the data after - // the raw, binary data has been split using the values of the `quote` and - // `fieldDelimiter` properties. - // - // If you don't specify an encoding, or if you specify a UTF-8 encoding when - // the CSV file is not UTF-8 encoded, BigQuery attempts to convert the data to - // UTF-8. Generally, your data loads successfully, but it may not match - // byte-for-byte what you expect. To avoid this, specify the correct encoding - // by using the `--encoding` flag. - // - // If BigQuery can't convert a character other than the ASCII `0` character, - // BigQuery converts the character to the standard Unicode replacement - // character: �. - string encoding = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The value that is used to quote data sections in a CSV file. - // BigQuery converts the string to ISO-8859-1 encoding, and then uses the - // first byte of the encoded string to split the data in its raw, binary - // state. - // The default value is a double-quote ('"'). - // If your data does not contain quoted sections, set the property value to an - // empty string. - // If your data contains quoted newline characters, you must also set the - // allowQuotedNewlines property to true. - // To include the specific quote character within a quoted value, precede it - // with an additional matching quote character. For example, if you want to - // escape the default character ' " ', use ' "" '. - // @default " - google.protobuf.StringValue quote = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of bad records that BigQuery can ignore when - // running the job. If the number of bad records exceeds this value, an - // invalid error is returned in the job result. - // The default value is 0, which requires that all records are valid. - // This is only supported for CSV and NEWLINE_DELIMITED_JSON file formats. - google.protobuf.Int32Value max_bad_records = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Indicates if BigQuery should allow quoted data sections that contain - // newline characters in a CSV file. The default value is false. - google.protobuf.BoolValue allow_quoted_newlines = 15; - - // Optional. The format of the data files. - // For CSV files, specify "CSV". For datastore backups, - // specify "DATASTORE_BACKUP". For newline-delimited JSON, - // specify "NEWLINE_DELIMITED_JSON". For Avro, specify "AVRO". - // For parquet, specify "PARQUET". For orc, specify "ORC". - // The default value is CSV. - string source_format = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Accept rows that are missing trailing optional columns. - // The missing values are treated as nulls. - // If false, records with missing trailing columns are treated as bad records, - // and if there are too many bad records, an invalid error is returned in the - // job result. - // The default value is false. - // Only applicable to CSV, ignored for other formats. - google.protobuf.BoolValue allow_jagged_rows = 17 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates if BigQuery should allow extra values that are not - // represented in the table schema. - // If true, the extra values are ignored. - // If false, records with extra columns are treated as bad records, and if - // there are too many bad records, an invalid error is returned in the job - // result. The default value is false. - // The sourceFormat property determines what BigQuery treats as an extra - // value: - // CSV: Trailing columns - // JSON: Named values that don't match any column names in the table schema - // Avro, Parquet, ORC: Fields in the file schema that don't exist in the - // table schema. - google.protobuf.BoolValue ignore_unknown_values = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // If sourceFormat is set to "DATASTORE_BACKUP", indicates which entity - // properties to load into BigQuery from a Cloud Datastore backup. Property - // names are case sensitive and must be top-level properties. If no properties - // are specified, BigQuery loads all properties. If any named property isn't - // found in the Cloud Datastore backup, an invalid error is returned in the - // job result. - repeated string projection_fields = 19; - - // Optional. Indicates if we should automatically infer the options and - // schema for CSV and JSON sources. - google.protobuf.BoolValue autodetect = 20 - [(google.api.field_behavior) = OPTIONAL]; - - // Allows the schema of the destination table to be updated as a side effect - // of the load job if a schema is autodetected or supplied in the job - // configuration. - // Schema update options are supported in two cases: - // when writeDisposition is WRITE_APPEND; - // when writeDisposition is WRITE_TRUNCATE and the destination table is a - // partition of a table, specified by partition decorators. For normal tables, - // WRITE_TRUNCATE will always overwrite the schema. - // One or more of the following values are specified: - // - // * ALLOW_FIELD_ADDITION: allow adding a nullable field to the schema. - // * ALLOW_FIELD_RELAXATION: allow relaxing a required field in the original - // schema to nullable. - repeated string schema_update_options = 21; - - // Time-based partitioning specification for the destination table. Only one - // of timePartitioning and rangePartitioning should be specified. - TimePartitioning time_partitioning = 22; - - // Range partitioning specification for the destination table. - // Only one of timePartitioning and rangePartitioning should be specified. - RangePartitioning range_partitioning = 26; - - // Clustering specification for the destination table. - Clustering clustering = 23; - - // Custom encryption configuration (e.g., Cloud KMS keys) - EncryptionConfiguration destination_encryption_configuration = 24; - - // Optional. If sourceFormat is set to "AVRO", indicates whether to interpret - // logical types as the corresponding BigQuery data type (for example, - // TIMESTAMP), instead of using the raw type (for example, INTEGER). - google.protobuf.BoolValue use_avro_logical_types = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The user can provide a reference file with the reader schema. - // This file is only loaded if it is part of source URIs, but is not loaded - // otherwise. It is enabled for the following formats: AVRO, PARQUET, ORC. - google.protobuf.StringValue reference_file_schema_uri = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When set, configures hive partitioning support. - // Not all storage formats support hive partitioning -- requesting hive - // partitioning on an unsupported format will lead to an error, as will - // providing an invalid specification. - HivePartitioningOptions hive_partitioning_options = 37 - [(google.api.field_behavior) = OPTIONAL]; - - // Defines the list of possible SQL data types to which the source decimal - // values are converted. This list and the precision and the scale parameters - // of the decimal field determine the target type. In the order of NUMERIC, - // BIGNUMERIC, and STRING, a - // type is picked if it is in the specified list and if it supports the - // precision and the scale. STRING supports all precision and scale values. - // If none of the listed types supports the precision and the scale, the type - // supporting the widest range in the specified list is picked, and if a value - // exceeds the supported range when reading the data, an error will be thrown. - // - // Example: Suppose the value of this field is ["NUMERIC", "BIGNUMERIC"]. - // If (precision,scale) is: - // - // * (38,9) -> NUMERIC; - // * (39,9) -> BIGNUMERIC (NUMERIC cannot hold 30 integer digits); - // * (38,10) -> BIGNUMERIC (NUMERIC cannot hold 10 fractional digits); - // * (76,38) -> BIGNUMERIC; - // * (77,38) -> BIGNUMERIC (error if value exeeds supported range). - // - // This field cannot contain duplicate types. The order of the types in this - // field is ignored. For example, ["BIGNUMERIC", "NUMERIC"] is the same as - // ["NUMERIC", "BIGNUMERIC"] and NUMERIC always takes precedence over - // BIGNUMERIC. - // - // Defaults to ["NUMERIC", "STRING"] for ORC and ["NUMERIC"] for the other - // file formats. - repeated DecimalTargetType decimal_target_types = 39; - - // Optional. Load option to be used together with source_format - // newline-delimited JSON to indicate that a variant of JSON is being loaded. - // To load newline-delimited GeoJSON, specify GEOJSON (and source_format must - // be set to NEWLINE_DELIMITED_JSON). - JsonExtension json_extension = 41 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional properties to set if sourceFormat is set to PARQUET. - ParquetOptions parquet_options = 42 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When sourceFormat is set to "CSV", this indicates whether the - // embedded ASCII control characters (the first 32 characters in the - // ASCII-table, from - // '\x00' to '\x1F') are preserved. - google.protobuf.BoolValue preserve_ascii_control_characters = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Connection properties which can modify the load job behavior. - // Currently, only the 'session_id' connection property is supported, and is - // used to resolve _SESSION appearing as the dataset id. - repeated ConnectionProperty connection_properties = 46 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If this property is true, the job creates a new session using a - // randomly generated session_id. To continue using a created session with - // subsequent queries, pass the existing session identifier as a - // `ConnectionProperty` value. The session identifier is returned as part of - // the `SessionInfo` message within the query statistics. - // - // The new session's location will be set to `Job.JobReference.location` if it - // is present, otherwise it's set to the default location based on existing - // routing logic. - google.protobuf.BoolValue create_session = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Character map supported for column names in CSV/Parquet loads. - // Defaults to STRICT and can be overridden by Project Config Service. Using - // this option with unsupporting load formats will result in an error. - ColumnNameCharacterMap column_name_character_map = 50 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. [Experimental] Configures the load job to copy files directly to - // the destination BigLake managed table, bypassing file content reading and - // rewriting. - // - // Copying files only is supported when all the following are true: - // - // * `source_uris` are located in the same Cloud Storage location as the - // destination table's `storage_uri` location. - // * `source_format` is `PARQUET`. - // * `destination_table` is an existing BigLake managed table. The table's - // schema does not have flexible column names. The table's columns do not - // have type parameters other than precision and scale. - // * No options other than the above are specified. - google.protobuf.BoolValue copy_files_only = 51 - [(google.api.field_behavior) = OPTIONAL]; -} - -// JobConfigurationTableCopy configures a job that copies data from one table -// to another. -// For more information on copying tables, see [Copy a -// table](https://cloud.google.com/bigquery/docs/managing-tables#copy-table). -message JobConfigurationTableCopy { - // Indicates different operation types supported in table copy job. - enum OperationType { - // Unspecified operation type. - OPERATION_TYPE_UNSPECIFIED = 0; - - // The source and destination table have the same table type. - COPY = 1; - - // The source table type is TABLE and - // the destination table type is SNAPSHOT. - SNAPSHOT = 2; - - // The source table type is SNAPSHOT and - // the destination table type is TABLE. - RESTORE = 3; - - // The source and destination table have the same table type, - // but only bill for unique data. - CLONE = 4; - } - - // [Pick one] Source table to copy. - TableReference source_table = 1; - - // [Pick one] Source tables to copy. - repeated TableReference source_tables = 2; - - // [Required] The destination table. - TableReference destination_table = 3; - - // Optional. Specifies whether the job is allowed to create new tables. - // The following values are supported: - // - // * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the - // table. - // * CREATE_NEVER: The table must already exist. If it does not, - // a 'notFound' error is returned in the job result. - // - // The default value is CREATE_IF_NEEDED. - // Creation, truncation and append actions occur as one atomic update - // upon job completion. - string create_disposition = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the action that occurs if the destination table - // already exists. The following values are supported: - // - // * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the - // table data and uses the schema and table constraints from the source table. - // * WRITE_APPEND: If the table already exists, BigQuery appends the data to - // the table. - // * WRITE_EMPTY: If the table already exists and contains data, a 'duplicate' - // error is returned in the job result. - // - // The default value is WRITE_EMPTY. Each action is atomic and only occurs if - // BigQuery is able to complete the job successfully. Creation, truncation and - // append actions occur as one atomic update upon job completion. - string write_disposition = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Custom encryption configuration (e.g., Cloud KMS keys). - EncryptionConfiguration destination_encryption_configuration = 6; - - // Optional. Supported operation types in table copy job. - OperationType operation_type = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time when the destination table expires. Expired tables will - // be deleted and their storage reclaimed. - google.protobuf.Timestamp destination_expiration_time = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -// JobConfigurationExtract configures a job that exports data from a BigQuery -// table into Google Cloud Storage. -message JobConfigurationExtract { - // Options related to model extraction. - message ModelExtractOptions { - // The 1-based ID of the trial to be exported from a hyperparameter tuning - // model. If not specified, the trial with id = - // [Model](https://cloud.google.com/bigquery/docs/reference/rest/v2/models#resource:-model).defaultTrialId - // is exported. This field is ignored for models not trained with - // hyperparameter tuning. - google.protobuf.Int64Value trial_id = 1; - } - - // Required. Source reference for the export. - oneof source { - // A reference to the table being exported. - TableReference source_table = 1; - - // A reference to the model being exported. - ModelReference source_model = 9; - } - - // [Pick one] A list of fully-qualified Google Cloud Storage URIs where the - // extracted table should be written. - repeated string destination_uris = 3; - - // Optional. Whether to print out a header row in the results. - // Default is true. Not applicable when extracting models. - google.protobuf.BoolValue print_header = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When extracting data in CSV format, this defines the - // delimiter to use between fields in the exported data. - // Default is ','. Not applicable when extracting models. - string field_delimiter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The exported file format. Possible values include CSV, - // NEWLINE_DELIMITED_JSON, PARQUET, or AVRO for tables and ML_TF_SAVED_MODEL - // or ML_XGBOOST_BOOSTER for models. The default value for tables is CSV. - // Tables with nested or repeated fields cannot be exported as CSV. The - // default value for models is ML_TF_SAVED_MODEL. - string destination_format = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The compression type to use for exported files. Possible values - // include DEFLATE, GZIP, NONE, SNAPPY, and ZSTD. The default value is NONE. - // Not all compression formats are support for all file formats. DEFLATE is - // only supported for Avro. ZSTD is only supported for Parquet. Not applicable - // when extracting models. - string compression = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Whether to use logical types when extracting to AVRO format. Not applicable - // when extracting models. - google.protobuf.BoolValue use_avro_logical_types = 13; - - // Optional. Model extract options only applicable when extracting models. - ModelExtractOptions model_extract_options = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -message JobConfiguration { - // Output only. The type of the job. Can be QUERY, LOAD, EXTRACT, COPY or - // UNKNOWN. - string job_type = 8; - - // [Pick one] Configures a query job. - JobConfigurationQuery query = 1; - - // [Pick one] Configures a load job. - JobConfigurationLoad load = 2; - - // [Pick one] Copies a table. - JobConfigurationTableCopy copy = 3; - - // [Pick one] Configures an extract job. - JobConfigurationExtract extract = 4; - - // Optional. If set, don't actually run this job. A valid query will return - // a mostly empty response with some processing statistics, while an invalid - // query will return the same error it would if it wasn't a dry run. Behavior - // of non-query jobs is undefined. - google.protobuf.BoolValue dry_run = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Job timeout in milliseconds. If this time limit is exceeded, - // BigQuery will attempt to stop a longer job, but may not always succeed in - // canceling it before the job completes. For example, a job that takes more - // than 60 seconds to complete has a better chance of being stopped than a job - // that takes 10 seconds to complete. - google.protobuf.Int64Value job_timeout_ms = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this job. You can use these to organize and - // group your jobs. - // Label keys and values can be no longer than 63 characters, can only contain - // lowercase letters, numeric characters, underscores and dashes. - // International characters are allowed. Label values are optional. Label - // keys must start with a letter and each label in the list must have a - // different key. - map labels = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline deleted file mode 100644 index 0cede032b16c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_creation_reason.proto.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "JobCreationReasonProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Reason about why a Job was created from a -// [`jobs.query`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query) -// method when used with `JOB_CREATION_OPTIONAL` Job creation mode. -// -// For -// [`jobs.insert`](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/insert) -// method calls it will always be `REQUESTED`. -// -// [Preview](https://cloud.google.com/products/#product-launch-stages) -message JobCreationReason { - // Indicates the high level reason why a job was created. - enum Code { - // Reason is not specified. - CODE_UNSPECIFIED = 0; - - // Job creation was requested. - REQUESTED = 1; - - // The query request ran beyond a system defined timeout specified by the - // [timeoutMs field in the - // QueryRequest](https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest). - // As a result it was considered a long running operation for which a job - // was created. - LONG_RUNNING = 2; - - // The results from the query cannot fit in the response. - LARGE_RESULTS = 3; - - // BigQuery has determined that the query needs to be executed as a Job. - OTHER = 4; - } - - // Output only. Specifies the high level reason why a Job was created. - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_reference.proto.baseline deleted file mode 100644 index d7f3ece6f7f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_reference.proto.baseline +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// A job reference is a fully qualified identifier for referring to a job. -message JobReference { - // Required. The ID of the project containing this job. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the job. The ID must contain only letters (a-z, A-Z), - // numbers (0-9), underscores (_), or dashes (-). The maximum length is 1,024 - // characters. - string job_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The geographic location of the job. The default value is US. - // - // For more information about BigQuery locations, see: - // https://cloud.google.com/bigquery/docs/locations - google.protobuf.StringValue location = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // This field should not be used. - repeated string location_alternative = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_stats.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_stats.proto.baseline deleted file mode 100644 index 877e0039291a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_stats.proto.baseline +++ /dev/null @@ -1,1439 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/bigquery/v2/dataset_reference.proto"; -import "google/cloud/bigquery/v2/model.proto"; -import "google/cloud/bigquery/v2/query_parameter.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/row_access_policy_reference.proto"; -import "google/cloud/bigquery/v2/session_info.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobStatsProto"; -option java_package = "com.google.cloud.bigquery.v2"; -option (google.api.resource_definition) = { - type: "cloudkms.googleapis.com/CryptoKey" - pattern: "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}" -}; -option (google.api.resource_definition) = { - type: "storage.googleapis.com/Bucket" - pattern: "*" -}; - -// An operation within a stage. -message ExplainQueryStep { - // Machine-readable operation type. - string kind = 1; - - // Human-readable description of the step(s). - repeated string substeps = 2; -} - -// A single stage of query execution. -message ExplainQueryStage { - // Indicates the type of compute mode. - enum ComputeMode { - // ComputeMode type not specified. - COMPUTE_MODE_UNSPECIFIED = 0; - - // This stage was processed using BigQuery slots. - BIGQUERY = 1; - - // This stage was processed using BI Engine compute. - BI_ENGINE = 2; - } - - // Human-readable name for the stage. - string name = 1; - - // Unique ID for the stage within the plan. - google.protobuf.Int64Value id = 2; - - // Stage start time represented as milliseconds since the epoch. - int64 start_ms = 3; - - // Stage end time represented as milliseconds since the epoch. - int64 end_ms = 4; - - // IDs for stages that are inputs to this stage. - repeated int64 input_stages = 5; - - // Relative amount of time the average shard spent waiting to be - // scheduled. - google.protobuf.DoubleValue wait_ratio_avg = 6; - - // Milliseconds the average shard spent waiting to be scheduled. - google.protobuf.Int64Value wait_ms_avg = 7; - - // Relative amount of time the slowest shard spent waiting to be - // scheduled. - google.protobuf.DoubleValue wait_ratio_max = 8; - - // Milliseconds the slowest shard spent waiting to be scheduled. - google.protobuf.Int64Value wait_ms_max = 9; - - // Relative amount of time the average shard spent reading input. - google.protobuf.DoubleValue read_ratio_avg = 10; - - // Milliseconds the average shard spent reading input. - google.protobuf.Int64Value read_ms_avg = 11; - - // Relative amount of time the slowest shard spent reading input. - google.protobuf.DoubleValue read_ratio_max = 12; - - // Milliseconds the slowest shard spent reading input. - google.protobuf.Int64Value read_ms_max = 13; - - // Relative amount of time the average shard spent on CPU-bound tasks. - google.protobuf.DoubleValue compute_ratio_avg = 14; - - // Milliseconds the average shard spent on CPU-bound tasks. - google.protobuf.Int64Value compute_ms_avg = 15; - - // Relative amount of time the slowest shard spent on CPU-bound tasks. - google.protobuf.DoubleValue compute_ratio_max = 16; - - // Milliseconds the slowest shard spent on CPU-bound tasks. - google.protobuf.Int64Value compute_ms_max = 17; - - // Relative amount of time the average shard spent on writing output. - google.protobuf.DoubleValue write_ratio_avg = 18; - - // Milliseconds the average shard spent on writing output. - google.protobuf.Int64Value write_ms_avg = 19; - - // Relative amount of time the slowest shard spent on writing output. - google.protobuf.DoubleValue write_ratio_max = 20; - - // Milliseconds the slowest shard spent on writing output. - google.protobuf.Int64Value write_ms_max = 21; - - // Total number of bytes written to shuffle. - google.protobuf.Int64Value shuffle_output_bytes = 22; - - // Total number of bytes written to shuffle and spilled to disk. - google.protobuf.Int64Value shuffle_output_bytes_spilled = 23; - - // Number of records read into the stage. - google.protobuf.Int64Value records_read = 24; - - // Number of records written by the stage. - google.protobuf.Int64Value records_written = 25; - - // Number of parallel input segments to be processed - google.protobuf.Int64Value parallel_inputs = 26; - - // Number of parallel input segments completed. - google.protobuf.Int64Value completed_parallel_inputs = 27; - - // Current status for this stage. - string status = 28; - - // List of operations within the stage in dependency order (approximately - // chronological). - repeated ExplainQueryStep steps = 29; - - // Slot-milliseconds used by the stage. - google.protobuf.Int64Value slot_ms = 30; - - // Output only. Compute mode for this stage. - ComputeMode compute_mode = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Summary of the state of query execution at a given time. -message QueryTimelineSample { - // Milliseconds elapsed since the start of query execution. - google.protobuf.Int64Value elapsed_ms = 1; - - // Cumulative slot-ms consumed by the query. - google.protobuf.Int64Value total_slot_ms = 2; - - // Total units of work remaining for the query. This number can be revised - // (increased or decreased) while the query is running. - google.protobuf.Int64Value pending_units = 3; - - // Total parallel units of work completed by this query. - google.protobuf.Int64Value completed_units = 4; - - // Total number of active workers. This does not correspond directly to - // slot usage. This is the largest value observed since the last sample. - google.protobuf.Int64Value active_units = 5; - - // Units of work that can be scheduled immediately. Providing additional slots - // for these units of work will accelerate the query, if no other query in - // the reservation needs additional slots. - google.protobuf.Int64Value estimated_runnable_units = 7; -} - -// The external service cost is a portion of the total cost, these costs are not -// additive with total_bytes_billed. Moreover, this field only track external -// service costs that will show up as BigQuery costs (e.g. training BigQuery -// ML job with google cloud CAIP or Automl Tables services), not other costs -// which may be accrued by running the query (e.g. reading from Bigtable or -// Cloud Storage). The external service costs with different billing sku (e.g. -// CAIP job is charged based on VM usage) are converted to BigQuery -// billed_bytes and slot_ms with equivalent amount of US dollars. Services may -// not directly correlate to these metrics, but these are the equivalents for -// billing purposes. -// Output only. -message ExternalServiceCost { - // External service name. - string external_service = 1; - - // External service cost in terms of bigquery bytes processed. - google.protobuf.Int64Value bytes_processed = 2; - - // External service cost in terms of bigquery bytes billed. - google.protobuf.Int64Value bytes_billed = 3; - - // External service cost in terms of bigquery slot milliseconds. - google.protobuf.Int64Value slot_ms = 4; - - // Non-preemptable reserved slots used for external job. - // For example, reserved slots for Cloua AI Platform job are the VM usages - // converted to BigQuery slot with equivalent mount of price. - int64 reserved_slot_count = 5; -} - -// Statistics for the EXPORT DATA statement as part of Query Job. EXTRACT -// JOB statistics are populated in JobStatistics4. -message ExportDataStatistics { - // Number of destination files generated in case of EXPORT DATA - // statement only. - google.protobuf.Int64Value file_count = 1; - - // [Alpha] Number of destination rows generated in case of EXPORT DATA - // statement only. - google.protobuf.Int64Value row_count = 2; -} - -// Reason why BI Engine didn't accelerate the query (or sub-query). -message BiEngineReason { - // Indicates the high-level reason for no/partial acceleration - enum Code { - // BiEngineReason not specified. - CODE_UNSPECIFIED = 0; - - // No reservation available for BI Engine acceleration. - NO_RESERVATION = 1; - - // Not enough memory available for BI Engine acceleration. - INSUFFICIENT_RESERVATION = 2; - - // This particular SQL text is not supported for acceleration by BI Engine. - UNSUPPORTED_SQL_TEXT = 4; - - // Input too large for acceleration by BI Engine. - INPUT_TOO_LARGE = 5; - - // Catch-all code for all other cases for partial or disabled acceleration. - OTHER_REASON = 6; - - // One or more tables were not eligible for BI Engine acceleration. - TABLE_EXCLUDED = 7; - } - - // Output only. High-level BI Engine reason for partial or disabled - // acceleration - Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Free form human-readable reason for partial or disabled - // acceleration. - string message = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a BI Engine specific query. -// Populated as part of JobStatistics2 -message BiEngineStatistics { - // Indicates the type of BI Engine acceleration. - enum BiEngineMode { - // BiEngineMode type not specified. - ACCELERATION_MODE_UNSPECIFIED = 0; - - // BI Engine disabled the acceleration. bi_engine_reasons - // specifies a more detailed reason. - DISABLED = 1; - - // Part of the query was accelerated using BI Engine. - // See bi_engine_reasons for why parts of the query were not - // accelerated. - PARTIAL = 2; - - // All of the query was accelerated using BI Engine. - FULL = 3; - } - - // Indicates the type of BI Engine acceleration. - enum BiEngineAccelerationMode { - // BiEngineMode type not specified. - BI_ENGINE_ACCELERATION_MODE_UNSPECIFIED = 0; - - // BI Engine acceleration was attempted but disabled. bi_engine_reasons - // specifies a more detailed reason. - BI_ENGINE_DISABLED = 1; - - // Some inputs were accelerated using BI Engine. - // See bi_engine_reasons for why parts of the query were not - // accelerated. - PARTIAL_INPUT = 2; - - // All of the query inputs were accelerated using BI Engine. - FULL_INPUT = 3; - - // All of the query was accelerated using BI Engine. - FULL_QUERY = 4; - } - - // Output only. Specifies which mode of BI Engine acceleration was performed - // (if any). - BiEngineMode bi_engine_mode = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Specifies which mode of BI Engine acceleration was performed - // (if any). - BiEngineAccelerationMode acceleration_mode = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // In case of DISABLED or PARTIAL bi_engine_mode, these contain the - // explanatory reasons as to why BI Engine could not accelerate. - // In case the full query was accelerated, this field is not populated. - repeated BiEngineReason bi_engine_reasons = 2; -} - -// Reason about why no search index was used in the search query (or -// sub-query). -message IndexUnusedReason { - // Indicates the high-level reason for the scenario when no search index was - // used. - enum Code { - // Code not specified. - CODE_UNSPECIFIED = 0; - - // Indicates the search index configuration has not been created. - INDEX_CONFIG_NOT_AVAILABLE = 1; - - // Indicates the search index creation has not been completed. - PENDING_INDEX_CREATION = 2; - - // Indicates the base table has been truncated (rows have been removed - // from table with TRUNCATE TABLE statement) since the last time the search - // index was refreshed. - BASE_TABLE_TRUNCATED = 3; - - // Indicates the search index configuration has been changed since the last - // time the search index was refreshed. - INDEX_CONFIG_MODIFIED = 4; - - // Indicates the search query accesses data at a timestamp before the last - // time the search index was refreshed. - TIME_TRAVEL_QUERY = 5; - - // Indicates the usage of search index will not contribute to any pruning - // improvement for the search function, e.g. when the search predicate is in - // a disjunction with other non-search predicates. - NO_PRUNING_POWER = 6; - - // Indicates the search index does not cover all fields in the search - // function. - UNINDEXED_SEARCH_FIELDS = 7; - - // Indicates the search index does not support the given search query - // pattern. - UNSUPPORTED_SEARCH_PATTERN = 8; - - // Indicates the query has been optimized by using a materialized view. - OPTIMIZED_WITH_MATERIALIZED_VIEW = 9; - - // Indicates the query has been secured by data masking, and thus search - // indexes are not applicable. - SECURED_BY_DATA_MASKING = 11; - - // Indicates that the search index and the search function call do not - // have the same text analyzer. - MISMATCHED_TEXT_ANALYZER = 12; - - // Indicates the base table is too small (below a certain threshold). - // The index does not provide noticeable search performance gains - // when the base table is too small. - BASE_TABLE_TOO_SMALL = 13; - - // Indicates that the total size of indexed base tables in your organization - // exceeds your region's limit and the index is not used in the query. To - // index larger base tables, you can - // use - // your own reservation for index-management jobs. - BASE_TABLE_TOO_LARGE = 14; - - // Indicates that the estimated performance gain from using the search index - // is too low for the given search query. - ESTIMATED_PERFORMANCE_GAIN_TOO_LOW = 15; - - // Indicates that search indexes can not be used for search query with - // STANDARD edition. - NOT_SUPPORTED_IN_STANDARD_EDITION = 17; - - // Indicates that an option in the search function that cannot make use of - // the index has been selected. - INDEX_SUPPRESSED_BY_FUNCTION_OPTION = 18; - - // Indicates that the query was cached, and thus the search index was not - // used. - QUERY_CACHE_HIT = 19; - - // The index cannot be used in the search query because it is stale. - STALE_INDEX = 20; - - // Indicates an internal error that causes the search index to be unused. - INTERNAL_ERROR = 10; - - // Indicates that the reason search indexes cannot be used in the query is - // not covered by any of the other IndexUnusedReason options. - OTHER_REASON = 16; - } - - // Specifies the high-level reason for the scenario when no search index was - // used. - optional Code code = 1; - - // Free form human-readable reason for the scenario when no search index was - // used. - optional string message = 2; - - // Specifies the base table involved in the reason that no search index was - // used. - optional TableReference base_table = 3; - - // Specifies the name of the unused search index, if available. - optional string index_name = 4; -} - -// Statistics for a search query. -// Populated as part of JobStatistics2. -message SearchStatistics { - // Indicates the type of search index usage in the entire search query. - enum IndexUsageMode { - // Index usage mode not specified. - INDEX_USAGE_MODE_UNSPECIFIED = 0; - - // No search indexes were used in the search query. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for detailed reasons. - UNUSED = 1; - - // Part of the search query used search indexes. See [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for why other parts of the query did not use search indexes. - PARTIALLY_USED = 2; - - // The entire search query used search indexes. - FULLY_USED = 4; - } - - // Specifies the index usage mode for the query. - IndexUsageMode index_usage_mode = 1; - - // When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains - // why indexes were not used in all or part of the search query. If - // `indexUsageMode` is `FULLY_USED`, this field is not populated. - repeated IndexUnusedReason index_unused_reasons = 2; -} - -// Statistics for a vector search query. -// Populated as part of JobStatistics2. -message VectorSearchStatistics { - // Indicates the type of vector index usage in the entire vector search query. - enum IndexUsageMode { - // Index usage mode not specified. - INDEX_USAGE_MODE_UNSPECIFIED = 0; - - // No vector indexes were used in the vector search query. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for detailed reasons. - UNUSED = 1; - - // Part of the vector search query used vector indexes. See - // [`indexUnusedReasons`] - // (/bigquery/docs/reference/rest/v2/Job#IndexUnusedReason) - // for why other parts of the query did not use vector indexes. - PARTIALLY_USED = 2; - - // The entire vector search query used vector indexes. - FULLY_USED = 4; - } - - // Specifies the index usage mode for the query. - IndexUsageMode index_usage_mode = 1; - - // When `indexUsageMode` is `UNUSED` or `PARTIALLY_USED`, this field explains - // why indexes were not used in all or part of the vector search query. If - // `indexUsageMode` is `FULLY_USED`, this field is not populated. - repeated IndexUnusedReason index_unused_reasons = 2; -} - -// Query optimization information for a QUERY job. -message QueryInfo { - // Output only. Information about query optimizations. - google.protobuf.Struct optimization_details = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a LOAD query. -message LoadQueryStatistics { - // Output only. Number of source files in a LOAD query. - google.protobuf.Int64Value input_files = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of bytes of source data in a LOAD query. - google.protobuf.Int64Value input_file_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of rows imported in a LOAD query. - // Note that while a LOAD query is in the running state, this value may - // change. - google.protobuf.Int64Value output_rows = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Size of the loaded data in bytes. Note that while a LOAD query - // is in the running state, this value may change. - google.protobuf.Int64Value output_bytes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of bad records encountered while processing a LOAD - // query. Note that if the job has failed because of more bad records - // encountered than the maximum allowed in the load job configuration, then - // this number can be less than the total number of bad records present in the - // input data. - google.protobuf.Int64Value bad_records = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a query job. -message JobStatistics2 { - // Output only. Describes execution plan for the query. - repeated ExplainQueryStage query_plan = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The original estimate of bytes processed for the job. - google.protobuf.Int64Value estimated_bytes_processed = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total number of partitions processed from all partitioned - // tables referenced in the job. - google.protobuf.Int64Value total_partitions_processed = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes processed for the job. - google.protobuf.Int64Value total_bytes_processed = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. For dry-run jobs, totalBytesProcessed is an estimate and this - // field specifies the accuracy of the estimate. Possible values can be: - // UNKNOWN: accuracy of the estimate is unknown. - // PRECISE: estimate is precise. - // LOWER_BOUND: estimate is lower bound of what the query would cost. - // UPPER_BOUND: estimate is upper bound of what the query would cost. - string total_bytes_processed_accuracy = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If the project is configured to use on-demand pricing, - // then this field contains the total bytes billed for the job. - // If the project is configured to use flat-rate pricing, then you are - // not billed for bytes and this field is informational only. - google.protobuf.Int64Value total_bytes_billed = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Billing tier for the job. This is a BigQuery-specific concept - // which is not related to the Google Cloud notion of "free tier". The value - // here is a measure of the query's resource consumption relative to the - // amount of data scanned. For on-demand queries, the limit is 100, and all - // queries within this limit are billed at the standard on-demand rates. - // On-demand queries that exceed this limit will fail with a - // billingTierLimitExceeded error. - google.protobuf.Int32Value billing_tier = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Slot-milliseconds for the job. - google.protobuf.Int64Value total_slot_ms = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the query result was fetched from the query cache. - google.protobuf.BoolValue cache_hit = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced tables for the job. Queries that reference more - // than 50 tables will not have a complete list. - repeated TableReference referenced_tables = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced routines for the job. - repeated RoutineReference referenced_routines = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The schema of the results. Present only for successful dry - // run of non-legacy SQL queries. - TableSchema schema = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of rows affected by a DML statement. Present - // only for DML statements INSERT, UPDATE or DELETE. - google.protobuf.Int64Value num_dml_affected_rows = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Detailed statistics for DML statements INSERT, UPDATE, DELETE, - // MERGE or TRUNCATE. - DmlStats dml_stats = 32 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. GoogleSQL only: list of undeclared query - // parameters detected during a dry run validation. - repeated QueryParameter undeclared_query_parameters = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of query statement, if valid. - // Possible values: - // - // * `SELECT`: - // [`SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_list) - // statement. - // * `ASSERT`: - // [`ASSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/debugging-statements#assert) - // statement. - // * `INSERT`: - // [`INSERT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#insert_statement) - // statement. - // * `UPDATE`: - // [`UPDATE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#update_statement) - // statement. - // * `DELETE`: - // [`DELETE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) - // statement. - // * `MERGE`: - // [`MERGE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-manipulation-language) - // statement. - // * `CREATE_TABLE`: [`CREATE - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_statement) - // statement, without `AS SELECT`. - // * `CREATE_TABLE_AS_SELECT`: [`CREATE TABLE AS - // SELECT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#query_statement) - // statement. - // * `CREATE_VIEW`: [`CREATE - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_view_statement) - // statement. - // * `CREATE_MODEL`: [`CREATE - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-create#create_model_statement) - // statement. - // * `CREATE_MATERIALIZED_VIEW`: [`CREATE MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_materialized_view_statement) - // statement. - // * `CREATE_FUNCTION`: [`CREATE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement) - // statement. - // * `CREATE_TABLE_FUNCTION`: [`CREATE TABLE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_table_function_statement) - // statement. - // * `CREATE_PROCEDURE`: [`CREATE - // PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_procedure) - // statement. - // * `CREATE_ROW_ACCESS_POLICY`: [`CREATE ROW ACCESS - // POLICY`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_row_access_policy_statement) - // statement. - // * `CREATE_SCHEMA`: [`CREATE - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_schema_statement) - // statement. - // * `CREATE_SNAPSHOT_TABLE`: [`CREATE SNAPSHOT - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_snapshot_table_statement) - // statement. - // * `CREATE_SEARCH_INDEX`: [`CREATE SEARCH - // INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_search_index_statement) - // statement. - // * `DROP_TABLE`: [`DROP - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_statement) - // statement. - // * `DROP_EXTERNAL_TABLE`: [`DROP EXTERNAL - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_external_table_statement) - // statement. - // * `DROP_VIEW`: [`DROP - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_view_statement) - // statement. - // * `DROP_MODEL`: [`DROP - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-drop-model) - // statement. - // * `DROP_MATERIALIZED_VIEW`: [`DROP MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_materialized_view_statement) - // statement. - // * `DROP_FUNCTION` : [`DROP - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_function_statement) - // statement. - // * `DROP_TABLE_FUNCTION` : [`DROP TABLE - // FUNCTION`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_table_function) - // statement. - // * `DROP_PROCEDURE`: [`DROP - // PROCEDURE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_procedure_statement) - // statement. - // * `DROP_SEARCH_INDEX`: [`DROP SEARCH - // INDEX`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_search_index) - // statement. - // * `DROP_SCHEMA`: [`DROP - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_schema_statement) - // statement. - // * `DROP_SNAPSHOT_TABLE`: [`DROP SNAPSHOT - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_snapshot_table_statement) - // statement. - // * `DROP_ROW_ACCESS_POLICY`: [`DROP [ALL] ROW ACCESS - // POLICY|POLICIES`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#drop_row_access_policy_statement) - // statement. - // * `ALTER_TABLE`: [`ALTER - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_table_set_options_statement) - // statement. - // * `ALTER_VIEW`: [`ALTER - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_view_set_options_statement) - // statement. - // * `ALTER_MATERIALIZED_VIEW`: [`ALTER MATERIALIZED - // VIEW`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#alter_materialized_view_set_options_statement) - // statement. - // * `ALTER_SCHEMA`: [`ALTER - // SCHEMA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#aalter_schema_set_options_statement) - // statement. - // * `SCRIPT`: - // [`SCRIPT`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language). - // * `TRUNCATE_TABLE`: [`TRUNCATE - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#truncate_table_statement) - // statement. - // * `CREATE_EXTERNAL_TABLE`: [`CREATE EXTERNAL - // TABLE`](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_external_table_statement) - // statement. - // * `EXPORT_DATA`: [`EXPORT - // DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#export_data_statement) - // statement. - // * `EXPORT_MODEL`: [`EXPORT - // MODEL`](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-export-model) - // statement. - // * `LOAD_DATA`: [`LOAD - // DATA`](https://cloud.google.com/bigquery/docs/reference/standard-sql/other-statements#load_data_statement) - // statement. - // * `CALL`: - // [`CALL`](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#call) - // statement. - string statement_type = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL operation performed, possibly - // dependent on the pre-existence of the DDL target. - string ddl_operation_performed = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target table. Present only for - // CREATE/DROP TABLE/VIEW and DROP ALL ROW ACCESS POLICIES queries. - TableReference ddl_target_table = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The table after rename. Present only for ALTER TABLE RENAME TO - // query. - TableReference ddl_destination_table = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target row access policy. Present only for - // CREATE/DROP ROW ACCESS POLICY queries. - RowAccessPolicyReference ddl_target_row_access_policy = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of row access policies affected by a DDL statement. - // Present only for DROP ALL ROW ACCESS POLICIES queries. - google.protobuf.Int64Value ddl_affected_row_access_policy_count = 27 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Beta] The DDL target routine. Present only for - // CREATE/DROP FUNCTION/PROCEDURE queries. - RoutineReference ddl_target_routine = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DDL target dataset. Present only for CREATE/ALTER/DROP - // SCHEMA(dataset) queries. - DatasetReference ddl_target_dataset = 30 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of a BigQuery ML training job. - MlStatistics ml_statistics = 23 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Stats for EXPORT DATA statement. - ExportDataStatistics export_data_statistics = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Job cost breakdown as bigquery internal cost and external - // service costs. - repeated ExternalServiceCost external_service_costs = 28 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. BI Engine specific Statistics. - BiEngineStatistics bi_engine_statistics = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a LOAD query. - LoadQueryStatistics load_query_statistics = 33 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced table for DCL statement. - TableReference dcl_target_table = 34 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced view for DCL statement. - TableReference dcl_target_view = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Referenced dataset for DCL statement. - DatasetReference dcl_target_dataset = 36 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Search query specific statistics. - SearchStatistics search_statistics = 37 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Vector Search query specific statistics. - VectorSearchStatistics vector_search_statistics = 44 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Performance insights. - PerformanceInsights performance_insights = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Query optimization information for a QUERY job. - QueryInfo query_info = 39 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of a Spark procedure job. - SparkStatistics spark_statistics = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes transferred for cross-cloud queries such as Cross - // Cloud Transfer and CREATE TABLE AS SELECT (CTAS). - google.protobuf.Int64Value transferred_bytes = 41 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of materialized views of a query job. - MaterializedViewStatistics materialized_view_statistics = 42 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics of metadata cache usage in a query for BigLake - // tables. - MetadataCacheStatistics metadata_cache_statistics = 43 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a load job. -message JobStatistics3 { - // Output only. Number of source files in a load job. - google.protobuf.Int64Value input_files = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of bytes of source data in a load job. - google.protobuf.Int64Value input_file_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of rows imported in a load job. - // Note that while an import job is in the running state, this - // value may change. - google.protobuf.Int64Value output_rows = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Size of the loaded data in bytes. Note - // that while a load job is in the running state, this value may change. - google.protobuf.Int64Value output_bytes = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of bad records encountered. Note that if the job - // has failed because of more bad records encountered than the maximum - // allowed in the load job configuration, then this number can be less than - // the total number of bad records present in the input data. - google.protobuf.Int64Value bad_records = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for an extract job. -message JobStatistics4 { - // Output only. Number of files per destination URI or URI pattern - // specified in the extract configuration. These values will be in the same - // order as the URIs specified in the 'destinationUris' field. - repeated int64 destination_uri_file_counts = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of user bytes extracted into the result. This is the - // byte count as computed by BigQuery for billing purposes - // and doesn't have any relationship with the number of actual - // result bytes extracted in the desired format. - google.protobuf.Int64Value input_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes a timeline of job execution. - repeated QueryTimelineSample timeline = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a copy job. -message CopyJobStatistics { - // Output only. Number of rows copied to the destination table. - google.protobuf.Int64Value copied_rows = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes copied to the destination table. - google.protobuf.Int64Value copied_logical_bytes = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Job statistics specific to a BigQuery ML training job. -message MlStatistics { - // Training type. - enum TrainingType { - // Unspecified training type. - TRAINING_TYPE_UNSPECIFIED = 0; - - // Single training with fixed parameter space. - SINGLE_TRAINING = 1; - - // [Hyperparameter tuning - // training](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview). - HPARAM_TUNING = 2; - } - - // Output only. Maximum number of iterations specified as max_iterations in - // the 'CREATE MODEL' query. The actual number of iterations may be less than - // this number due to early stop. - int64 max_iterations = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Results for all completed iterations. - // Empty for [hyperparameter tuning - // jobs](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview). - repeated Model.TrainingRun.IterationResult iteration_results = 2; - - // Output only. The type of the model that is being trained. - Model.ModelType model_type = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Training type of the job. - TrainingType training_type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Trials of a [hyperparameter tuning - // job](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // sorted by trial_id. - repeated Model.HparamTuningTrial hparam_trials = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Job statistics specific to the child job of a script. -message ScriptStatistics { - // Describes how the job is evaluated. - enum EvaluationKind { - // Default value. - EVALUATION_KIND_UNSPECIFIED = 0; - - // The statement appears directly in the script. - STATEMENT = 1; - - // The statement evaluates an expression that appears in the script. - EXPRESSION = 2; - } - - // Represents the location of the statement/expression being evaluated. - // Line and column numbers are defined as follows: - // - // - Line and column numbers start with one. That is, line 1 column 1 denotes - // the start of the script. - // - When inside a stored procedure, all line/column numbers are relative - // to the procedure body, not the script in which the procedure was defined. - // - Start/end positions exclude leading/trailing comments and whitespace. - // The end position always ends with a ";", when present. - // - Multi-byte Unicode characters are treated as just one column. - // - If the original script (or procedure definition) contains TAB characters, - // a tab "snaps" the indentation forward to the nearest multiple of 8 - // characters, plus 1. For example, a TAB on column 1, 2, 3, 4, 5, 6 , or 8 - // will advance the next character to column 9. A TAB on column 9, 10, 11, - // 12, 13, 14, 15, or 16 will advance the next character to column 17. - message ScriptStackFrame { - // Output only. One-based start line. - int32 start_line = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based start column. - int32 start_column = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based end line. - int32 end_line = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. One-based end column. - int32 end_column = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the active procedure, empty if in a top-level - // script. - string procedure_id = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Text of the current statement/expression. - string text = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Whether this child job was a statement or expression. - EvaluationKind evaluation_kind = 1; - - // Stack trace showing the line/column/procedure name of each frame on the - // stack at the point where the current evaluation happened. The leaf frame - // is first, the primary script is last. Never empty. - repeated ScriptStackFrame stack_frames = 2; -} - -// Statistics for row-level security. -message RowLevelSecurityStatistics { - // Whether any accessed data was protected by row access policies. - bool row_level_security_applied = 1; -} - -// Statistics for data-masking. -message DataMaskingStatistics { - // Whether any accessed data was protected by the data masking. - bool data_masking_applied = 1; -} - -// Statistics for a single job execution. -message JobStatistics { - // [Alpha] Information of a multi-statement transaction. - message TransactionInfo { - // Output only. [Alpha] Id of the transaction. - string transaction_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Creation time of this job, in milliseconds since the epoch. - // This field will be present on all jobs. - int64 creation_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Start time of this job, in milliseconds since the epoch. - // This field will be present when the job transitions from the PENDING state - // to either RUNNING or DONE. - int64 start_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. End time of this job, in milliseconds since the epoch. This - // field will be present whenever a job is in the DONE state. - int64 end_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total bytes processed for the job. - google.protobuf.Int64Value total_bytes_processed = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [TrustedTester] Job progress (0.0 -> 1.0) for LOAD and - // EXTRACT jobs. - google.protobuf.DoubleValue completion_ratio = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Quotas which delayed this job's start time. - repeated string quota_deferments = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a query job. - JobStatistics2 query = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a load job. - JobStatistics3 load = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for an extract job. - JobStatistics4 extract = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for a copy job. - CopyJobStatistics copy = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Slot-milliseconds for the job. - google.protobuf.Int64Value total_slot_ms = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the primary reservation assigned to this job. Note - // that this could be different than reservations reported in the reservation - // usage field if parent reservations were used to execute this job. - string reservation_id = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of child jobs executed. - int64 num_child_jobs = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this is a child job, specifies the job ID of the parent. - string parent_job_id = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If this a child job of a script, specifies information about - // the context of this job within the script. - ScriptStatistics script_statistics = 14 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for row-level security. Present only for query and - // extract jobs. - RowLevelSecurityStatistics row_level_security_statistics = 16 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for data-masking. Present only for query and - // extract jobs. - DataMaskingStatistics data_masking_statistics = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. [Alpha] Information of the multi-statement transaction if this - // job is part of one. - // - // This property is only expected on a child job or a job that is in a - // session. A script parent job is not part of the transaction started in the - // script. - TransactionInfo transaction_info = 17 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information of the session if this job is part of one. - SessionInfo session_info = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The duration in milliseconds of the execution of the final - // attempt of this job, as BigQuery may internally re-attempt to execute the - // job. - int64 final_execution_duration_ms = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of edition corresponding to the reservation for this job - // at the time of this update. - ReservationEdition edition = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Detailed statistics for DML statements -message DmlStats { - // Output only. Number of inserted Rows. Populated by DML INSERT and MERGE - // statements - google.protobuf.Int64Value inserted_row_count = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of deleted Rows. populated by DML DELETE, MERGE and - // TRUNCATE statements. - google.protobuf.Int64Value deleted_row_count = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of updated Rows. Populated by DML UPDATE and MERGE - // statements. - google.protobuf.Int64Value updated_row_count = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Performance insights for the job. -message PerformanceInsights { - // Output only. Average execution ms of previous runs. Indicates the job ran - // slow compared to previous executions. To find previous executions, use - // INFORMATION_SCHEMA tables and filter jobs with same query hash. - int64 avg_previous_execution_ms = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Standalone query stage performance insights, for exploring - // potential improvements. - repeated StagePerformanceStandaloneInsight - stage_performance_standalone_insights = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Query stage performance insights compared to previous runs, - // for diagnosing performance regression. - repeated StagePerformanceChangeInsight stage_performance_change_insights = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Performance insights compared to the previous executions for a specific -// stage. -message StagePerformanceChangeInsight { - // Output only. The stage id that the insight mapped to. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Input data change insight of the query stage. - optional InputDataChange input_data_change = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Details about the input data change insight. -message InputDataChange { - // Output only. Records read difference percentage compared to a previous run. - float records_read_diff_percentage = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Standalone performance insights for a specific stage. -message StagePerformanceStandaloneInsight { - // Output only. The stage id that the insight mapped to. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the stage has a slot contention issue. - optional bool slot_contention = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if the stage has insufficient shuffle quota. - optional bool insufficient_shuffle_quota = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. If present, the stage had the following reasons for being - // disqualified from BI Engine execution. - repeated BiEngineReason bi_engine_reasons = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. High cardinality joins in the stage. - repeated HighCardinalityJoin high_cardinality_joins = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Partition skew in the stage. - optional PartitionSkew partition_skew = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// High cardinality join detailed information. -message HighCardinalityJoin { - // Output only. Count of left input rows. - int64 left_rows = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Count of right input rows. - int64 right_rows = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Count of the output rows. - int64 output_rows = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The index of the join operator in the ExplainQueryStep lists. - int32 step_index = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Partition skew detailed information. -message PartitionSkew { - // Details about source stages which produce skewed data. - message SkewSource { - // Output only. Stage id of the skew source stage. - int64 stage_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Source stages which produce skewed data. - repeated SkewSource skew_sources = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Statistics for a BigSpark query. -// Populated as part of JobStatistics2 -message SparkStatistics { - // Spark job logs can be filtered by these fields in Cloud Logging. - message LoggingInfo { - // Output only. Resource type used for logging. - string resource_type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Project ID where the Spark logs were written. - string project_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Spark job ID if a Spark job is created successfully. - optional string spark_job_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Location where the Spark job is executed. - // A location is selected by BigQueury for jobs configured to run in a - // multi-region. - optional string spark_job_location = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Endpoints returned from Dataproc. - // Key list: - // - history_server_endpoint: A link to Spark job UI. - map endpoints = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Logging info is used to generate a link to Cloud Logging. - optional LoggingInfo logging_info = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Cloud KMS encryption key that is used to protect the - // resources created by the Spark job. If the Spark procedure uses the invoker - // security mode, the Cloud KMS encryption key is either inferred from the - // provided system variable, - // `@@spark_proc_properties.kms_key_name`, or the default key of the BigQuery - // job's project (if the CMEK organization policy is enforced). Otherwise, the - // Cloud KMS key is either inferred from the Spark connection associated with - // the procedure (if it is provided), or from the default key of the Spark - // connection's project if the CMEK organization policy is enforced. - // - // Example: - // - // * `projects/[kms_project_id]/locations/[region]/keyRings/[key_region]/cryptoKeys/[key]` - optional string kms_key_name = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "cloudkms.googleapis.com/CryptoKey" - } - ]; - - // Output only. The Google Cloud Storage bucket that is used as the default - // file system by the Spark application. This field is only filled when the - // Spark procedure uses the invoker security mode. The `gcsStagingBucket` - // bucket is inferred from the `@@spark_proc_properties.staging_bucket` system - // variable (if it is provided). Otherwise, BigQuery creates a default staging - // bucket for the job and returns the bucket name in this field. - // - // Example: - // - // * `gs://[bucket_name]` - optional string gcs_staging_bucket = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { type: "storage.googleapis.com/Bucket" } - ]; -} - -// Statistics of materialized views considered in a query job. -message MaterializedViewStatistics { - // Materialized views considered for the query job. Only certain materialized - // views are used. For a detailed list, see the child message. - // - // If many materialized views are considered, then the list might be - // incomplete. - repeated MaterializedView materialized_view = 1; -} - -// A materialized view considered for a query job. -message MaterializedView { - // Reason why a materialized view was not chosen for a query. For more - // information, see [Understand why materialized views were - // rejected](https://cloud.google.com/bigquery/docs/materialized-views-use#understand-rejected). - enum RejectedReason { - // Default unspecified value. - REJECTED_REASON_UNSPECIFIED = 0; - - // View has no cached data because it has not refreshed yet. - NO_DATA = 1; - - // The estimated cost of the view is more expensive than another view or the - // base table. - // - // Note: The estimate cost might not match the billed cost. - COST = 2; - - // View has no cached data because a base table is truncated. - BASE_TABLE_TRUNCATED = 3; - - // View is invalidated because of a data change in one or more base tables. - // It could be any recent change if the - // [`max_staleness`](https://cloud.google.com/bigquery/docs/materialized-views-create#max_staleness) - // option is not set for the view, or otherwise any change outside of the - // staleness window. - BASE_TABLE_DATA_CHANGE = 4; - - // View is invalidated because a base table's partition expiration has - // changed. - BASE_TABLE_PARTITION_EXPIRATION_CHANGE = 5; - - // View is invalidated because a base table's partition has expired. - BASE_TABLE_EXPIRED_PARTITION = 6; - - // View is invalidated because a base table has an incompatible metadata - // change. - BASE_TABLE_INCOMPATIBLE_METADATA_CHANGE = 7; - - // View is invalidated because it was refreshed with a time zone other than - // that of the current job. - TIME_ZONE = 8; - - // View is outside the time travel window. - OUT_OF_TIME_TRAVEL_WINDOW = 9; - - // View is inaccessible to the user because of a fine-grained security - // policy on one of its base tables. - BASE_TABLE_FINE_GRAINED_SECURITY_POLICY = 10; - - // One of the view's base tables is too stale. For example, the cached - // metadata of a BigLake external table needs to be updated. - BASE_TABLE_TOO_STALE = 11; - } - - // The candidate materialized view. - optional TableReference table_reference = 1; - - // Whether the materialized view is chosen for the query. - // - // A materialized view can be chosen to rewrite multiple parts of the same - // query. If a materialized view is chosen to rewrite any part of the query, - // then this field is true, even if the materialized view was not chosen to - // rewrite others parts. - optional bool chosen = 2; - - // If present, specifies a best-effort estimation of the bytes saved by using - // the materialized view rather than its base tables. - optional int64 estimated_bytes_saved = 3; - - // If present, specifies the reason why the materialized view was not chosen - // for the query. - optional RejectedReason rejected_reason = 4; -} - -// Table level detail on the usage of metadata caching. Only set for Metadata -// caching eligible tables referenced in the query. -message TableMetadataCacheUsage { - // Reasons for not using metadata caching. - enum UnusedReason { - // Unused reasons not specified. - UNUSED_REASON_UNSPECIFIED = 0; - - // Metadata cache was outside the table's maxStaleness. - EXCEEDED_MAX_STALENESS = 1; - - // Metadata caching feature is not enabled. [Update BigLake tables] - // (/bigquery/docs/create-cloud-storage-table-biglake#update-biglake-tables) - // to enable the metadata caching. - METADATA_CACHING_NOT_ENABLED = 3; - - // Other unknown reason. - OTHER_REASON = 2; - } - - // Metadata caching eligible table referenced in the query. - optional TableReference table_reference = 1; - - // Reason for not using metadata caching for the table. - optional UnusedReason unused_reason = 2; - - // Free form human-readable reason metadata caching was unused for - // the job. - optional string explanation = 3; - - // Duration since last refresh as of this job for managed tables (indicates - // metadata cache staleness as seen by this job). - google.protobuf.Duration staleness = 5; - - // [Table - // type](https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#Table.FIELDS.type). - string table_type = 6; -} - -// Statistics for metadata caching in BigLake tables. -message MetadataCacheStatistics { - // Set for the Metadata caching eligible tables referenced in the query. - repeated TableMetadataCacheUsage table_metadata_cache_usage = 1; -} - -// The type of editions. -// Different features and behaviors are provided to different editions -// Capacity commitments and reservations are linked to editions. -enum ReservationEdition { - // Default value, which will be treated as ENTERPRISE. - RESERVATION_EDITION_UNSPECIFIED = 0; - - // Standard edition. - STANDARD = 1; - - // Enterprise edition. - ENTERPRISE = 2; - - // Enterprise plus edition. - ENTERPRISE_PLUS = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_status.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_status.proto.baseline deleted file mode 100644 index 71f0a33dcb9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/job_status.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/error.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "JobStatusProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message JobStatus { - // Output only. Final error result of the job. If present, indicates that the - // job has completed and was unsuccessful. - ErrorProto error_result = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The first errors encountered during the running of the job. - // The final message includes the number of errors that caused the process to - // stop. Errors here do not necessarily mean that the job has not completed or - // was unsuccessful. - repeated ErrorProto errors = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Running state of the job. Valid states include 'PENDING', - // 'RUNNING', and 'DONE'. - string state = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/json_extension.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/json_extension.proto.baseline deleted file mode 100644 index 49338d7466aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/json_extension.proto.baseline +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "JsonExtensionProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Used to indicate that a JSON variant, rather than normal JSON, is being used -// as the source_format. This should only be used in combination with the -// JSON source format. -enum JsonExtension { - // The default if provided value is not one included in the enum, or the value - // is not specified. The source formate is parsed without any modification. - JSON_EXTENSION_UNSPECIFIED = 0; - - // Use GeoJSON variant of JSON. See https://tools.ietf.org/html/rfc7946. - GEOJSON = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline deleted file mode 100644 index 391bd5ae4331..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/location_metadata.proto.baseline +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "LocationMetadataProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// BigQuery-specific metadata about a location. This will be set on -// google.cloud.location.Location.metadata in Cloud Location API -// responses. -message LocationMetadata { - // The legacy BigQuery location ID, e.g. “EU” for the “europe” location. - // This is for any API consumers that need the legacy “US” and “EU” locations. - string legacy_location_id = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline deleted file mode 100644 index dc66e7d7abe8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/map_target_type.proto.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "MapTargetTypeProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Indicates the map target type. Only applies to parquet maps. -enum MapTargetType { - // In this mode, the map will have the following schema: - // struct map_field_name { repeated struct key_value { key value } }. - MAP_TARGET_TYPE_UNSPECIFIED = 0; - - // In this mode, the map will have the following schema: - // repeated struct map_field_name { key value }. - ARRAY_OF_STRUCT = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model.proto.baseline deleted file mode 100644 index dc3311876100..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model.proto.baseline +++ /dev/null @@ -1,2040 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/model_reference.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ModelProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Model Service. -// -// It should not be relied on for production use cases at this time. -service ModelService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified model resource by model ID. - rpc GetModel(GetModelRequest) returns (Model) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - }; - option (google.api.method_signature) = "project_id,dataset_id,model_id"; - } - - // Lists all models in the specified dataset. Requires the READER dataset - // role. After retrieving the list of models, you can get information about a - // particular model by calling the models.get method. - rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models" - }; - option (google.api.method_signature) = "project_id,dataset_id,max_results"; - } - - // Patch specific fields in the specified model. - rpc PatchModel(PatchModelRequest) returns (Model) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - body: "model" - }; - option (google.api.method_signature) = - "project_id,dataset_id,model_id,model"; - } - - // Deletes the model specified by modelId from the dataset. - rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/models/{model_id=*}" - }; - option (google.api.method_signature) = "project_id,dataset_id,model_id"; - } -} - -// Remote Model Info -message RemoteModelInfo { - // Supported service type for remote model. - enum RemoteServiceType { - // Unspecified remote service type. - REMOTE_SERVICE_TYPE_UNSPECIFIED = 0; - - // V3 Cloud AI Translation API. See more details at [Cloud Translation API] - // (https://cloud.google.com/translate/docs/reference/rest). - CLOUD_AI_TRANSLATE_V3 = 1; - - // V1 Cloud AI Vision API See more details at [Cloud Vision API] - // (https://cloud.google.com/vision/docs/reference/rest). - CLOUD_AI_VISION_V1 = 2; - - // V1 Cloud AI Natural Language API. See more details at [REST Resource: - // documents](https://cloud.google.com/natural-language/docs/reference/rest/v1/documents). - CLOUD_AI_NATURAL_LANGUAGE_V1 = 3; - - // V2 Speech-to-Text API. See more details at [Google Cloud Speech-to-Text - // V2 API](https://cloud.google.com/speech-to-text/v2/docs) - CLOUD_AI_SPEECH_TO_TEXT_V2 = 7; - } - - // Remote services are services outside of BigQuery used by remote models for - // predictions. A remote service is backed by either an arbitrary endpoint or - // a selected remote service type, but not both. - oneof remote_service { - // Output only. The endpoint for remote model. - string endpoint = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The remote service type for remote model. - RemoteServiceType remote_service_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. Fully qualified name of the user-provided connection object of - // the remote model. Format: - // ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"``` - string connection = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Max number of rows in each batch sent to the remote service. - // If unset, the number of rows in each batch is set dynamically. - int64 max_batching_rows = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The model version for LLM. - string remote_model_version = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The name of the speech recognizer to use for speech - // recognition. The expected format is - // `projects/{project}/locations/{location}/recognizers/{recognizer}`. - // Customers can specify this field at model creation. If not specified, a - // default recognizer `projects/{model - // project}/locations/global/recognizers/_` will be used. See more details at - // [recognizers](https://cloud.google.com/speech-to-text/v2/docs/reference/rest/v2/projects.locations.recognizers) - string speech_recognizer = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about a single transform column. -message TransformColumn { - // Output only. Name of the column. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Data type of the column after the transform. - StandardSqlDataType type = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The SQL expression used in the column transform. - string transform_sql = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message Model { - // Indicates the type of the Model. - enum ModelType { - // Default value. - MODEL_TYPE_UNSPECIFIED = 0; - - // Linear regression model. - LINEAR_REGRESSION = 1; - - // Logistic regression based classification model. - LOGISTIC_REGRESSION = 2; - - // K-means clustering model. - KMEANS = 3; - - // Matrix factorization model. - MATRIX_FACTORIZATION = 4; - - // DNN classifier model. - DNN_CLASSIFIER = 5; - - // An imported TensorFlow model. - TENSORFLOW = 6; - - // DNN regressor model. - DNN_REGRESSOR = 7; - - // An imported XGBoost model. - XGBOOST = 8; - - // Boosted tree regressor model. - BOOSTED_TREE_REGRESSOR = 9; - - // Boosted tree classifier model. - BOOSTED_TREE_CLASSIFIER = 10; - - // ARIMA model. - ARIMA = 11; - - // AutoML Tables regression model. - AUTOML_REGRESSOR = 12; - - // AutoML Tables classification model. - AUTOML_CLASSIFIER = 13; - - // Prinpical Component Analysis model. - PCA = 14; - - // Wide-and-deep classifier model. - DNN_LINEAR_COMBINED_CLASSIFIER = 16; - - // Wide-and-deep regressor model. - DNN_LINEAR_COMBINED_REGRESSOR = 17; - - // Autoencoder model. - AUTOENCODER = 18; - - // New name for the ARIMA model. - ARIMA_PLUS = 19; - - // ARIMA with external regressors. - ARIMA_PLUS_XREG = 23; - - // Random forest regressor model. - RANDOM_FOREST_REGRESSOR = 24; - - // Random forest classifier model. - RANDOM_FOREST_CLASSIFIER = 25; - - // An imported TensorFlow Lite model. - TENSORFLOW_LITE = 26; - - // An imported ONNX model. - ONNX = 28; - - // Model to capture the columns and logic in the TRANSFORM clause along with - // statistics useful for ML analytic functions. - TRANSFORM_ONLY = 29; - } - - // Loss metric to evaluate model training performance. - enum LossType { - // Default value. - LOSS_TYPE_UNSPECIFIED = 0; - - // Mean squared loss, used for linear regression. - MEAN_SQUARED_LOSS = 1; - - // Mean log loss, used for logistic regression. - MEAN_LOG_LOSS = 2; - } - - // Distance metric used to compute the distance between two points. - enum DistanceType { - // Default value. - DISTANCE_TYPE_UNSPECIFIED = 0; - - // Eculidean distance. - EUCLIDEAN = 1; - - // Cosine distance. - COSINE = 2; - } - - // Indicates the method to split input data into multiple tables. - enum DataSplitMethod { - // Default value. - DATA_SPLIT_METHOD_UNSPECIFIED = 0; - - // Splits data randomly. - RANDOM = 1; - - // Splits data with the user provided tags. - CUSTOM = 2; - - // Splits data sequentially. - SEQUENTIAL = 3; - - // Data split will be skipped. - NO_SPLIT = 4; - - // Splits data automatically: Uses NO_SPLIT if the data size is small. - // Otherwise uses RANDOM. - AUTO_SPLIT = 5; - } - - // Type of supported data frequency for time series forecasting models. - enum DataFrequency { - // Default value. - DATA_FREQUENCY_UNSPECIFIED = 0; - - // Automatically inferred from timestamps. - AUTO_FREQUENCY = 1; - - // Yearly data. - YEARLY = 2; - - // Quarterly data. - QUARTERLY = 3; - - // Monthly data. - MONTHLY = 4; - - // Weekly data. - WEEKLY = 5; - - // Daily data. - DAILY = 6; - - // Hourly data. - HOURLY = 7; - - // Per-minute data. - PER_MINUTE = 8; - } - - // Type of supported holiday regions for time series forecasting models. - enum HolidayRegion { - // Holiday region unspecified. - HOLIDAY_REGION_UNSPECIFIED = 0; - - // Global. - GLOBAL = 1; - - // North America. - NA = 2; - - // Japan and Asia Pacific: Korea, Greater China, India, Australia, and New - // Zealand. - JAPAC = 3; - - // Europe, the Middle East and Africa. - EMEA = 4; - - // Latin America and the Caribbean. - LAC = 5; - - // United Arab Emirates - AE = 6; - - // Argentina - AR = 7; - - // Austria - AT = 8; - - // Australia - AU = 9; - - // Belgium - BE = 10; - - // Brazil - BR = 11; - - // Canada - CA = 12; - - // Switzerland - CH = 13; - - // Chile - CL = 14; - - // China - CN = 15; - - // Colombia - CO = 16; - - // Czechoslovakia - CS = 17; - - // Czech Republic - CZ = 18; - - // Germany - DE = 19; - - // Denmark - DK = 20; - - // Algeria - DZ = 21; - - // Ecuador - EC = 22; - - // Estonia - EE = 23; - - // Egypt - EG = 24; - - // Spain - ES = 25; - - // Finland - FI = 26; - - // France - FR = 27; - - // Great Britain (United Kingdom) - GB = 28; - - // Greece - GR = 29; - - // Hong Kong - HK = 30; - - // Hungary - HU = 31; - - // Indonesia - ID = 32; - - // Ireland - IE = 33; - - // Israel - IL = 34; - - // India - IN = 35; - - // Iran - IR = 36; - - // Italy - IT = 37; - - // Japan - JP = 38; - - // Korea (South) - KR = 39; - - // Latvia - LV = 40; - - // Morocco - MA = 41; - - // Mexico - MX = 42; - - // Malaysia - MY = 43; - - // Nigeria - NG = 44; - - // Netherlands - NL = 45; - - // Norway - NO = 46; - - // New Zealand - NZ = 47; - - // Peru - PE = 48; - - // Philippines - PH = 49; - - // Pakistan - PK = 50; - - // Poland - PL = 51; - - // Portugal - PT = 52; - - // Romania - RO = 53; - - // Serbia - RS = 54; - - // Russian Federation - RU = 55; - - // Saudi Arabia - SA = 56; - - // Sweden - SE = 57; - - // Singapore - SG = 58; - - // Slovenia - SI = 59; - - // Slovakia - SK = 60; - - // Thailand - TH = 61; - - // Turkey - TR = 62; - - // Taiwan - TW = 63; - - // Ukraine - UA = 64; - - // United States - US = 65; - - // Venezuela - VE = 66; - - // Viet Nam - VN = 67; - - // South Africa - ZA = 68; - } - - // Enums for seasonal period. - message SeasonalPeriod { - // Seasonal period type. - enum SeasonalPeriodType { - // Unspecified seasonal period. - SEASONAL_PERIOD_TYPE_UNSPECIFIED = 0; - - // No seasonality - NO_SEASONALITY = 1; - - // Daily period, 24 hours. - DAILY = 2; - - // Weekly period, 7 days. - WEEKLY = 3; - - // Monthly period, 30 days or irregular. - MONTHLY = 4; - - // Quarterly period, 90 days or irregular. - QUARTERLY = 5; - - // Yearly period, 365 days or irregular. - YEARLY = 6; - } - } - - // Enums for color space, used for processing images in Object Table. - // See more details at - // https://www.tensorflow.org/io/tutorials/colorspace. - enum ColorSpace { - // Unspecified color space - COLOR_SPACE_UNSPECIFIED = 0; - - // RGB - RGB = 1; - - // HSV - HSV = 2; - - // YIQ - YIQ = 3; - - // YUV - YUV = 4; - - // GRAYSCALE - GRAYSCALE = 5; - } - - // Enums for kmeans model type. - message KmeansEnums { - // Indicates the method used to initialize the centroids for KMeans - // clustering algorithm. - enum KmeansInitializationMethod { - // Unspecified initialization method. - KMEANS_INITIALIZATION_METHOD_UNSPECIFIED = 0; - - // Initializes the centroids randomly. - RANDOM = 1; - - // Initializes the centroids using data specified in - // kmeans_initialization_column. - CUSTOM = 2; - - // Initializes with kmeans++. - KMEANS_PLUS_PLUS = 3; - } - } - - // Enums for XGBoost model type. - message BoostedTreeOptionEnums { - // Booster types supported. Refer to booster parameter in XGBoost. - enum BoosterType { - // Unspecified booster type. - BOOSTER_TYPE_UNSPECIFIED = 0; - - // Gbtree booster. - GBTREE = 1; - - // Dart booster. - DART = 2; - } - - // Type of normalization algorithm for boosted tree models using dart - // booster. Refer to normalize_type in XGBoost. - enum DartNormalizeType { - // Unspecified dart normalize type. - DART_NORMALIZE_TYPE_UNSPECIFIED = 0; - - // New trees have the same weight of each of dropped trees. - TREE = 1; - - // New trees have the same weight of sum of dropped trees. - FOREST = 2; - } - - // Tree construction algorithm used in boosted tree models. - // Refer to tree_method in XGBoost. - enum TreeMethod { - // Unspecified tree method. - TREE_METHOD_UNSPECIFIED = 0; - - // Use heuristic to choose the fastest method. - AUTO = 1; - - // Exact greedy algorithm. - EXACT = 2; - - // Approximate greedy algorithm using quantile sketch and gradient - // histogram. - APPROX = 3; - - // Fast histogram optimized approximate greedy algorithm. - HIST = 4; - } - } - - // Enums for hyperparameter tuning. - message HparamTuningEnums { - // Available evaluation metrics used as hyperparameter tuning objectives. - enum HparamTuningObjective { - // Unspecified evaluation metric. - HPARAM_TUNING_OBJECTIVE_UNSPECIFIED = 0; - - // Mean absolute error. - // mean_absolute_error = AVG(ABS(label - predicted)) - MEAN_ABSOLUTE_ERROR = 1; - - // Mean squared error. - // mean_squared_error = AVG(POW(label - predicted, 2)) - MEAN_SQUARED_ERROR = 2; - - // Mean squared log error. - // mean_squared_log_error = AVG(POW(LN(1 + label) - LN(1 + predicted), 2)) - MEAN_SQUARED_LOG_ERROR = 3; - - // Mean absolute error. - // median_absolute_error = APPROX_QUANTILES(absolute_error, 2)[OFFSET(1)] - MEDIAN_ABSOLUTE_ERROR = 4; - - // R^2 score. This corresponds to r2_score in ML.EVALUATE. - // r_squared = 1 - SUM(squared_error)/(COUNT(label)*VAR_POP(label)) - R_SQUARED = 5; - - // Explained variance. - // explained_variance = 1 - VAR_POP(label_error)/VAR_POP(label) - EXPLAINED_VARIANCE = 6; - - // Precision is the fraction of actual positive predictions that had - // positive actual labels. For multiclass this is a macro-averaged metric - // treating each class as a binary classifier. - PRECISION = 7; - - // Recall is the fraction of actual positive labels that were given a - // positive prediction. For multiclass this is a macro-averaged metric. - RECALL = 8; - - // Accuracy is the fraction of predictions given the correct label. For - // multiclass this is a globally micro-averaged metric. - ACCURACY = 9; - - // The F1 score is an average of recall and precision. For multiclass this - // is a macro-averaged metric. - F1_SCORE = 10; - - // Logorithmic Loss. For multiclass this is a macro-averaged metric. - LOG_LOSS = 11; - - // Area Under an ROC Curve. For multiclass this is a macro-averaged - // metric. - ROC_AUC = 12; - - // Davies-Bouldin Index. - DAVIES_BOULDIN_INDEX = 13; - - // Mean Average Precision. - MEAN_AVERAGE_PRECISION = 14; - - // Normalized Discounted Cumulative Gain. - NORMALIZED_DISCOUNTED_CUMULATIVE_GAIN = 15; - - // Average Rank. - AVERAGE_RANK = 16; - } - } - - // Indicates the learning rate optimization strategy to use. - enum LearnRateStrategy { - // Default value. - LEARN_RATE_STRATEGY_UNSPECIFIED = 0; - - // Use line search to determine learning rate. - LINE_SEARCH = 1; - - // Use a constant learning rate. - CONSTANT = 2; - } - - // Indicates the optimization strategy used for training. - enum OptimizationStrategy { - // Default value. - OPTIMIZATION_STRATEGY_UNSPECIFIED = 0; - - // Uses an iterative batch gradient descent algorithm. - BATCH_GRADIENT_DESCENT = 1; - - // Uses a normal equation to solve linear regression problem. - NORMAL_EQUATION = 2; - } - - // Indicates the training algorithm to use for matrix factorization models. - enum FeedbackType { - // Default value. - FEEDBACK_TYPE_UNSPECIFIED = 0; - - // Use weighted-als for implicit feedback problems. - IMPLICIT = 1; - - // Use nonweighted-als for explicit feedback problems. - EXPLICIT = 2; - } - - // Evaluation metrics for regression and explicit feedback type matrix - // factorization models. - message RegressionMetrics { - // Mean absolute error. - google.protobuf.DoubleValue mean_absolute_error = 1; - - // Mean squared error. - google.protobuf.DoubleValue mean_squared_error = 2; - - // Mean squared log error. - google.protobuf.DoubleValue mean_squared_log_error = 3; - - // Median absolute error. - google.protobuf.DoubleValue median_absolute_error = 4; - - // R^2 score. This corresponds to r2_score in ML.EVALUATE. - google.protobuf.DoubleValue r_squared = 5; - } - - // Aggregate metrics for classification/classifier models. For multi-class - // models, the metrics are either macro-averaged or micro-averaged. When - // macro-averaged, the metrics are calculated for each label and then an - // unweighted average is taken of those values. When micro-averaged, the - // metric is calculated globally by counting the total number of correctly - // predicted rows. - message AggregateClassificationMetrics { - // Precision is the fraction of actual positive predictions that had - // positive actual labels. For multiclass this is a macro-averaged - // metric treating each class as a binary classifier. - google.protobuf.DoubleValue precision = 1; - - // Recall is the fraction of actual positive labels that were given a - // positive prediction. For multiclass this is a macro-averaged metric. - google.protobuf.DoubleValue recall = 2; - - // Accuracy is the fraction of predictions given the correct label. For - // multiclass this is a micro-averaged metric. - google.protobuf.DoubleValue accuracy = 3; - - // Threshold at which the metrics are computed. For binary - // classification models this is the positive class threshold. - // For multi-class classfication models this is the confidence - // threshold. - google.protobuf.DoubleValue threshold = 4; - - // The F1 score is an average of recall and precision. For multiclass - // this is a macro-averaged metric. - google.protobuf.DoubleValue f1_score = 5; - - // Logarithmic Loss. For multiclass this is a macro-averaged metric. - google.protobuf.DoubleValue log_loss = 6; - - // Area Under a ROC Curve. For multiclass this is a macro-averaged - // metric. - google.protobuf.DoubleValue roc_auc = 7; - } - - // Evaluation metrics for binary classification/classifier models. - message BinaryClassificationMetrics { - // Confusion matrix for binary classification models. - message BinaryConfusionMatrix { - // Threshold value used when computing each of the following metric. - google.protobuf.DoubleValue positive_class_threshold = 1; - - // Number of true samples predicted as true. - google.protobuf.Int64Value true_positives = 2; - - // Number of false samples predicted as true. - google.protobuf.Int64Value false_positives = 3; - - // Number of true samples predicted as false. - google.protobuf.Int64Value true_negatives = 4; - - // Number of false samples predicted as false. - google.protobuf.Int64Value false_negatives = 5; - - // The fraction of actual positive predictions that had positive actual - // labels. - google.protobuf.DoubleValue precision = 6; - - // The fraction of actual positive labels that were given a positive - // prediction. - google.protobuf.DoubleValue recall = 7; - - // The equally weighted average of recall and precision. - google.protobuf.DoubleValue f1_score = 8; - - // The fraction of predictions given the correct label. - google.protobuf.DoubleValue accuracy = 9; - } - - // Aggregate classification metrics. - AggregateClassificationMetrics aggregate_classification_metrics = 1; - - // Binary confusion matrix at multiple thresholds. - repeated BinaryConfusionMatrix binary_confusion_matrix_list = 2; - - // Label representing the positive class. - string positive_label = 3; - - // Label representing the negative class. - string negative_label = 4; - } - - // Evaluation metrics for multi-class classification/classifier models. - message MultiClassClassificationMetrics { - // Confusion matrix for multi-class classification models. - message ConfusionMatrix { - // A single entry in the confusion matrix. - message Entry { - // The predicted label. For confidence_threshold > 0, we will - // also add an entry indicating the number of items under the - // confidence threshold. - string predicted_label = 1; - - // Number of items being predicted as this label. - google.protobuf.Int64Value item_count = 2; - } - - // A single row in the confusion matrix. - message Row { - // The original label of this row. - string actual_label = 1; - - // Info describing predicted label distribution. - repeated Entry entries = 2; - } - - // Confidence threshold used when computing the entries of the - // confusion matrix. - google.protobuf.DoubleValue confidence_threshold = 1; - - // One row per actual label. - repeated Row rows = 2; - } - - // Aggregate classification metrics. - AggregateClassificationMetrics aggregate_classification_metrics = 1; - - // Confusion matrix at different thresholds. - repeated ConfusionMatrix confusion_matrix_list = 2; - } - - // Evaluation metrics for clustering models. - message ClusteringMetrics { - // Message containing the information about one cluster. - message Cluster { - // Representative value of a single feature within the cluster. - message FeatureValue { - // Representative value of a categorical feature. - message CategoricalValue { - // Represents the count of a single category within the cluster. - message CategoryCount { - // The name of category. - string category = 1; - - // The count of training samples matching the category within the - // cluster. - google.protobuf.Int64Value count = 2; - } - - // Counts of all categories for the categorical feature. If there are - // more than ten categories, we return top ten (by count) and return - // one more CategoryCount with category "_OTHER_" and count as - // aggregate counts of remaining categories. - repeated CategoryCount category_counts = 1; - } - - // The feature column name. - string feature_column = 1; - - // Value. - oneof value { - // The numerical feature value. This is the centroid value for this - // feature. - google.protobuf.DoubleValue numerical_value = 2; - - // The categorical feature value. - CategoricalValue categorical_value = 3; - } - } - - // Centroid id. - int64 centroid_id = 1; - - // Values of highly variant features for this cluster. - repeated FeatureValue feature_values = 2; - - // Count of training data rows that were assigned to this cluster. - google.protobuf.Int64Value count = 3; - } - - // Davies-Bouldin index. - google.protobuf.DoubleValue davies_bouldin_index = 1; - - // Mean of squared distances between each sample to its cluster centroid. - google.protobuf.DoubleValue mean_squared_distance = 2; - - // Information for all clusters. - repeated Cluster clusters = 3; - } - - // Evaluation metrics used by weighted-ALS models specified by - // feedback_type=implicit. - message RankingMetrics { - // Calculates a precision per user for all the items by ranking them and - // then averages all the precisions across all the users. - google.protobuf.DoubleValue mean_average_precision = 1; - - // Similar to the mean squared error computed in regression and explicit - // recommendation models except instead of computing the rating directly, - // the output from evaluate is computed against a preference which is 1 or 0 - // depending on if the rating exists or not. - google.protobuf.DoubleValue mean_squared_error = 2; - - // A metric to determine the goodness of a ranking calculated from the - // predicted confidence by comparing it to an ideal rank measured by the - // original ratings. - google.protobuf.DoubleValue normalized_discounted_cumulative_gain = 3; - - // Determines the goodness of a ranking by computing the percentile rank - // from the predicted confidence and dividing it by the original rank. - google.protobuf.DoubleValue average_rank = 4; - } - - // Model evaluation metrics for ARIMA forecasting models. - message ArimaForecastingMetrics { - // Model evaluation metrics for a single ARIMA forecasting model. - message ArimaSingleModelForecastingMetrics { - // Non-seasonal order. - ArimaOrder non_seasonal_order = 1; - - // Arima fitting metrics. - ArimaFittingMetrics arima_fitting_metrics = 2; - - // Is arima model fitted with drift or not. It is always false when d - // is not 1. - google.protobuf.BoolValue has_drift = 3; - - // The time_series_id value for this time series. It will be one of - // the unique values from the time_series_id_column specified during - // ARIMA model training. Only present when time_series_id_column - // training option was used. - string time_series_id = 4; - - // The tuple of time_series_ids identifying this time series. It will - // be one of the unique tuples of values present in the - // time_series_id_columns specified during ARIMA model training. Only - // present when time_series_id_columns training option was used and - // the order of values here are same as the order of - // time_series_id_columns. - repeated string time_series_ids = 9; - - // Seasonal periods. Repeated because multiple periods are supported - // for one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 5; - - // If true, holiday_effect is a part of time series decomposition result. - google.protobuf.BoolValue has_holiday_effect = 6; - - // If true, spikes_and_dips is a part of time series decomposition result. - google.protobuf.BoolValue has_spikes_and_dips = 7; - - // If true, step_changes is a part of time series decomposition result. - google.protobuf.BoolValue has_step_changes = 8; - } - - // Repeated as there can be many metric sets (one for each model) in - // auto-arima and the large-scale case. - repeated ArimaSingleModelForecastingMetrics - arima_single_model_forecasting_metrics = 6; - } - - // Model evaluation metrics for dimensionality reduction models. - message DimensionalityReductionMetrics { - // Total percentage of variance explained by the selected principal - // components. - google.protobuf.DoubleValue total_explained_variance_ratio = 1; - } - - // Evaluation metrics of a model. These are either computed on all training - // data or just the eval data based on whether eval data was used during - // training. These are not present for imported models. - message EvaluationMetrics { - // Metrics. - oneof metrics { - // Populated for regression models and explicit feedback type matrix - // factorization models. - RegressionMetrics regression_metrics = 1; - - // Populated for binary classification/classifier models. - BinaryClassificationMetrics binary_classification_metrics = 2; - - // Populated for multi-class classification/classifier models. - MultiClassClassificationMetrics multi_class_classification_metrics = 3; - - // Populated for clustering models. - ClusteringMetrics clustering_metrics = 4; - - // Populated for implicit feedback type matrix factorization models. - RankingMetrics ranking_metrics = 5; - - // Populated for ARIMA models. - ArimaForecastingMetrics arima_forecasting_metrics = 6; - - // Evaluation metrics when the model is a dimensionality reduction model, - // which currently includes PCA. - DimensionalityReductionMetrics dimensionality_reduction_metrics = 7; - } - } - - // Data split result. This contains references to the training and evaluation - // data tables that were used to train the model. - message DataSplitResult { - // Table reference of the training data after split. - TableReference training_table = 1; - - // Table reference of the evaluation data after split. - TableReference evaluation_table = 2; - - // Table reference of the test data after split. - TableReference test_table = 3; - } - - // Arima order, can be used for both non-seasonal and seasonal parts. - message ArimaOrder { - // Order of the autoregressive part. - google.protobuf.Int64Value p = 1; - - // Order of the differencing part. - google.protobuf.Int64Value d = 2; - - // Order of the moving-average part. - google.protobuf.Int64Value q = 3; - } - - // ARIMA model fitting metrics. - message ArimaFittingMetrics { - // Log-likelihood. - google.protobuf.DoubleValue log_likelihood = 1; - - // AIC. - google.protobuf.DoubleValue aic = 2; - - // Variance. - google.protobuf.DoubleValue variance = 3; - } - - // Global explanations containing the top most important features - // after training. - message GlobalExplanation { - // Explanation for a single feature. - message Explanation { - // The full feature name. For non-numerical features, will be formatted - // like `.`. Overall size of feature - // name will always be truncated to first 120 characters. - string feature_name = 1; - - // Attribution of feature. - google.protobuf.DoubleValue attribution = 2; - } - - // A list of the top global explanations. Sorted by absolute value of - // attribution in descending order. - repeated Explanation explanations = 1; - - // Class label for this set of global explanations. Will be empty/null for - // binary logistic and linear regression models. Sorted alphabetically in - // descending order. - string class_label = 2; - } - - // Encoding methods for categorical features. - message CategoryEncodingMethod { - // Supported encoding methods for categorical features. - enum EncodingMethod { - // Unspecified encoding method. - ENCODING_METHOD_UNSPECIFIED = 0; - - // Applies one-hot encoding. - ONE_HOT_ENCODING = 1; - - // Applies label encoding. - LABEL_ENCODING = 2; - - // Applies dummy encoding. - DUMMY_ENCODING = 3; - } - } - - // PCA solver options. - message PcaSolverOptionEnums { - // Enums for supported PCA solvers. - enum PcaSolver { - // Default value. - UNSPECIFIED = 0; - - // Full eigen-decoposition. - FULL = 1; - - // Randomized SVD. - RANDOMIZED = 2; - - // Auto. - AUTO = 3; - } - } - - // Model registry options. - message ModelRegistryOptionEnums { - // Enums for supported model registries. - enum ModelRegistry { - // Default value. - MODEL_REGISTRY_UNSPECIFIED = 0; - - // Vertex AI. - VERTEX_AI = 1; - } - } - - // Information about a single training query run for the model. - message TrainingRun { - // Options used in model training. - message TrainingOptions { - // The maximum number of iterations in training. Used only for iterative - // training algorithms. - int64 max_iterations = 1; - - // Type of loss function used during training run. - LossType loss_type = 2; - - // Learning rate in training. Used only for iterative training algorithms. - double learn_rate = 3; - - // L1 regularization coefficient. - google.protobuf.DoubleValue l1_regularization = 4; - - // L2 regularization coefficient. - google.protobuf.DoubleValue l2_regularization = 5; - - // When early_stop is true, stops training when accuracy improvement is - // less than 'min_relative_progress'. Used only for iterative training - // algorithms. - google.protobuf.DoubleValue min_relative_progress = 6; - - // Whether to train a model from the last checkpoint. - google.protobuf.BoolValue warm_start = 7; - - // Whether to stop early when the loss doesn't improve significantly - // any more (compared to min_relative_progress). Used only for iterative - // training algorithms. - google.protobuf.BoolValue early_stop = 8; - - // Name of input label columns in training data. - repeated string input_label_columns = 9; - - // The data split type for training and evaluation, e.g. RANDOM. - DataSplitMethod data_split_method = 10; - - // The fraction of evaluation data over the whole input data. The rest - // of data will be used as training data. The format should be double. - // Accurate to two decimal places. - // Default value is 0.2. - double data_split_eval_fraction = 11; - - // The column to split data with. This column won't be used as a - // feature. - // 1. When data_split_method is CUSTOM, the corresponding column should - // be boolean. The rows with true value tag are eval data, and the false - // are training data. - // 2. When data_split_method is SEQ, the first DATA_SPLIT_EVAL_FRACTION - // rows (from smallest to largest) in the corresponding column are used - // as training data, and the rest are eval data. It respects the order - // in Orderable data types: - // https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#data-type-properties - string data_split_column = 12; - - // The strategy to determine learn rate for the current iteration. - LearnRateStrategy learn_rate_strategy = 13; - - // Specifies the initial learning rate for the line search learn rate - // strategy. - double initial_learn_rate = 16; - - // Weights associated with each label class, for rebalancing the - // training data. Only applicable for classification models. - map label_class_weights = 17; - - // User column specified for matrix factorization models. - string user_column = 18; - - // Item column specified for matrix factorization models. - string item_column = 19; - - // Distance type for clustering models. - DistanceType distance_type = 20; - - // Number of clusters for clustering models. - int64 num_clusters = 21; - - // Google Cloud Storage URI from which the model was imported. Only - // applicable for imported models. - string model_uri = 22; - - // Optimization strategy for training linear regression models. - OptimizationStrategy optimization_strategy = 23; - - // Hidden units for dnn models. - repeated int64 hidden_units = 24; - - // Batch size for dnn models. - int64 batch_size = 25; - - // Dropout probability for dnn models. - google.protobuf.DoubleValue dropout = 26; - - // Maximum depth of a tree for boosted tree models. - int64 max_tree_depth = 27; - - // Subsample fraction of the training data to grow tree to prevent - // overfitting for boosted tree models. - double subsample = 28; - - // Minimum split loss for boosted tree models. - google.protobuf.DoubleValue min_split_loss = 29; - - // Booster type for boosted tree models. - BoostedTreeOptionEnums.BoosterType booster_type = 60; - - // Number of parallel trees constructed during each iteration for boosted - // tree models. - google.protobuf.Int64Value num_parallel_tree = 61; - - // Type of normalization algorithm for boosted tree models using - // dart booster. - BoostedTreeOptionEnums.DartNormalizeType dart_normalize_type = 62; - - // Tree construction algorithm for boosted tree models. - BoostedTreeOptionEnums.TreeMethod tree_method = 63; - - // Minimum sum of instance weight needed in a child for boosted tree - // models. - google.protobuf.Int64Value min_tree_child_weight = 64; - - // Subsample ratio of columns when constructing each tree for boosted tree - // models. - google.protobuf.DoubleValue colsample_bytree = 65; - - // Subsample ratio of columns for each level for boosted tree models. - google.protobuf.DoubleValue colsample_bylevel = 66; - - // Subsample ratio of columns for each node(split) for boosted tree - // models. - google.protobuf.DoubleValue colsample_bynode = 67; - - // Num factors specified for matrix factorization models. - int64 num_factors = 30; - - // Feedback type that specifies which algorithm to run for matrix - // factorization. - FeedbackType feedback_type = 31; - - // Hyperparameter for matrix factoration when implicit feedback type is - // specified. - google.protobuf.DoubleValue wals_alpha = 32; - - // The method used to initialize the centroids for kmeans algorithm. - KmeansEnums.KmeansInitializationMethod kmeans_initialization_method = 33; - - // The column used to provide the initial centroids for kmeans algorithm - // when kmeans_initialization_method is CUSTOM. - string kmeans_initialization_column = 34; - - // Column to be designated as time series timestamp for ARIMA model. - string time_series_timestamp_column = 35; - - // Column to be designated as time series data for ARIMA model. - string time_series_data_column = 36; - - // Whether to enable auto ARIMA or not. - google.protobuf.BoolValue auto_arima = 37; - - // A specification of the non-seasonal part of the ARIMA model: the three - // components (p, d, q) are the AR order, the degree of differencing, and - // the MA order. - ArimaOrder non_seasonal_order = 38; - - // The data frequency of a time series. - DataFrequency data_frequency = 39; - - // Whether or not p-value test should be computed for this model. Only - // available for linear and logistic regression models. - google.protobuf.BoolValue calculate_p_values = 40; - - // Include drift when fitting an ARIMA model. - google.protobuf.BoolValue include_drift = 41; - - // The geographical region based on which the holidays are considered in - // time series modeling. If a valid value is specified, then holiday - // effects modeling is enabled. - HolidayRegion holiday_region = 42; - - // A list of geographical regions that are used for time series modeling. - repeated HolidayRegion holiday_regions = 71; - - // The time series id column that was used during ARIMA model training. - string time_series_id_column = 43; - - // The time series id columns that were used during ARIMA model training. - repeated string time_series_id_columns = 51; - - // The number of periods ahead that need to be forecasted. - int64 horizon = 44; - - // The max value of the sum of non-seasonal p and q. - int64 auto_arima_max_order = 46; - - // The min value of the sum of non-seasonal p and q. - int64 auto_arima_min_order = 83; - - // Number of trials to run this hyperparameter tuning job. - int64 num_trials = 47; - - // Maximum number of trials to run in parallel. - int64 max_parallel_trials = 48; - - // The target evaluation metrics to optimize the hyperparameters for. - repeated HparamTuningEnums.HparamTuningObjective - hparam_tuning_objectives = 54; - - // If true, perform decompose time series and save the results. - google.protobuf.BoolValue decompose_time_series = 50; - - // If true, clean spikes and dips in the input time series. - google.protobuf.BoolValue clean_spikes_and_dips = 52; - - // If true, detect step changes and make data adjustment in the input time - // series. - google.protobuf.BoolValue adjust_step_changes = 53; - - // If true, enable global explanation during training. - google.protobuf.BoolValue enable_global_explain = 55; - - // Number of paths for the sampled Shapley explain method. - int64 sampled_shapley_num_paths = 56; - - // Number of integral steps for the integrated gradients explain method. - int64 integrated_gradients_num_steps = 57; - - // Categorical feature encoding method. - CategoryEncodingMethod.EncodingMethod category_encoding_method = 58; - - // Based on the selected TF version, the corresponding docker image is - // used to train external models. - string tf_version = 70; - - // Enums for color space, used for processing images in Object Table. - // See more details at - // https://www.tensorflow.org/io/tutorials/colorspace. - ColorSpace color_space = 72; - - // Name of the instance weight column for training data. - // This column isn't be used as a feature. - string instance_weight_column = 73; - - // Smoothing window size for the trend component. When a positive value is - // specified, a center moving average smoothing is applied on the history - // trend. When the smoothing window is out of the boundary at the - // beginning or the end of the trend, the first element or the last - // element is padded to fill the smoothing window before the average is - // applied. - int64 trend_smoothing_window_size = 74; - - // The fraction of the interpolated length of the time series that's used - // to model the time series trend component. All of the time points of the - // time series are used to model the non-trend component. This training - // option accelerates modeling training without sacrificing much - // forecasting accuracy. You can use this option with - // `minTimeSeriesLength` but not with `maxTimeSeriesLength`. - double time_series_length_fraction = 75; - - // The minimum number of time points in a time series that are used in - // modeling the trend component of the time series. If you use this option - // you must also set the `timeSeriesLengthFraction` option. This training - // option ensures that enough time points are available when you use - // `timeSeriesLengthFraction` in trend modeling. This is particularly - // important when forecasting multiple time series in a single query using - // `timeSeriesIdColumn`. If the total number of time points is less than - // the `minTimeSeriesLength` value, then the query uses all available time - // points. - int64 min_time_series_length = 76; - - // The maximum number of time points in a time series that can be used in - // modeling the trend component of the time series. Don't use this option - // with the `timeSeriesLengthFraction` or `minTimeSeriesLength` options. - int64 max_time_series_length = 77; - - // User-selected XGBoost versions for training of XGBoost models. - string xgboost_version = 78; - - // Whether to use approximate feature contribution method in XGBoost model - // explanation for global explain. - google.protobuf.BoolValue approx_global_feature_contrib = 84; - - // Whether the model should include intercept during model training. - google.protobuf.BoolValue fit_intercept = 85; - - // Number of principal components to keep in the PCA model. Must be <= the - // number of features. - int64 num_principal_components = 86; - - // The minimum ratio of cumulative explained variance that needs to be - // given by the PCA model. - double pca_explained_variance_ratio = 87; - - // If true, scale the feature values by dividing the feature standard - // deviation. Currently only apply to PCA. - google.protobuf.BoolValue scale_features = 88; - - // The solver for PCA. - PcaSolverOptionEnums.PcaSolver pca_solver = 89; - - // Whether to calculate class weights automatically based on the - // popularity of each label. - google.protobuf.BoolValue auto_class_weights = 90; - - // Activation function of the neural nets. - string activation_fn = 91; - - // Optimizer used for training the neural nets. - string optimizer = 92; - - // Budget in hours for AutoML training. - double budget_hours = 93; - - // Whether to standardize numerical features. Default to true. - google.protobuf.BoolValue standardize_features = 94; - - // L1 regularization coefficient to activations. - double l1_reg_activation = 95; - - // The model registry. - ModelRegistryOptionEnums.ModelRegistry model_registry = 96; - - // The version aliases to apply in Vertex AI model registry. Always - // overwrite if the version aliases exists in a existing model. - repeated string vertex_ai_model_version_aliases = 97; - } - - // Information about a single iteration of the training run. - message IterationResult { - // Information about a single cluster for clustering model. - message ClusterInfo { - // Centroid id. - int64 centroid_id = 1; - - // Cluster radius, the average distance from centroid - // to each point assigned to the cluster. - google.protobuf.DoubleValue cluster_radius = 2; - - // Cluster size, the total number of points assigned to the cluster. - google.protobuf.Int64Value cluster_size = 3; - } - - // (Auto-)arima fitting result. Wrap everything in ArimaResult for easier - // refactoring if we want to use model-specific iteration results. - message ArimaResult { - // Arima coefficients. - message ArimaCoefficients { - // Auto-regressive coefficients, an array of double. - repeated double auto_regressive_coefficients = 1; - - // Moving-average coefficients, an array of double. - repeated double moving_average_coefficients = 2; - - // Intercept coefficient, just a double not an array. - google.protobuf.DoubleValue intercept_coefficient = 3; - } - - // Arima model information. - message ArimaModelInfo { - // Non-seasonal order. - ArimaOrder non_seasonal_order = 1; - - // Arima coefficients. - ArimaCoefficients arima_coefficients = 2; - - // Arima fitting metrics. - ArimaFittingMetrics arima_fitting_metrics = 3; - - // Whether Arima model fitted with drift or not. It is always false - // when d is not 1. - google.protobuf.BoolValue has_drift = 4; - - // The time_series_id value for this time series. It will be one of - // the unique values from the time_series_id_column specified during - // ARIMA model training. Only present when time_series_id_column - // training option was used. - string time_series_id = 5; - - // The tuple of time_series_ids identifying this time series. It will - // be one of the unique tuples of values present in the - // time_series_id_columns specified during ARIMA model training. Only - // present when time_series_id_columns training option was used and - // the order of values here are same as the order of - // time_series_id_columns. - repeated string time_series_ids = 10; - - // Seasonal periods. Repeated because multiple periods are supported - // for one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 6; - - // If true, holiday_effect is a part of time series decomposition - // result. - google.protobuf.BoolValue has_holiday_effect = 7; - - // If true, spikes_and_dips is a part of time series decomposition - // result. - google.protobuf.BoolValue has_spikes_and_dips = 8; - - // If true, step_changes is a part of time series decomposition - // result. - google.protobuf.BoolValue has_step_changes = 9; - } - - // This message is repeated because there are multiple arima models - // fitted in auto-arima. For non-auto-arima model, its size is one. - repeated ArimaModelInfo arima_model_info = 1; - - // Seasonal periods. Repeated because multiple periods are supported for - // one time series. - repeated SeasonalPeriod.SeasonalPeriodType seasonal_periods = 2; - } - - // Principal component infos, used only for eigen decomposition based - // models, e.g., PCA. Ordered by explained_variance in the descending - // order. - message PrincipalComponentInfo { - // Id of the principal component. - google.protobuf.Int64Value principal_component_id = 1; - - // Explained variance by this principal component, which is simply the - // eigenvalue. - google.protobuf.DoubleValue explained_variance = 2; - - // Explained_variance over the total explained variance. - google.protobuf.DoubleValue explained_variance_ratio = 3; - - // The explained_variance is pre-ordered in the descending order to - // compute the cumulative explained variance ratio. - google.protobuf.DoubleValue cumulative_explained_variance_ratio = 4; - } - - // Index of the iteration, 0 based. - google.protobuf.Int32Value index = 1; - - // Time taken to run the iteration in milliseconds. - google.protobuf.Int64Value duration_ms = 4; - - // Loss computed on the training data at the end of iteration. - google.protobuf.DoubleValue training_loss = 5; - - // Loss computed on the eval data at the end of iteration. - google.protobuf.DoubleValue eval_loss = 6; - - // Learn rate used for this iteration. - double learn_rate = 7; - - // Information about top clusters for clustering models. - repeated ClusterInfo cluster_infos = 8; - - // Arima result. - ArimaResult arima_result = 9; - - // The information of the principal components. - repeated PrincipalComponentInfo principal_component_infos = 10; - } - - // Output only. Options that were used for this training run, includes - // user specified and default options that were used. - TrainingOptions training_options = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The start time of this training run. - google.protobuf.Timestamp start_time = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Output of each iteration run, results.size() <= - // max_iterations. - repeated IterationResult results = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The evaluation metrics over training/eval data that were - // computed at the end of training. - EvaluationMetrics evaluation_metrics = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Data split result of the training run. Only set when the - // input data is actually split. - DataSplitResult data_split_result = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Global explanation contains the explanation of top features - // on the model level. Applies to both regression and classification models. - GlobalExplanation model_level_global_explanation = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Global explanation contains the explanation of top features - // on the class level. Applies to classification models only. - repeated GlobalExplanation class_level_global_explanations = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The model id in the [Vertex AI Model - // Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) - // for this training run. - string vertex_ai_model_id = 14; - - // Output only. The model version in the [Vertex AI Model - // Registry](https://cloud.google.com/vertex-ai/docs/model-registry/introduction) - // for this training run. - string vertex_ai_model_version = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Search space for a double hyperparameter. - message DoubleHparamSearchSpace { - // Range of a double hyperparameter. - message DoubleRange { - // Min value of the double parameter. - google.protobuf.DoubleValue min = 1; - - // Max value of the double parameter. - google.protobuf.DoubleValue max = 2; - } - - // Discrete candidates of a double hyperparameter. - message DoubleCandidates { - // Candidates for the double parameter in increasing order. - repeated google.protobuf.DoubleValue candidates = 1; - } - - // Search space. - oneof search_space { - // Range of the double hyperparameter. - DoubleRange range = 1; - - // Candidates of the double hyperparameter. - DoubleCandidates candidates = 2; - } - } - - // Search space for an int hyperparameter. - message IntHparamSearchSpace { - // Range of an int hyperparameter. - message IntRange { - // Min value of the int parameter. - google.protobuf.Int64Value min = 1; - - // Max value of the int parameter. - google.protobuf.Int64Value max = 2; - } - - // Discrete candidates of an int hyperparameter. - message IntCandidates { - // Candidates for the int parameter in increasing order. - repeated google.protobuf.Int64Value candidates = 1; - } - - // Search space. - oneof search_space { - // Range of the int hyperparameter. - IntRange range = 1; - - // Candidates of the int hyperparameter. - IntCandidates candidates = 2; - } - } - - // Search space for string and enum. - message StringHparamSearchSpace { - // Canididates for the string or enum parameter in lower case. - repeated string candidates = 1; - } - - // Search space for int array. - message IntArrayHparamSearchSpace { - // An array of int. - message IntArray { - // Elements in the int array. - repeated int64 elements = 1; - } - - // Candidates for the int array parameter. - repeated IntArray candidates = 1; - } - - // Hyperparameter search spaces. - // These should be a subset of training_options. - message HparamSearchSpaces { - // Learning rate of training jobs. - DoubleHparamSearchSpace learn_rate = 2; - - // L1 regularization coefficient. - DoubleHparamSearchSpace l1_reg = 3; - - // L2 regularization coefficient. - DoubleHparamSearchSpace l2_reg = 4; - - // Number of clusters for k-means. - IntHparamSearchSpace num_clusters = 26; - - // Number of latent factors to train on. - IntHparamSearchSpace num_factors = 31; - - // Hidden units for neural network models. - IntArrayHparamSearchSpace hidden_units = 34; - - // Mini batch sample size. - IntHparamSearchSpace batch_size = 37; - - // Dropout probability for dnn model training and boosted tree models - // using dart booster. - DoubleHparamSearchSpace dropout = 38; - - // Maximum depth of a tree for boosted tree models. - IntHparamSearchSpace max_tree_depth = 41; - - // Subsample the training data to grow tree to prevent overfitting for - // boosted tree models. - DoubleHparamSearchSpace subsample = 42; - - // Minimum split loss for boosted tree models. - DoubleHparamSearchSpace min_split_loss = 43; - - // Hyperparameter for matrix factoration when implicit feedback type is - // specified. - DoubleHparamSearchSpace wals_alpha = 49; - - // Booster type for boosted tree models. - StringHparamSearchSpace booster_type = 56; - - // Number of parallel trees for boosted tree models. - IntHparamSearchSpace num_parallel_tree = 57; - - // Dart normalization type for boosted tree models. - StringHparamSearchSpace dart_normalize_type = 58; - - // Tree construction algorithm for boosted tree models. - StringHparamSearchSpace tree_method = 59; - - // Minimum sum of instance weight needed in a child for boosted tree models. - IntHparamSearchSpace min_tree_child_weight = 60; - - // Subsample ratio of columns when constructing each tree for boosted tree - // models. - DoubleHparamSearchSpace colsample_bytree = 61; - - // Subsample ratio of columns for each level for boosted tree models. - DoubleHparamSearchSpace colsample_bylevel = 62; - - // Subsample ratio of columns for each node(split) for boosted tree models. - DoubleHparamSearchSpace colsample_bynode = 63; - - // Activation functions of neural network models. - StringHparamSearchSpace activation_fn = 67; - - // Optimizer of TF models. - StringHparamSearchSpace optimizer = 68; - } - - // Training info of a trial in [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models. - message HparamTuningTrial { - // Current status of the trial. - enum TrialStatus { - // Default value. - TRIAL_STATUS_UNSPECIFIED = 0; - - // Scheduled but not started. - NOT_STARTED = 1; - - // Running state. - RUNNING = 2; - - // The trial succeeded. - SUCCEEDED = 3; - - // The trial failed. - FAILED = 4; - - // The trial is infeasible due to the invalid params. - INFEASIBLE = 5; - - // Trial stopped early because it's not promising. - STOPPED_EARLY = 6; - } - - // 1-based index of the trial. - int64 trial_id = 1; - - // Starting time of the trial. - int64 start_time_ms = 2; - - // Ending time of the trial. - int64 end_time_ms = 3; - - // The hyperprameters selected for this trial. - TrainingRun.TrainingOptions hparams = 4; - - // Evaluation metrics of this trial calculated on the test data. - // Empty in Job API. - EvaluationMetrics evaluation_metrics = 5; - - // The status of the trial. - TrialStatus status = 6; - - // Error message for FAILED and INFEASIBLE trial. - string error_message = 7; - - // Loss computed on the training data at the end of trial. - google.protobuf.DoubleValue training_loss = 8; - - // Loss computed on the eval data at the end of trial. - google.protobuf.DoubleValue eval_loss = 9; - - // Hyperparameter tuning evaluation metrics of this trial calculated on the - // eval data. Unlike evaluation_metrics, only the fields corresponding to - // the hparam_tuning_objectives are set. - EvaluationMetrics hparam_tuning_evaluation_metrics = 10; - } - - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Unique identifier for this model. - ModelReference model_reference = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this model was created, in millisecs since the - // epoch. - int64 creation_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this model was last modified, in millisecs since - // the epoch. - int64 last_modified_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. A user-friendly description of this model. - string description = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A descriptive name for this model. - string friendly_name = 14 [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this model. You can use these to organize - // and group your models. Label keys and values can be no longer - // than 63 characters, can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter and each - // label in the list must have a different key. - map labels = 15; - - // Optional. The time when this model expires, in milliseconds since the - // epoch. If not present, the model will persist indefinitely. Expired models - // will be deleted and their storage reclaimed. The defaultTableExpirationMs - // property of the encapsulating dataset can be used to set a default - // expirationTime on newly created models. - int64 expiration_time = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The geographic location where the model resides. This value - // is inherited from the dataset. - string location = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Custom encryption configuration (e.g., Cloud KMS keys). This shows the - // encryption configuration of the model data while stored in BigQuery - // storage. This field can be used with PatchModel to update encryption key - // for an already encrypted model. - EncryptionConfiguration encryption_configuration = 17; - - // Output only. Type of the model resource. - ModelType model_type = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Information for all training runs in increasing order of start_time. - repeated TrainingRun training_runs = 9; - - // Output only. Input feature columns for the model inference. If the model is - // trained with TRANSFORM clause, these are the input of the TRANSFORM clause. - repeated StandardSqlField feature_columns = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Label columns that were used to train this model. - // The output of the model will have a "predicted_" prefix to these columns. - repeated StandardSqlField label_columns = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This field will be populated if a TRANSFORM clause was used to - // train a model. TRANSFORM clause (if used) takes feature_columns as input - // and outputs transform_columns. transform_columns then are used to train the - // model. - repeated TransformColumn transform_columns = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. All hyperparameter search spaces in this model. - HparamSearchSpaces hparam_search_spaces = 18 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The default trial_id to use in TVFs when the trial_id is not - // passed in. For single-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, this is the best trial ID. For multi-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, this is the smallest trial ID among all Pareto optimal trials. - int64 default_trial_id = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Trials of a [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // model sorted by trial_id. - repeated HparamTuningTrial hparam_trials = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. For single-objective [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, it only contains the best trial. For multi-objective - // [hyperparameter - // tuning](https://cloud.google.com/bigquery-ml/docs/reference/standard-sql/bigqueryml-syntax-hp-tuning-overview) - // models, it contains all Pareto optimal trials sorted by trial_id. - repeated int64 optimal_trial_ids = 22 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Remote model info - RemoteModelInfo remote_model_info = 25 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request format for getting information about a BigQuery ML model. -message GetModelRequest { - // Required. Project ID of the requested model. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested model. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the requested model. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -message PatchModelRequest { - // Required. Project ID of the model to patch. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the model to patch. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the model to patch. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Patched model. - // Follows RFC5789 patch semantics. Missing fields are not updated. - // To clear a field, explicitly set to default value. - Model model = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for deleting BigQuery ML models. -message DeleteModelRequest { - // Required. Project ID of the model to delete. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the model to delete. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Model ID of the model to delete. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for listing BigQuery ML models. -message ListModelsRequest { - // Required. Project ID of the models to list. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the models to list. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call to request the next page of - // results - string page_token = 4; -} - -// Response format for a single page when listing BigQuery ML models. -message ListModelsResponse { - // Models in the requested dataset. Only the following fields are populated: - // model_reference, model_type, creation_time, last_modified_time and - // labels. - repeated Model models = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model_reference.proto.baseline deleted file mode 100644 index 9f190254e792..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/model_reference.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ModelReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a model. -message ModelReference { - // Required. The ID of the project containing this model. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this model. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the model. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 1,024 characters. - string model_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline deleted file mode 100644 index f331cb56ac05..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/partitioning_definition.proto.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "PartitioningDefinitionProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The partitioning information, which includes managed table, external table -// and metastore partitioned table partition information. -message PartitioningDefinition { - // Optional. Details about each partitioning column. This field is output only - // for all partitioning types other than metastore partitioned tables. - // BigQuery native tables only support 1 partitioning column. Other table - // types may support 0, 1 or more partitioning columns. - // For metastore partitioned tables, the order must match the definition order - // in the Hive Metastore, where it must match the physical layout of the - // table. For example, - // - // CREATE TABLE a_table(id BIGINT, name STRING) - // PARTITIONED BY (city STRING, state STRING). - // - // In this case the values must be ['city', 'state'] in that order. - repeated PartitionedColumn partitioned_column = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// The partitioning column information. -message PartitionedColumn { - // Required. The name of the partition column. - optional string field = 1 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline deleted file mode 100644 index 35f40a0a00df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/privacy_policy.proto.baseline +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "PrivacyPolicyProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Represents privacy policy associated with "aggregation threshold" method. -message AggregationThresholdPolicy { - // Optional. The threshold for the "aggregation threshold" policy. - optional int64 threshold = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The privacy unit column(s) associated with this policy. - // For now, only one column per data source object (table, view) is allowed as - // a privacy unit column. - // Representing as a repeated field in metadata for extensibility to - // multiple columns in future. - // Duplicates and Repeated struct fields are not allowed. - // For nested fields, use dot notation ("outer.inner") - repeated string privacy_unit_columns = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents privacy policy associated with "differential privacy" method. -message DifferentialPrivacyPolicy { - // Optional. The maximum epsilon value that a query can consume. If the - // subscriber specifies epsilon as a parameter in a SELECT query, it must be - // less than or equal to this value. The epsilon parameter controls the amount - // of noise that is added to the groups — a higher epsilon means less noise. - optional double max_epsilon_per_query = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The delta value that is used per query. Delta represents the - // probability that any row will fail to be epsilon differentially private. - // Indicates the risk associated with exposing aggregate rows in the result of - // a query. - optional double delta_per_query = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum groups contributed value that is used per query. - // Represents the maximum number of groups to which each protected entity can - // contribute. Changing this value does not improve or worsen privacy. The - // best value for accuracy and utility depends on the query and data. - optional int64 max_groups_contributed = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The privacy unit column associated with this policy. Differential - // privacy policies can only have one privacy unit column per data source - // object (table, view). - optional string privacy_unit_column = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The total epsilon budget for all queries against the - // privacy-protected view. Each subscriber query against this view charges the - // amount of epsilon they request in their query. If there is sufficient - // budget, then the subscriber query attempts to complete. It might still fail - // due to other reasons, in which case the charge is refunded. If there is - // insufficient budget the query is rejected. There might be multiple charge - // attempts if a single query references multiple views. In this case there - // must be sufficient budget for all charges or the query is rejected and - // charges are refunded in best effort. The budget does not have a refresh - // policy and can only be updated via ALTER VIEW or circumvented by creating a - // new view that can be queried with a fresh budget. - optional double epsilon_budget = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The total delta budget for all queries against the - // privacy-protected view. Each subscriber query against this view charges the - // amount of delta that is pre-defined by the contributor through the privacy - // policy delta_per_query field. If there is sufficient budget, then the - // subscriber query attempts to complete. It might still fail due to other - // reasons, in which case the charge is refunded. If there is insufficient - // budget the query is rejected. There might be multiple charge attempts if a - // single query references multiple views. In this case there must be - // sufficient budget for all charges or the query is rejected and charges are - // refunded in best effort. The budget does not have a refresh policy and can - // only be updated via ALTER VIEW or circumvented by creating a new view that - // can be queried with a fresh budget. - optional double delta_budget = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The epsilon budget remaining. If budget is exhausted, no more - // queries are allowed. Note that the budget for queries that are in progress - // is deducted before the query executes. If the query fails or is cancelled - // then the budget is refunded. In this case the amount of budget remaining - // can increase. - optional double epsilon_budget_remaining = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The delta budget remaining. If budget is exhausted, no more - // queries are allowed. Note that the budget for queries that are in progress - // is deducted before the query executes. If the query fails or is cancelled - // then the budget is refunded. In this case the amount of budget remaining - // can increase. - optional double delta_budget_remaining = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents privacy policy associated with "join restrictions". Join -// restriction gives data providers the ability to enforce joins on the -// 'join_allowed_columns' when data is queried from a privacy protected view. -message JoinRestrictionPolicy { - // Enum for Join Restrictions policy. - enum JoinCondition { - // A join is neither required nor restricted on any column. Default value. - JOIN_CONDITION_UNSPECIFIED = 0; - - // A join is required on at least one of the specified columns. - JOIN_ANY = 1; - - // A join is required on all specified columns. - JOIN_ALL = 2; - - // A join is not required, but if present it is only permitted on - // 'join_allowed_columns' - JOIN_NOT_REQUIRED = 3; - - // Joins are blocked for all queries. - JOIN_BLOCKED = 4; - } - - // Optional. Specifies if a join is required or not on queries for the view. - // Default is JOIN_CONDITION_UNSPECIFIED. - optional JoinCondition join_condition = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The only columns that joins are allowed on. - // This field is must be specified for join_conditions JOIN_ANY and JOIN_ALL - // and it cannot be set for JOIN_BLOCKED. - repeated string join_allowed_columns = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents privacy policy that contains the privacy requirements specified by -// the data owner. Currently, this is only supported on views. -message PrivacyPolicy { - // Privacy policy associated with this requirement specification. Only one of - // the privacy methods is allowed per data source object. - oneof privacy_policy { - // Optional. Policy used for aggregation thresholds. - AggregationThresholdPolicy aggregation_threshold_policy = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Policy used for differential privacy. - DifferentialPrivacyPolicy differential_privacy_policy = 3 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. Join restriction policy is outside of the one of policies, since - // this policy can be set along with other policies. This policy gives data - // providers the ability to enforce joins on the 'join_allowed_columns' when - // data is queried from a privacy protected view. - optional JoinRestrictionPolicy join_restriction_policy = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/project.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/project.proto.baseline deleted file mode 100644 index f04d3962efb6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/project.proto.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "ProjectProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Project Service. -// -// It should not be relied on for production use cases at this time. -service ProjectService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // RPC to get the service account for a project used for interactions with - // Google Cloud KMS - rpc GetServiceAccount(GetServiceAccountRequest) - returns (GetServiceAccountResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/serviceAccount" - }; - } -} - -// Request object of GetServiceAccount -message GetServiceAccountRequest { - // Required. ID of the project. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Response object of GetServiceAccount -message GetServiceAccountResponse { - // The resource type of the response. - string kind = 1; - - // The service account email address. - string email = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline deleted file mode 100644 index e65a95b80bed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/query_parameter.proto.baseline +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "QueryParameterProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The type of a struct parameter. -message QueryParameterStructType { - // Optional. The name of this field. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The type of this field. - QueryParameterType type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Human-oriented description of the field. - string description = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The type of a query parameter. -message QueryParameterType { - // Required. The top level type of this field. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The type of the array's elements, if this is an array. - QueryParameterType array_type = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The types of the fields of this struct, in order, if this is a - // struct. - repeated QueryParameterStructType struct_types = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The element type of the range, if this is a range. - QueryParameterType range_element_type = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the value of a range. -message RangeValue { - // Optional. The start value of the range. A missing value represents an - // unbounded start. - QueryParameterValue start = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The end value of the range. A missing value represents an - // unbounded end. - QueryParameterValue end = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The value of a query parameter. -message QueryParameterValue { - // Optional. The value of this value, if a simple scalar type. - google.protobuf.StringValue value = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The array values, if this is an array type. - repeated QueryParameterValue array_values = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // The struct field values. - map struct_values = 3; - - // Optional. The range value, if this is a range type. - RangeValue range_value = 6 [(google.api.field_behavior) = OPTIONAL]; - - // This field should not be used. - repeated google.protobuf.Value alt_struct_values = 5; -} - -// A parameter given to a query. -message QueryParameter { - // Optional. If unset, this is a positional parameter. Otherwise, should be - // unique within a query. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The type of this parameter. - QueryParameterType parameter_type = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The value of this parameter. - QueryParameterValue parameter_value = 3 - [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline deleted file mode 100644 index 1cfded0c9dc7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/range_partitioning.proto.baseline +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RangePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message RangePartitioning { - // Defines the ranges for range partitioning. - message Range { - // Required. The start of range partitioning, inclusive. This field is an - // INT64 value represented as a string. - string start = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The end of range partitioning, exclusive. This field is an - // INT64 value represented as a string. - string end = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The width of each interval. This field is an INT64 value - // represented as a string. - string interval = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The name of the column to partition the table on. It must be a - // top-level, INT64 column whose mode is NULLABLE or REQUIRED. - string field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Defines the ranges for range partitioning. - Range range = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline deleted file mode 100644 index 5d9422db323b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/restriction_config.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RestrictionConfigProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message RestrictionConfig { - // RestrictionType specifies the type of dataset/table restriction. - enum RestrictionType { - // Should never be used. - RESTRICTION_TYPE_UNSPECIFIED = 0; - - // Restrict data egress. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RESTRICTED_DATA_EGRESS = 1; - } - - // Output only. Specifies the type of dataset/table restriction. - RestrictionType type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine.proto.baseline deleted file mode 100644 index 352b74524159..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine.proto.baseline +++ /dev/null @@ -1,540 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/routine_reference.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RoutineProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Routine Service. -// -// It should not be relied on for production use cases at this time. -service RoutineService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified routine resource by routine ID. - rpc GetRoutine(GetRoutineRequest) returns (Routine) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - }; - } - - // Creates a new routine in the dataset. - rpc InsertRoutine(InsertRoutineRequest) returns (Routine) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines" - body: "routine" - }; - } - - // Updates information in an existing routine. The update method replaces the - // entire Routine resource. - rpc UpdateRoutine(UpdateRoutineRequest) returns (Routine) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - body: "routine" - }; - } - - // Patches information in an existing routine. The patch method does a partial - // update to an existing Routine resource. - rpc PatchRoutine(PatchRoutineRequest) returns (Routine) {} - - // Deletes the routine specified by routineId from the dataset. - rpc DeleteRoutine(DeleteRoutineRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines/{routine_id=*}" - }; - } - - // Lists all routines in the specified dataset. Requires the READER dataset - // role. - rpc ListRoutines(ListRoutinesRequest) returns (ListRoutinesResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/routines" - }; - } -} - -// A user-defined function or a stored procedure. -message Routine { - // The fine-grained type of the routine. - enum RoutineType { - // Default value. - ROUTINE_TYPE_UNSPECIFIED = 0; - - // Non-built-in persistent scalar function. - SCALAR_FUNCTION = 1; - - // Stored procedure. - PROCEDURE = 2; - - // Non-built-in persistent TVF. - TABLE_VALUED_FUNCTION = 3; - - // Non-built-in persistent aggregate function. - AGGREGATE_FUNCTION = 4; - } - - // The language of the routine. - enum Language { - // Default value. - LANGUAGE_UNSPECIFIED = 0; - - // SQL language. - SQL = 1; - - // JavaScript language. - JAVASCRIPT = 2; - - // Python language. - PYTHON = 3; - - // Java language. - JAVA = 4; - - // Scala language. - SCALA = 5; - } - - // Input/output argument of a function or a stored procedure. - message Argument { - // Represents the kind of a given argument. - enum ArgumentKind { - // Default value. - ARGUMENT_KIND_UNSPECIFIED = 0; - - // The argument is a variable with fully specified type, which can be a - // struct or an array, but not a table. - FIXED_TYPE = 1; - - // The argument is any type, including struct or array, but not a table. - // To be added: FIXED_TABLE, ANY_TABLE - ANY_TYPE = 2; - } - - // The input/output mode of the argument. - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // The argument is input-only. - IN = 1; - - // The argument is output-only. - OUT = 2; - - // The argument is both an input and an output. - INOUT = 3; - } - - // Optional. The name of this argument. Can be absent for function return - // argument. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defaults to FIXED_TYPE. - ArgumentKind argument_kind = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether the argument is input or output. - // Can be set for procedures only. - Mode mode = 3; - - // Required unless argument_kind = ANY_TYPE. - StandardSqlDataType data_type = 4; - - // Optional. Whether the argument is an aggregate function parameter. - // Must be Unset for routine types other than AGGREGATE_FUNCTION. - // For AGGREGATE_FUNCTION, if set to false, it is equivalent to adding "NOT - // AGGREGATE" clause in DDL; Otherwise, it is equivalent to omitting "NOT - // AGGREGATE" clause in DDL. - google.protobuf.BoolValue is_aggregate = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // JavaScript UDF determinism levels. - // - // If all JavaScript UDFs are DETERMINISTIC, the query result is - // potentially cachable (see below). If any JavaScript UDF is - // NOT_DETERMINISTIC, the query result is not cacheable. - // - // Even if a JavaScript UDF is deterministic, many other factors can prevent - // usage of cached query results. Example factors include but not limited to: - // DDL/DML, non-deterministic SQL function calls, update of referenced - // tables/views/UDFs or imported JavaScript libraries. - // - // SQL UDFs cannot have determinism specified. Their determinism is - // automatically determined. - enum DeterminismLevel { - // The determinism of the UDF is unspecified. - DETERMINISM_LEVEL_UNSPECIFIED = 0; - - // The UDF is deterministic, meaning that 2 function calls with the same - // inputs always produce the same result, even across 2 query runs. - DETERMINISTIC = 1; - - // The UDF is not deterministic. - NOT_DETERMINISTIC = 2; - } - - // Security mode. - enum SecurityMode { - // The security mode of the routine is unspecified. - SECURITY_MODE_UNSPECIFIED = 0; - - // The routine is to be executed with the privileges of the user who - // defines it. - DEFINER = 1; - - // The routine is to be executed with the privileges of the user who - // invokes it. - INVOKER = 2; - } - - // Options for a remote user-defined function. - message RemoteFunctionOptions { - // Endpoint of the user-provided remote service, e.g. - // ```https://us-east1-my_gcf_project.cloudfunctions.net/remote_add``` - string endpoint = 1; - - // Fully qualified name of the user-provided connection object which holds - // the authentication information to send requests to the remote service. - // Format: - // ```"projects/{projectId}/locations/{locationId}/connections/{connectionId}"``` - string connection = 2; - - // User-defined context as a set of key/value pairs, which will be sent as - // function invocation context together with batched arguments in the - // requests to the remote service. The total number of bytes of keys and - // values must be less than 8KB. - map user_defined_context = 3; - - // Max number of rows in each batch sent to the remote service. - // If absent or if 0, BigQuery dynamically decides the number of rows in a - // batch. - int64 max_batching_rows = 4; - } - - // Data governance type values. Only supports `DATA_MASKING`. - enum DataGovernanceType { - // The data governance type is unspecified. - DATA_GOVERNANCE_TYPE_UNSPECIFIED = 0; - - // The data governance type is data masking. - DATA_MASKING = 1; - } - - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this routine. - RoutineReference routine_reference = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The type of routine. - RoutineType routine_type = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this routine was created, in milliseconds since - // the epoch. - int64 creation_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this routine was last modified, in milliseconds - // since the epoch. - int64 last_modified_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Defaults to "SQL" if remote_function_options field is absent, not - // set otherwise. - Language language = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. - repeated Argument arguments = 7; - - // Optional if language = "SQL"; required otherwise. - // Cannot be set if routine_type = "TABLE_VALUED_FUNCTION". - // - // If absent, the return type is inferred from definition_body at query time - // in each query that references this routine. If present, then the evaluated - // result will be cast to the specified returned type at query time. - // - // For example, for the functions created with the following statements: - // - // * `CREATE FUNCTION Add(x FLOAT64, y FLOAT64) RETURNS FLOAT64 AS (x + y);` - // - // * `CREATE FUNCTION Increment(x FLOAT64) AS (Add(x, 1));` - // - // * `CREATE FUNCTION Decrement(x FLOAT64) RETURNS FLOAT64 AS (Add(x, -1));` - // - // The return_type is `{type_kind: "FLOAT64"}` for `Add` and `Decrement`, and - // is absent for `Increment` (inferred as FLOAT64 at query time). - // - // Suppose the function `Add` is replaced by - // `CREATE OR REPLACE FUNCTION Add(x INT64, y INT64) AS (x + y);` - // - // Then the inferred return type of `Increment` is automatically changed to - // INT64 at query time, while the return type of `Decrement` remains FLOAT64. - StandardSqlDataType return_type = 10; - - // Optional. Can be set only if routine_type = "TABLE_VALUED_FUNCTION". - // - // If absent, the return table type is inferred from definition_body at query - // time in each query that references this routine. If present, then the - // columns in the evaluated table result will be cast to match the column - // types specified in return table type, at query time. - StandardSqlTableType return_table_type = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If language = "JAVASCRIPT", this field stores the path of the - // imported JAVASCRIPT libraries. - repeated string imported_libraries = 8; - - // Required. The body of the routine. - // - // For functions, this is the expression in the AS clause. - // - // If language=SQL, it is the substring inside (but excluding) the - // parentheses. For example, for the function created with the following - // statement: - // - // `CREATE FUNCTION JoinLines(x string, y string) as (concat(x, "\n", y))` - // - // The definition_body is `concat(x, "\n", y)` (\n is not replaced with - // linebreak). - // - // If language=JAVASCRIPT, it is the evaluated string in the AS clause. - // For example, for the function created with the following statement: - // - // `CREATE FUNCTION f() RETURNS STRING LANGUAGE js AS 'return "\n";\n'` - // - // The definition_body is - // - // `return "\n";\n` - // - // Note that both \n are replaced with linebreaks. - string definition_body = 9; - - // Optional. The description of the routine, if defined. - string description = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The determinism level of the JavaScript UDF, if defined. - DeterminismLevel determinism_level = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The security mode of the routine, if defined. If not defined, the - // security mode is automatically determined from the routine's configuration. - SecurityMode security_mode = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Use this option to catch many common errors. Error checking is - // not exhaustive, and successfully creating a procedure doesn't guarantee - // that the procedure will successfully execute at runtime. If `strictMode` is - // set to `TRUE`, the procedure body is further checked for errors such as - // non-existent tables or columns. The `CREATE PROCEDURE` statement fails if - // the body fails any of these checks. - // - // If `strictMode` is set to `FALSE`, the procedure body is checked only for - // syntax. For procedures that invoke themselves recursively, specify - // `strictMode=FALSE` to avoid non-existent procedure errors during - // validation. - // - // Default value is `TRUE`. - google.protobuf.BoolValue strict_mode = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Remote function specific options. - RemoteFunctionOptions remote_function_options = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Spark specific options. - SparkOptions spark_options = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `DATA_MASKING`, the function is validated and made - // available as a masking function. For more information, see [Create custom - // masking - // routines](https://cloud.google.com/bigquery/docs/user-defined-functions#custom-mask). - DataGovernanceType data_governance_type = 17 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Options for a user-defined Spark routine. -message SparkOptions { - // Fully qualified name of the user-provided Spark connection object. Format: - // ```"projects/{project_id}/locations/{location_id}/connections/{connection_id}"``` - string connection = 1; - - // Runtime version. If not specified, the default runtime version is used. - string runtime_version = 2; - - // Custom container image for the runtime environment. - string container_image = 3; - - // Configuration properties as a set of key/value pairs, which will be passed - // on to the Spark application. For more information, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html) and the - // [procedure option - // list](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#procedure_option_list). - map properties = 4; - - // The main file/jar URI of the Spark application. Exactly one of the - // definition_body field and the main_file_uri field must be set for Python. - // Exactly one of main_class and main_file_uri field - // should be set for Java/Scala language type. - string main_file_uri = 5; - - // Python files to be placed on the PYTHONPATH for PySpark application. - // Supported file types: `.py`, `.egg`, and `.zip`. For more information - // about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string py_file_uris = 6; - - // JARs to include on the driver and executor CLASSPATH. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string jar_uris = 7; - - // Files to be placed in the working directory of each executor. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string file_uris = 8; - - // Archive files to be extracted into the working directory of each executor. - // For more information about Apache Spark, see - // [Apache Spark](https://spark.apache.org/docs/latest/index.html). - repeated string archive_uris = 9; - - // The fully qualified name of a class in jar_uris, for example, - // com.example.wordcount. Exactly one of main_class and main_jar_uri field - // should be set for Java/Scala language type. - string main_class = 10; -} - -// Describes the format for getting information about a routine. -message GetRoutineRequest { - // Required. Project ID of the requested routine - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested routine - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the requested routine - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for inserting a routine. -message InsertRoutineRequest { - // Required. Project ID of the new routine - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the new routine - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource to insert - Routine routine = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for updating a routine. -message UpdateRoutineRequest { - // Required. Project ID of the routine to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to update - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource which will replace the specified routine - Routine routine = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for the partial update (patch) of a routine. -message PatchRoutineRequest { - // Required. Project ID of the routine to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to update - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A routine resource which will be used to partially - // update the specified routine - Routine routine = 4 [(google.api.field_behavior) = REQUIRED]; - - // Only the Routine fields in the field mask are updated - // by the given routine. Repeated routine fields will be fully replaced - // if contained in the field mask. - google.protobuf.FieldMask field_mask = 5; -} - -// Describes the format for deleting a routine. -message DeleteRoutineRequest { - // Required. Project ID of the routine to delete - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routine to delete - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Routine ID of the routine to delete - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Describes the format for listing routines. -message ListRoutinesRequest { - // Required. Project ID of the routines to list - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the routines to list - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 4; - - // If set, then only the Routines matching this filter are returned. - // The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - // is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - string filter = 6; -} - -// Describes the format of a single result page when listing routines. -message ListRoutinesResponse { - // Routines in the requested dataset. Unless read_mask is set in the request, - // only the following fields are populated: - // etag, project_id, dataset_id, routine_id, routine_type, creation_time, - // last_modified_time, language, and remote_function_options. - repeated Routine routines = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline deleted file mode 100644 index 65ab1ae8df6d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/routine_reference.proto.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "RoutineReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a routine. -message RoutineReference { - // Required. The ID of the project containing this routine. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this routine. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the routine. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 256 characters. - string routine_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline deleted file mode 100644 index c6eb2e9b7d9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy.proto.baseline +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/row_access_policy_reference.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RowAccessPolicyProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Service for interacting with row access policies. -service RowAccessPolicyService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Lists all row access policies on the specified table. - rpc ListRowAccessPolicies(ListRowAccessPoliciesRequest) - returns (ListRowAccessPoliciesResponse) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}/rowAccessPolicies" - }; - } -} - -// Request message for the ListRowAccessPolicies method. -message ListRowAccessPoliciesRequest { - // Required. Project ID of the row access policies to list. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of row access policies to list. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to list row access policies. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Page token, returned by a previous call, to request the next page of - // results. - string page_token = 4; - - // The maximum number of results to return in a single response page. Leverage - // the page tokens to iterate through the entire collection. - int32 page_size = 5; -} - -// Response message for the ListRowAccessPolicies method. -message ListRowAccessPoliciesResponse { - // Row access policies on the requested table. - repeated RowAccessPolicy row_access_policies = 1; - - // A token to request the next page of results. - string next_page_token = 2; -} - -// Represents access on a subset of rows on the specified table, defined by its -// filter predicate. Access to the subset of rows is controlled by its IAM -// policy. -message RowAccessPolicy { - // Output only. A hash of this resource. - string etag = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this row access policy. - RowAccessPolicyReference row_access_policy_reference = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A SQL boolean expression that represents the rows defined by this - // row access policy, similar to the boolean expression in a WHERE clause of a - // SELECT query on a table. - // References to other tables, routines, and temporary functions are not - // supported. - // - // Examples: region="EU" - // date_field = CAST('2019-9-27' as DATE) - // nullable_field is not NULL - // numeric_field BETWEEN 1.0 AND 5.0 - string filter_predicate = 3 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this row access policy was created, in - // milliseconds since the epoch. - google.protobuf.Timestamp creation_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this row access policy was last modified, in - // milliseconds since the epoch. - google.protobuf.Timestamp last_modified_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline deleted file mode 100644 index 28028dab0ec6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/row_access_policy_reference.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "RowAccessPolicyReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Id path of a row access policy. -message RowAccessPolicyReference { - // Required. The ID of the project containing this row access policy. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this row access policy. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the table containing this row access policy. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the row access policy. The ID must contain only - // letters (a-z, A-Z), numbers (0-9), or underscores (_). The maximum - // length is 256 characters. - string policy_id = 4 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/session_info.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/session_info.proto.baseline deleted file mode 100644 index 333ab3b7edd2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/session_info.proto.baseline +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "SessionInfoProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// [Preview] Information related to sessions. -message SessionInfo { - // Output only. The id of the session. - string session_id = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline deleted file mode 100644 index 0f63b2d5f597..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/standard_sql.proto.baseline +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "StandardSqlProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// The data type of a variable such as a function argument. -// Examples include: -// -// * INT64: `{"typeKind": "INT64"}` -// -// * ARRAY: -// -// { -// "typeKind": "ARRAY", -// "arrayElementType": {"typeKind": "STRING"} -// } -// -// * STRUCT>: -// -// { -// "typeKind": "STRUCT", -// "structType": -// { -// "fields": -// [ -// { -// "name": "x", -// "type": {"typeKind": "STRING"} -// }, -// { -// "name": "y", -// "type": -// { -// "typeKind": "ARRAY", -// "arrayElementType": {"typeKind": "DATE"} -// } -// } -// ] -// } -// } -// -// * RANGE: -// -// { -// "typeKind": "RANGE", -// "rangeElementType": {"typeKind": "DATE"} -// } -message StandardSqlDataType { - // The kind of the datatype. - enum TypeKind { - // Invalid type. - TYPE_KIND_UNSPECIFIED = 0; - - // Encoded as a string in decimal format. - INT64 = 2; - - // Encoded as a boolean "false" or "true". - BOOL = 5; - - // Encoded as a number, or string "NaN", "Infinity" or "-Infinity". - FLOAT64 = 7; - - // Encoded as a string value. - STRING = 8; - - // Encoded as a base64 string per RFC 4648, section 4. - BYTES = 9; - - // Encoded as an RFC 3339 timestamp with mandatory "Z" time zone string: - // 1985-04-12T23:20:50.52Z - TIMESTAMP = 19; - - // Encoded as RFC 3339 full-date format string: 1985-04-12 - DATE = 10; - - // Encoded as RFC 3339 partial-time format string: 23:20:50.52 - TIME = 20; - - // Encoded as RFC 3339 full-date "T" partial-time: 1985-04-12T23:20:50.52 - DATETIME = 21; - - // Encoded as fully qualified 3 part: 0-5 15 2:30:45.6 - INTERVAL = 26; - - // Encoded as WKT - GEOGRAPHY = 22; - - // Encoded as a decimal string. - NUMERIC = 23; - - // Encoded as a decimal string. - BIGNUMERIC = 24; - - // Encoded as a string. - JSON = 25; - - // Encoded as a list with types matching Type.array_type. - ARRAY = 16; - - // Encoded as a list with fields of type Type.struct_type[i]. List is used - // because a JSON object cannot have duplicate field names. - STRUCT = 17; - - // Encoded as a pair with types matching range_element_type. Pairs must - // begin with "[", end with ")", and be separated by ", ". - RANGE = 29; - } - - // Required. The top level type of this field. - // Can be any GoogleSQL data type (e.g., "INT64", "DATE", "ARRAY"). - TypeKind type_kind = 1 [(google.api.field_behavior) = REQUIRED]; - - // For complex types, the sub type information. - oneof sub_type { - // The type of the array's elements, if type_kind = "ARRAY". - StandardSqlDataType array_element_type = 2; - - // The fields of this struct, in order, if type_kind = "STRUCT". - StandardSqlStructType struct_type = 3; - - // The type of the range's elements, if type_kind = "RANGE". - StandardSqlDataType range_element_type = 4; - } -} - -// A field or a column. -message StandardSqlField { - // Optional. The name of this field. Can be absent for struct fields. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The type of this parameter. Absent if not explicitly - // specified (e.g., CREATE FUNCTION statement can omit the return type; - // in this case the output parameter does not have this "type" field). - StandardSqlDataType type = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The representation of a SQL STRUCT type. -message StandardSqlStructType { - // Fields within the struct. - repeated StandardSqlField fields = 1; -} - -// A table type -message StandardSqlTableType { - // The columns in this table type - repeated StandardSqlField columns = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/system_variable.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/system_variable.proto.baseline deleted file mode 100644 index 4437f0f4e2cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/system_variable.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/standard_sql.proto"; -import "google/protobuf/struct.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_multiple_files = true; -option java_outer_classname = "SystemVariableProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// System variables given to a query. -message SystemVariables { - // Output only. Data type for each system variable. - map types = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Value for each system variable. - google.protobuf.Struct values = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table.proto.baseline deleted file mode 100644 index 9f93ae5df6df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table.proto.baseline +++ /dev/null @@ -1,730 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/biglake_config.proto"; -import "google/cloud/bigquery/v2/clustering.proto"; -import "google/cloud/bigquery/v2/encryption_config.proto"; -import "google/cloud/bigquery/v2/error.proto"; -import "google/cloud/bigquery/v2/external_catalog_table_options.proto"; -import "google/cloud/bigquery/v2/external_data_config.proto"; -import "google/cloud/bigquery/v2/partitioning_definition.proto"; -import "google/cloud/bigquery/v2/privacy_policy.proto"; -import "google/cloud/bigquery/v2/range_partitioning.proto"; -import "google/cloud/bigquery/v2/restriction_config.proto"; -import "google/cloud/bigquery/v2/table_constraints.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; -import "google/cloud/bigquery/v2/table_schema.proto"; -import "google/cloud/bigquery/v2/time_partitioning.proto"; -import "google/cloud/bigquery/v2/udf_resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// This is an experimental RPC service definition for the BigQuery -// Table Service. -// -// It should not be relied on for production use cases at this time. -service TableService { - option (google.api.default_host) = "bigquery.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/bigquery," - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only"; - - // Gets the specified table resource by table ID. - // This method does not return the data in the table, it only returns the - // table resource, which describes the structure of this table. - rpc GetTable(GetTableRequest) returns (Table) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - }; - } - - // Creates a new, empty table in the dataset. - rpc InsertTable(InsertTableRequest) returns (Table) { - option (google.api.http) = { - post: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables" - body: "table" - }; - } - - // Updates information in an existing table. The update method replaces the - // entire table resource, whereas the patch method only replaces fields that - // are provided in the submitted table resource. - // This method supports RFC5789 patch semantics. - rpc PatchTable(UpdateOrPatchTableRequest) returns (Table) { - option (google.api.http) = { - patch: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - body: "table" - }; - } - - // Updates information in an existing table. The update method replaces the - // entire Table resource, whereas the patch method only replaces fields that - // are provided in the submitted Table resource. - rpc UpdateTable(UpdateOrPatchTableRequest) returns (Table) { - option (google.api.http) = { - put: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - body: "table" - }; - } - - // Deletes the table specified by tableId from the dataset. - // If the table contains data, all the data will be deleted. - rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables/{table_id=*}" - }; - } - - // Lists all tables in the specified dataset. Requires the READER dataset - // role. - rpc ListTables(ListTablesRequest) returns (TableList) { - option (google.api.http) = { - get: "/bigquery/v2/projects/{project_id=*}/datasets/{dataset_id=*}/tables" - }; - } -} - -// Replication info of a table created using `AS REPLICA` DDL like: -// `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` -message TableReplicationInfo { - // Replication status of the table created using `AS REPLICA` like: - // `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` - enum ReplicationStatus { - // Default value. - REPLICATION_STATUS_UNSPECIFIED = 0; - - // Replication is Active with no errors. - ACTIVE = 1; - - // Source object is deleted. - SOURCE_DELETED = 2; - - // Source revoked replication permissions. - PERMISSION_DENIED = 3; - - // Source configuration doesn’t allow replication. - UNSUPPORTED_CONFIGURATION = 4; - } - - // Required. Source table reference that is replicated. - TableReference source_table = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Specifies the interval at which the source table is polled for - // updates. - // It's Optional. If not specified, default replication interval would be - // applied. - int64 replication_interval_ms = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. If source is a materialized view, this field - // signifies the last refresh time of the source. - int64 replicated_source_last_refresh_time = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Output only. Replication status of configured replication. - ReplicationStatus replication_status = 4 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Output only. Replication error that will permanently stopped - // table replication. - ErrorProto replication_error = 5 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// Describes the definition of a logical view. -message ViewDefinition { - // Required. A query that BigQuery executes when the view is referenced. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Describes user-defined function resources used in the query. - repeated UserDefinedFunctionResource user_defined_function_resources = 2; - - // Specifies whether to use BigQuery's legacy SQL for this view. - // The default value is true. If set to false, the view will use - // BigQuery's GoogleSQL: - // https://cloud.google.com/bigquery/sql-reference/ - // - // Queries and views that reference this view must use the same flag value. - // A wrapper is used here because the default value is True. - google.protobuf.BoolValue use_legacy_sql = 3; - - // True if the column names are explicitly specified. For example by using the - // 'CREATE VIEW v(c1, c2) AS ...' syntax. - // Can only be set for GoogleSQL views. - bool use_explicit_column_names = 4; - - // Optional. Specifices the privacy policy for the view. - PrivacyPolicy privacy_policy = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Foreign view representations. - repeated ForeignViewDefinition foreign_definitions = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// A view can be represented in multiple ways. Each representation has its own -// dialect. This message stores the metadata required for these representations. -message ForeignViewDefinition { - // Required. The query that defines the view. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Represents the dialect of the query. - string dialect = 7 [(google.api.field_behavior) = OPTIONAL]; -} - -// Definition and configuration of a materialized view. -message MaterializedViewDefinition { - // Required. A query whose results are persisted. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The time when this materialized view was last refreshed, in - // milliseconds since the epoch. - int64 last_refresh_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Enable automatic refresh of the materialized view when the base - // table is updated. The default value is "true". - google.protobuf.BoolValue enable_refresh = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum frequency at which this materialized view will be - // refreshed. The default value is "1800000" (30 minutes). - google.protobuf.UInt64Value refresh_interval_ms = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This option declares the intention to construct a materialized - // view that isn't refreshed incrementally. - google.protobuf.BoolValue allow_non_incremental_definition = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Status of a materialized view. -// The last refresh timestamp status is omitted here, but is present in the -// MaterializedViewDefinition message. -message MaterializedViewStatus { - // Output only. Refresh watermark of materialized view. The base tables' data - // were collected into the materialized view cache until this time. - google.protobuf.Timestamp refresh_watermark = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Error result of the last automatic refresh. If present, - // indicates that the last automatic refresh was unsuccessful. - ErrorProto last_refresh_status = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Information about base table and snapshot time of the snapshot. -message SnapshotDefinition { - // Required. Reference describing the ID of the table that was snapshot. - TableReference base_table_reference = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the base table was snapshot. This value is - // reported in the JSON response using RFC3339 format. - google.protobuf.Timestamp snapshot_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Information about base table and clone time of a table clone. -message CloneDefinition { - // Required. Reference describing the ID of the table that was cloned. - TableReference base_table_reference = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The time at which the base table was cloned. This value is - // reported in the JSON response using RFC3339 format. - google.protobuf.Timestamp clone_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -message Streamingbuffer { - // Output only. A lower-bound estimate of the number of bytes currently in - // the streaming buffer. - uint64 estimated_bytes = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A lower-bound estimate of the number of rows currently in the - // streaming buffer. - uint64 estimated_rows = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains the timestamp of the oldest entry in the streaming - // buffer, in milliseconds since the epoch, if the streaming buffer is - // available. - fixed64 oldest_entry_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message Table { - // The type of resource ID. - string kind = 1; - - // Output only. A hash of this resource. - string etag = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. An opaque ID uniquely identifying the table. - string id = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A URL that can be used to access this resource again. - string self_link = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Reference describing the ID of this table. - TableReference table_reference = 5 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A descriptive name for this table. - google.protobuf.StringValue friendly_name = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A user-friendly description of this table. - google.protobuf.StringValue description = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // The labels associated with this table. You can use these to organize and - // group your tables. Label keys and values can be no longer than 63 - // characters, can only contain lowercase letters, numeric characters, - // underscores and dashes. International characters are allowed. Label values - // are optional. Label keys must start with a letter and each label in the - // list must have a different key. - map labels = 8; - - // Optional. Describes the schema of this table. - TableSchema schema = 9 [(google.api.field_behavior) = OPTIONAL]; - - // If specified, configures time-based partitioning for this table. - TimePartitioning time_partitioning = 10; - - // If specified, configures range partitioning for this table. - RangePartitioning range_partitioning = 27; - - // Clustering specification for the table. Must be specified with time-based - // partitioning, data in the table will be first partitioned and subsequently - // clustered. - Clustering clustering = 23; - - // Optional. If set to true, queries over this table require - // a partition filter that can be used for partition elimination to be - // specified. - google.protobuf.BoolValue require_partition_filter = 28 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The partition information for all table formats, including - // managed partitioned tables, hive partitioned tables, iceberg partitioned, - // and metastore partitioned tables. This field is only populated for - // metastore partitioned tables. For other table formats, this is an output - // only field. - optional PartitioningDefinition partition_definition = 51 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The size of this table in logical bytes, excluding any data in - // the streaming buffer. - google.protobuf.Int64Value num_bytes = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The physical size of this table in bytes. This includes - // storage used for time travel. - google.protobuf.Int64Value num_physical_bytes = 26 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of logical bytes in the table that are considered - // "long-term storage". - google.protobuf.Int64Value num_long_term_bytes = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of rows of data in this table, excluding any data - // in the streaming buffer. - google.protobuf.UInt64Value num_rows = 13 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time when this table was created, in milliseconds since - // the epoch. - int64 creation_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The time when this table expires, in milliseconds since the - // epoch. If not present, the table will persist indefinitely. Expired tables - // will be deleted and their storage reclaimed. The defaultTableExpirationMs - // property of the encapsulating dataset can be used to set a default - // expirationTime on newly created tables. - google.protobuf.Int64Value expiration_time = 15 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time when this table was last modified, in milliseconds - // since the epoch. - fixed64 last_modified_time = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Describes the table type. The following values are supported: - // - // * `TABLE`: A normal BigQuery table. - // * `VIEW`: A virtual table defined by a SQL query. - // * `EXTERNAL`: A table that references data stored in an external storage - // system, such as Google Cloud Storage. - // * `MATERIALIZED_VIEW`: A precomputed view defined by a SQL query. - // * `SNAPSHOT`: An immutable BigQuery table that preserves the contents of a - // base table at a particular time. See additional information on - // [table - // snapshots](https://cloud.google.com/bigquery/docs/table-snapshots-intro). - // - // The default value is `TABLE`. - string type = 17 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The view definition. - ViewDefinition view = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The materialized view definition. - MaterializedViewDefinition materialized_view = 25 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The materialized view status. - MaterializedViewStatus materialized_view_status = 42 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Describes the data format, location, and other properties of - // a table stored outside of BigQuery. By defining these properties, the data - // source can then be queried as if it were a standard BigQuery table. - ExternalDataConfiguration external_data_configuration = 19 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the configuration of a BigLake managed table. - BigLakeConfiguration biglake_configuration = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The geographic location where the table resides. This value - // is inherited from the dataset. - string location = 20 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Contains information regarding this table's streaming buffer, - // if one is present. This field will be absent if the table is not being - // streamed to or if there is no data in the streaming buffer. - Streamingbuffer streaming_buffer = 21 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Custom encryption configuration (e.g., Cloud KMS keys). - EncryptionConfiguration encryption_configuration = 22; - - // Output only. Contains information about the snapshot. This value is set via - // snapshot creation. - SnapshotDefinition snapshot_definition = 29 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Defines the default collation specification of new STRING fields - // in the table. During table creation or update, if a STRING field is added - // to this table without explicit collation specified, then the table inherits - // the table default collation. A change to this field affects only fields - // added afterwards, and does not alter the existing fields. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue default_collation = 30 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Defines the default rounding mode specification of new decimal - // fields (NUMERIC OR BIGNUMERIC) in the table. During table creation or - // update, if a decimal field is added to this table without an explicit - // rounding mode specified, then the field inherits the table default - // rounding mode. Changing this field doesn't affect existing fields. - TableFieldSchema.RoundingMode default_rounding_mode = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Contains information about the clone. This value is set via - // the clone operation. - CloneDefinition clone_definition = 31 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes used by time travel storage (deleted - // or changed data). This data is not kept in real time, and might be delayed - // by a few seconds to a few minutes. - google.protobuf.Int64Value num_time_travel_physical_bytes = 33 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Total number of logical bytes in the table or materialized - // view. - google.protobuf.Int64Value num_total_logical_bytes = 34 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes that are less than 90 days old. - google.protobuf.Int64Value num_active_logical_bytes = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of logical bytes that are more than 90 days old. - google.protobuf.Int64Value num_long_term_logical_bytes = 36 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes used by current live data storage. - // This data is not kept in real time, and might be delayed by a few seconds - // to a few minutes. - google.protobuf.Int64Value num_current_physical_bytes = 53 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The physical size of this table in bytes. This also includes - // storage used for time travel. This data is not kept in real time, and might - // be delayed by a few seconds to a few minutes. - google.protobuf.Int64Value num_total_physical_bytes = 37 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes less than 90 days old. This data is - // not kept in real time, and might be delayed by a few seconds to a few - // minutes. - google.protobuf.Int64Value num_active_physical_bytes = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Number of physical bytes more than 90 days old. - // This data is not kept in real time, and might be delayed by a few seconds - // to a few minutes. - google.protobuf.Int64Value num_long_term_physical_bytes = 39 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of partitions present in the table or materialized - // view. This data is not kept in real time, and might be delayed by a few - // seconds to a few minutes. - google.protobuf.Int64Value num_partitions = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The maximum staleness of data that could be returned when the - // table (or stale MV) is queried. Staleness encoded as a string encoding - // of sql IntervalValue type. - string max_staleness = 41 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Restriction config for table. If set, restrict - // certain accesses on the table based on the config. See [Data - // egress](https://cloud.google.com/bigquery/docs/analytics-hub-introduction#data_egress) - // for more details. - RestrictionConfig restrictions = 46 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Tables Primary Key and Foreign Key information - TableConstraints table_constraints = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The [tags](https://cloud.google.com/bigquery/docs/tags) attached - // to this table. Tag keys are globally unique. Tag key is expected to be in - // the namespaced format, for example "123456789012/environment" where - // 123456789012 is the ID of the parent organization or project resource for - // this tag key. Tag value is expected to be the short name, for example - // "Production". See [Tag - // definitions](https://cloud.google.com/iam/docs/tags-access-control#definitions) - // for more details. - map resource_tags = 48 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Table replication info for table created `AS REPLICA` DDL like: - // `CREATE MATERIALIZED VIEW mv1 AS REPLICA OF src_mv` - TableReplicationInfo table_replication_info = 49 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Output only. Table references of all replicas currently active on - // the table. - repeated TableReference replicas = 50 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Options defining open source compatible table. - ExternalCatalogTableOptions external_catalog_table_options = 54 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for getting table metadata. -message GetTableRequest { - // TableMetadataView specifies which table information is returned. - enum TableMetadataView { - // The default value. - // Default to the STORAGE_STATS view. - TABLE_METADATA_VIEW_UNSPECIFIED = 0; - - // Includes basic table information including schema and - // partitioning specification. This view does not include storage statistics - // such as numRows or numBytes. This view is significantly more efficient - // and should be used to support high query rates. - BASIC = 1; - - // Includes all information in the BASIC view as well as storage statistics - // (numBytes, numLongTermBytes, numRows and lastModifiedTime). - STORAGE_STATS = 2; - - // Includes all table information, including storage statistics. - // It returns same information as STORAGE_STATS view, but may contain - // additional information in the future. - FULL = 3; - } - - // Required. Project ID of the requested table - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the requested table - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the requested table - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // List of table schema fields to return (comma-separated). - // If unspecified, all fields are returned. - // A fieldMask cannot be used here because the fields will automatically be - // converted from camelCase to snake_case and the conversion will fail if - // there are underscores. Since these are fields in BigQuery table schemas, - // underscores are allowed. - string selected_fields = 4; - - // Optional. Specifies the view that determines which table information is - // returned. By default, basic table information and storage statistics - // (STORAGE_STATS) are returned. - TableMetadataView view = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for inserting table metadata. -message InsertTableRequest { - // Required. Project ID of the new table - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the new table - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A tables resource to insert - Table table = 4 [(google.api.field_behavior) = REQUIRED]; -} - -message UpdateOrPatchTableRequest { - // Required. Project ID of the table to update - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the table to update - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to update - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. A tables resource which will replace or patch the specified table - Table table = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. When true will autodetect schema, else will keep original schema. - bool autodetect_schema = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request format for deleting a table. -message DeleteTableRequest { - // Required. Project ID of the table to delete - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the table to delete - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Table ID of the table to delete - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request format for enumerating tables. -message ListTablesRequest { - // Required. Project ID of the tables to list - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Dataset ID of the tables to list - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // The maximum number of results to return in a single response page. - // Leverage the page tokens to iterate through the entire collection. - google.protobuf.UInt32Value max_results = 3; - - // Page token, returned by a previous call, to request the next page of - // results - string page_token = 4; -} - -// Information about a logical view. -message ListFormatView { - // True if view is defined in legacy SQL dialect, - // false if in GoogleSQL. - google.protobuf.BoolValue use_legacy_sql = 1; - - // Specifices the privacy policy for the view. - PrivacyPolicy privacy_policy = 2; -} - -message ListFormatTable { - // The resource type. - string kind = 1; - - // An opaque ID of the table. - string id = 2; - - // A reference uniquely identifying table. - TableReference table_reference = 3; - - // The user-friendly name for this table. - google.protobuf.StringValue friendly_name = 4; - - // The type of table. - string type = 5; - - // The time-based partitioning for this table. - TimePartitioning time_partitioning = 6; - - // The range partitioning for this table. - RangePartitioning range_partitioning = 12; - - // Clustering specification for this table, if configured. - Clustering clustering = 11; - - // The labels associated with this table. You can use these to organize - // and group your tables. - map labels = 7; - - // Additional details for a view. - ListFormatView view = 8; - - // Output only. The time when this table was created, in milliseconds since - // the epoch. - int64 creation_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time when this table expires, in milliseconds since the - // epoch. If not present, the table will persist indefinitely. Expired tables - // will be deleted and their storage reclaimed. - int64 expiration_time = 10; - - // Optional. If set to true, queries including this table must specify a - // partition filter. This filter is used for partition elimination. - google.protobuf.BoolValue require_partition_filter = 14 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Partial projection of the metadata for a given table in a list response. -message TableList { - // The type of list. - string kind = 1; - - // A hash of this page of results. - string etag = 2; - - // A token to request the next page of results. - string next_page_token = 3; - - // Tables in the requested dataset. - repeated ListFormatTable tables = 4; - - // The total number of tables in the dataset. - google.protobuf.Int32Value total_items = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline deleted file mode 100644 index 13edc6bb905d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_constraints.proto.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/cloud/bigquery/v2/table_reference.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableConstraintsProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Represents the primary key constraint on a table's columns. -message PrimaryKey { - // Required. The columns that are composed of the primary key constraint. - repeated string columns = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The pair of the foreign key column and primary key column. -message ColumnReference { - // Required. The column that composes the foreign key. - string referencing_column = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The column in the primary key that are referenced by the - // referencing_column. - string referenced_column = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Represents a foreign key constraint on a table's columns. -message ForeignKey { - // Optional. Set only if the foreign key constraint is named. - string name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The table that holds the primary key and is referenced by this - // foreign key. - TableReference referenced_table = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The columns that compose the foreign key. - repeated ColumnReference column_references = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// The TableConstraints defines the primary key and foreign key. -message TableConstraints { - // Optional. Represents a primary key constraint on a table's columns. - // Present only if the table has a primary key. - // The primary key is not enforced. - PrimaryKey primary_key = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Present only if the table has a foreign key. - // The foreign key is not enforced. - repeated ForeignKey foreign_keys = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_reference.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_reference.proto.baseline deleted file mode 100644 index e6e9a1b35d1b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_reference.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableReferenceProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message TableReference { - // Required. The ID of the project containing this table. - string project_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the dataset containing this table. - string dataset_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the table. The ID can contain Unicode characters in - // category L (letter), M (mark), N (number), Pc (connector, including - // underscore), Pd (dash), and Zs (space). For more information, see [General - // Category](https://wikipedia.org/wiki/Unicode_character_property#General_Category). - // The maximum length is 1,024 characters. Certain operations allow suffixing - // of the table ID with a partition decorator, such as - // `sample_table$20190123`. - string table_id = 3 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_schema.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_schema.proto.baseline deleted file mode 100644 index 8a56f8e8720b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/table_schema.proto.baseline +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TableSchemaProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// Schema of a table -message TableSchema { - // Describes the fields in a table. - repeated TableFieldSchema fields = 1; - - // Optional. Specifies metadata of the foreign data type definition in field - // schema - // ([TableFieldSchema.foreign_type_definition][google.cloud.bigquery.v2.TableFieldSchema.foreign_type_definition]). - ForeignTypeInfo foreign_type_info = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata about the foreign data type definition such as the system -// in which the type is defined. -message ForeignTypeInfo { - // External systems, such as query engines or table formats, that have their - // own data types. - enum TypeSystem { - // TypeSystem not specified. - TYPE_SYSTEM_UNSPECIFIED = 0; - - // Represents Hive data types. - HIVE = 1; - } - - // Required. Specifies the system which defines the foreign data type. - TypeSystem type_system = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Data policy option proto, it currently supports name only, will support -// precedence later. -message DataPolicyOption { - // Data policy resource name in the form of - // projects/project_id/locations/location_id/dataPolicies/data_policy_id. - optional string name = 1; -} - -// A field in TableSchema -message TableFieldSchema { - message PolicyTagList { - // A list of policy tag resource names. For example, - // "projects/1/locations/eu/taxonomies/2/policyTags/3". At most 1 policy tag - // is currently allowed. - repeated string names = 1; - } - - // Rounding mode options that can be used when storing NUMERIC - // or BIGNUMERIC values. - enum RoundingMode { - // Unspecified will default to using ROUND_HALF_AWAY_FROM_ZERO. - ROUNDING_MODE_UNSPECIFIED = 0; - - // ROUND_HALF_AWAY_FROM_ZERO rounds half values away from zero - // when applying precision and scale upon writing of NUMERIC and BIGNUMERIC - // values. - // For Scale: 0 - // 1.1, 1.2, 1.3, 1.4 => 1 - // 1.5, 1.6, 1.7, 1.8, 1.9 => 2 - ROUND_HALF_AWAY_FROM_ZERO = 1; - - // ROUND_HALF_EVEN rounds half values to the nearest even value - // when applying precision and scale upon writing of NUMERIC and BIGNUMERIC - // values. - // For Scale: 0 - // 1.1, 1.2, 1.3, 1.4 => 1 - // 1.5 => 2 - // 1.6, 1.7, 1.8, 1.9 => 2 - // 2.5 => 2 - ROUND_HALF_EVEN = 2; - } - - // Represents the type of a field element. - message FieldElementType { - // Required. The type of a field element. For more information, see - // [TableFieldSchema.type][google.cloud.bigquery.v2.TableFieldSchema.type]. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. The field name. The name must contain only letters (a-z, A-Z), - // numbers (0-9), or underscores (_), and must start with a letter or - // underscore. The maximum length is 300 characters. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The field data type. Possible values include: - // - // * STRING - // * BYTES - // * INTEGER (or INT64) - // * FLOAT (or FLOAT64) - // * BOOLEAN (or BOOL) - // * TIMESTAMP - // * DATE - // * TIME - // * DATETIME - // * GEOGRAPHY - // * NUMERIC - // * BIGNUMERIC - // * JSON - // * RECORD (or STRUCT) - // * RANGE - // - // Use of RECORD/STRUCT indicates that the field contains a nested schema. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The field mode. Possible values include NULLABLE, REQUIRED and - // REPEATED. The default value is NULLABLE. - string mode = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Describes the nested schema fields if the type property is set - // to RECORD. - repeated TableFieldSchema fields = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The field description. The maximum length is 1,024 characters. - google.protobuf.StringValue description = 6 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The policy tags attached to this field, used for field-level - // access control. If not set, defaults to empty policy_tags. - PolicyTagList policy_tags = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Data policy options, will replace the data_policies. - repeated DataPolicyOption data_policies = 21 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Maximum length of values of this field for STRINGS or BYTES. - // - // If max_length is not specified, no maximum length constraint is imposed - // on this field. - // - // If type = "STRING", then max_length represents the maximum UTF-8 - // length of strings in this field. - // - // If type = "BYTES", then max_length represents the maximum number of - // bytes in this field. - // - // It is invalid to set this field if type ≠ "STRING" and ≠ "BYTES". - int64 max_length = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Precision (maximum number of total digits in base 10) and scale - // (maximum number of digits in the fractional part in base 10) constraints - // for values of this field for NUMERIC or BIGNUMERIC. - // - // It is invalid to set precision or scale if type ≠ "NUMERIC" and ≠ - // "BIGNUMERIC". - // - // If precision and scale are not specified, no value range constraint is - // imposed on this field insofar as values are permitted by the type. - // - // Values of this NUMERIC or BIGNUMERIC field must be in this range when: - // - // * Precision (P) and scale (S) are specified: - // [-10P-S + 10-S, - // 10P-S - 10-S] - // * Precision (P) is specified but not scale (and thus scale is - // interpreted to be equal to zero): - // [-10P + 1, 10P - 1]. - // - // Acceptable values for precision and scale if both are specified: - // - // * If type = "NUMERIC": - // 1 ≤ precision - scale ≤ 29 and 0 ≤ scale ≤ 9. - // * If type = "BIGNUMERIC": - // 1 ≤ precision - scale ≤ 38 and 0 ≤ scale ≤ 38. - // - // Acceptable values for precision if only precision is specified but not - // scale (and thus scale is interpreted to be equal to zero): - // - // * If type = "NUMERIC": 1 ≤ precision ≤ 29. - // * If type = "BIGNUMERIC": 1 ≤ precision ≤ 38. - // - // If scale is specified but not precision, then it is invalid. - int64 precision = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. See documentation for precision. - int64 scale = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the rounding mode to be used when storing values of - // NUMERIC and BIGNUMERIC type. - RoundingMode rounding_mode = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field collation can be set only when the type of field is STRING. - // The following values are supported: - // - // * 'und:ci': undetermined locale, case insensitive. - // * '': empty string. Default to case-sensitive behavior. - google.protobuf.StringValue collation = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A SQL expression to specify the [default value] - // (https://cloud.google.com/bigquery/docs/default-values) for this field. - google.protobuf.StringValue default_value_expression = 14 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The subtype of the RANGE, if the type of this field is RANGE. If - // the type is RANGE, this field is required. Values for the field element - // type can be the following: - // - // * DATE - // * DATETIME - // * TIMESTAMP - FieldElementType range_element_type = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Definition of the foreign data type. - // Only valid for top-level schema fields (not nested fields). - // If the type is FOREIGN, this field is required. - string foreign_type_definition = 23 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline deleted file mode 100644 index 440a209830b8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/time_partitioning.proto.baseline +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/api/field_behavior.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "TimePartitioningProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -message TimePartitioning { - // Required. The supported types are DAY, HOUR, MONTH, and YEAR, which will - // generate one partition per day, hour, month, and year, respectively. - string type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Number of milliseconds for which to keep the storage for a - // partition. - // A wrapper is used here because 0 is an invalid value. - google.protobuf.Int64Value expiration_ms = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If not set, the table is partitioned by pseudo - // column '_PARTITIONTIME'; if set, the table is partitioned by this field. - // The field must be a top-level TIMESTAMP or DATE field. Its mode must be - // NULLABLE or REQUIRED. - // A wrapper is used here because an empty string is an invalid value. - google.protobuf.StringValue field = 3 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline deleted file mode 100644 index d630bf9c7f17..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/bigquery/v2/udf_resource.proto.baseline +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.bigquery.v2; - -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/bigquery/apiv2/bigquerypb;bigquerypb"; -option java_outer_classname = "UdfProto"; -option java_package = "com.google.cloud.bigquery.v2"; - -// -// This is used for defining User Defined Function (UDF) resources only when -// using legacy SQL. Users of GoogleSQL should leverage either DDL (e.g. -// CREATE [TEMPORARY] FUNCTION ... ) or the Routines API to define UDF -// resources. -// -// For additional information on migrating, see: -// https://cloud.google.com/bigquery/docs/reference/standard-sql/migrating-from-legacy-sql#differences_in_user-defined_javascript_functions -message UserDefinedFunctionResource { - // [Pick one] A code resource to load from a Google Cloud Storage URI - // (gs://bucket/path). - google.protobuf.StringValue resource_uri = 1; - - // [Pick one] An inline resource that contains code for a user-defined - // function (UDF). Providing a inline code resource is equivalent to providing - // a URI for a file containing the same code. - google.protobuf.StringValue inline_code = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.delete_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.delete_dataset.js.baseline deleted file mode 100644 index 238da08214ee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.delete_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_DeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being deleted - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of dataset being deleted - */ - // const datasetId = 'abc123' - /** - * If True, delete all the tables in the dataset. - * If False and the dataset contains tables, the request will fail. - * Default is False - */ - // const deleteContents = true - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callDeleteDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.deleteDataset(request); - console.log(response); - } - - callDeleteDataset(); - // [END bigquery_v2_generated_DatasetService_DeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.get_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.get_dataset.js.baseline deleted file mode 100644 index 82f91e2e4e14..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.get_dataset.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_GetDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested dataset - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested dataset - */ - // const datasetId = 'abc123' - /** - * Optional. Specifies the view that determines which dataset information is - * returned. By default, metadata and ACL information are returned. - */ - // const datasetView = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callGetDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.getDataset(request); - console.log(response); - } - - callGetDataset(); - // [END bigquery_v2_generated_DatasetService_GetDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.insert_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.insert_dataset.js.baseline deleted file mode 100644 index 4129b357c313..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.insert_dataset.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, dataset) { - // [START bigquery_v2_generated_DatasetService_InsertDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new dataset - */ - // const projectId = 'abc123' - /** - * Required. Datasets resource to use for the new dataset - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callInsertDataset() { - // Construct request - const request = { - projectId, - dataset, - }; - - // Run request - const response = await bigqueryClient.insertDataset(request); - console.log(response); - } - - callInsertDataset(); - // [END bigquery_v2_generated_DatasetService_InsertDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.list_datasets.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.list_datasets.js.baseline deleted file mode 100644 index c68ec12c82b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.list_datasets.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_DatasetService_ListDatasets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the datasets to be listed - */ - // const projectId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - /** - * Whether to list all datasets, including hidden ones - */ - // const all = true - /** - * An expression for filtering the results of the request by label. - * The syntax is `labels.:`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See Filtering datasets using - * labels (https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - */ - // const filter = 'abc123' - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callListDatasets() { - // Construct request - const request = { - projectId, - }; - - // Run request - const iterable = bigqueryClient.listDatasetsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDatasets(); - // [END bigquery_v2_generated_DatasetService_ListDatasets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.patch_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.patch_dataset.js.baseline deleted file mode 100644 index ecc28dcc98e7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.patch_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, dataset) { - // [START bigquery_v2_generated_DatasetService_PatchDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being updated - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the dataset being updated - */ - // const datasetId = 'abc123' - /** - * Required. Datasets resource which will replace or patch the specified - * dataset. - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callPatchDataset() { - // Construct request - const request = { - projectId, - datasetId, - dataset, - }; - - // Run request - const response = await bigqueryClient.patchDataset(request); - console.log(response); - } - - callPatchDataset(); - // [END bigquery_v2_generated_DatasetService_PatchDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.undelete_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.undelete_dataset.js.baseline deleted file mode 100644 index b0446a20a9c5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.undelete_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_DatasetService_UndeleteDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset to be undeleted - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of dataset being deleted - */ - // const datasetId = 'abc123' - /** - * Optional. The exact time when the dataset was deleted. If not specified, - * the most recently deleted version is undeleted. Undeleting a dataset - * using deletion time is not supported. - */ - // const deletionTime = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callUndeleteDataset() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const response = await bigqueryClient.undeleteDataset(request); - console.log(response); - } - - callUndeleteDataset(); - // [END bigquery_v2_generated_DatasetService_UndeleteDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.update_dataset.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.update_dataset.js.baseline deleted file mode 100644 index 177f1b4f757f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/dataset_service.update_dataset.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, dataset) { - // [START bigquery_v2_generated_DatasetService_UpdateDataset_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the dataset being updated - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the dataset being updated - */ - // const datasetId = 'abc123' - /** - * Required. Datasets resource which will replace or patch the specified - * dataset. - */ - // const dataset = {} - - // Imports the Bigquery library - const {DatasetServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new DatasetServiceClient(); - - async function callUpdateDataset() { - // Construct request - const request = { - projectId, - datasetId, - dataset, - }; - - // Run request - const response = await bigqueryClient.updateDataset(request); - console.log(response); - } - - callUpdateDataset(); - // [END bigquery_v2_generated_DatasetService_UpdateDataset_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.cancel_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.cancel_job.js.baseline deleted file mode 100644 index bb7e65573e6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.cancel_job.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_CancelJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the job to cancel - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the job to cancel - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callCancelJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.cancelJob(request); - console.log(response); - } - - callCancelJob(); - // [END bigquery_v2_generated_JobService_CancelJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.delete_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.delete_job.js.baseline deleted file mode 100644 index 64762ca58c85..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.delete_job.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_DeleteJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the job for which metadata is to be deleted. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the job for which metadata is to be deleted. If this is - * a parent job which has child jobs, the metadata from all child jobs will be - * deleted as well. Direct deletion of the metadata of child jobs is not - * allowed. - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. Required. - * See details at: - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callDeleteJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.deleteJob(request); - console.log(response); - } - - callDeleteJob(); - // [END bigquery_v2_generated_JobService_DeleteJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_job.js.baseline deleted file mode 100644 index 8f2fb6cdad2f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_job.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_GetJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested job. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the requested job. - */ - // const jobId = 'abc123' - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callGetJob() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.getJob(request); - console.log(response); - } - - callGetJob(); - // [END bigquery_v2_generated_JobService_GetJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_query_results.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_query_results.js.baseline deleted file mode 100644 index 56ba4ae0d05f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.get_query_results.js.baseline +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, jobId) { - // [START bigquery_v2_generated_JobService_GetQueryResults_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the query job. - */ - // const projectId = 'abc123' - /** - * Required. Job ID of the query job. - */ - // const jobId = 'abc123' - /** - * Zero-based index of the starting row. - */ - // const startIndex = {} - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * Maximum number of results to read. - */ - // const maxResults = {} - /** - * Optional: Specifies the maximum amount of time, in milliseconds, that the - * client is willing to wait for the query to complete. By default, this limit - * is 10 seconds (10,000 milliseconds). If the query is complete, the - * jobComplete field in the response is true. If the query has not yet - * completed, jobComplete is false. - * You can request a longer timeout period in the timeoutMs field. However, - * the call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * If jobComplete is false, you can continue to wait for the query to complete - * by calling the getQueryResults method until the jobComplete field in the - * getQueryResults response is true. - */ - // const timeoutMs = {} - /** - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - */ - // const location = 'abc123' - /** - * Optional. Output format adjustments. - */ - // const formatOptions = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callGetQueryResults() { - // Construct request - const request = { - projectId, - jobId, - }; - - // Run request - const response = await bigqueryClient.getQueryResults(request); - console.log(response); - } - - callGetQueryResults(); - // [END bigquery_v2_generated_JobService_GetQueryResults_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.insert_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.insert_job.js.baseline deleted file mode 100644 index 03acfa0aa770..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.insert_job.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquery_v2_generated_JobService_InsertJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of project that will be billed for the job. - */ - // const projectId = 'abc123' - /** - * Jobs resource to insert. - */ - // const job = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callInsertJob() { - // Construct request - const request = { - }; - - // Run request - const response = await bigqueryClient.insertJob(request); - console.log(response); - } - - callInsertJob(); - // [END bigquery_v2_generated_JobService_InsertJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.list_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.list_jobs.js.baseline deleted file mode 100644 index 776cb0834aaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.list_jobs.js.baseline +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START bigquery_v2_generated_JobService_ListJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the jobs to list. - */ - // const projectId = 'abc123' - /** - * Whether to display jobs owned by all users in the project. Default False. - */ - // const allUsers = true - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - */ - // const minCreationTime = 1234 - /** - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - */ - // const maxCreationTime = {} - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * Restrict information returned to a set of selected fields - */ - // const projection = {} - /** - * Filter for job state - */ - // const stateFilter = [1,2,3,4] - /** - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - */ - // const parentJobId = 'abc123' - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callListJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = bigqueryClient.listJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobs(); - // [END bigquery_v2_generated_JobService_ListJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.query.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.query.js.baseline deleted file mode 100644 index 41f3b31453ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/job_service.query.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_JobService_Query_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the query request. - */ - // const projectId = 'abc123' - /** - * The query request body. - */ - // const queryRequest = {} - - // Imports the Bigquery library - const {JobServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new JobServiceClient(); - - async function callQuery() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await bigqueryClient.query(request); - console.log(response); - } - - callQuery(); - // [END bigquery_v2_generated_JobService_Query_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.delete_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.delete_model.js.baseline deleted file mode 100644 index 97aad90d382b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.delete_model.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId) { - // [START bigquery_v2_generated_ModelService_DeleteModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the model to delete. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the model to delete. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the model to delete. - */ - // const modelId = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callDeleteModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - }; - - // Run request - const response = await bigqueryClient.deleteModel(request); - console.log(response); - } - - callDeleteModel(); - // [END bigquery_v2_generated_ModelService_DeleteModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.get_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.get_model.js.baseline deleted file mode 100644 index 51254b03e66b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.get_model.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId) { - // [START bigquery_v2_generated_ModelService_GetModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested model. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested model. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the requested model. - */ - // const modelId = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callGetModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - }; - - // Run request - const response = await bigqueryClient.getModel(request); - console.log(response); - } - - callGetModel(); - // [END bigquery_v2_generated_ModelService_GetModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.list_models.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.list_models.js.baseline deleted file mode 100644 index c24e2d03490a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.list_models.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_ModelService_ListModels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the models to list. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the models to list. - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call to request the next page of - * results - */ - // const pageToken = 'abc123' - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callListModels() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listModelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListModels(); - // [END bigquery_v2_generated_ModelService_ListModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.patch_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.patch_model.js.baseline deleted file mode 100644 index 4e8ae1c2eba4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/model_service.patch_model.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, modelId, model) { - // [START bigquery_v2_generated_ModelService_PatchModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the model to patch. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the model to patch. - */ - // const datasetId = 'abc123' - /** - * Required. Model ID of the model to patch. - */ - // const modelId = 'abc123' - /** - * Required. Patched model. - * Follows RFC5789 patch semantics. Missing fields are not updated. - * To clear a field, explicitly set to default value. - */ - // const model = {} - - // Imports the Bigquery library - const {ModelServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ModelServiceClient(); - - async function callPatchModel() { - // Construct request - const request = { - projectId, - datasetId, - modelId, - model, - }; - - // Run request - const response = await bigqueryClient.patchModel(request); - console.log(response); - } - - callPatchModel(); - // [END bigquery_v2_generated_ModelService_PatchModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/project_service.get_service_account.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/project_service.get_service_account.js.baseline deleted file mode 100644 index 748f98e96437..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/project_service.get_service_account.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId) { - // [START bigquery_v2_generated_ProjectService_GetServiceAccount_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. ID of the project. - */ - // const projectId = 'abc123' - - // Imports the Bigquery library - const {ProjectServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new ProjectServiceClient(); - - async function callGetServiceAccount() { - // Construct request - const request = { - projectId, - }; - - // Run request - const response = await bigqueryClient.getServiceAccount(request); - console.log(response); - } - - callGetServiceAccount(); - // [END bigquery_v2_generated_ProjectService_GetServiceAccount_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.delete_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.delete_routine.js.baseline deleted file mode 100644 index 4a57bda38967..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.delete_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId) { - // [START bigquery_v2_generated_RoutineService_DeleteRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to delete - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to delete - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to delete - */ - // const routineId = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callDeleteRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - }; - - // Run request - const response = await bigqueryClient.deleteRoutine(request); - console.log(response); - } - - callDeleteRoutine(); - // [END bigquery_v2_generated_RoutineService_DeleteRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.get_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.get_routine.js.baseline deleted file mode 100644 index 040bc638f184..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.get_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId) { - // [START bigquery_v2_generated_RoutineService_GetRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested routine - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested routine - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the requested routine - */ - // const routineId = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callGetRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - }; - - // Run request - const response = await bigqueryClient.getRoutine(request); - console.log(response); - } - - callGetRoutine(); - // [END bigquery_v2_generated_RoutineService_GetRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.insert_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.insert_routine.js.baseline deleted file mode 100644 index 310794b14e75..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.insert_routine.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routine) { - // [START bigquery_v2_generated_RoutineService_InsertRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new routine - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the new routine - */ - // const datasetId = 'abc123' - /** - * Required. A routine resource to insert - */ - // const routine = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callInsertRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routine, - }; - - // Run request - const response = await bigqueryClient.insertRoutine(request); - console.log(response); - } - - callInsertRoutine(); - // [END bigquery_v2_generated_RoutineService_InsertRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.list_routines.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.list_routines.js.baseline deleted file mode 100644 index ceda506e7f46..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.list_routines.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_RoutineService_ListRoutines_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routines to list - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routines to list - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - /** - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - */ - // const filter = 'abc123' - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callListRoutines() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listRoutinesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRoutines(); - // [END bigquery_v2_generated_RoutineService_ListRoutines_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.patch_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.patch_routine.js.baseline deleted file mode 100644 index 7049a548cc67..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.patch_routine.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId, routine) { - // [START bigquery_v2_generated_RoutineService_PatchRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to update - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to update - */ - // const routineId = 'abc123' - /** - * Required. A routine resource which will be used to partially - * update the specified routine - */ - // const routine = {} - /** - * Only the Routine fields in the field mask are updated - * by the given routine. Repeated routine fields will be fully replaced - * if contained in the field mask. - */ - // const fieldMask = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callPatchRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - routine, - }; - - // Run request - const response = await bigqueryClient.patchRoutine(request); - console.log(response); - } - - callPatchRoutine(); - // [END bigquery_v2_generated_RoutineService_PatchRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.update_routine.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.update_routine.js.baseline deleted file mode 100644 index 4845980a9f85..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/routine_service.update_routine.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, routineId, routine) { - // [START bigquery_v2_generated_RoutineService_UpdateRoutine_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the routine to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the routine to update - */ - // const datasetId = 'abc123' - /** - * Required. Routine ID of the routine to update - */ - // const routineId = 'abc123' - /** - * Required. A routine resource which will replace the specified routine - */ - // const routine = {} - - // Imports the Bigquery library - const {RoutineServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RoutineServiceClient(); - - async function callUpdateRoutine() { - // Construct request - const request = { - projectId, - datasetId, - routineId, - routine, - }; - - // Run request - const response = await bigqueryClient.updateRoutine(request); - console.log(response); - } - - callUpdateRoutine(); - // [END bigquery_v2_generated_RoutineService_UpdateRoutine_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline deleted file mode 100644 index 3dc03f52949e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/row_access_policy_service.list_row_access_policies.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the row access policies to list. - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of row access policies to list. - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to list row access policies. - */ - // const tableId = 'abc123' - /** - * Page token, returned by a previous call, to request the next page of - * results. - */ - // const pageToken = 'abc123' - /** - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - */ - // const pageSize = 1234 - - // Imports the Bigquery library - const {RowAccessPolicyServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new RowAccessPolicyServiceClient(); - - async function callListRowAccessPolicies() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const iterable = bigqueryClient.listRowAccessPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRowAccessPolicies(); - // [END bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline deleted file mode 100644 index 917111d47b08..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/snippet_metadata_google.cloud.bigquery.v2.json.baseline +++ /dev/null @@ -1,1647 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-bigquery", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.bigquery.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "bigquery_v2_generated_DatasetService_GetDataset_async", - "title": "DatasetService getDataset Sample", - "origin": "API_DEFINITION", - "description": " Returns the dataset specified by datasetID.", - "canonical": true, - "file": "dataset_service.get_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.GetDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_view", - "type": ".google.cloud.bigquery.v2.GetDatasetRequest.DatasetView" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "GetDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.GetDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_InsertDataset_async", - "title": "DatasetService insertDataset Sample", - "origin": "API_DEFINITION", - "description": " Creates a new empty dataset.", - "canonical": true, - "file": "dataset_service.insert_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.InsertDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "InsertDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.InsertDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_PatchDataset_async", - "title": "DatasetService patchDataset Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource. This method supports RFC5789 patch semantics.", - "canonical": true, - "file": "dataset_service.patch_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.PatchDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "PatchDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.PatchDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_UpdateDataset_async", - "title": "DatasetService updateDataset Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing dataset. The update method replaces the entire dataset resource, whereas the patch method only replaces fields that are provided in the submitted dataset resource.", - "canonical": true, - "file": "dataset_service.update_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": ".google.cloud.bigquery.v2.Dataset" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "UpdateDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UpdateDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_DeleteDataset_async", - "title": "DatasetService deleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Deletes the dataset specified by the datasetId value. Before you can delete a dataset, you must delete all its tables, either manually or by specifying deleteContents. Immediately after deletion, you can create another dataset with the same name.", - "canonical": true, - "file": "dataset_service.delete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.DeleteDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "delete_contents", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "DeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.DeleteDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_ListDatasets_async", - "title": "DatasetService listDatasets Sample", - "origin": "API_DEFINITION", - "description": " Lists all datasets in the specified project to which the user has been granted the READER dataset role.", - "canonical": true, - "file": "dataset_service.list_datasets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDatasets", - "fullName": "google.cloud.bigquery.v2.DatasetService.ListDatasets", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "all", - "type": "TYPE_BOOL" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.DatasetList", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "ListDatasets", - "fullName": "google.cloud.bigquery.v2.DatasetService.ListDatasets", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_DatasetService_UndeleteDataset_async", - "title": "DatasetService undeleteDataset Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a dataset which is within time travel window based on datasetId. If a time is specified, the dataset version deleted at that time is undeleted, else the last live version is undeleted.", - "canonical": true, - "file": "dataset_service.undelete_dataset.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UndeleteDataset", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "deletion_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.bigquery.v2.Dataset", - "client": { - "shortName": "DatasetServiceClient", - "fullName": "google.cloud.bigquery.v2.DatasetServiceClient" - }, - "method": { - "shortName": "UndeleteDataset", - "fullName": "google.cloud.bigquery.v2.DatasetService.UndeleteDataset", - "service": { - "shortName": "DatasetService", - "fullName": "google.cloud.bigquery.v2.DatasetService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_CancelJob_async", - "title": "DatasetService cancelJob Sample", - "origin": "API_DEFINITION", - "description": " Requests that a job be cancelled. This call will return immediately, and the client will need to poll for the job status to see if the cancel completed successfully. Cancelled jobs may still incur costs.", - "canonical": true, - "file": "job_service.cancel_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelJob", - "fullName": "google.cloud.bigquery.v2.JobService.CancelJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.JobCancelResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "CancelJob", - "fullName": "google.cloud.bigquery.v2.JobService.CancelJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_GetJob_async", - "title": "DatasetService getJob Sample", - "origin": "API_DEFINITION", - "description": " Returns information about a specific job. Job information is available for a six month period after creation. Requires that you're the person who ran the job, or have the Is Owner project role.", - "canonical": true, - "file": "job_service.get_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJob", - "fullName": "google.cloud.bigquery.v2.JobService.GetJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Job", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "GetJob", - "fullName": "google.cloud.bigquery.v2.JobService.GetJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_InsertJob_async", - "title": "DatasetService insertJob Sample", - "origin": "API_DEFINITION", - "description": " Starts a new asynchronous job. This API has two different kinds of endpoint URIs, as this method supports a variety of use cases. * The *Metadata* URI is used for most interactions, as it accepts the job configuration directly. * The *Upload* URI is ONLY for the case when you're sending both a load job configuration and a data stream together. In this case, the Upload URI accepts the job configuration and the data as two distinct multipart MIME parts.", - "canonical": true, - "file": "job_service.insert_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertJob", - "fullName": "google.cloud.bigquery.v2.JobService.InsertJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job", - "type": ".google.cloud.bigquery.v2.Job" - } - ], - "resultType": ".google.cloud.bigquery.v2.Job", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "InsertJob", - "fullName": "google.cloud.bigquery.v2.JobService.InsertJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_DeleteJob_async", - "title": "DatasetService deleteJob Sample", - "origin": "API_DEFINITION", - "description": " Requests the deletion of the metadata of a job. This call returns when the job's metadata is deleted.", - "canonical": true, - "file": "job_service.delete_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJob", - "fullName": "google.cloud.bigquery.v2.JobService.DeleteJob", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "DeleteJob", - "fullName": "google.cloud.bigquery.v2.JobService.DeleteJob", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_ListJobs_async", - "title": "DatasetService listJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists all jobs that you started in the specified project. Job information is available for a six month period after creation. The job list is sorted in reverse chronological order, by job creation time. Requires the Can View project role, or the Is Owner project role if you set the allUsers property.", - "canonical": true, - "file": "job_service.list_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 91, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobs", - "fullName": "google.cloud.bigquery.v2.JobService.ListJobs", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "all_users", - "type": "TYPE_BOOL" - }, - { - "name": "max_results", - "type": ".google.protobuf.Int32Value" - }, - { - "name": "min_creation_time", - "type": "TYPE_UINT64" - }, - { - "name": "max_creation_time", - "type": ".google.protobuf.UInt64Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "projection", - "type": ".google.cloud.bigquery.v2.ListJobsRequest.Projection" - }, - { - "name": "state_filter", - "type": "TYPE_ENUM[]" - }, - { - "name": "parent_job_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.JobList", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "ListJobs", - "fullName": "google.cloud.bigquery.v2.JobService.ListJobs", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_GetQueryResults_async", - "title": "DatasetService getQueryResults Sample", - "origin": "API_DEFINITION", - "description": " RPC to get the results of a query job.", - "canonical": true, - "file": "job_service.get_query_results.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 101, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetQueryResults", - "fullName": "google.cloud.bigquery.v2.JobService.GetQueryResults", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "start_index", - "type": ".google.protobuf.UInt64Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "timeout_ms", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "location", - "type": "TYPE_STRING" - }, - { - "name": "format_options", - "type": ".google.cloud.bigquery.v2.DataFormatOptions" - } - ], - "resultType": ".google.cloud.bigquery.v2.GetQueryResultsResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "GetQueryResults", - "fullName": "google.cloud.bigquery.v2.JobService.GetQueryResults", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_JobService_Query_async", - "title": "DatasetService query Sample", - "origin": "API_DEFINITION", - "description": " Runs a BigQuery SQL query synchronously and returns query results if the query completes within a specified timeout.", - "canonical": true, - "file": "job_service.query.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Query", - "fullName": "google.cloud.bigquery.v2.JobService.Query", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "query_request", - "type": ".google.cloud.bigquery.v2.QueryRequest" - } - ], - "resultType": ".google.cloud.bigquery.v2.QueryResponse", - "client": { - "shortName": "JobServiceClient", - "fullName": "google.cloud.bigquery.v2.JobServiceClient" - }, - "method": { - "shortName": "Query", - "fullName": "google.cloud.bigquery.v2.JobService.Query", - "service": { - "shortName": "JobService", - "fullName": "google.cloud.bigquery.v2.JobService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_GetModel_async", - "title": "DatasetService getModel Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified model resource by model ID.", - "canonical": true, - "file": "model_service.get_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetModel", - "fullName": "google.cloud.bigquery.v2.ModelService.GetModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "GetModel", - "fullName": "google.cloud.bigquery.v2.ModelService.GetModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_ListModels_async", - "title": "DatasetService listModels Sample", - "origin": "API_DEFINITION", - "description": " Lists all models in the specified dataset. Requires the READER dataset role. After retrieving the list of models, you can get information about a particular model by calling the models.get method.", - "canonical": true, - "file": "model_service.list_models.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListModels", - "fullName": "google.cloud.bigquery.v2.ModelService.ListModels", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListModelsResponse", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "ListModels", - "fullName": "google.cloud.bigquery.v2.ModelService.ListModels", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_PatchModel_async", - "title": "DatasetService patchModel Sample", - "origin": "API_DEFINITION", - "description": " Patch specific fields in the specified model.", - "canonical": true, - "file": "model_service.patch_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchModel", - "fullName": "google.cloud.bigquery.v2.ModelService.PatchModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": ".google.cloud.bigquery.v2.Model" - } - ], - "resultType": ".google.cloud.bigquery.v2.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "PatchModel", - "fullName": "google.cloud.bigquery.v2.ModelService.PatchModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ModelService_DeleteModel_async", - "title": "DatasetService deleteModel Sample", - "origin": "API_DEFINITION", - "description": " Deletes the model specified by modelId from the dataset.", - "canonical": true, - "file": "model_service.delete_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteModel", - "fullName": "google.cloud.bigquery.v2.ModelService.DeleteModel", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "model_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.bigquery.v2.ModelServiceClient" - }, - "method": { - "shortName": "DeleteModel", - "fullName": "google.cloud.bigquery.v2.ModelService.DeleteModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.bigquery.v2.ModelService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_ProjectService_GetServiceAccount_async", - "title": "DatasetService getServiceAccount Sample", - "origin": "API_DEFINITION", - "description": " RPC to get the service account for a project used for interactions with Google Cloud KMS", - "canonical": true, - "file": "project_service.get_service_account.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServiceAccount", - "fullName": "google.cloud.bigquery.v2.ProjectService.GetServiceAccount", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.GetServiceAccountResponse", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.bigquery.v2.ProjectServiceClient" - }, - "method": { - "shortName": "GetServiceAccount", - "fullName": "google.cloud.bigquery.v2.ProjectService.GetServiceAccount", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.bigquery.v2.ProjectService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_GetRoutine_async", - "title": "DatasetService getRoutine Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified routine resource by routine ID.", - "canonical": true, - "file": "routine_service.get_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.GetRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "GetRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.GetRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_InsertRoutine_async", - "title": "DatasetService insertRoutine Sample", - "origin": "API_DEFINITION", - "description": " Creates a new routine in the dataset.", - "canonical": true, - "file": "routine_service.insert_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.InsertRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "InsertRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.InsertRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_UpdateRoutine_async", - "title": "DatasetService updateRoutine Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing routine. The update method replaces the entire Routine resource.", - "canonical": true, - "file": "routine_service.update_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.UpdateRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "UpdateRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.UpdateRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_PatchRoutine_async", - "title": "DatasetService patchRoutine Sample", - "origin": "API_DEFINITION", - "description": " Patches information in an existing routine. The patch method does a partial update to an existing Routine resource.", - "canonical": true, - "file": "routine_service.patch_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.PatchRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - }, - { - "name": "routine", - "type": ".google.cloud.bigquery.v2.Routine" - }, - { - "name": "field_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.bigquery.v2.Routine", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "PatchRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.PatchRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_DeleteRoutine_async", - "title": "DatasetService deleteRoutine Sample", - "origin": "API_DEFINITION", - "description": " Deletes the routine specified by routineId from the dataset.", - "canonical": true, - "file": "routine_service.delete_routine.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.DeleteRoutine", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "routine_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "DeleteRoutine", - "fullName": "google.cloud.bigquery.v2.RoutineService.DeleteRoutine", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RoutineService_ListRoutines_async", - "title": "DatasetService listRoutines Sample", - "origin": "API_DEFINITION", - "description": " Lists all routines in the specified dataset. Requires the READER dataset role.", - "canonical": true, - "file": "routine_service.list_routines.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRoutines", - "fullName": "google.cloud.bigquery.v2.RoutineService.ListRoutines", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListRoutinesResponse", - "client": { - "shortName": "RoutineServiceClient", - "fullName": "google.cloud.bigquery.v2.RoutineServiceClient" - }, - "method": { - "shortName": "ListRoutines", - "fullName": "google.cloud.bigquery.v2.RoutineService.ListRoutines", - "service": { - "shortName": "RoutineService", - "fullName": "google.cloud.bigquery.v2.RoutineService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async", - "title": "DatasetService listRowAccessPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists all row access policies on the specified table.", - "canonical": true, - "file": "row_access_policy_service.list_row_access_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRowAccessPolicies", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService.ListRowAccessPolicies", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.cloud.bigquery.v2.ListRowAccessPoliciesResponse", - "client": { - "shortName": "RowAccessPolicyServiceClient", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyServiceClient" - }, - "method": { - "shortName": "ListRowAccessPolicies", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService.ListRowAccessPolicies", - "service": { - "shortName": "RowAccessPolicyService", - "fullName": "google.cloud.bigquery.v2.RowAccessPolicyService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_GetTable_async", - "title": "DatasetService getTable Sample", - "origin": "API_DEFINITION", - "description": " Gets the specified table resource by table ID. This method does not return the data in the table, it only returns the table resource, which describes the structure of this table.", - "canonical": true, - "file": "table_service.get_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTable", - "fullName": "google.cloud.bigquery.v2.TableService.GetTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "selected_fields", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.bigquery.v2.GetTableRequest.TableMetadataView" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "GetTable", - "fullName": "google.cloud.bigquery.v2.TableService.GetTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_InsertTable_async", - "title": "DatasetService insertTable Sample", - "origin": "API_DEFINITION", - "description": " Creates a new, empty table in the dataset.", - "canonical": true, - "file": "table_service.insert_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InsertTable", - "fullName": "google.cloud.bigquery.v2.TableService.InsertTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "InsertTable", - "fullName": "google.cloud.bigquery.v2.TableService.InsertTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_PatchTable_async", - "title": "DatasetService patchTable Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing table. The update method replaces the entire table resource, whereas the patch method only replaces fields that are provided in the submitted table resource. This method supports RFC5789 patch semantics.", - "canonical": true, - "file": "table_service.patch_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PatchTable", - "fullName": "google.cloud.bigquery.v2.TableService.PatchTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - }, - { - "name": "autodetect_schema", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "PatchTable", - "fullName": "google.cloud.bigquery.v2.TableService.PatchTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_UpdateTable_async", - "title": "DatasetService updateTable Sample", - "origin": "API_DEFINITION", - "description": " Updates information in an existing table. The update method replaces the entire Table resource, whereas the patch method only replaces fields that are provided in the submitted Table resource.", - "canonical": true, - "file": "table_service.update_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateTable", - "fullName": "google.cloud.bigquery.v2.TableService.UpdateTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - }, - { - "name": "table", - "type": ".google.cloud.bigquery.v2.Table" - }, - { - "name": "autodetect_schema", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.bigquery.v2.Table", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "UpdateTable", - "fullName": "google.cloud.bigquery.v2.TableService.UpdateTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_DeleteTable_async", - "title": "DatasetService deleteTable Sample", - "origin": "API_DEFINITION", - "description": " Deletes the table specified by tableId from the dataset. If the table contains data, all the data will be deleted.", - "canonical": true, - "file": "table_service.delete_table.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTable", - "fullName": "google.cloud.bigquery.v2.TableService.DeleteTable", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "table_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "DeleteTable", - "fullName": "google.cloud.bigquery.v2.TableService.DeleteTable", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - }, - { - "regionTag": "bigquery_v2_generated_TableService_ListTables_async", - "title": "DatasetService listTables Sample", - "origin": "API_DEFINITION", - "description": " Lists all tables in the specified dataset. Requires the READER dataset role.", - "canonical": true, - "file": "table_service.list_tables.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTables", - "fullName": "google.cloud.bigquery.v2.TableService.ListTables", - "async": true, - "parameters": [ - { - "name": "project_id", - "type": "TYPE_STRING" - }, - { - "name": "dataset_id", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": ".google.protobuf.UInt32Value" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.bigquery.v2.TableList", - "client": { - "shortName": "TableServiceClient", - "fullName": "google.cloud.bigquery.v2.TableServiceClient" - }, - "method": { - "shortName": "ListTables", - "fullName": "google.cloud.bigquery.v2.TableService.ListTables", - "service": { - "shortName": "TableService", - "fullName": "google.cloud.bigquery.v2.TableService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.delete_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.delete_table.js.baseline deleted file mode 100644 index 2becfa09b578..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.delete_table.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_TableService_DeleteTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to delete - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to delete - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to delete - */ - // const tableId = 'abc123' - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callDeleteTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const response = await bigqueryClient.deleteTable(request); - console.log(response); - } - - callDeleteTable(); - // [END bigquery_v2_generated_TableService_DeleteTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.get_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.get_table.js.baseline deleted file mode 100644 index 40670c75158c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.get_table.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId) { - // [START bigquery_v2_generated_TableService_GetTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the requested table - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the requested table - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the requested table - */ - // const tableId = 'abc123' - /** - * List of table schema fields to return (comma-separated). - * If unspecified, all fields are returned. - * A fieldMask cannot be used here because the fields will automatically be - * converted from camelCase to snake_case and the conversion will fail if - * there are underscores. Since these are fields in BigQuery table schemas, - * underscores are allowed. - */ - // const selectedFields = 'abc123' - /** - * Optional. Specifies the view that determines which table information is - * returned. By default, basic table information and storage statistics - * (STORAGE_STATS) are returned. - */ - // const view = {} - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callGetTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - }; - - // Run request - const response = await bigqueryClient.getTable(request); - console.log(response); - } - - callGetTable(); - // [END bigquery_v2_generated_TableService_GetTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.insert_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.insert_table.js.baseline deleted file mode 100644 index e91288f6a105..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.insert_table.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, table) { - // [START bigquery_v2_generated_TableService_InsertTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the new table - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the new table - */ - // const datasetId = 'abc123' - /** - * Required. A tables resource to insert - */ - // const table = {} - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callInsertTable() { - // Construct request - const request = { - projectId, - datasetId, - table, - }; - - // Run request - const response = await bigqueryClient.insertTable(request); - console.log(response); - } - - callInsertTable(); - // [END bigquery_v2_generated_TableService_InsertTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.list_tables.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.list_tables.js.baseline deleted file mode 100644 index ac8d9d6dfcf8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.list_tables.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId) { - // [START bigquery_v2_generated_TableService_ListTables_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the tables to list - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the tables to list - */ - // const datasetId = 'abc123' - /** - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - */ - // const maxResults = 1234 - /** - * Page token, returned by a previous call, to request the next page of - * results - */ - // const pageToken = 'abc123' - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callListTables() { - // Construct request - const request = { - projectId, - datasetId, - }; - - // Run request - const iterable = bigqueryClient.listTablesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTables(); - // [END bigquery_v2_generated_TableService_ListTables_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.patch_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.patch_table.js.baseline deleted file mode 100644 index c3f7e333d181..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.patch_table.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId, table) { - // [START bigquery_v2_generated_TableService_PatchTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to update - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to update - */ - // const tableId = 'abc123' - /** - * Required. A tables resource which will replace or patch the specified table - */ - // const table = {} - /** - * Optional. When true will autodetect schema, else will keep original schema. - */ - // const autodetectSchema = true - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callPatchTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - table, - }; - - // Run request - const response = await bigqueryClient.patchTable(request); - console.log(response); - } - - callPatchTable(); - // [END bigquery_v2_generated_TableService_PatchTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.update_table.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.update_table.js.baseline deleted file mode 100644 index 639401eb936d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/samples/generated/v2/table_service.update_table.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(projectId, datasetId, tableId, table) { - // [START bigquery_v2_generated_TableService_UpdateTable_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project ID of the table to update - */ - // const projectId = 'abc123' - /** - * Required. Dataset ID of the table to update - */ - // const datasetId = 'abc123' - /** - * Required. Table ID of the table to update - */ - // const tableId = 'abc123' - /** - * Required. A tables resource which will replace or patch the specified table - */ - // const table = {} - /** - * Optional. When true will autodetect schema, else will keep original schema. - */ - // const autodetectSchema = true - - // Imports the Bigquery library - const {TableServiceClient} = require('bigquery').v2; - - // Instantiates a client - const bigqueryClient = new TableServiceClient(); - - async function callUpdateTable() { - // Construct request - const request = { - projectId, - datasetId, - tableId, - table, - }; - - // Run request - const response = await bigqueryClient.updateTable(request); - console.log(response); - } - - callUpdateTable(); - // [END bigquery_v2_generated_TableService_UpdateTable_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/index.ts.baseline deleted file mode 100644 index 9b89a10c9e7b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/index.ts.baseline +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2'; -const DatasetServiceClient = v2.DatasetServiceClient; -type DatasetServiceClient = v2.DatasetServiceClient; -const JobServiceClient = v2.JobServiceClient; -type JobServiceClient = v2.JobServiceClient; -const ModelServiceClient = v2.ModelServiceClient; -type ModelServiceClient = v2.ModelServiceClient; -const ProjectServiceClient = v2.ProjectServiceClient; -type ProjectServiceClient = v2.ProjectServiceClient; -const RoutineServiceClient = v2.RoutineServiceClient; -type RoutineServiceClient = v2.RoutineServiceClient; -const RowAccessPolicyServiceClient = v2.RowAccessPolicyServiceClient; -type RowAccessPolicyServiceClient = v2.RowAccessPolicyServiceClient; -const TableServiceClient = v2.TableServiceClient; -type TableServiceClient = v2.TableServiceClient; -export {v2, DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient}; -export default {v2, DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client.ts.baseline deleted file mode 100644 index f21d68556362..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client.ts.baseline +++ /dev/null @@ -1,1190 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/dataset_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './dataset_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Dataset Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class DatasetServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - datasetServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DatasetServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 DatasetServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DatasetServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listDatasets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'datasets') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.DatasetService', gapicConfig as gax.ClientConfig, - 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.datasetServiceStub) { - return this.datasetServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.DatasetService. - this.datasetServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.DatasetService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.DatasetService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const datasetServiceStubMethods = - ['getDataset', 'insertDataset', 'patchDataset', 'updateDataset', 'deleteDataset', 'listDatasets', 'undeleteDataset']; - for (const methodName of datasetServiceStubMethods) { - const callPromise = this.datasetServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.datasetServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns the dataset specified by datasetID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested dataset - * @param {string} request.datasetId - * Required. Dataset ID of the requested dataset - * @param {google.cloud.bigquery.v2.GetDatasetRequest.DatasetView} [request.datasetView] - * Optional. Specifies the view that determines which dataset information is - * returned. By default, metadata and ACL information 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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.get_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_GetDataset_async - */ - getDataset( - request?: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, {}|undefined - ]>; - getDataset( - request: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): void; - getDataset( - request?: protos.google.cloud.bigquery.v2.IGetDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IGetDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new empty dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new dataset - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource to use for the new dataset - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.insert_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_InsertDataset_async - */ - insertDataset( - request?: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, {}|undefined - ]>; - insertDataset( - request: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): void; - insertDataset( - request: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): void; - insertDataset( - request?: protos.google.cloud.bigquery.v2.IInsertDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.insertDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IInsertDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('insertDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing dataset. The update method replaces the - * entire dataset resource, whereas the patch method only replaces fields that - * are provided in the submitted dataset resource. - * This method supports RFC5789 patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being updated - * @param {string} request.datasetId - * Required. Dataset ID of the dataset being updated - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource which will replace or patch the specified - * dataset. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.patch_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_PatchDataset_async - */ - patchDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>; - patchDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - patchDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - patchDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.patchDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('patchDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing dataset. The update method replaces the - * entire dataset resource, whereas the patch method only replaces fields that - * are provided in the submitted dataset resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being updated - * @param {string} request.datasetId - * Required. Dataset ID of the dataset being updated - * @param {google.cloud.bigquery.v2.Dataset} request.dataset - * Required. Datasets resource which will replace or patch the specified - * dataset. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.update_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_UpdateDataset_async - */ - updateDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>; - updateDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - updateDataset( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): void; - updateDataset( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUpdateOrPatchDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the dataset specified by the datasetId value. Before you can delete - * a dataset, you must delete all its tables, either manually or by specifying - * deleteContents. Immediately after deletion, you can create another dataset - * with the same name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset being deleted - * @param {string} request.datasetId - * Required. Dataset ID of dataset being deleted - * @param {boolean} request.deleteContents - * If True, delete all the tables in the dataset. - * If False and the dataset contains tables, the request will fail. - * Default is False - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.delete_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_DeleteDataset_async - */ - deleteDataset( - request?: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, {}|undefined - ]>; - deleteDataset( - request: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - deleteDataset( - request?: protos.google.cloud.bigquery.v2.IDeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDataset request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Undeletes a dataset which is within time travel window based on datasetId. - * If a time is specified, the dataset version deleted at that time is - * undeleted, else the last live version is undeleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the dataset to be undeleted - * @param {string} request.datasetId - * Required. Dataset ID of dataset being deleted - * @param {google.protobuf.Timestamp} [request.deletionTime] - * Optional. The exact time when the dataset was deleted. If not specified, - * the most recently deleted version is undeleted. Undeleting a dataset - * using deletion time is not supported. - * @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 {@link protos.google.cloud.bigquery.v2.Dataset|Dataset}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dataset_service.undelete_dataset.js - * region_tag:bigquery_v2_generated_DatasetService_UndeleteDataset_async - */ - undeleteDataset( - request?: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, {}|undefined - ]>; - undeleteDataset( - request: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - undeleteDataset( - request: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): void; - undeleteDataset( - request?: protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('undeleteDataset request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('undeleteDataset response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.undeleteDataset(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IDataset, - protos.google.cloud.bigquery.v2.IUndeleteDatasetRequest|undefined, - {}|undefined - ]) => { - this._log.info('undeleteDataset response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all datasets in the specified project to which the user has been - * granted the READER dataset role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDatasetsAsync()` - * 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. - */ - listDatasets( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]>; - listDatasets( - request: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): void; - listDatasets( - request: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): void; - listDatasets( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListDatasetsRequest, - protos.google.cloud.bigquery.v2.IDatasetList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatDataset>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDatasets values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listDatasets request %j', request); - return this.innerApiCalls - .listDatasets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatDataset[], - protos.google.cloud.bigquery.v2.IListDatasetsRequest|null, - protos.google.cloud.bigquery.v2.IDatasetList - ]) => { - this._log.info('listDatasets values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDatasets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset} 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 `listDatasetsAsync()` - * 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. - */ - listDatasetsStream( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDatasets stream %j', request); - return this.descriptors.page.listDatasets.createStream( - this.innerApiCalls.listDatasets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDatasets`, 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.projectId - * Required. Project ID of the datasets to be listed - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {boolean} request.all - * Whether to list all datasets, including hidden ones - * @param {string} request.filter - * An expression for filtering the results of the request by label. - * The syntax is `labels.[:]`. - * Multiple filters can be ANDed together by connecting with a space. - * Example: `labels.department:receiving labels.active`. - * See [Filtering datasets using - * labels](https://cloud.google.com/bigquery/docs/filtering-labels#filtering_datasets_using_labels) - * for details. - * @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.cloud.bigquery.v2.ListFormatDataset|ListFormatDataset}. 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 include:samples/generated/v2/dataset_service.list_datasets.js - * region_tag:bigquery_v2_generated_DatasetService_ListDatasets_async - */ - listDatasetsAsync( - request?: protos.google.cloud.bigquery.v2.IListDatasetsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDatasets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDatasets iterate %j', request); - return this.descriptors.page.listDatasets.asyncIterate( - this.innerApiCalls['listDatasets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.datasetServiceStub && !this._terminated) { - return this.datasetServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client_config.json.baseline deleted file mode 100644 index 74c64e606036..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.DatasetService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDatasets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteDataset": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/dataset_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/index.ts.baseline deleted file mode 100644 index f8f6d8ed6976..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -export {DatasetServiceClient} from './dataset_service_client'; -export {JobServiceClient} from './job_service_client'; -export {ModelServiceClient} from './model_service_client'; -export {ProjectServiceClient} from './project_service_client'; -export {RoutineServiceClient} from './routine_service_client'; -export {RowAccessPolicyServiceClient} from './row_access_policy_service_client'; -export {TableServiceClient} from './table_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client.ts.baseline deleted file mode 100644 index a8e75365e8d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client.ts.baseline +++ /dev/null @@ -1,1263 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/job_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './job_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Job Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class JobServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - jobServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of JobServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 JobServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof JobServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'jobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.JobService', gapicConfig as gax.ClientConfig, - 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.jobServiceStub) { - return this.jobServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.JobService. - this.jobServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.JobService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.JobService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const jobServiceStubMethods = - ['cancelJob', 'getJob', 'insertJob', 'deleteJob', 'listJobs', 'getQueryResults', 'query']; - for (const methodName of jobServiceStubMethods) { - const callPromise = this.jobServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.jobServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/devstorage.full_control', - 'https://www.googleapis.com/auth/devstorage.read_only', - 'https://www.googleapis.com/auth/devstorage.read_write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Requests that a job be cancelled. This call will return immediately, and - * the client will need to poll for the job status to see if the cancel - * completed successfully. Cancelled jobs may still incur costs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the job to cancel - * @param {string} request.jobId - * Required. Job ID of the job to cancel - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.cloud.bigquery.v2.JobCancelResponse|JobCancelResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.cancel_job.js - * region_tag:bigquery_v2_generated_JobService_CancelJob_async - */ - cancelJob( - request?: protos.google.cloud.bigquery.v2.ICancelJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, {}|undefined - ]>; - cancelJob( - request: protos.google.cloud.bigquery.v2.ICancelJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request: protos.google.cloud.bigquery.v2.ICancelJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): void; - cancelJob( - request?: protos.google.cloud.bigquery.v2.ICancelJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('cancelJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancelJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.cancelJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJobCancelResponse, - protos.google.cloud.bigquery.v2.ICancelJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancelJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns information about a specific job. Job information is available for - * a six month period after creation. Requires that you're the person who ran - * the job, or have the Is Owner project role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested job. - * @param {string} request.jobId - * Required. Job ID of the requested job. - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.cloud.bigquery.v2.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.get_job.js - * region_tag:bigquery_v2_generated_JobService_GetJob_async - */ - getJob( - request?: protos.google.cloud.bigquery.v2.IGetJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, {}|undefined - ]>; - getJob( - request: protos.google.cloud.bigquery.v2.IGetJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request: protos.google.cloud.bigquery.v2.IGetJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): void; - getJob( - request?: protos.google.cloud.bigquery.v2.IGetJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IGetJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Starts a new asynchronous job. - * - * This API has two different kinds of endpoint URIs, as this method supports - * a variety of use cases. - * - * * The *Metadata* URI is used for most interactions, as it accepts the job - * configuration directly. - * * The *Upload* URI is ONLY for the case when you're sending both a load job - * configuration and a data stream together. In this case, the Upload URI - * accepts the job configuration and the data as two distinct multipart MIME - * parts. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of project that will be billed for the job. - * @param {google.cloud.bigquery.v2.Job} request.job - * Jobs resource to insert. - * @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 {@link protos.google.cloud.bigquery.v2.Job|Job}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.insert_job.js - * region_tag:bigquery_v2_generated_JobService_InsertJob_async - */ - insertJob( - request?: protos.google.cloud.bigquery.v2.IInsertJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, {}|undefined - ]>; - insertJob( - request: protos.google.cloud.bigquery.v2.IInsertJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): void; - insertJob( - request: protos.google.cloud.bigquery.v2.IInsertJobRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): void; - insertJob( - request?: protos.google.cloud.bigquery.v2.IInsertJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.insertJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IJob, - protos.google.cloud.bigquery.v2.IInsertJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('insertJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Requests the deletion of the metadata of a job. This call returns when the - * job's metadata is deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the job for which metadata is to be deleted. - * @param {string} request.jobId - * Required. Job ID of the job for which metadata is to be deleted. If this is - * a parent job which has child jobs, the metadata from all child jobs will be - * deleted as well. Direct deletion of the metadata of child jobs is not - * allowed. - * @param {string} request.location - * The geographic location of the job. Required. - * See details at: - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.delete_job.js - * region_tag:bigquery_v2_generated_JobService_DeleteJob_async - */ - deleteJob( - request?: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, {}|undefined - ]>; - deleteJob( - request: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): void; - deleteJob( - request?: protos.google.cloud.bigquery.v2.IDeleteJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * RPC to get the results of a query job. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the query job. - * @param {string} request.jobId - * Required. Job ID of the query job. - * @param {google.protobuf.UInt64Value} request.startIndex - * Zero-based index of the starting row. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.protobuf.UInt32Value} request.maxResults - * Maximum number of results to read. - * @param {google.protobuf.UInt32Value} request.timeoutMs - * Optional: Specifies the maximum amount of time, in milliseconds, that the - * client is willing to wait for the query to complete. By default, this limit - * is 10 seconds (10,000 milliseconds). If the query is complete, the - * jobComplete field in the response is true. If the query has not yet - * completed, jobComplete is false. - * - * You can request a longer timeout period in the timeoutMs field. However, - * the call is not guaranteed to wait for the specified timeout; it typically - * returns after around 200 seconds (200,000 milliseconds), even if the query - * is not complete. - * - * If jobComplete is false, you can continue to wait for the query to complete - * by calling the getQueryResults method until the jobComplete field in the - * getQueryResults response is true. - * @param {string} request.location - * The geographic location of the job. You must specify the location to run - * the job for the following scenarios: - * - * * If the location to run a job is not in the `us` or - * the `eu` multi-regional location - * * If the job's location is in a single region (for example, - * `us-central1`) - * - * For more information, see - * https://cloud.google.com/bigquery/docs/locations#specifying_your_location. - * @param {google.cloud.bigquery.v2.DataFormatOptions} [request.formatOptions] - * Optional. Output format adjustments. - * @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 {@link protos.google.cloud.bigquery.v2.GetQueryResultsResponse|GetQueryResultsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.get_query_results.js - * region_tag:bigquery_v2_generated_JobService_GetQueryResults_async - */ - getQueryResults( - request?: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, {}|undefined - ]>; - getQueryResults( - request: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): void; - getQueryResults( - request: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): void; - getQueryResults( - request?: protos.google.cloud.bigquery.v2.IGetQueryResultsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'job_id': request.jobId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getQueryResults request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getQueryResults response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getQueryResults(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IGetQueryResultsResponse, - protos.google.cloud.bigquery.v2.IGetQueryResultsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getQueryResults response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Runs a BigQuery SQL query synchronously and returns query results if the - * query completes within a specified timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the query request. - * @param {google.cloud.bigquery.v2.QueryRequest} request.queryRequest - * The query request body. - * @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 {@link protos.google.cloud.bigquery.v2.QueryResponse|QueryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/job_service.query.js - * region_tag:bigquery_v2_generated_JobService_Query_async - */ - query( - request?: protos.google.cloud.bigquery.v2.IPostQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, {}|undefined - ]>; - query( - request: protos.google.cloud.bigquery.v2.IPostQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): void; - query( - request: protos.google.cloud.bigquery.v2.IPostQueryRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): void; - query( - request?: protos.google.cloud.bigquery.v2.IPostQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('query request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('query response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.query(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IQueryResponse, - protos.google.cloud.bigquery.v2.IPostQueryRequest|undefined, - {}|undefined - ]) => { - this._log.info('query response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all jobs that you started in the specified project. Job information - * is available for a six month period after creation. The job list is sorted - * in reverse chronological order, by job creation time. Requires the Can View - * project role, or the Is Owner project role if you set the allUsers - * property. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatJob|ListFormatJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobsAsync()` - * 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. - */ - listJobs( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]>; - listJobs( - request: protos.google.cloud.bigquery.v2.IListJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): void; - listJobs( - request: protos.google.cloud.bigquery.v2.IListJobsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): void; - listJobs( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListJobsRequest, - protos.google.cloud.bigquery.v2.IJobList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listJobs request %j', request); - return this.innerApiCalls - .listJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatJob[], - protos.google.cloud.bigquery.v2.IListJobsRequest|null, - protos.google.cloud.bigquery.v2.IJobList - ]) => { - this._log.info('listJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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.cloud.bigquery.v2.ListFormatJob|ListFormatJob} 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 `listJobsAsync()` - * 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. - */ - listJobsStream( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobs stream %j', request); - return this.descriptors.page.listJobs.createStream( - this.innerApiCalls.listJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobs`, 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.projectId - * Project ID of the jobs to list. - * @param {boolean} request.allUsers - * Whether to display jobs owned by all users in the project. Default False. - * @param {google.protobuf.Int32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {number} request.minCreationTime - * Min value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created after or at this timestamp are returned. - * @param {google.protobuf.UInt64Value} request.maxCreationTime - * Max value for job creation time, in milliseconds since the POSIX epoch. - * If set, only jobs created before or at this timestamp are returned. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {google.cloud.bigquery.v2.ListJobsRequest.Projection} request.projection - * Restrict information returned to a set of selected fields - * @param {number[]} request.stateFilter - * Filter for job state - * @param {string} request.parentJobId - * If set, show only child jobs of the specified parent. Otherwise, show all - * top-level jobs. - * @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.cloud.bigquery.v2.ListFormatJob|ListFormatJob}. 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 include:samples/generated/v2/job_service.list_jobs.js - * region_tag:bigquery_v2_generated_JobService_ListJobs_async - */ - listJobsAsync( - request?: protos.google.cloud.bigquery.v2.IListJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobs iterate %j', request); - return this.descriptors.page.listJobs.asyncIterate( - this.innerApiCalls['listJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.jobServiceStub && !this._terminated) { - return this.jobServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client_config.json.baseline deleted file mode 100644 index 7b1d7cc9384f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.JobService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CancelJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetQueryResults": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Query": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/job_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client.ts.baseline deleted file mode 100644 index a08285153dd7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client.ts.baseline +++ /dev/null @@ -1,866 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/model_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './model_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Model Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class ModelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - modelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ModelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ModelServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ModelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listModels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'models') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.ModelService', gapicConfig as gax.ClientConfig, - 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.modelServiceStub) { - return this.modelServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.ModelService. - this.modelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.ModelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.ModelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const modelServiceStubMethods = - ['getModel', 'listModels', 'patchModel', 'deleteModel']; - for (const methodName of modelServiceStubMethods) { - const callPromise = this.modelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.modelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified model resource by model ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested model. - * @param {string} request.datasetId - * Required. Dataset ID of the requested model. - * @param {string} request.modelId - * Required. Model ID of the requested model. - * @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 {@link protos.google.cloud.bigquery.v2.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.get_model.js - * region_tag:bigquery_v2_generated_ModelService_GetModel_async - */ - getModel( - request?: protos.google.cloud.bigquery.v2.IGetModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, {}|undefined - ]>; - getModel( - request: protos.google.cloud.bigquery.v2.IGetModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request: protos.google.cloud.bigquery.v2.IGetModelRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request?: protos.google.cloud.bigquery.v2.IGetModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IGetModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('getModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Patch specific fields in the specified model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the model to patch. - * @param {string} request.datasetId - * Required. Dataset ID of the model to patch. - * @param {string} request.modelId - * Required. Model ID of the model to patch. - * @param {google.cloud.bigquery.v2.Model} request.model - * Required. Patched model. - * Follows RFC5789 patch semantics. Missing fields are not updated. - * To clear a field, explicitly set to default value. - * @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 {@link protos.google.cloud.bigquery.v2.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.patch_model.js - * region_tag:bigquery_v2_generated_ModelService_PatchModel_async - */ - patchModel( - request?: protos.google.cloud.bigquery.v2.IPatchModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, {}|undefined - ]>; - patchModel( - request: protos.google.cloud.bigquery.v2.IPatchModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): void; - patchModel( - request: protos.google.cloud.bigquery.v2.IPatchModelRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): void; - patchModel( - request?: protos.google.cloud.bigquery.v2.IPatchModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.patchModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IModel, - protos.google.cloud.bigquery.v2.IPatchModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('patchModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the model specified by modelId from the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the model to delete. - * @param {string} request.datasetId - * Required. Dataset ID of the model to delete. - * @param {string} request.modelId - * Required. Model ID of the model to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/model_service.delete_model.js - * region_tag:bigquery_v2_generated_ModelService_DeleteModel_async - */ - deleteModel( - request?: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, {}|undefined - ]>; - deleteModel( - request: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request?: protos.google.cloud.bigquery.v2.IDeleteModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'model_id': request.modelId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteModel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all models in the specified dataset. Requires the READER dataset - * role. After retrieving the list of models, you can get information about a - * particular model by calling the models.get method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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 Array of {@link protos.google.cloud.bigquery.v2.Model|Model}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listModelsAsync()` - * 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. - */ - listModels( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]>; - listModels( - request: protos.google.cloud.bigquery.v2.IListModelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): void; - listModels( - request: protos.google.cloud.bigquery.v2.IListModelsRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): void; - listModels( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>): - Promise<[ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListModelsRequest, - protos.google.cloud.bigquery.v2.IListModelsResponse|null|undefined, - protos.google.cloud.bigquery.v2.IModel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listModels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listModels request %j', request); - return this.innerApiCalls - .listModels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IModel[], - protos.google.cloud.bigquery.v2.IListModelsRequest|null, - protos.google.cloud.bigquery.v2.IListModelsResponse - ]) => { - this._log.info('listModels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listModels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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.cloud.bigquery.v2.Model|Model} 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 `listModelsAsync()` - * 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. - */ - listModelsStream( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels stream %j', request); - return this.descriptors.page.listModels.createStream( - this.innerApiCalls.listModels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listModels`, 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.projectId - * Required. Project ID of the models to list. - * @param {string} request.datasetId - * Required. Dataset ID of the models to list. - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call to request the next page of - * results - * @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.cloud.bigquery.v2.Model|Model}. 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 include:samples/generated/v2/model_service.list_models.js - * region_tag:bigquery_v2_generated_ModelService_ListModels_async - */ - listModelsAsync( - request?: protos.google.cloud.bigquery.v2.IListModelsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels iterate %j', request); - return this.descriptors.page.listModels.asyncIterate( - this.innerApiCalls['listModels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.modelServiceStub && !this._terminated) { - return this.modelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client_config.json.baseline deleted file mode 100644 index 76a66c9cb1e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_client_config.json.baseline +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.ModelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListModels": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteModel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/model_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client.ts.baseline deleted file mode 100644 index ab6e7ff277a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client.ts.baseline +++ /dev/null @@ -1,435 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/project_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './project_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Project Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class ProjectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - projectServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProjectServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ProjectServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProjectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.ProjectService', gapicConfig as gax.ClientConfig, - 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.projectServiceStub) { - return this.projectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.ProjectService. - this.projectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.ProjectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.ProjectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const projectServiceStubMethods = - ['getServiceAccount']; - for (const methodName of projectServiceStubMethods) { - const callPromise = this.projectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.projectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * RPC to get the service account for a project used for interactions with - * Google Cloud KMS - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. ID of the project. - * @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 {@link protos.google.cloud.bigquery.v2.GetServiceAccountResponse|GetServiceAccountResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/project_service.get_service_account.js - * region_tag:bigquery_v2_generated_ProjectService_GetServiceAccount_async - */ - getServiceAccount( - request?: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, {}|undefined - ]>; - getServiceAccount( - request: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getServiceAccount( - request: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): void; - getServiceAccount( - request?: protos.google.cloud.bigquery.v2.IGetServiceAccountRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServiceAccount request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServiceAccount response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getServiceAccount(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IGetServiceAccountResponse, - protos.google.cloud.bigquery.v2.IGetServiceAccountRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServiceAccount response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.projectServiceStub && !this._terminated) { - return this.projectServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client_config.json.baseline deleted file mode 100644 index 043d875e7d22..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.ProjectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetServiceAccount": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/project_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client.ts.baseline deleted file mode 100644 index db52c98a8164..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client.ts.baseline +++ /dev/null @@ -1,1076 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/routine_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './routine_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Routine Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class RoutineServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - routineServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RoutineServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 RoutineServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RoutineServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listRoutines: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routines') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.RoutineService', gapicConfig as gax.ClientConfig, - 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.routineServiceStub) { - return this.routineServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.RoutineService. - this.routineServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.RoutineService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.RoutineService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const routineServiceStubMethods = - ['getRoutine', 'insertRoutine', 'updateRoutine', 'patchRoutine', 'deleteRoutine', 'listRoutines']; - for (const methodName of routineServiceStubMethods) { - const callPromise = this.routineServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.routineServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified routine resource by routine ID. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested routine - * @param {string} request.datasetId - * Required. Dataset ID of the requested routine - * @param {string} request.routineId - * Required. Routine ID of the requested routine - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.get_routine.js - * region_tag:bigquery_v2_generated_RoutineService_GetRoutine_async - */ - getRoutine( - request?: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, {}|undefined - ]>; - getRoutine( - request: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): void; - getRoutine( - request: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): void; - getRoutine( - request?: protos.google.cloud.bigquery.v2.IGetRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoutine response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IGetRoutineRequest|undefined, - {}|undefined - ]) => { - this._log.info('getRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new routine in the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new routine - * @param {string} request.datasetId - * Required. Dataset ID of the new routine - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource to insert - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.insert_routine.js - * region_tag:bigquery_v2_generated_RoutineService_InsertRoutine_async - */ - insertRoutine( - request?: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, {}|undefined - ]>; - insertRoutine( - request: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): void; - insertRoutine( - request: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): void; - insertRoutine( - request?: protos.google.cloud.bigquery.v2.IInsertRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertRoutine response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.insertRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IInsertRoutineRequest|undefined, - {}|undefined - ]) => { - this._log.info('insertRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing routine. The update method replaces the - * entire Routine resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to update - * @param {string} request.datasetId - * Required. Dataset ID of the routine to update - * @param {string} request.routineId - * Required. Routine ID of the routine to update - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource which will replace the specified routine - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.update_routine.js - * region_tag:bigquery_v2_generated_RoutineService_UpdateRoutine_async - */ - updateRoutine( - request?: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, {}|undefined - ]>; - updateRoutine( - request: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): void; - updateRoutine( - request: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): void; - updateRoutine( - request?: protos.google.cloud.bigquery.v2.IUpdateRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoutine response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IUpdateRoutineRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Patches information in an existing routine. The patch method does a partial - * update to an existing Routine resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to update - * @param {string} request.datasetId - * Required. Dataset ID of the routine to update - * @param {string} request.routineId - * Required. Routine ID of the routine to update - * @param {google.cloud.bigquery.v2.Routine} request.routine - * Required. A routine resource which will be used to partially - * update the specified routine - * @param {google.protobuf.FieldMask} request.fieldMask - * Only the Routine fields in the field mask are updated - * by the given routine. Repeated routine fields will be fully replaced - * if contained in the field mask. - * @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 {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.patch_routine.js - * region_tag:bigquery_v2_generated_RoutineService_PatchRoutine_async - */ - patchRoutine( - request?: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, {}|undefined - ]>; - patchRoutine( - request: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): void; - patchRoutine( - request: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): void; - patchRoutine( - request?: protos.google.cloud.bigquery.v2.IPatchRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('patchRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchRoutine response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.patchRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.IRoutine, - protos.google.cloud.bigquery.v2.IPatchRoutineRequest|undefined, - {}|undefined - ]) => { - this._log.info('patchRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the routine specified by routineId from the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routine to delete - * @param {string} request.datasetId - * Required. Dataset ID of the routine to delete - * @param {string} request.routineId - * Required. Routine ID of the routine to delete - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/routine_service.delete_routine.js - * region_tag:bigquery_v2_generated_RoutineService_DeleteRoutine_async - */ - deleteRoutine( - request?: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, {}|undefined - ]>; - deleteRoutine( - request: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): void; - deleteRoutine( - request: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): void; - deleteRoutine( - request?: protos.google.cloud.bigquery.v2.IDeleteRoutineRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'routine_id': request.routineId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoutine request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoutine response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteRoutine(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteRoutineRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteRoutine response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all routines in the specified dataset. Requires the READER dataset - * role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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 Array of {@link protos.google.cloud.bigquery.v2.Routine|Routine}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoutinesAsync()` - * 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. - */ - listRoutines( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]>; - listRoutines( - request: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): void; - listRoutines( - request: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): void; - listRoutines( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>): - Promise<[ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRoutinesRequest, - protos.google.cloud.bigquery.v2.IListRoutinesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRoutine>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRoutines values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listRoutines request %j', request); - return this.innerApiCalls - .listRoutines(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IRoutine[], - protos.google.cloud.bigquery.v2.IListRoutinesRequest|null, - protos.google.cloud.bigquery.v2.IListRoutinesResponse - ]) => { - this._log.info('listRoutines values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRoutines`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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.cloud.bigquery.v2.Routine|Routine} 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 `listRoutinesAsync()` - * 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. - */ - listRoutinesStream( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRoutines']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRoutines stream %j', request); - return this.descriptors.page.listRoutines.createStream( - this.innerApiCalls.listRoutines as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRoutines`, 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.projectId - * Required. Project ID of the routines to list - * @param {string} request.datasetId - * Required. Dataset ID of the routines to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @param {string} request.filter - * If set, then only the Routines matching this filter are returned. - * The supported format is `routineType:{RoutineType}`, where `{RoutineType}` - * is a RoutineType enum. For example: `routineType:SCALAR_FUNCTION`. - * @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.cloud.bigquery.v2.Routine|Routine}. 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 include:samples/generated/v2/routine_service.list_routines.js - * region_tag:bigquery_v2_generated_RoutineService_ListRoutines_async - */ - listRoutinesAsync( - request?: protos.google.cloud.bigquery.v2.IListRoutinesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRoutines']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRoutines iterate %j', request); - return this.descriptors.page.listRoutines.asyncIterate( - this.innerApiCalls['listRoutines'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.routineServiceStub && !this._terminated) { - return this.routineServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client_config.json.baseline deleted file mode 100644 index 7d0cea2bae21..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.RoutineService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoutine": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRoutines": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/routine_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client.ts.baseline deleted file mode 100644 index 2c498b72ef0f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client.ts.baseline +++ /dev/null @@ -1,561 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/row_access_policy_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './row_access_policy_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for interacting with row access policies. - * @class - * @memberof v2 - */ -export class RowAccessPolicyServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - rowAccessPolicyServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RowAccessPolicyServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 RowAccessPolicyServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RowAccessPolicyServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listRowAccessPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rowAccessPolicies') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.RowAccessPolicyService', gapicConfig as gax.ClientConfig, - 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.rowAccessPolicyServiceStub) { - return this.rowAccessPolicyServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.RowAccessPolicyService. - this.rowAccessPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.RowAccessPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.RowAccessPolicyService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const rowAccessPolicyServiceStubMethods = - ['listRowAccessPolicies']; - for (const methodName of rowAccessPolicyServiceStubMethods) { - const callPromise = this.rowAccessPolicyServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.rowAccessPolicyServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Lists all row access policies on the specified table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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 Array of {@link protos.google.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRowAccessPoliciesAsync()` - * 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. - */ - listRowAccessPolicies( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]>; - listRowAccessPolicies( - request: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): void; - listRowAccessPolicies( - request: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): void; - listRowAccessPolicies( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>): - Promise<[ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse|null|undefined, - protos.google.cloud.bigquery.v2.IRowAccessPolicy>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRowAccessPolicies values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listRowAccessPolicies request %j', request); - return this.innerApiCalls - .listRowAccessPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IRowAccessPolicy[], - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest|null, - protos.google.cloud.bigquery.v2.IListRowAccessPoliciesResponse - ]) => { - this._log.info('listRowAccessPolicies values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRowAccessPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy} 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 `listRowAccessPoliciesAsync()` - * 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. - */ - listRowAccessPoliciesStream( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRowAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRowAccessPolicies stream %j', request); - return this.descriptors.page.listRowAccessPolicies.createStream( - this.innerApiCalls.listRowAccessPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRowAccessPolicies`, 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.projectId - * Required. Project ID of the row access policies to list. - * @param {string} request.datasetId - * Required. Dataset ID of row access policies to list. - * @param {string} request.tableId - * Required. Table ID of the table to list row access policies. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results. - * @param {number} request.pageSize - * The maximum number of results to return in a single response page. Leverage - * the page tokens to iterate through the entire collection. - * @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.cloud.bigquery.v2.RowAccessPolicy|RowAccessPolicy}. 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 include:samples/generated/v2/row_access_policy_service.list_row_access_policies.js - * region_tag:bigquery_v2_generated_RowAccessPolicyService_ListRowAccessPolicies_async - */ - listRowAccessPoliciesAsync( - request?: protos.google.cloud.bigquery.v2.IListRowAccessPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listRowAccessPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRowAccessPolicies iterate %j', request); - return this.descriptors.page.listRowAccessPolicies.asyncIterate( - this.innerApiCalls['listRowAccessPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.rowAccessPolicyServiceStub && !this._terminated) { - return this.rowAccessPolicyServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client_config.json.baseline deleted file mode 100644 index 6f88ac20f563..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.RowAccessPolicyService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListRowAccessPolicies": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/row_access_policy_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client.ts.baseline deleted file mode 100644 index e28c6c1fc894..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client.ts.baseline +++ /dev/null @@ -1,1087 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/table_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './table_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is an experimental RPC service definition for the BigQuery - * Table Service. - * - * It should not be relied on for production use cases at this time. - * @class - * @memberof v2 - */ -export class TableServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('bigquery'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - tableServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TableServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 TableServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TableServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'bigquery.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listTables: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tables') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.bigquery.v2.TableService', gapicConfig as gax.ClientConfig, - 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.tableServiceStub) { - return this.tableServiceStub; - } - - // Put together the "service stub" for - // google.cloud.bigquery.v2.TableService. - this.tableServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.bigquery.v2.TableService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.bigquery.v2.TableService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const tableServiceStubMethods = - ['getTable', 'insertTable', 'patchTable', 'updateTable', 'deleteTable', 'listTables']; - for (const methodName of tableServiceStubMethods) { - const callPromise = this.tableServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.tableServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'bigquery.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/bigquery', - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/cloud-platform.read-only' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the specified table resource by table ID. - * This method does not return the data in the table, it only returns the - * table resource, which describes the structure of this table. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the requested table - * @param {string} request.datasetId - * Required. Dataset ID of the requested table - * @param {string} request.tableId - * Required. Table ID of the requested table - * @param {string} request.selectedFields - * List of table schema fields to return (comma-separated). - * If unspecified, all fields are returned. - * A fieldMask cannot be used here because the fields will automatically be - * converted from camelCase to snake_case and the conversion will fail if - * there are underscores. Since these are fields in BigQuery table schemas, - * underscores are allowed. - * @param {google.cloud.bigquery.v2.GetTableRequest.TableMetadataView} [request.view] - * Optional. Specifies the view that determines which table information is - * returned. By default, basic table information and storage statistics - * (STORAGE_STATS) 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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.get_table.js - * region_tag:bigquery_v2_generated_TableService_GetTable_async - */ - getTable( - request?: protos.google.cloud.bigquery.v2.IGetTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, {}|undefined - ]>; - getTable( - request: protos.google.cloud.bigquery.v2.IGetTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request: protos.google.cloud.bigquery.v2.IGetTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): void; - getTable( - request?: protos.google.cloud.bigquery.v2.IGetTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getTable response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IGetTableRequest|undefined, - {}|undefined - ]) => { - this._log.info('getTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new, empty table in the dataset. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the new table - * @param {string} request.datasetId - * Required. Dataset ID of the new table - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource to insert - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.insert_table.js - * region_tag:bigquery_v2_generated_TableService_InsertTable_async - */ - insertTable( - request?: protos.google.cloud.bigquery.v2.IInsertTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, {}|undefined - ]>; - insertTable( - request: protos.google.cloud.bigquery.v2.IInsertTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): void; - insertTable( - request: protos.google.cloud.bigquery.v2.IInsertTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): void; - insertTable( - request?: protos.google.cloud.bigquery.v2.IInsertTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insertTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insertTable response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.insertTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IInsertTableRequest|undefined, - {}|undefined - ]) => { - this._log.info('insertTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing table. The update method replaces the - * entire table resource, whereas the patch method only replaces fields that - * are provided in the submitted table resource. - * This method supports RFC5789 patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to update - * @param {string} request.datasetId - * Required. Dataset ID of the table to update - * @param {string} request.tableId - * Required. Table ID of the table to update - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource which will replace or patch the specified table - * @param {boolean} [request.autodetectSchema] - * Optional. When true will autodetect schema, else will keep original schema. - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.patch_table.js - * region_tag:bigquery_v2_generated_TableService_PatchTable_async - */ - patchTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>; - patchTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - patchTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - patchTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('patchTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patchTable response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.patchTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, - {}|undefined - ]) => { - this._log.info('patchTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates information in an existing table. The update method replaces the - * entire Table resource, whereas the patch method only replaces fields that - * are provided in the submitted Table resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to update - * @param {string} request.datasetId - * Required. Dataset ID of the table to update - * @param {string} request.tableId - * Required. Table ID of the table to update - * @param {google.cloud.bigquery.v2.Table} request.table - * Required. A tables resource which will replace or patch the specified table - * @param {boolean} [request.autodetectSchema] - * Optional. When true will autodetect schema, else will keep original schema. - * @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 {@link protos.google.cloud.bigquery.v2.Table|Table}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.update_table.js - * region_tag:bigquery_v2_generated_TableService_UpdateTable_async - */ - updateTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>; - updateTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - updateTable( - request: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - callback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): void; - updateTable( - request?: protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateTable request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateTable response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.bigquery.v2.ITable, - protos.google.cloud.bigquery.v2.IUpdateOrPatchTableRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes the table specified by tableId from the dataset. - * If the table contains data, all the data will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the table to delete - * @param {string} request.datasetId - * Required. Dataset ID of the table to delete - * @param {string} request.tableId - * Required. Table ID of the table to delete - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/table_service.delete_table.js - * region_tag:bigquery_v2_generated_TableService_DeleteTable_async - */ - deleteTable( - request?: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, {}|undefined - ]>; - deleteTable( - request: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): void; - deleteTable( - request?: protos.google.cloud.bigquery.v2.IDeleteTableRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - 'table_id': request.tableId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTable request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTable response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteTable(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.bigquery.v2.IDeleteTableRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteTable response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all tables in the specified dataset. Requires the READER dataset - * role. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value| number } request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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 Array of {@link protos.google.cloud.bigquery.v2.ListFormatTable|ListFormatTable}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTablesAsync()` - * 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. - */ - listTables( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]>; - listTables( - request: protos.google.cloud.bigquery.v2.IListTablesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): void; - listTables( - request: protos.google.cloud.bigquery.v2.IListTablesRequest, - callback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): void; - listTables( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>, - callback?: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>): - Promise<[ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]>|void { - request = request || {}; - // Converts number to Unit32 or Int32 value for non-compliant APIs. - if(request.maxResults && typeof request.maxResults === "number"){ - const maxResultsObject = {"value": request.maxResults} - request.maxResults = maxResultsObject - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.bigquery.v2.IListTablesRequest, - protos.google.cloud.bigquery.v2.ITableList|null|undefined, - protos.google.cloud.bigquery.v2.IListFormatTable>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTables values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTables request %j', request); - return this.innerApiCalls - .listTables(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.bigquery.v2.IListFormatTable[], - protos.google.cloud.bigquery.v2.IListTablesRequest|null, - protos.google.cloud.bigquery.v2.ITableList - ]) => { - this._log.info('listTables values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTables`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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.cloud.bigquery.v2.ListFormatTable|ListFormatTable} 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 `listTablesAsync()` - * 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. - */ - listTablesStream( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTables stream %j', request); - return this.descriptors.page.listTables.createStream( - this.innerApiCalls.listTables as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTables`, 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.projectId - * Required. Project ID of the tables to list - * @param {string} request.datasetId - * Required. Dataset ID of the tables to list - * @param {google.protobuf.UInt32Value} request.maxResults - * The maximum number of results to return in a single response page. - * Leverage the page tokens to iterate through the entire collection. - * @param {string} request.pageToken - * Page token, returned by a previous call, to request the next page of - * results - * @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.cloud.bigquery.v2.ListFormatTable|ListFormatTable}. 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 include:samples/generated/v2/table_service.list_tables.js - * region_tag:bigquery_v2_generated_TableService_ListTables_async - */ - listTablesAsync( - request?: protos.google.cloud.bigquery.v2.IListTablesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project_id': request.projectId?.toString() ?? '', - 'dataset_id': request.datasetId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listTables']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTables iterate %j', request); - return this.descriptors.page.listTables.asyncIterate( - this.innerApiCalls['listTables'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.tableServiceStub && !this._terminated) { - return this.tableServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client_config.json.baseline deleted file mode 100644 index 3141de7410a6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.cloud.bigquery.v2.TableService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "InsertTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PatchTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTable": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTables": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_proto_list.json.baseline deleted file mode 100644 index 4878b9be176a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/src/v2/table_service_proto_list.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -[ - "../../protos/google/cloud/bigquery/v2/biglake_config.proto", - "../../protos/google/cloud/bigquery/v2/clustering.proto", - "../../protos/google/cloud/bigquery/v2/data_format_options.proto", - "../../protos/google/cloud/bigquery/v2/dataset.proto", - "../../protos/google/cloud/bigquery/v2/dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/decimal_target_types.proto", - "../../protos/google/cloud/bigquery/v2/encryption_config.proto", - "../../protos/google/cloud/bigquery/v2/error.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_dataset_options.proto", - "../../protos/google/cloud/bigquery/v2/external_catalog_table_options.proto", - "../../protos/google/cloud/bigquery/v2/external_data_config.proto", - "../../protos/google/cloud/bigquery/v2/external_dataset_reference.proto", - "../../protos/google/cloud/bigquery/v2/file_set_specification_type.proto", - "../../protos/google/cloud/bigquery/v2/hive_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/job.proto", - "../../protos/google/cloud/bigquery/v2/job_config.proto", - "../../protos/google/cloud/bigquery/v2/job_creation_reason.proto", - "../../protos/google/cloud/bigquery/v2/job_reference.proto", - "../../protos/google/cloud/bigquery/v2/job_stats.proto", - "../../protos/google/cloud/bigquery/v2/job_status.proto", - "../../protos/google/cloud/bigquery/v2/json_extension.proto", - "../../protos/google/cloud/bigquery/v2/location_metadata.proto", - "../../protos/google/cloud/bigquery/v2/map_target_type.proto", - "../../protos/google/cloud/bigquery/v2/model.proto", - "../../protos/google/cloud/bigquery/v2/model_reference.proto", - "../../protos/google/cloud/bigquery/v2/partitioning_definition.proto", - "../../protos/google/cloud/bigquery/v2/privacy_policy.proto", - "../../protos/google/cloud/bigquery/v2/project.proto", - "../../protos/google/cloud/bigquery/v2/query_parameter.proto", - "../../protos/google/cloud/bigquery/v2/range_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/restriction_config.proto", - "../../protos/google/cloud/bigquery/v2/routine.proto", - "../../protos/google/cloud/bigquery/v2/routine_reference.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy.proto", - "../../protos/google/cloud/bigquery/v2/row_access_policy_reference.proto", - "../../protos/google/cloud/bigquery/v2/session_info.proto", - "../../protos/google/cloud/bigquery/v2/standard_sql.proto", - "../../protos/google/cloud/bigquery/v2/system_variable.proto", - "../../protos/google/cloud/bigquery/v2/table.proto", - "../../protos/google/cloud/bigquery/v2/table_constraints.proto", - "../../protos/google/cloud/bigquery/v2/table_reference.proto", - "../../protos/google/cloud/bigquery/v2/table_schema.proto", - "../../protos/google/cloud/bigquery/v2/time_partitioning.proto", - "../../protos/google/cloud/bigquery/v2/udf_resource.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index f4b165acfaf1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const bigquery = require('bigquery'); - -function main() { - const datasetServiceClient = new bigquery.DatasetServiceClient(); - const jobServiceClient = new bigquery.JobServiceClient(); - const modelServiceClient = new bigquery.ModelServiceClient(); - const projectServiceClient = new bigquery.ProjectServiceClient(); - const routineServiceClient = new bigquery.RoutineServiceClient(); - const rowAccessPolicyServiceClient = new bigquery.RowAccessPolicyServiceClient(); - const tableServiceClient = new bigquery.TableServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index d6c84c7fbbec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - -import {DatasetServiceClient, JobServiceClient, ModelServiceClient, ProjectServiceClient, RoutineServiceClient, RowAccessPolicyServiceClient, TableServiceClient} from 'bigquery'; - -// check that the client class type name can be used -function doStuffWithDatasetServiceClient(client: DatasetServiceClient) { - client.close(); -} -function doStuffWithJobServiceClient(client: JobServiceClient) { - client.close(); -} -function doStuffWithModelServiceClient(client: ModelServiceClient) { - client.close(); -} -function doStuffWithProjectServiceClient(client: ProjectServiceClient) { - client.close(); -} -function doStuffWithRoutineServiceClient(client: RoutineServiceClient) { - client.close(); -} -function doStuffWithRowAccessPolicyServiceClient(client: RowAccessPolicyServiceClient) { - client.close(); -} -function doStuffWithTableServiceClient(client: TableServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const datasetServiceClient = new DatasetServiceClient(); - doStuffWithDatasetServiceClient(datasetServiceClient); - // check that the client instance can be created - const jobServiceClient = new JobServiceClient(); - doStuffWithJobServiceClient(jobServiceClient); - // check that the client instance can be created - const modelServiceClient = new ModelServiceClient(); - doStuffWithModelServiceClient(modelServiceClient); - // check that the client instance can be created - const projectServiceClient = new ProjectServiceClient(); - doStuffWithProjectServiceClient(projectServiceClient); - // check that the client instance can be created - const routineServiceClient = new RoutineServiceClient(); - doStuffWithRoutineServiceClient(routineServiceClient); - // check that the client instance can be created - const rowAccessPolicyServiceClient = new RowAccessPolicyServiceClient(); - doStuffWithRowAccessPolicyServiceClient(rowAccessPolicyServiceClient); - // check that the client instance can be created - const tableServiceClient = new TableServiceClient(); - doStuffWithTableServiceClient(tableServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_dataset_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_dataset_service_v2.ts.baseline deleted file mode 100644 index be0cee887bc6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_dataset_service_v2.ts.baseline +++ /dev/null @@ -1,1214 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as datasetserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.DatasetServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = datasetserviceModule.v2.DatasetServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = datasetserviceModule.v2.DatasetServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datasetserviceModule.v2.DatasetServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datasetserviceModule.v2.DatasetServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new datasetserviceModule.v2.DatasetServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = datasetserviceModule.v2.DatasetServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datasetServiceStub, undefined); - await client.initialize(); - assert(client.datasetServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.datasetServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datasetServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getDataset', () => { - it('invokes getDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCall(expectedResponse); - const [response] = await client.getDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.getDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDataset(request), expectedError); - }); - }); - - describe('insertDataset', () => { - it('invokes insertDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.insertDataset = stubSimpleCall(expectedResponse); - const [response] = await client.insertDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.insertDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertDataset(request), expectedError); - }); - }); - - describe('patchDataset', () => { - it('invokes patchDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.patchDataset = stubSimpleCall(expectedResponse); - const [response] = await client.patchDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.patchDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchDataset(request), expectedError); - }); - }); - - describe('updateDataset', () => { - it('invokes updateDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.updateDataset = stubSimpleCall(expectedResponse); - const [response] = await client.updateDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.updateDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDataset(request), expectedError); - }); - }); - - describe('deleteDataset', () => { - it('invokes deleteDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDataset( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDataset(request), expectedError); - }); - }); - - describe('undeleteDataset', () => { - it('invokes undeleteDataset without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.undeleteDataset = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteDataset(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Dataset() - ); - client.innerApiCalls.undeleteDataset = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteDataset( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IDataset|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteDataset = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteDataset(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteDataset as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteDataset with closed client', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UndeleteDatasetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UndeleteDatasetRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.undeleteDataset(request), expectedError); - }); - }); - - describe('listDatasets', () => { - it('invokes listDatasets without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCall(expectedResponse); - const [response] = await client.listDatasets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets without error using callback', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.innerApiCalls.listDatasets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDatasets( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatDataset[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasets with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDatasets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDatasets(request), expectedError); - const actualRequest = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDatasets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDatasetsStream without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatDataset[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatDataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDatasetsStream with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDatasetsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatDataset[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatDataset) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDatasets, request)); - assert( - (client.descriptors.page.listDatasets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets without error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatDataset()), - ]; - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatDataset[] = []; - const iterable = client.listDatasetsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDatasets with error', async () => { - const client = new datasetserviceModule.v2.DatasetServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListDatasetsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListDatasetsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDatasets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDatasetsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatDataset[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDatasets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_job_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_job_service_v2.ts.baseline deleted file mode 100644 index 0799090ee38c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_job_service_v2.ts.baseline +++ /dev/null @@ -1,1202 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as jobserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.JobServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = jobserviceModule.v2.JobServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = jobserviceModule.v2.JobServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new jobserviceModule.v2.JobServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new jobserviceModule.v2.JobServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new jobserviceModule.v2.JobServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new jobserviceModule.v2.JobServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new jobserviceModule.v2.JobServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = jobserviceModule.v2.JobServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new jobserviceModule.v2.JobServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new jobserviceModule.v2.JobServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobServiceStub, undefined); - await client.initialize(); - assert(client.jobServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.jobServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.jobServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('cancelJob', () => { - it('invokes cancelJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.JobCancelResponse() - ); - client.innerApiCalls.cancelJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.JobCancelResponse() - ); - client.innerApiCalls.cancelJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJobCancelResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.CancelJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.CancelJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelJob(request), expectedError); - }); - }); - - describe('getJob', () => { - it('invokes getJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.getJob = stubSimpleCall(expectedResponse); - const [response] = await client.getJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.getJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getJob(request), expectedError); - }); - }); - - describe('insertJob', () => { - it('invokes insertJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.insertJob = stubSimpleCall(expectedResponse); - const [response] = await client.insertJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Job() - ); - client.innerApiCalls.insertJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertJob( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertJob(request), expectedError); - const actualRequest = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertJobRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertJob(request), expectedError); - }); - }); - - describe('deleteJob', () => { - it('invokes deleteJob without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJob with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteJobRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteJob(request), expectedError); - }); - }); - - describe('getQueryResults', () => { - it('invokes getQueryResults without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsResponse() - ); - client.innerApiCalls.getQueryResults = stubSimpleCall(expectedResponse); - const [response] = await client.getQueryResults(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsResponse() - ); - client.innerApiCalls.getQueryResults = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getQueryResults( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IGetQueryResultsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&job_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getQueryResults = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getQueryResults(request), expectedError); - const actualRequest = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueryResults as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueryResults with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetQueryResultsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetQueryResultsRequest', ['jobId']); - request.jobId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getQueryResults(request), expectedError); - }); - }); - - describe('query', () => { - it('invokes query without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.QueryResponse() - ); - client.innerApiCalls.query = stubSimpleCall(expectedResponse); - const [response] = await client.query(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.QueryResponse() - ); - client.innerApiCalls.query = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.query( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IQueryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.query = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.query(request), expectedError); - const actualRequest = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.query as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes query with closed client', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PostQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PostQueryRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.query(request), expectedError); - }); - }); - - describe('listJobs', () => { - it('invokes listJobs without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.innerApiCalls.listJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs without error using callback', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.innerApiCalls.listJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobs( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobs with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobsStream without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatJob[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobsStream with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatJob[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobs, request)); - assert( - (client.descriptors.page.listJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs without error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatJob()), - ]; - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatJob[] = []; - const iterable = client.listJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobs with error', async () => { - const client = new jobserviceModule.v2.JobServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListJobsRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_model_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_model_service_v2.ts.baseline deleted file mode 100644 index 5450fa40562c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_model_service_v2.ts.baseline +++ /dev/null @@ -1,923 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as modelserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ModelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = modelserviceModule.v2.ModelServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = modelserviceModule.v2.ModelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new modelserviceModule.v2.ModelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new modelserviceModule.v2.ModelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2.ModelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2.ModelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new modelserviceModule.v2.ModelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = modelserviceModule.v2.ModelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new modelserviceModule.v2.ModelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - await client.initialize(); - assert(client.modelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.modelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getModel', () => { - it('invokes getModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.getModel = stubSimpleCall(expectedResponse); - const [response] = await client.getModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getModel( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getModel(request), expectedError); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getModel(request), expectedError); - }); - }); - - describe('patchModel', () => { - it('invokes patchModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.patchModel = stubSimpleCall(expectedResponse); - const [response] = await client.patchModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Model() - ); - client.innerApiCalls.patchModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchModel( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchModel(request), expectedError); - const actualRequest = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.PatchModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchModel(request), expectedError); - }); - }); - - describe('deleteModel', () => { - it('invokes deleteModel without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteModel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&model_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with closed client', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteModelRequest', ['modelId']); - request.modelId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteModel(request), expectedError); - }); - }); - - describe('listModels', () => { - it('invokes listModels without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); - const [response] = await client.listModels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels without error using callback', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listModels( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IModel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listModels(request), expectedError); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModelsStream without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Model[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listModelsStream with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Model[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels without error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Model()), - ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IModel[] = []; - const iterable = client.listModelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels with error', async () => { - const client = new modelserviceModule.v2.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListModelsRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listModelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IModel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_project_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_project_service_v2.ts.baseline deleted file mode 100644 index 4db88866c85f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_project_service_v2.ts.baseline +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as projectserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2.ProjectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = projectserviceModule.v2.ProjectServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = projectserviceModule.v2.ProjectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2.ProjectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2.ProjectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new projectserviceModule.v2.ProjectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = projectserviceModule.v2.ProjectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new projectserviceModule.v2.ProjectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - await client.initialize(); - assert(client.projectServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.projectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getServiceAccount', () => { - it('invokes getServiceAccount without error', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountResponse() - ); - client.innerApiCalls.getServiceAccount = stubSimpleCall(expectedResponse); - const [response] = await client.getServiceAccount(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount without error using callback', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountResponse() - ); - client.innerApiCalls.getServiceAccount = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServiceAccount( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IGetServiceAccountResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount with error', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServiceAccount = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServiceAccount(request), expectedError); - const actualRequest = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceAccount as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceAccount with closed client', async () => { - const client = new projectserviceModule.v2.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetServiceAccountRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetServiceAccountRequest', ['projectId']); - request.projectId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServiceAccount(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_routine_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_routine_service_v2.ts.baseline deleted file mode 100644 index 20fc2d9d3f87..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_routine_service_v2.ts.baseline +++ /dev/null @@ -1,1118 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as routineserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.RoutineServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = routineserviceModule.v2.RoutineServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = routineserviceModule.v2.RoutineServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new routineserviceModule.v2.RoutineServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new routineserviceModule.v2.RoutineServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new routineserviceModule.v2.RoutineServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = routineserviceModule.v2.RoutineServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new routineserviceModule.v2.RoutineServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routineServiceStub, undefined); - await client.initialize(); - assert(client.routineServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.routineServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.routineServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getRoutine', () => { - it('invokes getRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.getRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.getRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.getRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoutine(request), expectedError); - }); - }); - - describe('insertRoutine', () => { - it('invokes insertRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.insertRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.insertRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.insertRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertRoutine(request), expectedError); - }); - }); - - describe('updateRoutine', () => { - it('invokes updateRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.updateRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.updateRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoutine(request), expectedError); - }); - }); - - describe('patchRoutine', () => { - it('invokes patchRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.patchRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.patchRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Routine() - ); - client.innerApiCalls.patchRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchRoutine( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes patchRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.patchRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchRoutine(request), expectedError); - }); - - it('invokes patchRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.PatchRoutineRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchRoutine(request), expectedError); - }); - }); - - describe('deleteRoutine', () => { - it('invokes deleteRoutine without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoutine = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoutine(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoutine = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoutine( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&routine_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoutine = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoutine(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoutine as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoutine with closed client', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteRoutineRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteRoutineRequest', ['routineId']); - request.routineId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoutine(request), expectedError); - }); - }); - - describe('listRoutines', () => { - it('invokes listRoutines without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.innerApiCalls.listRoutines = stubSimpleCall(expectedResponse); - const [response] = await client.listRoutines(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutines without error using callback', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.innerApiCalls.listRoutines = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRoutines( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRoutine[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutines with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRoutines = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRoutines(request), expectedError); - const actualRequest = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutines as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutinesStream without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.descriptors.page.listRoutines.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoutinesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Routine[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Routine) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutines, request)); - assert( - (client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRoutinesStream with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutines.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoutinesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.Routine[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.Routine) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutines, request)); - assert( - (client.descriptors.page.listRoutines.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutines without error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.Routine()), - ]; - client.descriptors.page.listRoutines.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IRoutine[] = []; - const iterable = client.listRoutinesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutines with error', async () => { - const client = new routineserviceModule.v2.RoutineServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRoutinesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRoutinesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutines.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoutinesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IRoutine[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutines.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_row_access_policy_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_row_access_policy_service_v2.ts.baseline deleted file mode 100644 index a6bc8df9a403..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_row_access_policy_service_v2.ts.baseline +++ /dev/null @@ -1,548 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as rowaccesspolicyserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.RowAccessPolicyServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.rowAccessPolicyServiceStub, undefined); - await client.initialize(); - assert(client.rowAccessPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.rowAccessPolicyServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.rowAccessPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listRowAccessPolicies', () => { - it('invokes listRowAccessPolicies without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.innerApiCalls.listRowAccessPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listRowAccessPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPolicies without error using callback', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.innerApiCalls.listRowAccessPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRowAccessPolicies( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IRowAccessPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPolicies with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRowAccessPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRowAccessPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRowAccessPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRowAccessPoliciesStream without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.descriptors.page.listRowAccessPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRowAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.RowAccessPolicy[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.RowAccessPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRowAccessPolicies, request)); - assert( - (client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRowAccessPoliciesStream with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRowAccessPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRowAccessPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.RowAccessPolicy[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.RowAccessPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRowAccessPolicies, request)); - assert( - (client.descriptors.page.listRowAccessPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRowAccessPolicies without error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.RowAccessPolicy()), - ]; - client.descriptors.page.listRowAccessPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IRowAccessPolicy[] = []; - const iterable = client.listRowAccessPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRowAccessPolicies with error', async () => { - const client = new rowaccesspolicyserviceModule.v2.RowAccessPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListRowAccessPoliciesRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listRowAccessPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRowAccessPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IRowAccessPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRowAccessPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_table_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_table_service_v2.ts.baseline deleted file mode 100644 index 1a1268a6e03e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/test/gapic_table_service_v2.ts.baseline +++ /dev/null @@ -1,1175 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as tableserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.TableServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = tableserviceModule.v2.TableServiceClient.servicePath; - assert.strictEqual(servicePath, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = tableserviceModule.v2.TableServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'bigquery.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new tableserviceModule.v2.TableServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new tableserviceModule.v2.TableServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new tableserviceModule.v2.TableServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new tableserviceModule.v2.TableServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'bigquery.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new tableserviceModule.v2.TableServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = tableserviceModule.v2.TableServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new tableserviceModule.v2.TableServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new tableserviceModule.v2.TableServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tableServiceStub, undefined); - await client.initialize(); - assert(client.tableServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.tableServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.tableServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getTable', () => { - it('invokes getTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.getTable = stubSimpleCall(expectedResponse); - const [response] = await client.getTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.getTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTable(request), expectedError); - const actualRequest = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.GetTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.GetTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTable(request), expectedError); - }); - }); - - describe('insertTable', () => { - it('invokes insertTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.insertTable = stubSimpleCall(expectedResponse); - const [response] = await client.insertTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.insertTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insertTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insertTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insertTable(request), expectedError); - const actualRequest = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insertTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insertTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.InsertTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.InsertTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insertTable(request), expectedError); - }); - }); - - describe('patchTable', () => { - it('invokes patchTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.patchTable = stubSimpleCall(expectedResponse); - const [response] = await client.patchTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.patchTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patchTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patchTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patchTable(request), expectedError); - const actualRequest = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patchTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patchTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patchTable(request), expectedError); - }); - }); - - describe('updateTable', () => { - it('invokes updateTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.updateTable = stubSimpleCall(expectedResponse); - const [response] = await client.updateTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.bigquery.v2.Table() - ); - client.innerApiCalls.updateTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateTable( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.ITable|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateTable(request), expectedError); - const actualRequest = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.UpdateOrPatchTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.UpdateOrPatchTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateTable(request), expectedError); - }); - }); - - describe('deleteTable', () => { - it('invokes deleteTable without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTable(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTable = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTable( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }&table_id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTable = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTable(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTable as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTable with closed client', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.DeleteTableRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['datasetId']); - request.datasetId = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.bigquery.v2.DeleteTableRequest', ['tableId']); - request.tableId = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTable(request), expectedError); - }); - }); - - describe('listTables', () => { - it('invokes listTables without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.innerApiCalls.listTables = stubSimpleCall(expectedResponse); - const [response] = await client.listTables(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTables without error using callback', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.innerApiCalls.listTables = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTables( - request, - (err?: Error|null, result?: protos.google.cloud.bigquery.v2.IListFormatTable[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTables with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTables = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTables(request), expectedError); - const actualRequest = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTables as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTablesStream without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.descriptors.page.listTables.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatTable[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatTable) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTablesStream with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTablesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.bigquery.v2.ListFormatTable[] = []; - stream.on('data', (response: protos.google.cloud.bigquery.v2.ListFormatTable) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTables, request)); - assert( - (client.descriptors.page.listTables.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTables without error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - generateSampleMessage(new protos.google.cloud.bigquery.v2.ListFormatTable()), - ]; - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.bigquery.v2.IListFormatTable[] = []; - const iterable = client.listTablesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTables with error', async () => { - const client = new tableserviceModule.v2.TableServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.bigquery.v2.ListTablesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['projectId']); - request.projectId = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.bigquery.v2.ListTablesRequest', ['datasetId']); - request.datasetId = defaultValue2; - const expectedHeaderRequestParams = `project_id=${defaultValue1 ?? '' }&dataset_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTables.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTablesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.bigquery.v2.IListFormatTable[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTables.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/bigquery-v2/webpack.config.js.baseline deleted file mode 100644 index f4947d41e6bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/bigquery-v2/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DatasetService', - filename: './dataset-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 767d723e8b13..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/compute/google-cloud-compute-nodejs - dest: /owl-bot-staging/google-cloud-compute - -api-name: compute \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.jsdoc.cjs.baseline deleted file mode 100644 index ac56ea3fc894..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/compute', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/README.md.baseline deleted file mode 100644 index c51a2fc66f36..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Compute: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/compute.svg)](https://www.npmjs.org/package/@google-cloud/compute) - -Compute client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Compute Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/compute/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Compute API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/compute -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/compute@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/index.ts.baseline deleted file mode 100644 index 27c4c4a46fbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const AddressesClient = v1.AddressesClient; -type AddressesClient = v1.AddressesClient; -const RegionOperationsClient = v1.RegionOperationsClient; -type RegionOperationsClient = v1.RegionOperationsClient; -export {v1, AddressesClient, RegionOperationsClient}; -export default {v1, AddressesClient, RegionOperationsClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client.ts.baseline deleted file mode 100644 index d66447fcd4a0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client.ts.baseline +++ /dev/null @@ -1,898 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as addresses_client_config from './addresses_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/addresses_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'addresses_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * - * Services - * - * The Addresses API. - * @class - * @memberof v1 - */ -export class AddressesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('compute'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - addressesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AddressesClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 AddressesClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AddressesClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'compute.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - // Implicitely set 'rest' value for the apis use rest as transport (eg. googleapis-discovery apis). - if (!opts) { - opts = {fallback: 'rest'}; - } else { - opts.fallback = opts.fallback ?? 'rest'; - } - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - aggregatedList: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'items'), - list: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'items') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.compute.v1.Addresses', gapicConfig as gax.ClientConfig, - 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.addressesStub) { - return this.addressesStub; - } - - // Put together the "service stub" for - // google.cloud.compute.v1.Addresses. - this.addressesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.compute.v1.Addresses') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.compute.v1.Addresses, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const addressesStubMethods = - ['aggregatedList', 'delete', 'insert', 'list']; - for (const methodName of addressesStubMethods) { - const callPromise = this.addressesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.addressesStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/compute', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Deletes the specified address resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.address - * Name of the address resource to delete. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * This method is considered to be in beta. This means while - * stable it is still a work-in-progress and under active development, - * and might get backwards-incompatible changes at any time. - * `.promise()` is not supported yet. - * @example include:samples/generated/v1/addresses.delete.js - * region_tag:compute_v1_generated_Addresses_Delete_async - */ - delete( - request?: protos.google.cloud.compute.v1.IDeleteAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>; - delete( - request: protos.google.cloud.compute.v1.IDeleteAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): void; - delete( - request: protos.google.cloud.compute.v1.IDeleteAddressRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): void; - delete( - request?: protos.google.cloud.compute.v1.IDeleteAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'address': request.address ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|undefined, - {}|undefined>|undefined = callback - ? (error, response, nextRequest, rawResponse) => { - this._log.info('delete response %j', rawResponse); - callback!(error, response, nextRequest, rawResponse); // We verified `callback` above. - } - : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, operation, rawResponse]: [protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation]) => { - return [ - { latestResponse: response, done: false, name: response.id, metadata: null, result: {}}, - operation, - rawResponse - ]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates an address resource in the specified project by using the data included in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.compute.v1.Address} request.addressResource - * The body resource for this request - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * This method is considered to be in beta. This means while - * stable it is still a work-in-progress and under active development, - * and might get backwards-incompatible changes at any time. - * `.promise()` is not supported yet. - * @example include:samples/generated/v1/addresses.insert.js - * region_tag:compute_v1_generated_Addresses_Insert_async - */ - insert( - request?: protos.google.cloud.compute.v1.IInsertAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>; - insert( - request: protos.google.cloud.compute.v1.IInsertAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): void; - insert( - request: protos.google.cloud.compute.v1.IInsertAddressRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): void; - insert( - request?: protos.google.cloud.compute.v1.IInsertAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|undefined, - {}|undefined>|undefined = callback - ? (error, response, nextRequest, rawResponse) => { - this._log.info('insert response %j', rawResponse); - callback!(error, response, nextRequest, rawResponse); // We verified `callback` above. - } - : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, operation, rawResponse]: [protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation]) => { - return [ - { latestResponse: response, done: false, name: response.id, metadata: null, result: {}}, - operation, - rawResponse - ]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - -/** - * Retrieves an aggregated list of addresses. - * - * `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.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - * - * You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - * @param {boolean} request.includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @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 - * as tuple [string, {@link protos.google.cloud.compute.v1.AddressesScopedList|AddressesScopedList}]. 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 include:samples/generated/v1/addresses.aggregated_list.js - * region_tag:compute_v1_generated_Addresses_AggregatedList_async - */ - aggregatedListAsync( - request?: protos.google.cloud.compute.v1.IAggregatedListAddressesRequest, - options?: CallOptions): - AsyncIterable<[string, protos.google.cloud.compute.v1.IAddressesScopedList]>{ - 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({ - 'project': request.project ?? '', - }); - const defaultCallSettings = this._defaults['aggregatedList']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('aggregatedList iterate %j', request); - return this.descriptors.page.aggregatedList.asyncIterate( - this.innerApiCalls['aggregatedList'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable<[string, protos.google.cloud.compute.v1.IAddressesScopedList]>; - } - /** - * Retrieves a list of addresses contained within the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 Array of {@link protos.google.cloud.compute.v1.Address|Address}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAsync()` - * 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. - */ - list( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]>; - list( - request: protos.google.cloud.compute.v1.IListAddressesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): void; - list( - request: protos.google.cloud.compute.v1.IListAddressesRequest, - callback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): void; - list( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>, - callback?: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): - Promise<[ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('list values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('list request %j', request); - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]) => { - this._log.info('list values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `list`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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.cloud.compute.v1.Address|Address} 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 `listAsync()` - * 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. - */ - listStream( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['list']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('list stream %j', request); - return this.descriptors.page.list.createStream( - this.innerApiCalls.list as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `list`, 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.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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.cloud.compute.v1.Address|Address}. 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 include:samples/generated/v1/addresses.list.js - * region_tag:compute_v1_generated_Addresses_List_async - */ - listAsync( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['list']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('list iterate %j', request); - return this.descriptors.page.list.asyncIterate( - this.innerApiCalls['list'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.addressesStub && !this._terminated) { - return this.addressesStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client_config.json.baseline deleted file mode 100644 index 0d5310c8abaa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_client_config.json.baseline +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.compute.v1.Addresses": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AggregatedList": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Delete": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_proto_list.json.baseline deleted file mode 100644 index 807dc1f490a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/addresses_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/compute/v1/compute_small.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 023b44fd7f8e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2026 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. ** - -export {AddressesClient} from './addresses_client.js'; -export {RegionOperationsClient} from './region_operations_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client.ts.baseline deleted file mode 100644 index b19e1d149289..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client.ts.baseline +++ /dev/null @@ -1,562 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as region_operations_client_config from './region_operations_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/region_operations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'region_operations_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The RegionOperations API. - * @class - * @memberof v1 - */ -export class RegionOperationsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('compute'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - regionOperationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RegionOperationsClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 RegionOperationsClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RegionOperationsClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'compute.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - // Implicitely set 'rest' value for the apis use rest as transport (eg. googleapis-discovery apis). - if (!opts) { - opts = {fallback: 'rest'}; - } else { - opts.fallback = opts.fallback ?? 'rest'; - } - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.compute.v1.RegionOperations', gapicConfig as gax.ClientConfig, - 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.regionOperationsStub) { - return this.regionOperationsStub; - } - - // Put together the "service stub" for - // google.cloud.compute.v1.RegionOperations. - this.regionOperationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.compute.v1.RegionOperations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.compute.v1.RegionOperations, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const regionOperationsStubMethods = - ['get', 'wait']; - for (const methodName of regionOperationsStubMethods) { - const callPromise = this.regionOperationsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.regionOperationsStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Retrieves the specified region-specific Operations resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Name of the Operations resource to return. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 {@link protos.google.cloud.compute.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/region_operations.get.js - * region_tag:compute_v1_generated_RegionOperations_Get_async - */ - get( - request?: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, {}|undefined - ]>; - get( - request: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - get( - request: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - get( - request?: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'operation': request.operation ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. - * - * This method is called on a best-effort basis. Specifically: - * - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - * - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Name of the Operations resource to return. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 {@link protos.google.cloud.compute.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/region_operations.wait.js - * region_tag:compute_v1_generated_RegionOperations_Wait_async - */ - wait( - request?: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, {}|undefined - ]>; - wait( - request: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'operation': request.operation ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('wait request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('wait response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.regionOperationsStub && !this._terminated) { - return this.regionOperationsStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client_config.json.baseline deleted file mode 100644 index 08ee6ece8470..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_client_config.json.baseline +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.cloud.compute.v1.RegionOperations": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Get": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_proto_list.json.baseline deleted file mode 100644 index 807dc1f490a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/src/v1/region_operations_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/compute/v1/compute_small.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index dc40b7f7a61f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const compute = require('@google-cloud/compute'); - -function main() { - const addressesClient = new compute.AddressesClient(); - const regionOperationsClient = new compute.RegionOperationsClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 578b143c5e0e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as compute from '@google-cloud/compute'; - -function main() { - const addressesClient = new compute.AddressesClient(); - const regionOperationsClient = new compute.RegionOperationsClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 8f000a23986d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,39 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {AddressesClient, RegionOperationsClient} from '@google-cloud/compute'; - -// check that the client class type name can be used -function doStuffWithAddressesClient(client: AddressesClient) { - client.close(); -} -function doStuffWithRegionOperationsClient(client: RegionOperationsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const addressesClient = new AddressesClient(); - doStuffWithAddressesClient(addressesClient); - // check that the client instance can be created - const regionOperationsClient = new RegionOperationsClient(); - doStuffWithRegionOperationsClient(regionOperationsClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_addresses_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_addresses_v1.ts.baseline deleted file mode 100644 index c09f37884264..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_addresses_v1.ts.baseline +++ /dev/null @@ -1,871 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it, beforeEach, afterEach} from 'mocha'; -import * as addressesModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {GoogleAuth, protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AddressesClient', () => { - let googleAuth: GoogleAuth; - beforeEach(() => { - googleAuth = { - getClient: sinon.stub().resolves({ - getRequestHeaders: sinon.stub().resolves({Authorization: 'Bearer SOME_TOKEN'}), - }) - } as unknown as GoogleAuth; - }); - afterEach(() => { - sinon.restore(); - }); - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new addressesModule.v1.AddressesClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new addressesModule.v1.AddressesClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = addressesModule.v1.AddressesClient.servicePath; - assert.strictEqual(servicePath, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = addressesModule.v1.AddressesClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new addressesModule.v1.AddressesClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new addressesModule.v1.AddressesClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new addressesModule.v1.AddressesClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new addressesModule.v1.AddressesClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new addressesModule.v1.AddressesClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = addressesModule.v1.AddressesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new addressesModule.v1.AddressesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new addressesModule.v1.AddressesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.addressesStub, undefined); - await client.initialize(); - assert(client.addressesStub); - }); - - it('has close method for the initialized client', done => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.addressesStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.addressesStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response.latestResponse, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response.latestResponse, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('aggregatedList', () => { - - it('uses async iteration with aggregatedList without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.AggregatedListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.AggregatedListAddressesRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = [ - ['tuple_key_1', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ['tuple_key_2', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ['tuple_key_3', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ]; - client.descriptors.page.aggregatedList.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: Array<[string, protos.google.cloud.compute.v1.IAddressesScopedList]> = []; - const iterable = client.aggregatedListAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with aggregatedList with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.AggregatedListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.AggregatedListAddressesRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.aggregatedList.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.aggregatedListAsync(request); - await assert.rejects(async () => { - const responses: Array<[string, protos.google.cloud.compute.v1.IAddressesScopedList]> = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IAddress[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStream without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.descriptors.page.list.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.compute.v1.Address[] = []; - stream.on('data', (response: protos.google.cloud.compute.v1.Address) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.list.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.list, request)); - assert( - (client.descriptors.page.list.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStream with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.list.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.compute.v1.Address[] = []; - stream.on('data', (response: protos.google.cloud.compute.v1.Address) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.list.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.list, request)); - assert( - (client.descriptors.page.list.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with list without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.descriptors.page.list.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.compute.v1.IAddress[] = []; - const iterable = client.listAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with list with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.list.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.compute.v1.IAddress[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_region_operations_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_region_operations_v1.ts.baseline deleted file mode 100644 index 71f489ff7e31..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/esm/test/gapic_region_operations_v1.ts.baseline +++ /dev/null @@ -1,498 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it, beforeEach, afterEach} from 'mocha'; -import * as regionoperationsModule from '../src/index.js'; - -import {GoogleAuth, protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.RegionOperationsClient', () => { - let googleAuth: GoogleAuth; - beforeEach(() => { - googleAuth = { - getClient: sinon.stub().resolves({ - getRequestHeaders: sinon.stub().resolves({Authorization: 'Bearer SOME_TOKEN'}), - }) - } as unknown as GoogleAuth; - }); - afterEach(() => { - sinon.restore(); - }); - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = regionoperationsModule.v1.RegionOperationsClient.servicePath; - assert.strictEqual(servicePath, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = regionoperationsModule.v1.RegionOperationsClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new regionoperationsModule.v1.RegionOperationsClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new regionoperationsModule.v1.RegionOperationsClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = regionoperationsModule.v1.RegionOperationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.regionOperationsStub, undefined); - await client.initialize(); - assert(client.regionOperationsStub); - }); - - it('has close method for the initialized client', done => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.regionOperationsStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.regionOperationsStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.wait = stubSimpleCall(expectedResponse); - const [response] = await client.wait(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait without error using callback', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.wait = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait with error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait with closed client', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.wait(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json b/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json deleted file mode 100644 index 574539631ffa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "name": "@google-cloud/compute", - "version": "0.1.0", - "description": "Compute client for Node.js", - "repository": "googleapis/nodejs-compute", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google compute", - "compute", - "addresses", - "region operations" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/protos/google/cloud/compute/v1/compute_small.proto.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/protos/google/cloud/compute/v1/compute_small.proto.baseline deleted file mode 100644 index 7821c3982094..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/protos/google/cloud/compute/v1/compute_small.proto.baseline +++ /dev/null @@ -1,716 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the disco-to-proto3-converter. DO NOT EDIT! -// Source Discovery file: compute.v1.small.json -// Source file revision: 20200302 -// API name: compute -// API version: v1 - -syntax = "proto3"; - -package google.cloud.compute.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.Compute.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/compute/v1;compute"; -option java_multiple_files = true; -option java_package = "com.google.cloud.compute.v1"; -option php_namespace = "Google\\Cloud\\Compute\\V1"; -option ruby_package = "Google::Cloud::Compute::V1"; - -// -// File level resource definitions -// - -// [Empty] - -// -// Messages -// -// -message Errors { - // [Output Only] The error type identifier for this error. - optional string code = 3059181; - - // [Output Only] Indicates the field in the request that caused the error. This property is optional. - optional string location = 290430901; - - // [Output Only] An optional, human-readable error message. - optional string message = 418054151; - -} - -// [Output Only] If errors are generated during processing of the operation, this field will be populated. -message Error { - // [Output Only] The array of errors encountered while processing this operation. - repeated Errors errors = 315977579; - -} - -// -message Data { - // [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - optional string key = 106079; - - // [Output Only] A warning data value corresponding to the key. - optional string value = 111972721; - -} - -// -message Warnings { - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - enum Code { - // A value indicating that the enum field is not set. - UNDEFINED_CODE = 0; - - CLEANUP_FAILED = 150308440; - - DEPRECATED_RESOURCE_USED = 391835586; - - DEPRECATED_TYPE_USED = 346526230; - - DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 369442967; - - EXPERIMENTAL_TYPE_USED = 451954443; - - EXTERNAL_API_WARNING = 175546307; - - FIELD_VALUE_OVERRIDEN = 329669423; - - INJECTED_KERNELS_DEPRECATED = 417377419; - - MISSING_TYPE_DEPENDENCY = 344505463; - - NEXT_HOP_ADDRESS_NOT_ASSIGNED = 324964999; - - NEXT_HOP_CANNOT_IP_FORWARD = 383382887; - - NEXT_HOP_INSTANCE_NOT_FOUND = 464250446; - - NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 243758146; - - NEXT_HOP_NOT_RUNNING = 417081265; - - NOT_CRITICAL_ERROR = 105763924; - - NO_RESULTS_ON_PAGE = 30036744; - - REQUIRED_TOS_AGREEMENT = 3745539; - - RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING = 496728641; - - RESOURCE_NOT_DELETED = 168598460; - - SCHEMA_VALIDATION_IGNORED = 275245642; - - SINGLE_INSTANCE_PROPERTY_TEMPLATE = 268305617; - - UNDECLARED_PROPERTIES = 390513439; - - UNREACHABLE = 13328052; - - } - - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - optional Code code = 3059181; - - // [Output Only] Metadata about this warning in key: value format. For example: - // "data": [ { "key": "scope", "value": "zones/us-east1-d" } - repeated Data data = 3076010; - - // [Output Only] A human-readable description of the warning code. - optional string message = 418054151; - -} - -// Represents an Operation resource. -// -// Google Compute Engine has three Operation resources: -// -// * [Global](/compute/docs/reference/rest/{$api_version}/globalOperations) * [Regional](/compute/docs/reference/rest/{$api_version}/regionOperations) * [Zonal](/compute/docs/reference/rest/{$api_version}/zoneOperations) -// -// You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. -// -// Operations can be global, regional or zonal. -// - For global operations, use the globalOperations resource. -// - For regional operations, use the regionOperations resource. -// - For zonal operations, use the zoneOperations resource. -// -// For more information, read Global, Regional, and Zonal Resources. (== resource_for {$api_version}.globalOperations ==) (== resource_for {$api_version}.regionOperations ==) (== resource_for {$api_version}.zoneOperations ==) -message Operation { - // [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. - enum Status { - // A value indicating that the enum field is not set. - UNDEFINED_STATUS = 0; - - DONE = 2104194; - - PENDING = 35394935; - - RUNNING = 121282975; - - } - - // [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. - optional string client_operation_id = 297240295; - - // [Deprecated] This field is deprecated. - optional string creation_timestamp = 30525366; - - // [Output Only] A textual description of the operation, which is set when the operation is created. - optional string description = 422937596; - - // [Output Only] The time that this operation was completed. This value is in RFC3339 text format. - optional string end_time = 114938801; - - // [Output Only] If errors are generated during processing of the operation, this field will be populated. - optional Error error = 96784904; - - // [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. - optional string http_error_message = 202521945; - - // [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. - optional int32 http_error_status_code = 312345196; - - // [Output Only] The unique identifier for the operation. This identifier is defined by the server. - optional uint64 id = 3355; - - // [Output Only] The time that this operation was requested. This value is in RFC3339 text format. - optional string insert_time = 433722515; - - // [Output Only] Type of the resource. Always compute#operation for Operation resources. - optional string kind = 3292052; - - // [Output Only] Name of the operation. - optional string name = 3373707; - - // [Output Only] The type of operation, such as insert, update, or delete, and so on. - optional string operation_type = 177650450; - - // [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. - optional int32 progress = 72663597; - - // [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. - optional string region = 138946292; - - // [Output Only] Server-defined URL for the resource. - optional string self_link = 456214797; - - // [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. - optional string start_time = 37467274; - - // [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. - optional Status status = 181260274; - - // [Output Only] An optional textual description of the current status of the operation. - optional string status_message = 297428154; - - // [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. - optional uint64 target_id = 258165385; - - // [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. - optional string target_link = 62671336; - - // [Output Only] User who requested the operation, for example: user@example.com. - optional string user = 3599307; - - // [Output Only] If warning messages are generated during processing of the operation, this field will be populated. - repeated Warnings warnings = 498091095; - - // [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. - optional string zone = 3744684; - -} - -// Use global external addresses for GFE-based external HTTP(S) load balancers in Premium Tier. -// -// Use global internal addresses for reserved peering network range. -// -// Use regional external addresses for the following resources: -// -// - External IP addresses for VM instances - Regional external forwarding rules - Cloud NAT external IP addresses - GFE based LBs in Standard Tier - Network LBs in Premium or Standard Tier - Cloud VPN gateways (both Classic and HA) -// -// Use regional internal IP addresses for subnet IP ranges (primary and secondary). This includes: -// -// - Internal IP addresses for VM instances - Alias IP ranges of VM instances (/32 only) - Regional internal forwarding rules - Internal TCP/UDP load balancer addresses - Internal HTTP(S) load balancer addresses - Cloud DNS inbound forwarding IP addresses -// -// For more information, read reserved IP address. -// -// (== resource_for {$api_version}.addresses ==) (== resource_for {$api_version}.globalAddresses ==) -message Address { - // The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. - enum AddressType { - // A value indicating that the enum field is not set. - UNDEFINED_ADDRESS_TYPE = 0; - - EXTERNAL = 35607499; - - INTERNAL = 279295677; - - UNSPECIFIED_TYPE = 53933922; - - } - - // The IP version that will be used by this address. Valid options are IPV4 or IPV6. This can only be specified for a global address. - enum IpVersion { - // A value indicating that the enum field is not set. - UNDEFINED_IP_VERSION = 0; - - IPV4 = 2254341; - - IPV6 = 2254343; - - UNSPECIFIED_VERSION = 21850000; - - } - - // This signifies the networking tier used for configuring this address and can only take the following values: PREMIUM or STANDARD. Global forwarding rules can only be Premium Tier. Regional forwarding rules can be either Premium or Standard Tier. Standard Tier addresses applied to regional forwarding rules can be used with any external load balancer. Regional forwarding rules in Premium Tier can only be used with a network load balancer. - // - // If this field is not specified, it is assumed to be PREMIUM. - enum NetworkTier { - // A value indicating that the enum field is not set. - UNDEFINED_NETWORK_TIER = 0; - - PREMIUM = 399530551; - - STANDARD = 484642493; - - } - - // The purpose of this resource, which can be one of the following values: - // - `GCE_ENDPOINT` for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources. - // - `DNS_RESOLVER` for a DNS resolver address in a subnetwork - // - `VPC_PEERING` for addresses that are reserved for VPC peer networks. - // - `NAT_AUTO` for addresses that are external IP addresses automatically reserved for Cloud NAT. - enum Purpose { - // A value indicating that the enum field is not set. - UNDEFINED_PURPOSE = 0; - - DNS_RESOLVER = 476114556; - - GCE_ENDPOINT = 230515243; - - NAT_AUTO = 163666477; - - VPC_PEERING = 400800170; - - } - - // [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. - enum Status { - // A value indicating that the enum field is not set. - UNDEFINED_STATUS = 0; - - IN_USE = 17393485; - - RESERVED = 432241448; - - RESERVING = 514587225; - - } - - // The static IP address represented by this resource. - optional string address = 462920692; - - // The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. - optional AddressType address_type = 264307877; - - // [Output Only] Creation timestamp in RFC3339 text format. - optional string creation_timestamp = 30525366; - - // An optional description of this resource. Provide this field when you create the resource. - optional string description = 422937596; - - // [Output Only] The unique identifier for the resource. This identifier is defined by the server. - optional uint64 id = 3355; - - // The IP version that will be used by this address. Valid options are IPV4 or IPV6. This can only be specified for a global address. - optional IpVersion ip_version = 294959552; - - // [Output Only] Type of the resource. Always compute#address for addresses. - optional string kind = 3292052; - - // Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. - optional string name = 3373707; - - // The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with the VPC_PEERING purpose. - optional string network = 232872494; - - // This signifies the networking tier used for configuring this address and can only take the following values: PREMIUM or STANDARD. Global forwarding rules can only be Premium Tier. Regional forwarding rules can be either Premium or Standard Tier. Standard Tier addresses applied to regional forwarding rules can be used with any external load balancer. Regional forwarding rules in Premium Tier can only be used with a network load balancer. - // - // If this field is not specified, it is assumed to be PREMIUM. - optional NetworkTier network_tier = 517397843; - - // The prefix length if the resource reprensents an IP range. - optional int32 prefix_length = 453565747; - - // The purpose of this resource, which can be one of the following values: - // - `GCE_ENDPOINT` for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources. - // - `DNS_RESOLVER` for a DNS resolver address in a subnetwork - // - `VPC_PEERING` for addresses that are reserved for VPC peer networks. - // - `NAT_AUTO` for addresses that are external IP addresses automatically reserved for Cloud NAT. - optional Purpose purpose = 316407070; - - // [Output Only] The URL of the region where the regional address resides. This field is not applicable to global addresses. You must specify this field as part of the HTTP request URL. - optional string region = 138946292; - - // [Output Only] Server-defined URL for the resource. - optional string self_link = 456214797; - - // [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. - optional Status status = 181260274; - - // The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with a GCE_ENDPOINT or DNS_RESOLVER purpose. - optional string subnetwork = 307827694; - - // [Output Only] The URLs of the resources that are using this address. - repeated string users = 111578632; - -} - -// -message AddressesScopedList { - // [Output Only] A list of addresses contained in this scope. - repeated Address addresses = 337673122; - - // [Output Only] Informational warning which replaces the list of addresses when the list is empty. - optional Warning warning = 50704284; - -} - -// [Output Only] Informational warning message. -message Warning { - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - enum Code { - // A value indicating that the enum field is not set. - UNDEFINED_CODE = 0; - - CLEANUP_FAILED = 150308440; - - DEPRECATED_RESOURCE_USED = 391835586; - - DEPRECATED_TYPE_USED = 346526230; - - DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 369442967; - - EXPERIMENTAL_TYPE_USED = 451954443; - - EXTERNAL_API_WARNING = 175546307; - - FIELD_VALUE_OVERRIDEN = 329669423; - - INJECTED_KERNELS_DEPRECATED = 417377419; - - MISSING_TYPE_DEPENDENCY = 344505463; - - NEXT_HOP_ADDRESS_NOT_ASSIGNED = 324964999; - - NEXT_HOP_CANNOT_IP_FORWARD = 383382887; - - NEXT_HOP_INSTANCE_NOT_FOUND = 464250446; - - NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 243758146; - - NEXT_HOP_NOT_RUNNING = 417081265; - - NOT_CRITICAL_ERROR = 105763924; - - NO_RESULTS_ON_PAGE = 30036744; - - REQUIRED_TOS_AGREEMENT = 3745539; - - RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING = 496728641; - - RESOURCE_NOT_DELETED = 168598460; - - SCHEMA_VALIDATION_IGNORED = 275245642; - - SINGLE_INSTANCE_PROPERTY_TEMPLATE = 268305617; - - UNDECLARED_PROPERTIES = 390513439; - - UNREACHABLE = 13328052; - - } - - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - optional Code code = 3059181; - - // [Output Only] Metadata about this warning in key: value format. For example: - // "data": [ { "key": "scope", "value": "zones/us-east1-d" } - repeated Data data = 3076010; - - // [Output Only] A human-readable description of the warning code. - optional string message = 418054151; - -} - -// -message AddressAggregatedList { - // [Output Only] Unique identifier for the resource; defined by the server. - optional string id = 3355; - - // A list of AddressesScopedList resources. - map items = 100526016; - - // [Output Only] Type of resource. Always compute#addressAggregatedList for aggregated lists of addresses. - optional string kind = 3292052; - - // [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - optional string next_page_token = 79797525; - - // [Output Only] Server-defined URL for this resource. - optional string self_link = 456214797; - - // [Output Only] Informational warning message. - optional Warning warning = 50704284; - -} - -// Contains a list of addresses. -message AddressList { - // [Output Only] Unique identifier for the resource; defined by the server. - optional string id = 3355; - - // A list of Address resources. - repeated Address items = 100526016; - - // [Output Only] Type of resource. Always compute#addressList for lists of addresses. - optional string kind = 3292052; - - // [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - optional string next_page_token = 79797525; - - // [Output Only] Server-defined URL for this resource. - optional string self_link = 456214797; - - // [Output Only] Informational warning message. - optional Warning warning = 50704284; - -} - -// A request message for Addresses.AggregatedList. See the method description for details. -message AggregatedListAddressesRequest { - // A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - // - // You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - // - // To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - optional string filter = 336120696; - - // Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - optional bool include_all_scopes = 391327988; - - // The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - optional uint32 max_results = 54715419; - - // Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - // - // You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - // - // Currently, only sorting by `name` or `creationTimestamp desc` is supported. - optional string order_by = 160562920; - - // Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - optional string page_token = 19994697; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for Addresses.Delete. See the method description for details. -message DeleteAddressRequest { - // Name of the address resource to delete. - string address = 462920692 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - - // An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - // - // For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - optional string request_id = 37109963; - -} - -// A request message for Addresses.Insert. See the method description for details. -message InsertAddressRequest { - // The body resource for this request - Address address_resource = 483888121 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - - // An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - // - // For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - optional string request_id = 37109963; - -} - -// A request message for Addresses.List. See the method description for details. -message ListAddressesRequest { - // A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - // - // For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - // - // You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - // - // To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - optional string filter = 336120696; - - // The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - optional uint32 max_results = 54715419; - - // Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - // - // You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - // - // Currently, only sorting by name or creationTimestamp desc is supported. - string order_by = 160562920 [(google.api.field_behavior) = REQUIRED]; - - // Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - optional string page_token = 19994697; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for RegionOperations.Get. See the method description for details. -message GetRegionOperationRequest { - // Name of the Operations resource to return. - string operation = 52090215 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for RegionOperations.Wait. See the method description for details. -message WaitRegionOperationRequest { - // Name of the Operations resource to return. - string operation = 52090215 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// -// Services -// -// The Addresses API. -service Addresses { - option (google.api.default_host) = - "compute.googleapis.com"; - - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/cloud-platform"; - - // Retrieves an aggregated list of addresses. - rpc AggregatedList(AggregatedListAddressesRequest) returns (AddressAggregatedList) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/aggregated/addresses" - }; - option (google.api.method_signature) = "project"; - } - - // Deletes the specified address resource. - rpc Delete(DeleteAddressRequest) returns (Operation) { - option (google.api.http) = { - delete: "/compute/v1/projects/{project}/regions/{region}/addresses/{address}" - }; - option (google.api.method_signature) = "project,region,address"; - } - - // Creates an address resource in the specified project by using the data included in the request. - rpc Insert(InsertAddressRequest) returns (Operation) { - option (google.api.http) = { - post: "/compute/v1/projects/{project}/regions/{region}/addresses" - body: "address_resource" - }; - option (google.api.method_signature) = "project,region,address_resource"; - } - - // Retrieves a list of addresses contained within the specified region. - rpc List(ListAddressesRequest) returns (AddressList) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/regions/{region}/addresses" - }; - option (google.api.method_signature) = "project,region,order_by"; - } - -} - -// The RegionOperations API. -service RegionOperations { - option (google.api.default_host) = - "compute.googleapis.com"; - - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/cloud-platform"; - - // Retrieves the specified region-specific Operations resource. - rpc Get(GetRegionOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/regions/{region}/operations/{operation}" - }; - option (google.api.method_signature) = "project,region,operation"; - } - - // Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. - // - // This method is called on a best-effort basis. Specifically: - // - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - // - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - rpc Wait(WaitRegionOperationRequest) returns (Operation) { - option (google.api.http) = { - post: "/compute/v1/projects/projects/{project}/regions/{region}/operations/{operation}/wait" - }; - option (google.api.method_signature) = "project,region,operation"; - } - -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.aggregated_list.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.aggregated_list.js.baseline deleted file mode 100644 index 7d76873cf7b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.aggregated_list.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project) { - // [START compute_v1_generated_Addresses_AggregatedList_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - * For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - * You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - */ - // const filter = 'abc123' - /** - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - */ - // const includeAllScopes = true - /** - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - */ - // const maxResults = 1234 - /** - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * Currently, only sorting by `name` or `creationTimestamp desc` is supported. - */ - // const orderBy = 'abc123' - /** - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - */ - // const pageToken = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callAggregatedList() { - // Construct request - const request = { - project, - }; - - // Run request - const iterable = computeClient.aggregatedListAsync(request); - for await (const [key, value] of iterable) { - console.log(response); - } - } - - callAggregatedList(); - // [END compute_v1_generated_Addresses_AggregatedList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.delete.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.delete.js.baseline deleted file mode 100644 index 26b55b0ef5c1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.delete.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(address, project, region) { - // [START compute_v1_generated_Addresses_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the address resource to delete. - */ - // const address = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - /** - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callDelete() { - // Construct request - const request = { - address, - project, - region, - }; - - // Run request - const response = await computeClient.delete(request); - console.log(response); - } - - callDelete(); - // [END compute_v1_generated_Addresses_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.insert.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.insert.js.baseline deleted file mode 100644 index 2bb25d6f1849..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.insert.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(addressResource, project, region) { - // [START compute_v1_generated_Addresses_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The body resource for this request - */ - // const addressResource = {} - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - /** - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callInsert() { - // Construct request - const request = { - addressResource, - project, - region, - }; - - // Run request - const response = await computeClient.insert(request); - console.log(response); - } - - callInsert(); - // [END compute_v1_generated_Addresses_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.list.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.list.js.baseline deleted file mode 100644 index ef0a023a496a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/addresses.list.js.baseline +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(orderBy, project, region) { - // [START compute_v1_generated_Addresses_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - */ - // const filter = 'abc123' - /** - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - */ - // const maxResults = 1234 - /** - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * Currently, only sorting by name or creationTimestamp desc is supported. - */ - // const orderBy = 'abc123' - /** - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - */ - // const pageToken = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callList() { - // Construct request - const request = { - orderBy, - project, - region, - }; - - // Run request - const iterable = computeClient.listAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callList(); - // [END compute_v1_generated_Addresses_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.get.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.get.js.baseline deleted file mode 100644 index 2ddf73f9073b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.get.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(operation, project, region) { - // [START compute_v1_generated_RegionOperations_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the Operations resource to return. - */ - // const operation = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {RegionOperationsClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new RegionOperationsClient(); - - async function callGet() { - // Construct request - const request = { - operation, - project, - region, - }; - - // Run request - const response = await computeClient.get(request); - console.log(response); - } - - callGet(); - // [END compute_v1_generated_RegionOperations_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.wait.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.wait.js.baseline deleted file mode 100644 index 077bb85ede2b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/region_operations.wait.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(operation, project, region) { - // [START compute_v1_generated_RegionOperations_Wait_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the Operations resource to return. - */ - // const operation = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {RegionOperationsClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new RegionOperationsClient(); - - async function callWait() { - // Construct request - const request = { - operation, - project, - region, - }; - - // Run request - const response = await computeClient.wait(request); - console.log(response); - } - - callWait(); - // [END compute_v1_generated_RegionOperations_Wait_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline deleted file mode 100644 index 2f63f6c82a86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline +++ /dev/null @@ -1,335 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-compute", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.compute.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "compute_v1_generated_Addresses_AggregatedList_async", - "title": "Addresses aggregatedList Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an aggregated list of addresses.", - "canonical": true, - "file": "addresses.aggregated_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AggregatedList", - "fullName": "google.cloud.compute.v1.Addresses.AggregatedList", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "include_all_scopes", - "type": "TYPE_BOOL" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.AddressAggregatedList", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "AggregatedList", - "fullName": "google.cloud.compute.v1.Addresses.AggregatedList", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_Delete_async", - "title": "Addresses delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified address resource.", - "canonical": true, - "file": "addresses.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.compute.v1.Addresses.Delete", - "async": true, - "parameters": [ - { - "name": "address", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.compute.v1.Addresses.Delete", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_Insert_async", - "title": "Addresses insert Sample", - "origin": "API_DEFINITION", - "description": " Creates an address resource in the specified project by using the data included in the request.", - "canonical": true, - "file": "addresses.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.compute.v1.Addresses.Insert", - "async": true, - "parameters": [ - { - "name": "address_resource", - "type": ".google.cloud.compute.v1.Address" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.compute.v1.Addresses.Insert", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_List_async", - "title": "Addresses list Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a list of addresses contained within the specified region.", - "canonical": true, - "file": "addresses.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.compute.v1.Addresses.List", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.AddressList", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.compute.v1.Addresses.List", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_RegionOperations_Get_async", - "title": "Addresses get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified region-specific Operations resource.", - "canonical": true, - "file": "region_operations.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.compute.v1.RegionOperations.Get", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "RegionOperationsClient", - "fullName": "google.cloud.compute.v1.RegionOperationsClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.compute.v1.RegionOperations.Get", - "service": { - "shortName": "RegionOperations", - "fullName": "google.cloud.compute.v1.RegionOperations" - } - } - } - }, - { - "regionTag": "compute_v1_generated_RegionOperations_Wait_async", - "title": "Addresses wait Sample", - "origin": "API_DEFINITION", - "description": " Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.", - "canonical": true, - "file": "region_operations.wait.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Wait", - "fullName": "google.cloud.compute.v1.RegionOperations.Wait", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "RegionOperationsClient", - "fullName": "google.cloud.compute.v1.RegionOperationsClient" - }, - "method": { - "shortName": "Wait", - "fullName": "google.cloud.compute.v1.RegionOperations.Wait", - "service": { - "shortName": "RegionOperations", - "fullName": "google.cloud.compute.v1.RegionOperations" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/compute-esm/webpack.config.cjs.baseline deleted file mode 100644 index e5f87460510a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Addresses', - filename: './addresses.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.OwlBot.yaml.baseline deleted file mode 100644 index 767d723e8b13..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/compute/google-cloud-compute-nodejs - dest: /owl-bot-staging/google-cloud-compute - -api-name: compute \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.jsdoc.js.baseline deleted file mode 100644 index bb9fc5593446..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/compute', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/compute/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/compute/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/compute/README.md.baseline deleted file mode 100644 index c51a2fc66f36..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Compute: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/compute.svg)](https://www.npmjs.org/package/@google-cloud/compute) - -Compute client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Compute Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/compute/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Compute API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/compute -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/compute@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=compute.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-compute diff --git a/core/generator/gapic-generator-typescript/baselines/compute/package.json b/core/generator/gapic-generator-typescript/baselines/compute/package.json deleted file mode 100644 index 341a8d6bb41f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "@google-cloud/compute", - "version": "0.1.0", - "description": "Compute client for Node.js", - "repository": "googleapis/nodejs-compute", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google compute", - "compute", - "addresses", - "region operations" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute/protos/google/cloud/compute/v1/compute_small.proto.baseline b/core/generator/gapic-generator-typescript/baselines/compute/protos/google/cloud/compute/v1/compute_small.proto.baseline deleted file mode 100644 index 7821c3982094..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/protos/google/cloud/compute/v1/compute_small.proto.baseline +++ /dev/null @@ -1,716 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Generated by the disco-to-proto3-converter. DO NOT EDIT! -// Source Discovery file: compute.v1.small.json -// Source file revision: 20200302 -// API name: compute -// API version: v1 - -syntax = "proto3"; - -package google.cloud.compute.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.Compute.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/compute/v1;compute"; -option java_multiple_files = true; -option java_package = "com.google.cloud.compute.v1"; -option php_namespace = "Google\\Cloud\\Compute\\V1"; -option ruby_package = "Google::Cloud::Compute::V1"; - -// -// File level resource definitions -// - -// [Empty] - -// -// Messages -// -// -message Errors { - // [Output Only] The error type identifier for this error. - optional string code = 3059181; - - // [Output Only] Indicates the field in the request that caused the error. This property is optional. - optional string location = 290430901; - - // [Output Only] An optional, human-readable error message. - optional string message = 418054151; - -} - -// [Output Only] If errors are generated during processing of the operation, this field will be populated. -message Error { - // [Output Only] The array of errors encountered while processing this operation. - repeated Errors errors = 315977579; - -} - -// -message Data { - // [Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding). - optional string key = 106079; - - // [Output Only] A warning data value corresponding to the key. - optional string value = 111972721; - -} - -// -message Warnings { - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - enum Code { - // A value indicating that the enum field is not set. - UNDEFINED_CODE = 0; - - CLEANUP_FAILED = 150308440; - - DEPRECATED_RESOURCE_USED = 391835586; - - DEPRECATED_TYPE_USED = 346526230; - - DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 369442967; - - EXPERIMENTAL_TYPE_USED = 451954443; - - EXTERNAL_API_WARNING = 175546307; - - FIELD_VALUE_OVERRIDEN = 329669423; - - INJECTED_KERNELS_DEPRECATED = 417377419; - - MISSING_TYPE_DEPENDENCY = 344505463; - - NEXT_HOP_ADDRESS_NOT_ASSIGNED = 324964999; - - NEXT_HOP_CANNOT_IP_FORWARD = 383382887; - - NEXT_HOP_INSTANCE_NOT_FOUND = 464250446; - - NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 243758146; - - NEXT_HOP_NOT_RUNNING = 417081265; - - NOT_CRITICAL_ERROR = 105763924; - - NO_RESULTS_ON_PAGE = 30036744; - - REQUIRED_TOS_AGREEMENT = 3745539; - - RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING = 496728641; - - RESOURCE_NOT_DELETED = 168598460; - - SCHEMA_VALIDATION_IGNORED = 275245642; - - SINGLE_INSTANCE_PROPERTY_TEMPLATE = 268305617; - - UNDECLARED_PROPERTIES = 390513439; - - UNREACHABLE = 13328052; - - } - - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - optional Code code = 3059181; - - // [Output Only] Metadata about this warning in key: value format. For example: - // "data": [ { "key": "scope", "value": "zones/us-east1-d" } - repeated Data data = 3076010; - - // [Output Only] A human-readable description of the warning code. - optional string message = 418054151; - -} - -// Represents an Operation resource. -// -// Google Compute Engine has three Operation resources: -// -// * [Global](/compute/docs/reference/rest/{$api_version}/globalOperations) * [Regional](/compute/docs/reference/rest/{$api_version}/regionOperations) * [Zonal](/compute/docs/reference/rest/{$api_version}/zoneOperations) -// -// You can use an operation resource to manage asynchronous API requests. For more information, read Handling API responses. -// -// Operations can be global, regional or zonal. -// - For global operations, use the globalOperations resource. -// - For regional operations, use the regionOperations resource. -// - For zonal operations, use the zoneOperations resource. -// -// For more information, read Global, Regional, and Zonal Resources. (== resource_for {$api_version}.globalOperations ==) (== resource_for {$api_version}.regionOperations ==) (== resource_for {$api_version}.zoneOperations ==) -message Operation { - // [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. - enum Status { - // A value indicating that the enum field is not set. - UNDEFINED_STATUS = 0; - - DONE = 2104194; - - PENDING = 35394935; - - RUNNING = 121282975; - - } - - // [Output Only] The value of `requestId` if you provided it in the request. Not present otherwise. - optional string client_operation_id = 297240295; - - // [Deprecated] This field is deprecated. - optional string creation_timestamp = 30525366; - - // [Output Only] A textual description of the operation, which is set when the operation is created. - optional string description = 422937596; - - // [Output Only] The time that this operation was completed. This value is in RFC3339 text format. - optional string end_time = 114938801; - - // [Output Only] If errors are generated during processing of the operation, this field will be populated. - optional Error error = 96784904; - - // [Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND. - optional string http_error_message = 202521945; - - // [Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found. - optional int32 http_error_status_code = 312345196; - - // [Output Only] The unique identifier for the operation. This identifier is defined by the server. - optional uint64 id = 3355; - - // [Output Only] The time that this operation was requested. This value is in RFC3339 text format. - optional string insert_time = 433722515; - - // [Output Only] Type of the resource. Always compute#operation for Operation resources. - optional string kind = 3292052; - - // [Output Only] Name of the operation. - optional string name = 3373707; - - // [Output Only] The type of operation, such as insert, update, or delete, and so on. - optional string operation_type = 177650450; - - // [Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses. - optional int32 progress = 72663597; - - // [Output Only] The URL of the region where the operation resides. Only applicable when performing regional operations. - optional string region = 138946292; - - // [Output Only] Server-defined URL for the resource. - optional string self_link = 456214797; - - // [Output Only] The time that this operation was started by the server. This value is in RFC3339 text format. - optional string start_time = 37467274; - - // [Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE. - optional Status status = 181260274; - - // [Output Only] An optional textual description of the current status of the operation. - optional string status_message = 297428154; - - // [Output Only] The unique target ID, which identifies a specific incarnation of the target resource. - optional uint64 target_id = 258165385; - - // [Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from. - optional string target_link = 62671336; - - // [Output Only] User who requested the operation, for example: user@example.com. - optional string user = 3599307; - - // [Output Only] If warning messages are generated during processing of the operation, this field will be populated. - repeated Warnings warnings = 498091095; - - // [Output Only] The URL of the zone where the operation resides. Only applicable when performing per-zone operations. - optional string zone = 3744684; - -} - -// Use global external addresses for GFE-based external HTTP(S) load balancers in Premium Tier. -// -// Use global internal addresses for reserved peering network range. -// -// Use regional external addresses for the following resources: -// -// - External IP addresses for VM instances - Regional external forwarding rules - Cloud NAT external IP addresses - GFE based LBs in Standard Tier - Network LBs in Premium or Standard Tier - Cloud VPN gateways (both Classic and HA) -// -// Use regional internal IP addresses for subnet IP ranges (primary and secondary). This includes: -// -// - Internal IP addresses for VM instances - Alias IP ranges of VM instances (/32 only) - Regional internal forwarding rules - Internal TCP/UDP load balancer addresses - Internal HTTP(S) load balancer addresses - Cloud DNS inbound forwarding IP addresses -// -// For more information, read reserved IP address. -// -// (== resource_for {$api_version}.addresses ==) (== resource_for {$api_version}.globalAddresses ==) -message Address { - // The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. - enum AddressType { - // A value indicating that the enum field is not set. - UNDEFINED_ADDRESS_TYPE = 0; - - EXTERNAL = 35607499; - - INTERNAL = 279295677; - - UNSPECIFIED_TYPE = 53933922; - - } - - // The IP version that will be used by this address. Valid options are IPV4 or IPV6. This can only be specified for a global address. - enum IpVersion { - // A value indicating that the enum field is not set. - UNDEFINED_IP_VERSION = 0; - - IPV4 = 2254341; - - IPV6 = 2254343; - - UNSPECIFIED_VERSION = 21850000; - - } - - // This signifies the networking tier used for configuring this address and can only take the following values: PREMIUM or STANDARD. Global forwarding rules can only be Premium Tier. Regional forwarding rules can be either Premium or Standard Tier. Standard Tier addresses applied to regional forwarding rules can be used with any external load balancer. Regional forwarding rules in Premium Tier can only be used with a network load balancer. - // - // If this field is not specified, it is assumed to be PREMIUM. - enum NetworkTier { - // A value indicating that the enum field is not set. - UNDEFINED_NETWORK_TIER = 0; - - PREMIUM = 399530551; - - STANDARD = 484642493; - - } - - // The purpose of this resource, which can be one of the following values: - // - `GCE_ENDPOINT` for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources. - // - `DNS_RESOLVER` for a DNS resolver address in a subnetwork - // - `VPC_PEERING` for addresses that are reserved for VPC peer networks. - // - `NAT_AUTO` for addresses that are external IP addresses automatically reserved for Cloud NAT. - enum Purpose { - // A value indicating that the enum field is not set. - UNDEFINED_PURPOSE = 0; - - DNS_RESOLVER = 476114556; - - GCE_ENDPOINT = 230515243; - - NAT_AUTO = 163666477; - - VPC_PEERING = 400800170; - - } - - // [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. - enum Status { - // A value indicating that the enum field is not set. - UNDEFINED_STATUS = 0; - - IN_USE = 17393485; - - RESERVED = 432241448; - - RESERVING = 514587225; - - } - - // The static IP address represented by this resource. - optional string address = 462920692; - - // The type of address to reserve, either INTERNAL or EXTERNAL. If unspecified, defaults to EXTERNAL. - optional AddressType address_type = 264307877; - - // [Output Only] Creation timestamp in RFC3339 text format. - optional string creation_timestamp = 30525366; - - // An optional description of this resource. Provide this field when you create the resource. - optional string description = 422937596; - - // [Output Only] The unique identifier for the resource. This identifier is defined by the server. - optional uint64 id = 3355; - - // The IP version that will be used by this address. Valid options are IPV4 or IPV6. This can only be specified for a global address. - optional IpVersion ip_version = 294959552; - - // [Output Only] Type of the resource. Always compute#address for addresses. - optional string kind = 3292052; - - // Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all following characters (except for the last character) must be a dash, lowercase letter, or digit. The last character must be a lowercase letter or digit. - optional string name = 3373707; - - // The URL of the network in which to reserve the address. This field can only be used with INTERNAL type with the VPC_PEERING purpose. - optional string network = 232872494; - - // This signifies the networking tier used for configuring this address and can only take the following values: PREMIUM or STANDARD. Global forwarding rules can only be Premium Tier. Regional forwarding rules can be either Premium or Standard Tier. Standard Tier addresses applied to regional forwarding rules can be used with any external load balancer. Regional forwarding rules in Premium Tier can only be used with a network load balancer. - // - // If this field is not specified, it is assumed to be PREMIUM. - optional NetworkTier network_tier = 517397843; - - // The prefix length if the resource reprensents an IP range. - optional int32 prefix_length = 453565747; - - // The purpose of this resource, which can be one of the following values: - // - `GCE_ENDPOINT` for addresses that are used by VM instances, alias IP ranges, internal load balancers, and similar resources. - // - `DNS_RESOLVER` for a DNS resolver address in a subnetwork - // - `VPC_PEERING` for addresses that are reserved for VPC peer networks. - // - `NAT_AUTO` for addresses that are external IP addresses automatically reserved for Cloud NAT. - optional Purpose purpose = 316407070; - - // [Output Only] The URL of the region where the regional address resides. This field is not applicable to global addresses. You must specify this field as part of the HTTP request URL. - optional string region = 138946292; - - // [Output Only] Server-defined URL for the resource. - optional string self_link = 456214797; - - // [Output Only] The status of the address, which can be one of RESERVING, RESERVED, or IN_USE. An address that is RESERVING is currently in the process of being reserved. A RESERVED address is currently reserved and available to use. An IN_USE address is currently being used by another resource and is not available. - optional Status status = 181260274; - - // The URL of the subnetwork in which to reserve the address. If an IP address is specified, it must be within the subnetwork's IP range. This field can only be used with INTERNAL type with a GCE_ENDPOINT or DNS_RESOLVER purpose. - optional string subnetwork = 307827694; - - // [Output Only] The URLs of the resources that are using this address. - repeated string users = 111578632; - -} - -// -message AddressesScopedList { - // [Output Only] A list of addresses contained in this scope. - repeated Address addresses = 337673122; - - // [Output Only] Informational warning which replaces the list of addresses when the list is empty. - optional Warning warning = 50704284; - -} - -// [Output Only] Informational warning message. -message Warning { - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - enum Code { - // A value indicating that the enum field is not set. - UNDEFINED_CODE = 0; - - CLEANUP_FAILED = 150308440; - - DEPRECATED_RESOURCE_USED = 391835586; - - DEPRECATED_TYPE_USED = 346526230; - - DISK_SIZE_LARGER_THAN_IMAGE_SIZE = 369442967; - - EXPERIMENTAL_TYPE_USED = 451954443; - - EXTERNAL_API_WARNING = 175546307; - - FIELD_VALUE_OVERRIDEN = 329669423; - - INJECTED_KERNELS_DEPRECATED = 417377419; - - MISSING_TYPE_DEPENDENCY = 344505463; - - NEXT_HOP_ADDRESS_NOT_ASSIGNED = 324964999; - - NEXT_HOP_CANNOT_IP_FORWARD = 383382887; - - NEXT_HOP_INSTANCE_NOT_FOUND = 464250446; - - NEXT_HOP_INSTANCE_NOT_ON_NETWORK = 243758146; - - NEXT_HOP_NOT_RUNNING = 417081265; - - NOT_CRITICAL_ERROR = 105763924; - - NO_RESULTS_ON_PAGE = 30036744; - - REQUIRED_TOS_AGREEMENT = 3745539; - - RESOURCE_IN_USE_BY_OTHER_RESOURCE_WARNING = 496728641; - - RESOURCE_NOT_DELETED = 168598460; - - SCHEMA_VALIDATION_IGNORED = 275245642; - - SINGLE_INSTANCE_PROPERTY_TEMPLATE = 268305617; - - UNDECLARED_PROPERTIES = 390513439; - - UNREACHABLE = 13328052; - - } - - // [Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response. - optional Code code = 3059181; - - // [Output Only] Metadata about this warning in key: value format. For example: - // "data": [ { "key": "scope", "value": "zones/us-east1-d" } - repeated Data data = 3076010; - - // [Output Only] A human-readable description of the warning code. - optional string message = 418054151; - -} - -// -message AddressAggregatedList { - // [Output Only] Unique identifier for the resource; defined by the server. - optional string id = 3355; - - // A list of AddressesScopedList resources. - map items = 100526016; - - // [Output Only] Type of resource. Always compute#addressAggregatedList for aggregated lists of addresses. - optional string kind = 3292052; - - // [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - optional string next_page_token = 79797525; - - // [Output Only] Server-defined URL for this resource. - optional string self_link = 456214797; - - // [Output Only] Informational warning message. - optional Warning warning = 50704284; - -} - -// Contains a list of addresses. -message AddressList { - // [Output Only] Unique identifier for the resource; defined by the server. - optional string id = 3355; - - // A list of Address resources. - repeated Address items = 100526016; - - // [Output Only] Type of resource. Always compute#addressList for lists of addresses. - optional string kind = 3292052; - - // [Output Only] This token allows you to get the next page of results for list requests. If the number of results is larger than maxResults, use the nextPageToken as a value for the query parameter pageToken in the next list request. Subsequent list requests will have their own nextPageToken to continue paging through the results. - optional string next_page_token = 79797525; - - // [Output Only] Server-defined URL for this resource. - optional string self_link = 456214797; - - // [Output Only] Informational warning message. - optional Warning warning = 50704284; - -} - -// A request message for Addresses.AggregatedList. See the method description for details. -message AggregatedListAddressesRequest { - // A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - // - // For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - // - // You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - // - // To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - optional string filter = 336120696; - - // Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - optional bool include_all_scopes = 391327988; - - // The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - optional uint32 max_results = 54715419; - - // Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - // - // You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - // - // Currently, only sorting by `name` or `creationTimestamp desc` is supported. - optional string order_by = 160562920; - - // Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - optional string page_token = 19994697; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for Addresses.Delete. See the method description for details. -message DeleteAddressRequest { - // Name of the address resource to delete. - string address = 462920692 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - - // An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - // - // For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - optional string request_id = 37109963; - -} - -// A request message for Addresses.Insert. See the method description for details. -message InsertAddressRequest { - // The body resource for this request - Address address_resource = 483888121 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - - // An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - // - // For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - optional string request_id = 37109963; - -} - -// A request message for Addresses.List. See the method description for details. -message ListAddressesRequest { - // A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - // - // For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - // - // You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - // - // To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - optional string filter = 336120696; - - // The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - optional uint32 max_results = 54715419; - - // Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - // - // You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - // - // Currently, only sorting by name or creationTimestamp desc is supported. - string order_by = 160562920 [(google.api.field_behavior) = REQUIRED]; - - // Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - optional string page_token = 19994697; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for RegionOperations.Get. See the method description for details. -message GetRegionOperationRequest { - // Name of the Operations resource to return. - string operation = 52090215 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// A request message for RegionOperations.Wait. See the method description for details. -message WaitRegionOperationRequest { - // Name of the Operations resource to return. - string operation = 52090215 [(google.api.field_behavior) = REQUIRED]; - - // Project ID for this request. - string project = 227560217 [(google.api.field_behavior) = REQUIRED]; - - // Name of the region for this request. - string region = 138946292 [(google.api.field_behavior) = REQUIRED]; - -} - -// -// Services -// -// The Addresses API. -service Addresses { - option (google.api.default_host) = - "compute.googleapis.com"; - - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/cloud-platform"; - - // Retrieves an aggregated list of addresses. - rpc AggregatedList(AggregatedListAddressesRequest) returns (AddressAggregatedList) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/aggregated/addresses" - }; - option (google.api.method_signature) = "project"; - } - - // Deletes the specified address resource. - rpc Delete(DeleteAddressRequest) returns (Operation) { - option (google.api.http) = { - delete: "/compute/v1/projects/{project}/regions/{region}/addresses/{address}" - }; - option (google.api.method_signature) = "project,region,address"; - } - - // Creates an address resource in the specified project by using the data included in the request. - rpc Insert(InsertAddressRequest) returns (Operation) { - option (google.api.http) = { - post: "/compute/v1/projects/{project}/regions/{region}/addresses" - body: "address_resource" - }; - option (google.api.method_signature) = "project,region,address_resource"; - } - - // Retrieves a list of addresses contained within the specified region. - rpc List(ListAddressesRequest) returns (AddressList) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/regions/{region}/addresses" - }; - option (google.api.method_signature) = "project,region,order_by"; - } - -} - -// The RegionOperations API. -service RegionOperations { - option (google.api.default_host) = - "compute.googleapis.com"; - - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/compute.readonly," - "https://www.googleapis.com/auth/compute," - "https://www.googleapis.com/auth/cloud-platform"; - - // Retrieves the specified region-specific Operations resource. - rpc Get(GetRegionOperationRequest) returns (Operation) { - option (google.api.http) = { - get: "/compute/v1/projects/{project}/regions/{region}/operations/{operation}" - }; - option (google.api.method_signature) = "project,region,operation"; - } - - // Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. - // - // This method is called on a best-effort basis. Specifically: - // - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - // - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - rpc Wait(WaitRegionOperationRequest) returns (Operation) { - option (google.api.http) = { - post: "/compute/v1/projects/projects/{project}/regions/{region}/operations/{operation}/wait" - }; - option (google.api.method_signature) = "project,region,operation"; - } - -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.aggregated_list.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.aggregated_list.js.baseline deleted file mode 100644 index 7d76873cf7b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.aggregated_list.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project) { - // [START compute_v1_generated_Addresses_AggregatedList_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - * For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - * You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - */ - // const filter = 'abc123' - /** - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - */ - // const includeAllScopes = true - /** - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - */ - // const maxResults = 1234 - /** - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * Currently, only sorting by `name` or `creationTimestamp desc` is supported. - */ - // const orderBy = 'abc123' - /** - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - */ - // const pageToken = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callAggregatedList() { - // Construct request - const request = { - project, - }; - - // Run request - const iterable = computeClient.aggregatedListAsync(request); - for await (const [key, value] of iterable) { - console.log(response); - } - } - - callAggregatedList(); - // [END compute_v1_generated_Addresses_AggregatedList_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.delete.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.delete.js.baseline deleted file mode 100644 index 26b55b0ef5c1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.delete.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(address, project, region) { - // [START compute_v1_generated_Addresses_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the address resource to delete. - */ - // const address = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - /** - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callDelete() { - // Construct request - const request = { - address, - project, - region, - }; - - // Run request - const response = await computeClient.delete(request); - console.log(response); - } - - callDelete(); - // [END compute_v1_generated_Addresses_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.insert.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.insert.js.baseline deleted file mode 100644 index 2bb25d6f1849..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.insert.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(addressResource, project, region) { - // [START compute_v1_generated_Addresses_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The body resource for this request - */ - // const addressResource = {} - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - /** - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callInsert() { - // Construct request - const request = { - addressResource, - project, - region, - }; - - // Run request - const response = await computeClient.insert(request); - console.log(response); - } - - callInsert(); - // [END compute_v1_generated_Addresses_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.list.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.list.js.baseline deleted file mode 100644 index ef0a023a496a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/addresses.list.js.baseline +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(orderBy, project, region) { - // [START compute_v1_generated_Addresses_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - */ - // const filter = 'abc123' - /** - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - */ - // const maxResults = 1234 - /** - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * Currently, only sorting by name or creationTimestamp desc is supported. - */ - // const orderBy = 'abc123' - /** - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - */ - // const pageToken = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {AddressesClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new AddressesClient(); - - async function callList() { - // Construct request - const request = { - orderBy, - project, - region, - }; - - // Run request - const iterable = computeClient.listAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callList(); - // [END compute_v1_generated_Addresses_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.get.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.get.js.baseline deleted file mode 100644 index 2ddf73f9073b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.get.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(operation, project, region) { - // [START compute_v1_generated_RegionOperations_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the Operations resource to return. - */ - // const operation = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {RegionOperationsClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new RegionOperationsClient(); - - async function callGet() { - // Construct request - const request = { - operation, - project, - region, - }; - - // Run request - const response = await computeClient.get(request); - console.log(response); - } - - callGet(); - // [END compute_v1_generated_RegionOperations_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.wait.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.wait.js.baseline deleted file mode 100644 index 077bb85ede2b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/region_operations.wait.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(operation, project, region) { - // [START compute_v1_generated_RegionOperations_Wait_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the Operations resource to return. - */ - // const operation = 'abc123' - /** - * Project ID for this request. - */ - // const project = 'my-project' - /** - * Name of the region for this request. - */ - // const region = 'us-central1' - - // Imports the Compute library - const {RegionOperationsClient} = require('@google-cloud/compute').v1; - - // Instantiates a client - const computeClient = new RegionOperationsClient(); - - async function callWait() { - // Construct request - const request = { - operation, - project, - region, - }; - - // Run request - const response = await computeClient.wait(request); - console.log(response); - } - - callWait(); - // [END compute_v1_generated_RegionOperations_Wait_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline deleted file mode 100644 index 2f63f6c82a86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/samples/generated/v1/snippet_metadata_google.cloud.compute.v1.json.baseline +++ /dev/null @@ -1,335 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-compute", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.compute.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "compute_v1_generated_Addresses_AggregatedList_async", - "title": "Addresses aggregatedList Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an aggregated list of addresses.", - "canonical": true, - "file": "addresses.aggregated_list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AggregatedList", - "fullName": "google.cloud.compute.v1.Addresses.AggregatedList", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "include_all_scopes", - "type": "TYPE_BOOL" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.AddressAggregatedList", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "AggregatedList", - "fullName": "google.cloud.compute.v1.Addresses.AggregatedList", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_Delete_async", - "title": "Addresses delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified address resource.", - "canonical": true, - "file": "addresses.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.compute.v1.Addresses.Delete", - "async": true, - "parameters": [ - { - "name": "address", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.compute.v1.Addresses.Delete", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_Insert_async", - "title": "Addresses insert Sample", - "origin": "API_DEFINITION", - "description": " Creates an address resource in the specified project by using the data included in the request.", - "canonical": true, - "file": "addresses.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.compute.v1.Addresses.Insert", - "async": true, - "parameters": [ - { - "name": "address_resource", - "type": ".google.cloud.compute.v1.Address" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.compute.v1.Addresses.Insert", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_Addresses_List_async", - "title": "Addresses list Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a list of addresses contained within the specified region.", - "canonical": true, - "file": "addresses.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.compute.v1.Addresses.List", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.AddressList", - "client": { - "shortName": "AddressesClient", - "fullName": "google.cloud.compute.v1.AddressesClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.compute.v1.Addresses.List", - "service": { - "shortName": "Addresses", - "fullName": "google.cloud.compute.v1.Addresses" - } - } - } - }, - { - "regionTag": "compute_v1_generated_RegionOperations_Get_async", - "title": "Addresses get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves the specified region-specific Operations resource.", - "canonical": true, - "file": "region_operations.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.compute.v1.RegionOperations.Get", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "RegionOperationsClient", - "fullName": "google.cloud.compute.v1.RegionOperationsClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.compute.v1.RegionOperations.Get", - "service": { - "shortName": "RegionOperations", - "fullName": "google.cloud.compute.v1.RegionOperations" - } - } - } - }, - { - "regionTag": "compute_v1_generated_RegionOperations_Wait_async", - "title": "Addresses wait Sample", - "origin": "API_DEFINITION", - "description": " Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. This method is called on a best-effort basis. Specifically: - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`.", - "canonical": true, - "file": "region_operations.wait.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Wait", - "fullName": "google.cloud.compute.v1.RegionOperations.Wait", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "region", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.compute.v1.Operation", - "client": { - "shortName": "RegionOperationsClient", - "fullName": "google.cloud.compute.v1.RegionOperationsClient" - }, - "method": { - "shortName": "Wait", - "fullName": "google.cloud.compute.v1.RegionOperations.Wait", - "service": { - "shortName": "RegionOperations", - "fullName": "google.cloud.compute.v1.RegionOperations" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/index.ts.baseline deleted file mode 100644 index 9a838f04175a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/index.ts.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const AddressesClient = v1.AddressesClient; -type AddressesClient = v1.AddressesClient; -const RegionOperationsClient = v1.RegionOperationsClient; -type RegionOperationsClient = v1.RegionOperationsClient; -export {v1, AddressesClient, RegionOperationsClient}; -export default {v1, AddressesClient, RegionOperationsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client.ts.baseline deleted file mode 100644 index 9b25f024cd75..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client.ts.baseline +++ /dev/null @@ -1,878 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/addresses_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './addresses_client_config.json'; -const version = require('../../../package.json').version; - -/** - * - * Services - * - * The Addresses API. - * @class - * @memberof v1 - */ -export class AddressesClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('compute'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - addressesStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AddressesClient. - * - * @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://cloud.google.com/docs/authentication/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 AddressesClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AddressesClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'compute.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - // Implicitly enable HTTP transport for the APIs that use REST as transport (e.g. Google Cloud Compute). - if (!opts) { - opts = {fallback: true}; - } else { - opts.fallback = opts.fallback ?? true; - } - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - aggregatedList: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'items'), - list: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'items') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.compute.v1.Addresses', gapicConfig as gax.ClientConfig, - 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.addressesStub) { - return this.addressesStub; - } - - // Put together the "service stub" for - // google.cloud.compute.v1.Addresses. - this.addressesStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.compute.v1.Addresses') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.compute.v1.Addresses, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const addressesStubMethods = - ['aggregatedList', 'delete', 'insert', 'list']; - for (const methodName of addressesStubMethods) { - const callPromise = this.addressesStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.addressesStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/compute', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Deletes the specified address resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.address - * Name of the address resource to delete. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * This method is considered to be in beta. This means while - * stable it is still a work-in-progress and under active development, - * and might get backwards-incompatible changes at any time. - * `.promise()` is not supported yet. - * @example include:samples/generated/v1/addresses.delete.js - * region_tag:compute_v1_generated_Addresses_Delete_async - */ - delete( - request?: protos.google.cloud.compute.v1.IDeleteAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>; - delete( - request: protos.google.cloud.compute.v1.IDeleteAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): void; - delete( - request: protos.google.cloud.compute.v1.IDeleteAddressRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): void; - delete( - request?: protos.google.cloud.compute.v1.IDeleteAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'address': request.address ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IDeleteAddressRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, nextRequest, rawResponse) => { - this._log.info('delete response %j', rawResponse); - callback!(error, response, nextRequest, rawResponse); // We verified `callback` above. - } - : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, operation, rawResponse]: [protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation]) => { - return [ - { latestResponse: response, done: false, name: response.id, metadata: null, result: {}}, - operation, - rawResponse - ]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates an address resource in the specified project by using the data included in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.compute.v1.Address} request.addressResource - * The body resource for this request - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @param {string} request.requestId - * An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. - * - * For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). - * @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 - * a long running operation. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * This method is considered to be in beta. This means while - * stable it is still a work-in-progress and under active development, - * and might get backwards-incompatible changes at any time. - * `.promise()` is not supported yet. - * @example include:samples/generated/v1/addresses.insert.js - * region_tag:compute_v1_generated_Addresses_Insert_async - */ - insert( - request?: protos.google.cloud.compute.v1.IInsertAddressRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>; - insert( - request: protos.google.cloud.compute.v1.IInsertAddressRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): void; - insert( - request: protos.google.cloud.compute.v1.IInsertAddressRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): void; - insert( - request?: protos.google.cloud.compute.v1.IInsertAddressRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.cloud.compute.v1.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IInsertAddressRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, nextRequest, rawResponse) => { - this._log.info('insert response %j', rawResponse); - callback!(error, response, nextRequest, rawResponse); // We verified `callback` above. - } - : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, operation, rawResponse]: [protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation, protos.google.cloud.compute.v1.IOperation]) => { - return [ - { latestResponse: response, done: false, name: response.id, metadata: null, result: {}}, - operation, - rawResponse - ]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - -/** - * Retrieves an aggregated list of addresses. - * - * `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.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either `=`, `!=`, `>`, or `<`. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named `example-instance` by specifying `name != example-instance`. - * - * You can also filter nested fields. For example, you could specify `scheduling.automaticRestart = false` to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example: ``` (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By default, each expression is an `AND` expression. However, you can include `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true) ``` - * @param {boolean} request.includeAllScopes - * Indicates whether every visible scope for each scope type (zone, region, global) should be included in the response. For new resource types added after this field, the flag has no effect as new resource types will always include every visible scope for each scope type in response. For resource types which predate this field, if this flag is omitted or false, only scopes of the scope types where the resource type is expected to be found will be included. - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than `maxResults`, Compute Engine returns a `nextPageToken` that can be used to get the next page of results in subsequent list requests. Acceptable values are `0` to `500`, inclusive. (Default: `500`) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using `orderBy="creationTimestamp desc"`. This sorts results based on the `creationTimestamp` field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by `name` or `creationTimestamp desc` is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set `pageToken` to the `nextPageToken` returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @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 - * as tuple [string, {@link protos.google.cloud.compute.v1.AddressesScopedList|AddressesScopedList}]. 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 include:samples/generated/v1/addresses.aggregated_list.js - * region_tag:compute_v1_generated_Addresses_AggregatedList_async - */ - aggregatedListAsync( - request?: protos.google.cloud.compute.v1.IAggregatedListAddressesRequest, - options?: CallOptions): - AsyncIterable<[string, protos.google.cloud.compute.v1.IAddressesScopedList]>{ - 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({ - 'project': request.project ?? '', - }); - const defaultCallSettings = this._defaults['aggregatedList']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('aggregatedList iterate %j', request); - return this.descriptors.page.aggregatedList.asyncIterate( - this.innerApiCalls['aggregatedList'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable<[string, protos.google.cloud.compute.v1.IAddressesScopedList]>; - } - /** - * Retrieves a list of addresses contained within the specified region. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 Array of {@link protos.google.cloud.compute.v1.Address|Address}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAsync()` - * 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. - */ - list( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]>; - list( - request: protos.google.cloud.compute.v1.IListAddressesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): void; - list( - request: protos.google.cloud.compute.v1.IListAddressesRequest, - callback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): void; - list( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>, - callback?: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>): - Promise<[ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.compute.v1.IListAddressesRequest, - protos.google.cloud.compute.v1.IAddressList|null|undefined, - protos.google.cloud.compute.v1.IAddress>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('list values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('list request %j', request); - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.compute.v1.IAddress[], - protos.google.cloud.compute.v1.IListAddressesRequest|null, - protos.google.cloud.compute.v1.IAddressList - ]) => { - this._log.info('list values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `list`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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.cloud.compute.v1.Address|Address} 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 `listAsync()` - * 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. - */ - listStream( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - Transform{ - 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({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['list']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('list stream %j', request); - return this.descriptors.page.list.createStream( - this.innerApiCalls.list as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `list`, 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.filter - * A filter expression that filters resources listed in the response. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, or a boolean. The comparison operator must be either =, !=, >, or <. - * - * For example, if you are filtering Compute Engine instances, you can exclude instances named example-instance by specifying name != example-instance. - * - * You can also filter nested fields. For example, you could specify scheduling.automaticRestart = false to include instances only if they are not scheduled for automatic restarts. You can use filtering on nested fields to filter based on resource labels. - * - * To filter on multiple expressions, provide each separate expression within parentheses. For example, (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake"). By default, each expression is an AND expression. However, you can include AND and OR expressions explicitly. For example, (cpuPlatform = "Intel Skylake") OR (cpuPlatform = "Intel Broadwell") AND (scheduling.automaticRestart = true). - * @param {number} request.maxResults - * The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500) - * @param {string} request.orderBy - * Sorts list results by a certain order. By default, results are returned in alphanumerical order based on the resource name. - * - * You can also sort results in descending order based on the creation timestamp using orderBy="creationTimestamp desc". This sorts results based on the creationTimestamp field in reverse chronological order (newest result first). Use this to sort resources like operations so that the newest operation is returned first. - * - * Currently, only sorting by name or creationTimestamp desc is supported. - * @param {string} request.pageToken - * Specifies a page token to use. Set pageToken to the nextPageToken returned by a previous list request to get the next page of results. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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.cloud.compute.v1.Address|Address}. 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 include:samples/generated/v1/addresses.list.js - * region_tag:compute_v1_generated_Addresses_List_async - */ - listAsync( - request?: protos.google.cloud.compute.v1.IListAddressesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'project': request.project ?? '', - 'region': request.region ?? '', - }); - const defaultCallSettings = this._defaults['list']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('list iterate %j', request); - return this.descriptors.page.list.asyncIterate( - this.innerApiCalls['list'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.addressesStub && !this._terminated) { - return this.addressesStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client_config.json.baseline deleted file mode 100644 index 0d5310c8abaa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_client_config.json.baseline +++ /dev/null @@ -1,42 +0,0 @@ -{ - "interfaces": { - "google.cloud.compute.v1.Addresses": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AggregatedList": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Delete": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_proto_list.json.baseline deleted file mode 100644 index 807dc1f490a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/addresses_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/compute/v1/compute_small.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/index.ts.baseline deleted file mode 100644 index 89eedd6b8c95..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/index.ts.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2026 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. ** - -export {AddressesClient} from './addresses_client'; -export {RegionOperationsClient} from './region_operations_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client.ts.baseline deleted file mode 100644 index 7a51227dbe50..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client.ts.baseline +++ /dev/null @@ -1,544 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/region_operations_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './region_operations_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The RegionOperations API. - * @class - * @memberof v1 - */ -export class RegionOperationsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('compute'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - regionOperationsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of RegionOperationsClient. - * - * @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://cloud.google.com/docs/authentication/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 RegionOperationsClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof RegionOperationsClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'compute.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - // Implicitly enable HTTP transport for the APIs that use REST as transport (e.g. Google Cloud Compute). - if (!opts) { - opts = {fallback: true}; - } else { - opts.fallback = opts.fallback ?? true; - } - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.compute.v1.RegionOperations', gapicConfig as gax.ClientConfig, - 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.regionOperationsStub) { - return this.regionOperationsStub; - } - - // Put together the "service stub" for - // google.cloud.compute.v1.RegionOperations. - this.regionOperationsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.compute.v1.RegionOperations') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.compute.v1.RegionOperations, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const regionOperationsStubMethods = - ['get', 'wait']; - for (const methodName of regionOperationsStubMethods) { - const callPromise = this.regionOperationsStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.regionOperationsStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'compute.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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/compute.readonly', - 'https://www.googleapis.com/auth/compute', - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Retrieves the specified region-specific Operations resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Name of the Operations resource to return. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 {@link protos.google.cloud.compute.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/region_operations.get.js - * region_tag:compute_v1_generated_RegionOperations_Get_async - */ - get( - request?: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, {}|undefined - ]>; - get( - request: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - get( - request: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - get( - request?: protos.google.cloud.compute.v1.IGetRegionOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'operation': request.operation ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IGetRegionOperationRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Waits for the specified Operation resource to return as `DONE` or for the request to approach the 2 minute deadline, and retrieves the specified Operation resource. This method differs from the `GET` method in that it waits for no more than the default deadline (2 minutes) and then returns the current state of the operation, which might be `DONE` or still in progress. - * - * This method is called on a best-effort basis. Specifically: - * - In uncommon cases, when the server is overloaded, the request might return before the default deadline is reached, or might return after zero seconds. - * - If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not `DONE`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Name of the Operations resource to return. - * @param {string} request.project - * Project ID for this request. - * @param {string} request.region - * Name of the region for this request. - * @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 {@link protos.google.cloud.compute.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/region_operations.wait.js - * region_tag:compute_v1_generated_RegionOperations_Wait_async - */ - wait( - request?: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, {}|undefined - ]>; - wait( - request: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - callback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.cloud.compute.v1.IWaitRegionOperationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'region': request.region ?? '', - 'operation': request.operation ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('wait request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('wait response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.compute.v1.IOperation, - protos.google.cloud.compute.v1.IWaitRegionOperationRequest|undefined, - {}|undefined - ]) => { - this._log.info('wait response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.regionOperationsStub && !this._terminated) { - return this.regionOperationsStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client_config.json.baseline deleted file mode 100644 index 08ee6ece8470..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_client_config.json.baseline +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.cloud.compute.v1.RegionOperations": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Get": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_proto_list.json.baseline deleted file mode 100644 index 807dc1f490a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/src/v1/region_operations_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/compute/v1/compute_small.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 9fe84b556875..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const compute = require('@google-cloud/compute'); - -function main() { - const addressesClient = new compute.AddressesClient(); - const regionOperationsClient = new compute.RegionOperationsClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 33f6383ebf4c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2026 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. ** - -import {AddressesClient, RegionOperationsClient} from '@google-cloud/compute'; - -// check that the client class type name can be used -function doStuffWithAddressesClient(client: AddressesClient) { - client.close(); -} -function doStuffWithRegionOperationsClient(client: RegionOperationsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const addressesClient = new AddressesClient(); - doStuffWithAddressesClient(addressesClient); - // check that the client instance can be created - const regionOperationsClient = new RegionOperationsClient(); - doStuffWithRegionOperationsClient(regionOperationsClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_addresses_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_addresses_v1.ts.baseline deleted file mode 100644 index 730191a98310..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_addresses_v1.ts.baseline +++ /dev/null @@ -1,862 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it, beforeEach, afterEach} from 'mocha'; -import * as addressesModule from '../src'; - -import {PassThrough} from 'stream'; - -import {GoogleAuth, protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.AddressesClient', () => { - let googleAuth: GoogleAuth; - beforeEach(() => { - googleAuth = { - getClient: sinon.stub().resolves({ - getRequestHeaders: sinon.stub().resolves({Authorization: 'Bearer SOME_TOKEN'}), - }) - } as unknown as GoogleAuth; - }); - afterEach(() => { - sinon.restore(); - }); - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new addressesModule.v1.AddressesClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new addressesModule.v1.AddressesClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = addressesModule.v1.AddressesClient.servicePath; - assert.strictEqual(servicePath, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = addressesModule.v1.AddressesClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new addressesModule.v1.AddressesClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new addressesModule.v1.AddressesClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new addressesModule.v1.AddressesClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new addressesModule.v1.AddressesClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new addressesModule.v1.AddressesClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = addressesModule.v1.AddressesClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new addressesModule.v1.AddressesClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new addressesModule.v1.AddressesClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.addressesStub, undefined); - await client.initialize(); - assert(client.addressesStub); - }); - - it('has close method for the initialized client', done => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.addressesStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.addressesStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response.latestResponse, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&address=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.DeleteAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.DeleteAddressRequest', ['address']); - request.address = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response.latestResponse, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.InsertAddressRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.InsertAddressRequest', ['region']); - request.region = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('aggregatedList', () => { - - it('uses async iteration with aggregatedList without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.AggregatedListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.AggregatedListAddressesRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = [ - ['tuple_key_1', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ['tuple_key_2', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ['tuple_key_3', generateSampleMessage(new protos.google.cloud.compute.v1.AddressesScopedList())], - ]; - client.descriptors.page.aggregatedList.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: Array<[string, protos.google.cloud.compute.v1.IAddressesScopedList]> = []; - const iterable = client.aggregatedListAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with aggregatedList with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.AggregatedListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.AggregatedListAddressesRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.aggregatedList.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.aggregatedListAsync(request); - await assert.rejects(async () => { - const responses: Array<[string, protos.google.cloud.compute.v1.IAddressesScopedList]> = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.aggregatedList.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IAddress[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStream without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.descriptors.page.list.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.compute.v1.Address[] = []; - stream.on('data', (response: protos.google.cloud.compute.v1.Address) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.list.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.list, request)); - assert( - (client.descriptors.page.list.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStream with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.list.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.compute.v1.Address[] = []; - stream.on('data', (response: protos.google.cloud.compute.v1.Address) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.list.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.list, request)); - assert( - (client.descriptors.page.list.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with list without error', async () => { - const client = new addressesModule.v1.AddressesClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - generateSampleMessage(new protos.google.cloud.compute.v1.Address()), - ]; - client.descriptors.page.list.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.compute.v1.IAddress[] = []; - const iterable = client.listAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with list with error', async () => { - const client = new addressesModule.v1.AddressesClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.ListAddressesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.ListAddressesRequest', ['region']); - request.region = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.list.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.compute.v1.IAddress[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.list.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_region_operations_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_region_operations_v1.ts.baseline deleted file mode 100644 index 1315afcae7c4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/test/gapic_region_operations_v1.ts.baseline +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it, beforeEach, afterEach} from 'mocha'; -import * as regionoperationsModule from '../src'; - -import {GoogleAuth, protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.RegionOperationsClient', () => { - let googleAuth: GoogleAuth; - beforeEach(() => { - googleAuth = { - getClient: sinon.stub().resolves({ - getRequestHeaders: sinon.stub().resolves({Authorization: 'Bearer SOME_TOKEN'}), - }) - } as unknown as GoogleAuth; - }); - afterEach(() => { - sinon.restore(); - }); - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = regionoperationsModule.v1.RegionOperationsClient.servicePath; - assert.strictEqual(servicePath, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = regionoperationsModule.v1.RegionOperationsClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'compute.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new regionoperationsModule.v1.RegionOperationsClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new regionoperationsModule.v1.RegionOperationsClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'compute.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new regionoperationsModule.v1.RegionOperationsClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = regionoperationsModule.v1.RegionOperationsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.regionOperationsStub, undefined); - await client.initialize(); - assert(client.regionOperationsStub); - }); - - it('has close method for the initialized client', done => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.regionOperationsStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - assert.strictEqual(client.regionOperationsStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.GetRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.GetRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.wait = stubSimpleCall(expectedResponse); - const [response] = await client.wait(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait without error using callback', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.compute.v1.Operation() - ); - client.innerApiCalls.wait = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, result?: protos.google.cloud.compute.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait with error', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }®ion=${defaultValue2 ?? '' }&operation=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - const actualRequest = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.wait as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes wait with closed client', async () => { - const client = new regionoperationsModule.v1.RegionOperationsClient({ - auth: googleAuth, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.compute.v1.WaitRegionOperationRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['region']); - request.region = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.compute.v1.WaitRegionOperationRequest', ['operation']); - request.operation = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.wait(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/compute/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/compute/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/compute/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/compute/webpack.config.js.baseline deleted file mode 100644 index e5f87460510a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/compute/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Addresses', - filename: './addresses.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 1924bf29e17b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/deprecatedtest/google-deprecatedtest-nodejs - dest: /owl-bot-staging/google-deprecatedtest - -api-name: deprecatedtest \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 7877bb1cd2bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'deprecatedtest', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/README.md.baseline deleted file mode 100644 index 5b9e989e9791..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Deprecatedtest: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/deprecatedtest.svg)](https://www.npmjs.org/package/deprecatedtest) - -Deprecatedtest client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Deprecatedtest Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/deprecatedtest/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Deprecatedtest API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install deprecatedtest -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install deprecatedtest@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/index.ts.baseline deleted file mode 100644 index 3f8b8154d178..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const DeprecatedServiceClient = v1.DeprecatedServiceClient; -type DeprecatedServiceClient = v1.DeprecatedServiceClient; -export {v1, DeprecatedServiceClient}; -export default {v1, DeprecatedServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client.ts.baseline deleted file mode 100644 index abbf771ffe6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client.ts.baseline +++ /dev/null @@ -1,537 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as deprecated_service_client_config from './deprecated_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/deprecated_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'deprecated_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is a service description. - * It takes up multiple lines, like so. - * @class - * @memberof v1 - * @deprecated DeprecatedService is deprecated and may be removed in a future version. - */ -export class DeprecatedServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('deprecatedtest'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - deprecatedServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DeprecatedServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 DeprecatedServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DeprecatedServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.deprecatedtest.v1.DeprecatedService', gapicConfig as gax.ClientConfig, - 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.deprecatedServiceStub) { - this.warn('DEP$DeprecatedService', 'DeprecatedService is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.deprecatedServiceStub; - } - - // Put together the "service stub" for - // google.deprecatedtest.v1.DeprecatedService. - this.deprecatedServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.deprecatedtest.v1.DeprecatedService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.deprecatedtest.v1.DeprecatedService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const deprecatedServiceStubMethods = - ['fastFibonacci', 'slowFibonacci']; - for (const methodName of deprecatedServiceStubMethods) { - const callPromise = this.deprecatedServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - this.warn('DEP$DeprecatedService', 'DeprecatedService is deprecated and may be removed in a future version.', 'DeprecationWarning'); - - return this.deprecatedServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Calculates Fibonacci on the provided value, quickly. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/deprecated_service.fast_fibonacci.js - * region_tag:localhost_v1_generated_DeprecatedService_FastFibonacci_async - */ - fastFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - fastFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('fastFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('fastFibonacci response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.fastFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]) => { - this._log.info('fastFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, slowly. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/deprecated_service.slow_fibonacci.js - * region_tag:localhost_v1_generated_DeprecatedService_SlowFibonacci_async - * @deprecated SlowFibonacci is deprecated and may be removed in a future version. - */ - slowFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - slowFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this.warn('DEP$DeprecatedService-$SlowFibonacci','SlowFibonacci is deprecated and may be removed in a future version.', 'DeprecationWarning'); - this._log.info('slowFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('slowFibonacci response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.slowFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]) => { - this._log.info('slowFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.deprecatedServiceStub && !this._terminated) { - return this.deprecatedServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client_config.json.baseline deleted file mode 100644 index 49407ef57c4b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_client_config.json.baseline +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.deprecatedtest.v1.DeprecatedService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "FastFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SlowFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_proto_list.json.baseline deleted file mode 100644 index 0c4d1090fe6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/deprecated_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/deprecatedtest/v1/deprecatedtest_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 91d195e31d85..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DeprecatedServiceClient} from './deprecated_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index e76463f5052f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const deprecatedtest = require('deprecatedtest'); - -function main() { - const deprecatedServiceClient = new deprecatedtest.DeprecatedServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 5255b6528d8a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as deprecatedtest from 'deprecatedtest'; - -function main() { - const deprecatedServiceClient = new deprecatedtest.DeprecatedServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 8ba7f01cacbd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {DeprecatedServiceClient} from 'deprecatedtest'; - -// check that the client class type name can be used -function doStuffWithDeprecatedServiceClient(client: DeprecatedServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const deprecatedServiceClient = new DeprecatedServiceClient(); - doStuffWithDeprecatedServiceClient(deprecatedServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json deleted file mode 100644 index 843f1661d115..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "deprecatedtest", - "version": "0.1.0", - "description": "Deprecatedtest client for Node.js", - "repository": "googleapis/nodejs-deprecatedtest", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google deprecatedtest", - "deprecatedtest", - "deprecated service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline deleted file mode 100644 index 9e16c2993ad7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/empty.proto"; - -package google.deprecatedtest.v1; - -option java_package = "com.google.deprecatedtest.v1"; -option java_multiple_files = true; - -// This is a service description. -// It takes up multiple lines, like so. -service DeprecatedService { - option (google.api.default_host) = "localhost:7469"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - option deprecated = true; - - // Calculates Fibonacci on the provided value, quickly. - rpc FastFibonacci(FibonacciRequest) returns (google.protobuf.Empty); - - // Calculates Fibonacci on the provided value, slowly. - rpc SlowFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - option deprecated = true; - }; -} - -// This is a message descxription. -// Lorum ipsum dolor sit amet consectetur adipiscing elit. -message FibonacciRequest { - // The nth term to retrieve in the Fibonacci sequence. - int32 value = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline deleted file mode 100644 index 3984cb1a064f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_DeprecatedService_FastFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - - // Imports the Deprecatedtest library - const {DeprecatedServiceClient} = require('deprecatedtest').v1; - - // Instantiates a client - const deprecatedtestClient = new DeprecatedServiceClient(); - - async function callFastFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await deprecatedtestClient.fastFibonacci(request); - console.log(response); - } - - callFastFibonacci(); - // [END localhost_v1_generated_DeprecatedService_FastFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline deleted file mode 100644 index 015bb1949987..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_DeprecatedService_SlowFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - - // Imports the Deprecatedtest library - const {DeprecatedServiceClient} = require('deprecatedtest').v1; - - // Instantiates a client - const deprecatedtestClient = new DeprecatedServiceClient(); - - async function callSlowFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await deprecatedtestClient.slowFibonacci(request); - console.log(response); - } - - callSlowFibonacci(); - // [END localhost_v1_generated_DeprecatedService_SlowFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline deleted file mode 100644 index 51ec214c4c6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline +++ /dev/null @@ -1,95 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-deprecatedtest", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.deprecatedtest.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1_generated_DeprecatedService_FastFibonacci_async", - "title": "DeprecatedService fastFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, quickly.", - "canonical": true, - "file": "deprecated_service.fast_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FastFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.FastFibonacci", - "async": true, - "parameters": [ - { - "name": "value", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeprecatedServiceClient", - "fullName": "google.deprecatedtest.v1.DeprecatedServiceClient" - }, - "method": { - "shortName": "FastFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.FastFibonacci", - "service": { - "shortName": "DeprecatedService", - "fullName": "google.deprecatedtest.v1.DeprecatedService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_DeprecatedService_SlowFibonacci_async", - "title": "DeprecatedService slowFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, slowly.", - "canonical": true, - "file": "deprecated_service.slow_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SlowFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.SlowFibonacci", - "async": true, - "parameters": [ - { - "name": "value", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeprecatedServiceClient", - "fullName": "google.deprecatedtest.v1.DeprecatedServiceClient" - }, - "method": { - "shortName": "SlowFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.SlowFibonacci", - "service": { - "shortName": "DeprecatedService", - "fullName": "google.deprecatedtest.v1.DeprecatedService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/webpack.config.cjs.baseline deleted file mode 100644 index 4cdc3b27d699..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DeprecatedService', - filename: './deprecated-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.OwlBot.yaml.baseline deleted file mode 100644 index 1924bf29e17b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/deprecatedtest/google-deprecatedtest-nodejs - dest: /owl-bot-staging/google-deprecatedtest - -api-name: deprecatedtest \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.jsdoc.js.baseline deleted file mode 100644 index 2b82f042774c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'deprecatedtest', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/README.md.baseline deleted file mode 100644 index 5b9e989e9791..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Deprecatedtest: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/deprecatedtest.svg)](https://www.npmjs.org/package/deprecatedtest) - -Deprecatedtest client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Deprecatedtest Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/deprecatedtest/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Deprecatedtest API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install deprecatedtest -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install deprecatedtest@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-deprecatedtest diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json deleted file mode 100644 index 88c1982c292e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "deprecatedtest", - "version": "0.1.0", - "description": "Deprecatedtest client for Node.js", - "repository": "googleapis/nodejs-deprecatedtest", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google deprecatedtest", - "deprecatedtest", - "deprecated service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline deleted file mode 100644 index 9e16c2993ad7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/protos/google/deprecatedtest/v1/deprecatedtest_service.proto.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/protobuf/empty.proto"; - -package google.deprecatedtest.v1; - -option java_package = "com.google.deprecatedtest.v1"; -option java_multiple_files = true; - -// This is a service description. -// It takes up multiple lines, like so. -service DeprecatedService { - option (google.api.default_host) = "localhost:7469"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - option deprecated = true; - - // Calculates Fibonacci on the provided value, quickly. - rpc FastFibonacci(FibonacciRequest) returns (google.protobuf.Empty); - - // Calculates Fibonacci on the provided value, slowly. - rpc SlowFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - option deprecated = true; - }; -} - -// This is a message descxription. -// Lorum ipsum dolor sit amet consectetur adipiscing elit. -message FibonacciRequest { - // The nth term to retrieve in the Fibonacci sequence. - int32 value = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline deleted file mode 100644 index 3984cb1a064f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.fast_fibonacci.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_DeprecatedService_FastFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - - // Imports the Deprecatedtest library - const {DeprecatedServiceClient} = require('deprecatedtest').v1; - - // Instantiates a client - const deprecatedtestClient = new DeprecatedServiceClient(); - - async function callFastFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await deprecatedtestClient.fastFibonacci(request); - console.log(response); - } - - callFastFibonacci(); - // [END localhost_v1_generated_DeprecatedService_FastFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline deleted file mode 100644 index 015bb1949987..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/deprecated_service.slow_fibonacci.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_DeprecatedService_SlowFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - - // Imports the Deprecatedtest library - const {DeprecatedServiceClient} = require('deprecatedtest').v1; - - // Instantiates a client - const deprecatedtestClient = new DeprecatedServiceClient(); - - async function callSlowFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await deprecatedtestClient.slowFibonacci(request); - console.log(response); - } - - callSlowFibonacci(); - // [END localhost_v1_generated_DeprecatedService_SlowFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline deleted file mode 100644 index 51ec214c4c6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/samples/generated/v1/snippet_metadata_google.deprecatedtest.v1.json.baseline +++ /dev/null @@ -1,95 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-deprecatedtest", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.deprecatedtest.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1_generated_DeprecatedService_FastFibonacci_async", - "title": "DeprecatedService fastFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, quickly.", - "canonical": true, - "file": "deprecated_service.fast_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FastFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.FastFibonacci", - "async": true, - "parameters": [ - { - "name": "value", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeprecatedServiceClient", - "fullName": "google.deprecatedtest.v1.DeprecatedServiceClient" - }, - "method": { - "shortName": "FastFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.FastFibonacci", - "service": { - "shortName": "DeprecatedService", - "fullName": "google.deprecatedtest.v1.DeprecatedService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_DeprecatedService_SlowFibonacci_async", - "title": "DeprecatedService slowFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, slowly.", - "canonical": true, - "file": "deprecated_service.slow_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SlowFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.SlowFibonacci", - "async": true, - "parameters": [ - { - "name": "value", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DeprecatedServiceClient", - "fullName": "google.deprecatedtest.v1.DeprecatedServiceClient" - }, - "method": { - "shortName": "SlowFibonacci", - "fullName": "google.deprecatedtest.v1.DeprecatedService.SlowFibonacci", - "service": { - "shortName": "DeprecatedService", - "fullName": "google.deprecatedtest.v1.DeprecatedService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/index.ts.baseline deleted file mode 100644 index 304b2110ce96..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const DeprecatedServiceClient = v1.DeprecatedServiceClient; -type DeprecatedServiceClient = v1.DeprecatedServiceClient; -export {v1, DeprecatedServiceClient}; -export default {v1, DeprecatedServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client.ts.baseline deleted file mode 100644 index 1592625448ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client.ts.baseline +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/deprecated_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './deprecated_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is a service description. - * It takes up multiple lines, like so. - * @class - * @memberof v1 - * @deprecated DeprecatedService is deprecated and may be removed in a future version. - */ -export class DeprecatedServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('deprecatedtest'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - deprecatedServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DeprecatedServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 DeprecatedServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DeprecatedServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.deprecatedtest.v1.DeprecatedService', gapicConfig as gax.ClientConfig, - 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.deprecatedServiceStub) { - this.warn('DEP$DeprecatedService', 'DeprecatedService is deprecated and may be removed in a future version.', 'DeprecationWarning'); - return this.deprecatedServiceStub; - } - - // Put together the "service stub" for - // google.deprecatedtest.v1.DeprecatedService. - this.deprecatedServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.deprecatedtest.v1.DeprecatedService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.deprecatedtest.v1.DeprecatedService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const deprecatedServiceStubMethods = - ['fastFibonacci', 'slowFibonacci']; - for (const methodName of deprecatedServiceStubMethods) { - const callPromise = this.deprecatedServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - this.warn('DEP$DeprecatedService', 'DeprecatedService is deprecated and may be removed in a future version.', 'DeprecationWarning'); - - return this.deprecatedServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Calculates Fibonacci on the provided value, quickly. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/deprecated_service.fast_fibonacci.js - * region_tag:localhost_v1_generated_DeprecatedService_FastFibonacci_async - */ - fastFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - fastFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('fastFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('fastFibonacci response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.fastFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, - {}|undefined - ]) => { - this._log.info('fastFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, slowly. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/deprecated_service.slow_fibonacci.js - * region_tag:localhost_v1_generated_DeprecatedService_SlowFibonacci_async - * @deprecated SlowFibonacci is deprecated and may be removed in a future version. - */ - slowFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - slowFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request: protos.google.deprecatedtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request?: protos.google.deprecatedtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this.warn('DEP$DeprecatedService-$SlowFibonacci','SlowFibonacci is deprecated and may be removed in a future version.', 'DeprecationWarning'); - this._log.info('slowFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('slowFibonacci response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.slowFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.deprecatedtest.v1.IFibonacciRequest|undefined, - {}|undefined - ]) => { - this._log.info('slowFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.deprecatedServiceStub && !this._terminated) { - return this.deprecatedServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client_config.json.baseline deleted file mode 100644 index 49407ef57c4b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_client_config.json.baseline +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.deprecatedtest.v1.DeprecatedService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "FastFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SlowFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_proto_list.json.baseline deleted file mode 100644 index 0c4d1090fe6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/deprecated_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/deprecatedtest/v1/deprecatedtest_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/index.ts.baseline deleted file mode 100644 index ee2c326c95a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DeprecatedServiceClient} from './deprecated_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 062e9f68e68d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const deprecatedtest = require('deprecatedtest'); - -function main() { - const deprecatedServiceClient = new deprecatedtest.DeprecatedServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 4327167deaf7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {DeprecatedServiceClient} from 'deprecatedtest'; - -// check that the client class type name can be used -function doStuffWithDeprecatedServiceClient(client: DeprecatedServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const deprecatedServiceClient = new DeprecatedServiceClient(); - doStuffWithDeprecatedServiceClient(deprecatedServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/deprecatedtest/webpack.config.js.baseline deleted file mode 100644 index 4cdc3b27d699..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/deprecatedtest/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DeprecatedService', - filename: './deprecated-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 0b1a54f4109e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/README.md.baseline deleted file mode 100644 index ccf41b264f5e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Showcase: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Showcase client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Showcase Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Showcase API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/index.ts.baseline deleted file mode 100644 index 485391ab99b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const ComplianceClient = v1beta1.ComplianceClient; -type ComplianceClient = v1beta1.ComplianceClient; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -const IdentityClient = v1beta1.IdentityClient; -type IdentityClient = v1beta1.IdentityClient; -const MessagingClient = v1beta1.MessagingClient; -type MessagingClient = v1beta1.MessagingClient; -const SequenceServiceClient = v1beta1.SequenceServiceClient; -type SequenceServiceClient = v1beta1.SequenceServiceClient; -const TestingClient = v1beta1.TestingClient; -type TestingClient = v1beta1.TestingClient; -export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client.ts.baseline deleted file mode 100644 index 30365083d88c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client.ts.baseline +++ /dev/null @@ -1,1792 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as compliance_client_config from './compliance_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/compliance_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'compliance_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format - * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped - * correctly. - * @class - * @memberof v1beta1 - */ -export class ComplianceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - complianceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ComplianceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ComplianceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ComplianceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, - 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.complianceStub) { - return this.complianceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Compliance. - this.complianceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Compliance, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const complianceStubMethods = - ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; - for (const methodName of complianceStubMethods) { - const callPromise = this.complianceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.complianceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * This method echoes the ComplianceData request. This method exercises - * sending the entire request object in the REST body. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async - */ - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBody request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBody response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBody(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBody response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending the a message-type field in the REST body. Per AIP-127, only - * top-level, non-repeated fields can be sent this way. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async - */ - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyInfo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyInfo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyInfo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyInfo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending all request fields as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async - */ - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataQuery request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataQuery response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending some parameters as "simple" path variables (i.e., of the form - * "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async - */ - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_int32': request.info!.fInt32 ?? '', - 'info.f_double': request.info!.fDouble ?? '', - 'info.f_bool': request.info!.fBool ?? '', - 'info.f_kingdom': request.info!.fKingdom ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataSimplePath request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataSimplePath response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataSimplePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataSimplePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a path resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async - */ - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - 'info.f_bool': request.info!.fBool ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathResource response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataPathResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataPathResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a trailing resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async - */ - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathTrailingResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataPathTrailingResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PUT method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async - */ - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPut request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPut response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyPut(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyPut response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PATCH method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async - */ - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPatch request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPatch response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyPatch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyPatch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - * response from this RPC as the request to VerifyEnum() - * - * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {boolean} request.unknownEnum - * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.get_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async - */ - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('getEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getEnum response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]) => { - this._log.info('getEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - * with the same EnumResponse; otherwise, the RPC errors. - * - * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - * although they are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.EnumRequest} request.request - * The original request for a known or unknown enum from the server. - * @param {google.showcase.v1beta1.Continent} request.continent - * The actual enum the server provided. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.verify_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async - */ - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('verifyEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyEnum response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.verifyEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]) => { - this._log.info('verifyEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.complianceStub && !this._terminated) { - return this.complianceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client_config.json.baseline deleted file mode 100644 index 43582a4ff828..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Compliance": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "RepeatDataBody": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyInfo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataQuery": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataSimplePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathTrailingResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPut": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/compliance_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index dda6cc472d0d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1691 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as echo_client_config from './echo_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'echo_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 EchoClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client.ts.baseline deleted file mode 100644 index 9f09510c537b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client.ts.baseline +++ /dev/null @@ -1,1324 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as identity_client_config from './identity_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/identity_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'identity_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A simple identity service. - * @class - * @memberof v1beta1 - */ -export class IdentityClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - identityStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 IdentityClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listUsers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'users') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Identity', gapicConfig as gax.ClientConfig, - 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.identityStub) { - return this.identityStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Identity. - this.identityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Identity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Identity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const identityStubMethods = - ['createUser', 'getUser', 'updateUser', 'deleteUser', 'listUsers']; - for (const methodName of identityStubMethods) { - const callPromise = this.identityStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.identityStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.create_user.js - * region_tag:localhost_v1beta1_generated_Identity_CreateUser_async - */ - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]) => { - this._log.info('createUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the User with the given uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested user. - * @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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.get_user.js - * region_tag:localhost_v1beta1_generated_Identity_GetUser_async - */ - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]) => { - this._log.info('getUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.update_user.js - * region_tag:localhost_v1beta1_generated_Identity_UpdateUser_async - */ - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'user.name': request.user!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]) => { - this._log.info('updateUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a user, their profile, and all of their authored messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the user to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.delete_user.js - * region_tag:localhost_v1beta1_generated_Identity_DeleteUser_async - */ - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUser request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all users. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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 Array of {@link protos.google.showcase.v1beta1.User|User}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUsersAsync()` - * 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. - */ - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUsers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listUsers request %j', request); - return this.innerApiCalls - .listUsers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]) => { - this._log.info('listUsers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUsers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User} 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 `listUsersAsync()` - * 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. - */ - listUsersStream( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers stream %j', request); - return this.descriptors.page.listUsers.createStream( - this.innerApiCalls.listUsers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsers`, 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 {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User}. 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 include:samples/generated/v1beta1/identity.list_users.js - * region_tag:localhost_v1beta1_generated_Identity_ListUsers_async - */ - listUsersAsync( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers iterate %j', request); - return this.descriptors.page.listUsers.asyncIterate( - this.innerApiCalls['listUsers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.identityStub && !this._terminated) { - return this.identityStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client_config.json.baseline deleted file mode 100644 index 3a162c29cdc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Identity": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/identity_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index 3a94be5d9834..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {ComplianceClient} from './compliance_client.js'; -export {EchoClient} from './echo_client.js'; -export {IdentityClient} from './identity_client.js'; -export {MessagingClient} from './messaging_client.js'; -export {SequenceServiceClient} from './sequence_service_client.js'; -export {TestingClient} from './testing_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client.ts.baseline deleted file mode 100644 index cd0dce341068..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client.ts.baseline +++ /dev/null @@ -1,2187 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as messaging_client_config from './messaging_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/messaging_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'messaging_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A simple messaging service that implements chat rooms and profile posts. - * - * This messaging service showcases the features that API clients - * generated by gapic-generators implement. - * @class - * @memberof v1beta1 - */ -export class MessagingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - messagingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MessagingClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 MessagingClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MessagingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listRooms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rooms'), - listBlurbs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'blurbs') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const searchBlurbsResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsResponse') as gax.protobuf.Type; - const searchBlurbsMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - searchBlurbs: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - searchBlurbsResponse.decode.bind(searchBlurbsResponse), - searchBlurbsMetadata.decode.bind(searchBlurbsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Messaging', gapicConfig as gax.ClientConfig, - 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.messagingStub) { - return this.messagingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Messaging. - this.messagingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Messaging') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Messaging, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const messagingStubMethods = - ['createRoom', 'getRoom', 'updateRoom', 'deleteRoom', 'listRooms', 'createBlurb', 'getBlurb', 'updateBlurb', 'deleteBlurb', 'listBlurbs', 'searchBlurbs', 'streamBlurbs', 'sendBlurbs', 'connect']; - for (const methodName of messagingStubMethods) { - const callPromise = this.messagingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.messagingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_room.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateRoom_async - */ - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('createRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Room with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_room.js - * region_tag:localhost_v1beta1_generated_Messaging_GetRoom_async - */ - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('getRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_room.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateRoom_async - */ - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'room.name': request.room!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('updateRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a room and all of its blurbs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_room.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteRoom_async - */ - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoom request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a blurb. If the parent is a room, the blurb is understood to be a - * message in that room. If the parent is a profile, the blurb is understood - * to be a post on the profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the chat room or user profile that this blurb will - * be tied to. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateBlurb_async - */ - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('createBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Blurb with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_GetBlurb_async - */ - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('getBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateBlurb_async - */ - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'blurb.name': request.blurb!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('updateBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteBlurb_async - */ - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This returns a stream that emits the blurbs that are created for a - * particular chat room or user profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of a chat room or user profile whose blurbs to stream. - * @param {google.protobuf.Timestamp} request.expireTime - * The time at which this stream will close. - * @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 {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.stream_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_StreamBlurbs_async - */ - streamBlurbs( - request?: protos.google.showcase.v1beta1.IStreamBlurbsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('streamBlurbs stream %j', options); - return this.innerApiCalls.streamBlurbs(request, options); - } - -/** - * This is a stream to create multiple blurbs. If an invalid blurb is - * requested to be created, the stream will close with an error. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.CreateBlurbRequest|CreateBlurbRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.send_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SendBlurbs_async - */ - sendBlurbs( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('sendBlurbs stream %j', options); - return this.innerApiCalls.sendBlurbs(null, options, callback); - } - -/** - * This method starts a bidirectional stream that receives all blurbs that - * are being created after the stream has started and sends requests to create - * blurbs. If an invalid blurb is requested to be created, the stream will - * close with an error. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.ConnectRequest|ConnectRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.connect.js - * region_tag:localhost_v1beta1_generated_Messaging_Connect_async - */ - connect( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('connect stream %j', options); - return this.innerApiCalls.connect(null, options); - } - -/** - * This method searches through all blurbs across all rooms and profiles - * for blurbs containing to words found in the query. Only posts that - * contain an exact match of a queried word will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.query - * The query used to search for blurbs containing to words of this string. - * Only posts that contain an exact match of a queried word will be returned. - * @param {string} request.parent - * The rooms or profiles to search. If unset, `SearchBlurbs` will search all - * rooms and all profiles. - * @param {number} request.pageSize - * The maximum number of blurbs return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of - * google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('searchBlurbs response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('searchBlurbs request %j', request); - return this.innerApiCalls.searchBlurbs(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('searchBlurbs response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `searchBlurbs()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - async checkSearchBlurbsProgress(name: string): Promise>{ - this._log.info('searchBlurbs long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.searchBlurbs, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all chat rooms. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Room|Room}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoomsAsync()` - * 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. - */ - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRooms values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listRooms request %j', request); - return this.innerApiCalls - .listRooms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]) => { - this._log.info('listRooms values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRooms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room} 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 `listRoomsAsync()` - * 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. - */ - listRoomsStream( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms stream %j', request); - return this.descriptors.page.listRooms.createStream( - this.innerApiCalls.listRooms as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRooms`, 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 {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room}. 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 include:samples/generated/v1beta1/messaging.list_rooms.js - * region_tag:localhost_v1beta1_generated_Messaging_ListRooms_async - */ - listRoomsAsync( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms iterate %j', request); - return this.descriptors.page.listRooms.asyncIterate( - this.innerApiCalls['listRooms'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists blurbs for a specific chat room or user profile depending on the - * parent resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBlurbsAsync()` - * 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. - */ - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBlurbs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listBlurbs request %j', request); - return this.innerApiCalls - .listBlurbs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]) => { - this._log.info('listBlurbs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBlurbs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb} 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 `listBlurbsAsync()` - * 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. - */ - listBlurbsStream( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs stream %j', request); - return this.descriptors.page.listBlurbs.createStream( - this.innerApiCalls.listBlurbs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBlurbs`, 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 - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb}. 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 include:samples/generated/v1beta1/messaging.list_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_ListBlurbs_async - */ - listBlurbsAsync( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs iterate %j', request); - return this.descriptors.page.listBlurbs.asyncIterate( - this.innerApiCalls['listBlurbs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.messagingStub && !this._terminated) { - return this.messagingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client_config.json.baseline deleted file mode 100644 index 551a130c2342..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_client_config.json.baseline +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Messaging": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRooms": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SearchBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StreamBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Connect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/messaging_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client.ts.baseline deleted file mode 100644 index 548fa4288d27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client.ts.baseline +++ /dev/null @@ -1,1036 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as sequence_service_client_config from './sequence_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/sequence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'sequence_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * @class - * @memberof v1beta1 - */ -export class SequenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sequenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SequenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 SequenceServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SequenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, - 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.sequenceServiceStub) { - return this.sequenceServiceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.SequenceService. - this.sequenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.SequenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sequenceServiceStubMethods = - ['createSequence', 'getSequenceReport', 'attemptSequence']; - for (const methodName of sequenceServiceStubMethods) { - const callPromise = this.sequenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sequenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Sequence} request.sequence - * @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 {@link protos.google.showcase.v1beta1.Sequence|Sequence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async - */ - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSequence request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSequence response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]) => { - this._log.info('createSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.showcase.v1beta1.SequenceReport|SequenceReport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js - * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async - */ - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSequenceReport request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSequenceReport response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSequenceReport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]) => { - this._log.info('getSequenceReport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Attempts a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async - */ - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('attemptSequence request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('attemptSequence response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.attemptSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]) => { - this._log.info('attemptSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sequenceServiceStub && !this._terminated) { - return this.sequenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline deleted file mode 100644 index 77c80d32a901..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.SequenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSequenceReport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttemptSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client.ts.baseline deleted file mode 100644 index 4861b537ba76..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client.ts.baseline +++ /dev/null @@ -1,1708 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as testing_client_config from './testing_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/testing_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'testing_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A service to facilitate running discrete sets of tests - * against Showcase. - * @class - * @memberof v1beta1 - */ -export class TestingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - testingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestingClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TestingClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listSessions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessions'), - listTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tests') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Testing', gapicConfig as gax.ClientConfig, - 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.testingStub) { - return this.testingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Testing. - this.testingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Testing') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Testing, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testingStubMethods = - ['createSession', 'getSession', 'listSessions', 'deleteSession', 'reportSession', 'listTests', 'deleteTest', 'verifyTest']; - for (const methodName of testingStubMethods) { - const callPromise = this.testingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.testingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Session} request.session - * The session to be created. - * Sessions are immutable once they are created (although they can - * be deleted). - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.create_session.js - * region_tag:localhost_v1beta1_generated_Testing_CreateSession_async - */ - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('createSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be retrieved. - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.get_session.js - * region_tag:localhost_v1beta1_generated_Testing_GetSession_async - */ - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('getSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete a test session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_session.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteSession_async - */ - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSession request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Report on the status of a session. - * This generates a report detailing which tests have been completed, - * and an overall rollup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be reported on. - * @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 {@link protos.google.showcase.v1beta1.ReportSessionResponse|ReportSessionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.report_session.js - * region_tag:localhost_v1beta1_generated_Testing_ReportSession_async - */ - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reportSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reportSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.reportSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('reportSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Explicitly decline to implement a test. - * - * This removes the test from subsequent `ListTests` calls, and - * attempting to do the test will error. - * - * This method will error if attempting to delete a required test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_test.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteTest_async - */ - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTest request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTest response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Register a response to a test. - * - * In cases where a test involves registering a final answer at the - * end of the test, this method provides the means to do so. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to have an answer registered to it. - * @param {Buffer} request.answer - * The answer from the test. - * @param {Buffer[]} request.answers - * The answers from the test if multiple are to be checked - * @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 {@link protos.google.showcase.v1beta1.VerifyTestResponse|VerifyTestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.verify_test.js - * region_tag:localhost_v1beta1_generated_Testing_VerifyTest_async - */ - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyTest request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyTest response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.verifyTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]) => { - this._log.info('verifyTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the current test sessions. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Session|Session}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionsAsync()` - * 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. - */ - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSessions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listSessions request %j', request); - return this.innerApiCalls - .listSessions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]) => { - this._log.info('listSessions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSessions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session} 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 `listSessionsAsync()` - * 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. - */ - listSessionsStream( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions stream %j', request); - return this.descriptors.page.listSessions.createStream( - this.innerApiCalls.listSessions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessions`, 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 {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session}. 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 include:samples/generated/v1beta1/testing.list_sessions.js - * region_tag:localhost_v1beta1_generated_Testing_ListSessions_async - */ - listSessionsAsync( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions iterate %j', request); - return this.descriptors.page.listSessions.asyncIterate( - this.innerApiCalls['listSessions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the tests of a sessesion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Test|Test}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTestsAsync()` - * 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. - */ - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTests values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listTests request %j', request); - return this.innerApiCalls - .listTests(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]) => { - this._log.info('listTests values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTests`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test} 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 `listTestsAsync()` - * 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. - */ - listTestsStream( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests stream %j', request); - return this.descriptors.page.listTests.createStream( - this.innerApiCalls.listTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTests`, 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 - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test}. 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 include:samples/generated/v1beta1/testing.list_tests.js - * region_tag:localhost_v1beta1_generated_Testing_ListTests_async - */ - listTestsAsync( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests iterate %j', request); - return this.descriptors.page.listTests.asyncIterate( - this.innerApiCalls['listTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testingStub && !this._terminated) { - return this.testingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client_config.json.baseline deleted file mode 100644 index 03815dc3f5e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Testing": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSessions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReportSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTests": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/src/v1beta1/testing_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_compliance_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_compliance_v1beta1.ts.baseline deleted file mode 100644 index 7403c5712d59..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_compliance_v1beta1.ts.baseline +++ /dev/null @@ -1,1568 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as complianceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.ComplianceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new complianceModule.v1beta1.ComplianceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = complianceModule.v1beta1.ComplianceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - await client.initialize(); - assert(client.complianceStub); - }); - - it('has close method for the initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.complianceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('repeatDataBody', () => { - it('invokes repeatDataBody without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBody(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBody( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - - it('invokes repeatDataBody with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - }); - - describe('repeatDataBodyInfo', () => { - it('invokes repeatDataBodyInfo without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyInfo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyInfo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - - it('invokes repeatDataBodyInfo with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - }); - - describe('repeatDataQuery', () => { - it('invokes repeatDataQuery without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataQuery(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataQuery( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - - it('invokes repeatDataQuery with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - }); - - describe('repeatDataSimplePath', () => { - it('invokes repeatDataSimplePath without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataSimplePath(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataSimplePath( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - }); - }); - - describe('repeatDataPathResource', () => { - it('invokes repeatDataPathResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - }); - }); - - describe('repeatDataPathTrailingResource', () => { - it('invokes repeatDataPathTrailingResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathTrailingResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathTrailingResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - }); - }); - - describe('repeatDataBodyPut', () => { - it('invokes repeatDataBodyPut without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPut(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPut( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - - it('invokes repeatDataBodyPut with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - }); - - describe('repeatDataBodyPatch', () => { - it('invokes repeatDataBodyPatch without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPatch(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPatch( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - - it('invokes repeatDataBodyPatch with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - }); - - describe('getEnum', () => { - it('invokes getEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); - const [response] = await client.getEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnum(request), expectedError); - }); - - it('invokes getEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEnum(request), expectedError); - }); - }); - - describe('verifyEnum', () => { - it('invokes verifyEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); - const [response] = await client.verifyEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - - it('invokes verifyEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index 20d0e7f6fb07..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1537 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new echoModule.v1beta1.EchoClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_identity_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_identity_v1beta1.ts.baseline deleted file mode 100644 index 2da43f67b837..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_identity_v1beta1.ts.baseline +++ /dev/null @@ -1,1212 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as identityModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.IdentityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = identityModule.v1beta1.IdentityClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = identityModule.v1beta1.IdentityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new identityModule.v1beta1.IdentityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = identityModule.v1beta1.IdentityClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityModule.v1beta1.IdentityClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityModule.v1beta1.IdentityClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - await client.initialize(); - assert(client.identityStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.identityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createUser', () => { - it('invokes createUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCall(expectedResponse); - const [response] = await client.createUser(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUser(request), expectedError); - }); - - it('invokes createUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUser(request), expectedError); - }); - }); - - describe('getUser', () => { - it('invokes getUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCall(expectedResponse); - const [response] = await client.getUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUser(request), expectedError); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUser(request), expectedError); - }); - }); - - describe('updateUser', () => { - it('invokes updateUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCall(expectedResponse); - const [response] = await client.updateUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUser(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUser(request), expectedError); - }); - }); - - describe('deleteUser', () => { - it('invokes deleteUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUser( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUser(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUser(request), expectedError); - }); - }); - - describe('listUsers', () => { - it('invokes listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCall(expectedResponse); - const [response] = await client.listUsers(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsers( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUsers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsers(request), expectedError); - }); - - it('invokes listUsersStream without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('invokes listUsersStream with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('uses async iteration with listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IUser[] = []; - const iterable = client.listUsersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IUser[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_messaging_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_messaging_v1beta1.ts.baseline deleted file mode 100644 index e65f87dfaf42..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_messaging_v1beta1.ts.baseline +++ /dev/null @@ -1,2364 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as messagingModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.MessagingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = messagingModule.v1beta1.MessagingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = messagingModule.v1beta1.MessagingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new messagingModule.v1beta1.MessagingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = messagingModule.v1beta1.MessagingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - await client.initialize(); - assert(client.messagingStub); - }); - - it('has close method for the initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.messagingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createRoom', () => { - it('invokes createRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCall(expectedResponse); - const [response] = await client.createRoom(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createRoom(request), expectedError); - }); - - it('invokes createRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createRoom(request), expectedError); - }); - }); - - describe('getRoom', () => { - it('invokes getRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCall(expectedResponse); - const [response] = await client.getRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoom(request), expectedError); - }); - }); - - describe('updateRoom', () => { - it('invokes updateRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoom(request), expectedError); - }); - }); - - describe('deleteRoom', () => { - it('invokes deleteRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoom( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoom(request), expectedError); - }); - }); - - describe('createBlurb', () => { - it('invokes createBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.createBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBlurb(request), expectedError); - }); - }); - - describe('getBlurb', () => { - it('invokes getBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.getBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBlurb(request), expectedError); - }); - }); - - describe('updateBlurb', () => { - it('invokes updateBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.updateBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBlurb(request), expectedError); - }); - }); - - describe('deleteBlurb', () => { - it('invokes deleteBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBlurb( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBlurb(request), expectedError); - }); - }); - - describe('searchBlurbs', () => { - it('invokes searchBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(expectedResponse); - const [operation] = await client.searchBlurbs(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchBlurbs( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with call error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.searchBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with LRO error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.searchBlurbs(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSearchBlurbsProgress without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSearchBlurbsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSearchBlurbsProgress with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSearchBlurbsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('streamBlurbs', () => { - it('invokes streamBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs without error and gaxServerStreamingRetries enabled', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(undefined, expectedError); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('connect', () => { - it('invokes connect without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.connect = stubBidiStreamingCall(expectedResponse); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes connect with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.connect = stubBidiStreamingCall(undefined, expectedError); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('sendBlurbs', () => { - it('invokes sendBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SendBlurbsResponse() - ); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes sendBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('listRooms', () => { - it('invokes listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCall(expectedResponse); - const [response] = await client.listRooms(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRooms( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listRooms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRooms(request), expectedError); - }); - - it('invokes listRoomsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('invokes listRoomsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('uses async iteration with listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - const iterable = client.listRoomsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoomsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listBlurbs', () => { - it('invokes listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCall(expectedResponse); - const [response] = await client.listBlurbs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBlurbs( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBlurbs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBlurbsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - const iterable = client.listBlurbsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBlurbsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline deleted file mode 100644 index 6ad653d66ad9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline +++ /dev/null @@ -1,878 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as sequenceserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.SequenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sequenceserviceModule.v1beta1.SequenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - await client.initialize(); - assert(client.sequenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sequenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSequence', () => { - it('invokes createSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); - const [response] = await client.createSequence(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSequence( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSequence(request), expectedError); - }); - - it('invokes createSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSequence(request), expectedError); - }); - }); - - describe('getSequenceReport', () => { - it('invokes getSequenceReport without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); - const [response] = await client.getSequenceReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSequenceReport( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSequenceReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSequenceReport(request), expectedError); - }); - }); - - describe('attemptSequence', () => { - it('invokes attemptSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); - const [response] = await client.attemptSequence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attemptSequence( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.attemptSequence(request), expectedError); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.attemptSequence(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_testing_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_testing_v1beta1.ts.baseline deleted file mode 100644 index f19fcdb3cbb3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/esm/test/gapic_testing_v1beta1.ts.baseline +++ /dev/null @@ -1,1669 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testingModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.TestingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testingModule.v1beta1.TestingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testingModule.v1beta1.TestingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testingModule.v1beta1.TestingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testingModule.v1beta1.TestingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testingModule.v1beta1.TestingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testingModule.v1beta1.TestingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testingModule.v1beta1.TestingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testingModule.v1beta1.TestingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - await client.initialize(); - assert(client.testingStub); - }); - - it('has close method for the initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSession', () => { - it('invokes createSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCall(expectedResponse); - const [response] = await client.createSession(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSession(request), expectedError); - }); - - it('invokes createSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSession(request), expectedError); - }); - }); - - describe('getSession', () => { - it('invokes getSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCall(expectedResponse); - const [response] = await client.getSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSession(request), expectedError); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSession(request), expectedError); - }); - }); - - describe('deleteSession', () => { - it('invokes deleteSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSession( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSession(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSession(request), expectedError); - }); - }); - - describe('reportSession', () => { - it('invokes reportSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCall(expectedResponse); - const [response] = await client.reportSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reportSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IReportSessionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reportSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reportSession(request), expectedError); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reportSession(request), expectedError); - }); - }); - - describe('deleteTest', () => { - it('invokes deleteTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTest( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTest(request), expectedError); - }); - }); - - describe('verifyTest', () => { - it('invokes verifyTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCall(expectedResponse); - const [response] = await client.verifyTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyTest( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IVerifyTestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyTest(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyTest(request), expectedError); - }); - }); - - describe('listSessions', () => { - it('invokes listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCall(expectedResponse); - const [response] = await client.listSessions(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessions( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listSessions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessions(request), expectedError); - }); - - it('invokes listSessionsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('invokes listSessionsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('uses async iteration with listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ISession[] = []; - const iterable = client.listSessionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ISession[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listTests', () => { - it('invokes listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCall(expectedResponse); - const [response] = await client.listTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTests( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ITest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTestsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTestsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ITest[] = []; - const iterable = client.listTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ITest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json deleted file mode 100644 index 6de66ad2bdaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "compliance", - "echo", - "identity", - "messaging", - "sequence service", - "testing" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/compliance.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/compliance.proto.baseline deleted file mode 100644 index 9b6c0b7d757e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/compliance.proto.baseline +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format -// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped -// correctly. -service Compliance { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // This method echoes the ComplianceData request. This method exercises - // sending the entire request object in the REST body. - rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:body" - body: "*" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending the a message-type field in the REST body. Per AIP-127, only - // top-level, non-repeated fields can be sent this way. - rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:bodyinfo" - body: "info" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending all request fields as query parameters. - rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat:query" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending some parameters as "simple" path variables (i.e., of the form - // "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" - }; - } - - // Same as RepeatDataSimplePath, but with a path resource. - rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" - additional_bindings { - get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" - } - }; - } - - // Same as RepeatDataSimplePath, but with a trailing resource. - rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PUT method. - rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - put: "/v1beta1/repeat:bodyput" - body: "*" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PATCH method. - rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - patch: "/v1beta1/repeat:bodypatch" - body: "*" - }; - } - - // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - // response from this RPC as the request to VerifyEnum() - // - // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - rpc GetEnum(EnumRequest) returns (EnumResponse) { - option (google.api.http) = { - get: "/v1beta1/compliance/enum" - }; - } - - // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - // with the same EnumResponse; otherwise, the RPC errors. - // - // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - // although they are not guaranteed to be the same across separate Showcase server runs. - rpc VerifyEnum(EnumResponse) returns (EnumResponse) { - option (google.api.http) = { - post: "/v1beta1/compliance/enum" - }; - } - -} - -message RepeatRequest { - string name = 1; - ComplianceData info = 2; - - // If true, the server will verify that the received request matches - // the request with the same name in the compliance test suite. - bool server_verify = 3; - - // The URI template this request is expected to be bound to server-side. - optional string intended_binding_uri = 10; - - // Some top level fields, to test that these are encoded correctly - // in query params. - int32 f_int32 = 4; - int64 f_int64 = 5; - double f_double = 6; - - optional int32 p_int32 = 7; - optional int64 p_int64 = 8; - optional double p_double = 9; -} - -message RepeatResponse { - RepeatRequest request = 1; - - // The URI template the request was bound to server-side. - string binding_uri = 2; -} - -// ComplianceSuite contains a set of requests that microgenerators should issue -// over REST to the Compliance service to test their gRPC-to-REST transcoding -// implementation. -message ComplianceSuite { - repeated ComplianceGroup group = 1; -} - -// ComplianceGroups encapsulates a group of RPC requests to the Compliance -// server: one request for each combination of elements of `rpcs` and of -// `requests`. -message ComplianceGroup { - string name = 1; - repeated string rpcs = 2; - repeated RepeatRequest requests = 3; -} - -// ComplianceData is a message used for testing REST transcoding of -// different data types. -message ComplianceData { - enum LifeKingdom { - LIFE_KINGDOM_UNSPECIFIED = 0; - ARCHAEBACTERIA = 1; - EUBACTERIA = 2; - PROTISTA = 3; - FUNGI = 4; - PLANTAE = 5; - ANIMALIA = 6; -} - // scalar types - - string f_string = 1; - - int32 f_int32 = 2; - sint32 f_sint32 = 3; - sfixed32 f_sfixed32 = 4; - - uint32 f_uint32 = 5; - fixed32 f_fixed32 = 6; - - int64 f_int64 = 7; - sint64 f_sint64 = 8; - sfixed64 f_sfixed64 = 9; - - uint64 f_uint64 = 10; - fixed64 f_fixed64 = 11; - - double f_double = 12; - float f_float = 13; - - bool f_bool = 14; - - bytes f_bytes = 15; - - LifeKingdom f_kingdom = 22; - - ComplianceDataChild f_child = 16; - - // optional fields - - optional string p_string = 17; - optional int32 p_int32 = 18; - optional double p_double = 19; - optional bool p_bool = 20; - optional LifeKingdom p_kingdom = 23; - optional ComplianceDataChild p_child = 21; -} - -message ComplianceDataChild { - string f_string = 1; - float f_float = 2; - double f_double = 3; - bool f_bool = 4; - Continent f_continent = 11; - ComplianceDataGrandchild f_child = 5; - - optional string p_string = 6; - optional float p_float = 7; - optional double p_double = 8; - optional bool p_bool = 9; - Continent p_continent = 12; - optional ComplianceDataGrandchild p_child = 10; -} - -message ComplianceDataGrandchild { - string f_string = 1; - double f_double = 2; - bool f_bool = 3; -} - -enum Continent { - CONTINENT_UNSPECIFIED = 0; - AFRICA = 1; - AMERICA = 2; - ANTARTICA = 3; - AUSTRALIA = 4; - EUROPE = 5; -} - - -message EnumRequest { - // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - bool unknown_enum = 1; -} - -message EnumResponse { - // The original request for a known or unknown enum from the server. - EnumRequest request = 1; - - // The actual enum the server provided. - Continent continent = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/identity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/identity.proto.baseline deleted file mode 100644 index 569c604d78fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/identity.proto.baseline +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple identity service. -service Identity { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a user. - rpc CreateUser(CreateUserRequest) returns (User) { - option (google.api.http) = { - post: "/v1beta1/users" - body: "*" - }; - option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = - "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; - } - - // Retrieves the User with the given uri. - rpc GetUser(GetUserRequest) returns (User) { - option (google.api.http) = { - get: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a user. - rpc UpdateUser(UpdateUserRequest) returns (User) { - option (google.api.http) = { - patch: "/v1beta1/{user.name=users/*}" - body: "user" - }; - } - - // Deletes a user, their profile, and all of their authored messages. - rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all users. - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { - option (google.api.http) = { - get: "/v1beta1/users" - }; - } -} - -// A user. -message User { - option (google.api.resource) = { - type: "showcase.googleapis.com/User" - pattern: "users/{user}" - }; - - // The resource name of the user. - string name = 1; - - // The display_name of the user. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The email address of the user. - string email = 3 [(google.api.field_behavior) = REQUIRED]; - - // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The age of the user in years. - optional int32 age = 6; - - // The height of the user in feet. - optional double height_feet = 7; - - // The nickname of the user. - // - // (-- aip.dev/not-precedent: An empty string is a valid nickname. - // Ordinarily, proto3_optional should not be used on a `string` field. --) - optional string nickname = 8; - - // Enables the receiving of notifications. The default is true if unset. - // - // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) - optional bool enable_notifications = 9; -} - -// The request message for the google.showcase.v1beta1.Identity\CreateUser -// method. -message CreateUserRequest { - // The user to create. - User user = 1; -} - -// The request message for the google.showcase.v1beta1.Identity\GetUser -// method. -message GetUserRequest { - // The resource name of the requested user. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\UpdateUser -// method. -message UpdateUserRequest { - // The user to update. - User user = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Identity\DeleteUser -// method. -message DeleteUserRequest { - // The resource name of the user to delete. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersRequest { - // The maximum number of users to return. Server may return fewer users - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Identity\ListUsers` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersResponse { - // The list of users. - repeated User users = 1; - - // A token to retrieve next page of results. - // Pass this value in ListUsersRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Message\ListUsers` method to retrieve the - // next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/messaging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/messaging.proto.baseline deleted file mode 100644 index 62196dfced39..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/messaging.proto.baseline +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/error_details.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple messaging service that implements chat rooms and profile posts. -// -// This messaging service showcases the features that API clients -// generated by gapic-generators implement. -service Messaging { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a room. - rpc CreateRoom(CreateRoomRequest) returns (Room) { - option (google.api.http) = { - post: "/v1beta1/rooms" - body: "*" - }; - option (google.api.method_signature) = "room.display_name,room.description"; - } - - // Retrieves the Room with the given resource name. - rpc GetRoom(GetRoomRequest) returns (Room) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a room. - rpc UpdateRoom(UpdateRoomRequest) returns (Room) { - option (google.api.http) = { - patch: "/v1beta1/{room.name=rooms/*}" - body: "room" - }; - } - - // Deletes a room and all of its blurbs. - rpc DeleteRoom(DeleteRoomRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all chat rooms. - rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) { - option (google.api.http) = { - get: "/v1beta1/rooms" - }; - } - - // Creates a blurb. If the parent is a room, the blurb is understood to be a - // message in that room. If the parent is a profile, the blurb is understood - // to be a post on the profile. - rpc CreateBlurb(CreateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,blurb.user,blurb.text"; - option (google.api.method_signature) = "parent,blurb.user,blurb.image"; - } - - // Retrieves the Blurb with the given resource name. - rpc GetBlurb(GetBlurbRequest) returns (Blurb) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a blurb. - rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "blurb" - additional_bindings: { - patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "blurb" - } - }; - } - - // Deletes a blurb. - rpc DeleteBlurb(DeleteBlurbRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - delete: "/v1beta1/{name=users/*/profile/blurbs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists blurbs for a specific chat room or user profile depending on the - // parent resource name. - rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } - }; - option (google.api.method_signature) = "parent"; - } - - // This method searches through all blurbs across all rooms and profiles - // for blurbs containing to words found in the query. Only posts that - // contain an exact match of a queried word will be returned. - rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:search" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:search" - } - }; - option (google.longrunning.operation_info) = { - response_type: "SearchBlurbsResponse" - metadata_type: "SearchBlurbsMetadata" - }; - option (google.api.method_signature) = "parent,query"; - } - - // This returns a stream that emits the blurbs that are created for a - // particular chat room or user profile. - rpc StreamBlurbs(StreamBlurbsRequest) returns (stream StreamBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=rooms/*}/blurbs:stream" - body: "*" - additional_bindings: { - post: "/v1beta1/{name=users/*/profile}/blurbs:stream" - body: "*" - } - }; - } - - // This is a stream to create multiple blurbs. If an invalid blurb is - // requested to be created, the stream will close with an error. - rpc SendBlurbs(stream CreateBlurbRequest) returns (SendBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:send" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:send" - body: "*" - } - }; - } - - // This method starts a bidirectional stream that receives all blurbs that - // are being created after the stream has started and sends requests to create - // blurbs. If an invalid blurb is requested to be created, the stream will - // close with an error. - rpc Connect(stream ConnectRequest) returns (stream StreamBlurbsResponse); -} - -// A chat room. -message Room { - option (google.api.resource) = { - type: "showcase.googleapis.com/Room" - pattern: "rooms/{room}" - }; - - // The resource name of the chat room. - string name = 1; - - // The human readable name of the chat room. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The description of the chat room. - string description = 3; - - // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateRoom -// method. -message CreateRoomRequest { - // The room to create. - Room room = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetRoom -// method. -message GetRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateRoom -// method. -message UpdateRoomRequest { - // The room to update. - Room room = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteRoom -// method. -message DeleteRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsRequest { - // The maximum number of rooms return. Server may return fewer rooms - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListRooms` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsResponse { - // The list of rooms. - repeated Room rooms = 1; - - // A token to retrieve next page of results. - // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// This protocol buffer message represents a blurb sent to a chat room or -// posted on a user profile. -message Blurb { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blurb" - pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" - pattern: "users/{user}/profile/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" - }; - - // The resource name of the chat room. - string name = 1; - - // The resource name of the blurb's author. - string user = 2 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; - - oneof content { - // The textual content of this blurb. - string text = 3; - - // The image content of this blurb. - bytes image = 4; - } - - // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. - // --) - oneof legacy_id { - // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern - // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` - string legacy_room_id = 7; - - // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern - // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` - string legacy_user_id = 8; - } -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateBlurb -// method. -message CreateBlurbRequest { - // The resource name of the chat room or user profile that this blurb will - // be tied to. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The blurb to create. - Blurb blurb = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetBlurb -// method. -message GetBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateBlurb -// method. -message UpdateBlurbRequest { - // The blurb to update. - Blurb blurb = 1; - - // The field mask to determine wich fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteBlurb -// method. -message DeleteBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsRequest { - // The resource name of the requested room or profile whos blurbs to list. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The maximum number of blurbs to return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 2; - - // The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListBlurbs` method. - string page_token = 3; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsResponse { - // The list of blurbs. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in ListBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\ListBlurbs` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\SearchBlurbs -// method. -message SearchBlurbsRequest { - // The query used to search for blurbs containing to words of this string. - // Only posts that contain an exact match of a queried word will be returned. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // The rooms or profiles to search. If unset, `SearchBlurbs` will search all - // rooms and all profiles. - string parent = 2 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - - // The maximum number of blurbs return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 3; - - // The value of - // google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - string page_token = 4; -} - -// The operation metadata message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsMetadata { - // This signals to the client when to next poll for response. - google.rpc.RetryInfo retry_info = 1; -} - -// The operation response message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsResponse { - // Blurbs that matched the search query. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in SearchBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\SearchBlurbs` method to - // retrieve the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsRequest { - // The resource name of a chat room or user profile whose blurbs to stream. - string name = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsResponse { - // The blurb that was either created, updated, or deleted. - Blurb blurb = 1; - - // The action that triggered the blurb to be returned. - enum Action { - ACTION_UNSPECIFIED = 0; - - // Specifies that the blurb was created. - CREATE = 1; - - // Specifies that the blurb was updated. - UPDATE = 2; - - // Specifies that the blurb was deleted. - DELETE = 3; - } - - // The action that triggered the blurb to be returned. - Action action = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\SendBlurbs -// method. -message SendBlurbsResponse { - // The names of successful blurb creations. - repeated string names = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\Connect -// method. -message ConnectRequest { - message ConnectConfig { - // The room or profile to follow and create messages for. - string parent = 1 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - } - - oneof request { - // Provides information that specifies how to process subsequent requests. - // The first `ConnectRequest` message must contain a `config` message. - ConnectConfig config = 1; - - // The blurb to be created. - Blurb blurb = 2; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/sequence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/sequence.proto.baseline deleted file mode 100644 index 26158fdd861f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/sequence.proto.baseline +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -service SequenceService { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a sequence. - rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { - option (google.api.http) = { - post: "/v1beta1/sequences" - body: "sequence" - }; - option (google.api.method_signature) = "sequence"; - }; - - // Retrieves a sequence. - rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { - option (google.api.http) = { - get: "/v1beta1/{name=sequences/*/sequenceReport}" - }; - option (google.api.method_signature) = "name"; - }; - - // Attempts a sequence. - rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=sequences/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - }; -} - -message Sequence { - option (google.api.resource) = { - type: "showcase.googleapis.com/Sequence" - pattern: "sequences/{sequence}" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A server response to an RPC Attempt in a sequence. - message Response { - // The status to return for an individual attempt. - google.rpc.Status status = 1; - - // The amount of time to delay sending the response. - google.protobuf.Duration delay = 2; - } - - // Sequence of responses to return in order for each attempt. If empty, the - // default response is an immediate OK. - repeated Response responses = 2; -} - -message SequenceReport { - option (google.api.resource) = { - type: "showcase.googleapis.com/SequenceReport" - pattern: "sequences/{sequence}/sequenceReport" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains metrics on individual RPC Attempts in a sequence. - message Attempt { - // The attempt number - starting at 0. - int32 attempt_number = 1; - - // The deadline dictated by the attempt to the server. - google.protobuf.Timestamp attempt_deadline = 2; - - // The time that the server responded to the RPC attempt. Used for - // calculating attempt_delay. - google.protobuf.Timestamp response_time = 3; - - // The server perceived delay between sending the last response and - // receiving this attempt. Used for validating attempt delay backoff. - google.protobuf.Duration attempt_delay = 4; - - // The status returned to the attempt. - google.rpc.Status status = 5; - } - - // The set of RPC attempts received by the server for a Sequence. - repeated Attempt attempts = 2; -} - -message CreateSequenceRequest { - Sequence sequence = 1; -} - -message AttemptSequenceRequest { - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", - (google.api.field_behavior) = REQUIRED - ]; -} - -message GetSequenceReportRequest { - string name = 1 [ - (google.api.resource_reference).type = - "showcase.googleapis.com/SequenceReport", - (google.api.field_behavior) = REQUIRED - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/testing.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/testing.proto.baseline deleted file mode 100644 index dbfe134c6fb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/protos/google/showcase/v1beta1/testing.proto.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2018 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. - -edition = "2023"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A service to facilitate running discrete sets of tests -// against Showcase. -service Testing { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a new testing session. - rpc CreateSession(CreateSessionRequest) returns (Session) { - option (google.api.http) = { - post: "/v1beta1/sessions" - body: "session" - }; - } - - // Gets a testing session. - rpc GetSession(GetSessionRequest) returns (Session) { - option (google.api.http) = { - get: "/v1beta1/{name=sessions/*}" - }; - } - - // Lists the current test sessions. - rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { - option (google.api.http) = { - get: "/v1beta1/sessions" - }; - } - - // Delete a test session. - rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*}" - }; - } - - // Report on the status of a session. - // This generates a report detailing which tests have been completed, - // and an overall rollup. - rpc ReportSession(ReportSessionRequest) returns (ReportSessionResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*}:report" - }; - } - - // List the tests of a sessesion. - rpc ListTests(ListTestsRequest) returns (ListTestsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=sessions/*}/tests" - }; - } - - // Explicitly decline to implement a test. - // - // This removes the test from subsequent `ListTests` calls, and - // attempting to do the test will error. - // - // This method will error if attempting to delete a required test. - rpc DeleteTest(DeleteTestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*/tests/*}" - }; - } - - // Register a response to a test. - // - // In cases where a test involves registering a final answer at the - // end of the test, this method provides the means to do so. - rpc VerifyTest(VerifyTestRequest) returns (VerifyTestResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*/tests/*}:check" - }; - } -} - -// A session is a suite of tests, generally being made in the context -// of testing code generation. -// -// A session defines tests it may expect, based on which version of the -// code generation spec is in use. -message Session { - option (google.api.resource) = { - type: "showcase.googleapis.com/Session" - pattern: "sessions/{session}" - }; - - // The name of the session. The ID must conform to ^[a-z]+$ - // If this is not provided, Showcase chooses one at random. - string name = 1; - - // The specification versions understood by Showcase. - enum Version { - // Unspecified version. If passed on creation, the session will default - // to using the latest stable release. - VERSION_UNSPECIFIED = 0; - - // The latest v1. Currently, this is v1.0. - V1_LATEST = 1; - - // v1.0. (Until the spec is "GA", this will be a moving target.) - V1_0 = 2; - } - - // Required. The version this session is using. - Version version = 2; -} - -// The request for the CreateSession method. -message CreateSessionRequest { - // The session to be created. - // Sessions are immutable once they are created (although they can - // be deleted). - Session session = 1; -} - -// The request for the GetSession method. -message GetSessionRequest { - // The session to be retrieved. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// The request for the ListSessions method. -message ListSessionsRequest { - // The maximum number of sessions to return per page. - int32 page_size = 1; - - // The page token, for retrieving subsequent pages. - string page_token = 2; -} - -// Response for the ListSessions method. -message ListSessionsResponse { - // The sessions being returned. - repeated Session sessions = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// Request for the DeleteSession method. -message DeleteSessionRequest { - // The session to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Request message for reporting on a session. -message ReportSessionRequest { - // The session to be reported on. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Response message for reporting on a session. -message ReportSessionResponse { - // The topline state of the report. - enum Result { - RESULT_UNSPECIFIED = 0; - - // The session is complete, and everything passed. - PASSED = 1; - - // The session had an explicit failure. - FAILED = 2; - - // The session is incomplete. This is a failure response. - INCOMPLETE = 3; - } - - // The state of the report. - Result result = 1; - - // The test runs of this session. - repeated TestRun test_runs = 2; -} - -message Test { - option (google.api.resource) = { - type: "showcase.googleapis.com/Test" - pattern: "sessions/{session}/tests/{test}" - }; - - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string name = 1; - - // Whether or not a test is required, recommended, or optional. - enum ExpectationLevel { - EXPECTATION_LEVEL_UNSPECIFIED = 0; - - // This test is strictly required. - REQUIRED = 1; - - // This test is recommended. - // - // If a generator explicitly ignores a recommended test (see `DeleteTest`), - // then the report may still pass, but with a warning. - // - // If a generator skips a recommended test and does not explicitly - // express that intention, the report will fail. - RECOMMENDED = 2; - - // This test is optional. - // - // If a generator explicitly ignores an optional test (see `DeleteTest`), - // then the report may still pass, and no warning will be issued. - // - // If a generator skips an optional test and does not explicitly - // express that intention, the report may still pass, but with a - // warning. - OPTIONAL = 3; - } - - // The expectation level for this test. - ExpectationLevel expectation_level = 2; - - // A description of the test. - string description = 3; - - // A blueprint is an explicit definition of methods and requests that are needed - // to be made to test this specific test case. Ideally this would be represented - // by something more robust like CEL, but as of writing this, I am unsure if CEL - // is ready. - message Blueprint { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blueprint" - pattern: "sessions/{session}/tests/{test}/blueprints/{blueprint}" - }; - - // The name of this blueprint. - string name = 1; - - // A description of this blueprint. - string description = 2; - - // A message representing a method invocation. - message Invocation { - // The fully qualified name of the showcase method to be invoked. - string method = 1; - - // The request to be made if a specific request is necessary. - bytes serialized_request = 2; - } - - // The initial request to trigger this test. - Invocation request = 3; - - // An ordered list of method calls that can be called to trigger this test. - repeated Invocation additional_requests = 4; - } - - // The blueprints that will satisfy this test. There may be multiple blueprints - // that can signal to the server that this test case is being exercised. Although - // multiple blueprints are specified, only a single blueprint needs to be run to - // signal that the test case was exercised. - repeated Blueprint blueprints = 4; -} - -// An issue found in the test. -message Issue { - // The different potential types of issues. - enum Type { - TYPE_UNSPECIFIED = 0; - - // The test was never instrumented. - SKIPPED = 1; - - // The test was started but never confirmed. - PENDING = 2; - - // The test was instrumented, but Showcase got an unexpected - // value when the generator tried to confirm success. - INCORRECT_CONFIRMATION = 3; - } - - // The type of the issue. - Type type = 1; - - // Severity levels. - enum Severity { - SEVERITY_UNSPECIFIED = 0; - - // Errors. - ERROR = 1; - - // Warnings. - WARNING = 2; - } - - // The severity of the issue. - Severity severity = 2; - - // A description of the issue. - string description = 3; -} - -// The request for the ListTests method. -message ListTestsRequest { - // The session. - string parent = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; - - // The maximum number of tests to return per page. - int32 page_size = 2; - - // The page token, for retrieving subsequent pages. - string page_token = 3; -} - -// The response for the ListTests method. -message ListTestsResponse { - // The tests being returned. - repeated Test tests = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// A TestRun is the result of running a Test. -message TestRun { - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string test = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - - // An issue found with the test run. If empty, this test run was successful. - Issue issue = 2; -} - -// Request message for deleting a test. -message DeleteTestRequest { - // The test to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; -} - -message VerifyTestRequest { - // The test to have an answer registered to it. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - // The answer from the test. - bytes answer = 2; - - // The answers from the test if multiple are to be checked - repeated bytes answers = 3; -} - -message VerifyTestResponse { - // An issue if check answer was unsuccessful. This will be empty if the check answer succeeded. - Issue issue = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/webpack.config.cjs.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.jsdoc.js.baseline deleted file mode 100644 index ba97f7f80544..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/README.md.baseline deleted file mode 100644 index ccf41b264f5e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Showcase: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Showcase client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Showcase Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Showcase API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json deleted file mode 100644 index e02a97d7b12a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "compliance", - "echo", - "identity", - "messaging", - "sequence service", - "testing" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline deleted file mode 100644 index 9b6c0b7d757e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/compliance.proto.baseline +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format -// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped -// correctly. -service Compliance { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // This method echoes the ComplianceData request. This method exercises - // sending the entire request object in the REST body. - rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:body" - body: "*" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending the a message-type field in the REST body. Per AIP-127, only - // top-level, non-repeated fields can be sent this way. - rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:bodyinfo" - body: "info" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending all request fields as query parameters. - rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat:query" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending some parameters as "simple" path variables (i.e., of the form - // "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" - }; - } - - // Same as RepeatDataSimplePath, but with a path resource. - rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" - additional_bindings { - get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" - } - }; - } - - // Same as RepeatDataSimplePath, but with a trailing resource. - rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PUT method. - rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - put: "/v1beta1/repeat:bodyput" - body: "*" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PATCH method. - rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - patch: "/v1beta1/repeat:bodypatch" - body: "*" - }; - } - - // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - // response from this RPC as the request to VerifyEnum() - // - // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - rpc GetEnum(EnumRequest) returns (EnumResponse) { - option (google.api.http) = { - get: "/v1beta1/compliance/enum" - }; - } - - // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - // with the same EnumResponse; otherwise, the RPC errors. - // - // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - // although they are not guaranteed to be the same across separate Showcase server runs. - rpc VerifyEnum(EnumResponse) returns (EnumResponse) { - option (google.api.http) = { - post: "/v1beta1/compliance/enum" - }; - } - -} - -message RepeatRequest { - string name = 1; - ComplianceData info = 2; - - // If true, the server will verify that the received request matches - // the request with the same name in the compliance test suite. - bool server_verify = 3; - - // The URI template this request is expected to be bound to server-side. - optional string intended_binding_uri = 10; - - // Some top level fields, to test that these are encoded correctly - // in query params. - int32 f_int32 = 4; - int64 f_int64 = 5; - double f_double = 6; - - optional int32 p_int32 = 7; - optional int64 p_int64 = 8; - optional double p_double = 9; -} - -message RepeatResponse { - RepeatRequest request = 1; - - // The URI template the request was bound to server-side. - string binding_uri = 2; -} - -// ComplianceSuite contains a set of requests that microgenerators should issue -// over REST to the Compliance service to test their gRPC-to-REST transcoding -// implementation. -message ComplianceSuite { - repeated ComplianceGroup group = 1; -} - -// ComplianceGroups encapsulates a group of RPC requests to the Compliance -// server: one request for each combination of elements of `rpcs` and of -// `requests`. -message ComplianceGroup { - string name = 1; - repeated string rpcs = 2; - repeated RepeatRequest requests = 3; -} - -// ComplianceData is a message used for testing REST transcoding of -// different data types. -message ComplianceData { - enum LifeKingdom { - LIFE_KINGDOM_UNSPECIFIED = 0; - ARCHAEBACTERIA = 1; - EUBACTERIA = 2; - PROTISTA = 3; - FUNGI = 4; - PLANTAE = 5; - ANIMALIA = 6; -} - // scalar types - - string f_string = 1; - - int32 f_int32 = 2; - sint32 f_sint32 = 3; - sfixed32 f_sfixed32 = 4; - - uint32 f_uint32 = 5; - fixed32 f_fixed32 = 6; - - int64 f_int64 = 7; - sint64 f_sint64 = 8; - sfixed64 f_sfixed64 = 9; - - uint64 f_uint64 = 10; - fixed64 f_fixed64 = 11; - - double f_double = 12; - float f_float = 13; - - bool f_bool = 14; - - bytes f_bytes = 15; - - LifeKingdom f_kingdom = 22; - - ComplianceDataChild f_child = 16; - - // optional fields - - optional string p_string = 17; - optional int32 p_int32 = 18; - optional double p_double = 19; - optional bool p_bool = 20; - optional LifeKingdom p_kingdom = 23; - optional ComplianceDataChild p_child = 21; -} - -message ComplianceDataChild { - string f_string = 1; - float f_float = 2; - double f_double = 3; - bool f_bool = 4; - Continent f_continent = 11; - ComplianceDataGrandchild f_child = 5; - - optional string p_string = 6; - optional float p_float = 7; - optional double p_double = 8; - optional bool p_bool = 9; - Continent p_continent = 12; - optional ComplianceDataGrandchild p_child = 10; -} - -message ComplianceDataGrandchild { - string f_string = 1; - double f_double = 2; - bool f_bool = 3; -} - -enum Continent { - CONTINENT_UNSPECIFIED = 0; - AFRICA = 1; - AMERICA = 2; - ANTARTICA = 3; - AUSTRALIA = 4; - EUROPE = 5; -} - - -message EnumRequest { - // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - bool unknown_enum = 1; -} - -message EnumResponse { - // The original request for a known or unknown enum from the server. - EnumRequest request = 1; - - // The actual enum the server provided. - Continent continent = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline deleted file mode 100644 index 569c604d78fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/identity.proto.baseline +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple identity service. -service Identity { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a user. - rpc CreateUser(CreateUserRequest) returns (User) { - option (google.api.http) = { - post: "/v1beta1/users" - body: "*" - }; - option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = - "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; - } - - // Retrieves the User with the given uri. - rpc GetUser(GetUserRequest) returns (User) { - option (google.api.http) = { - get: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a user. - rpc UpdateUser(UpdateUserRequest) returns (User) { - option (google.api.http) = { - patch: "/v1beta1/{user.name=users/*}" - body: "user" - }; - } - - // Deletes a user, their profile, and all of their authored messages. - rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all users. - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { - option (google.api.http) = { - get: "/v1beta1/users" - }; - } -} - -// A user. -message User { - option (google.api.resource) = { - type: "showcase.googleapis.com/User" - pattern: "users/{user}" - }; - - // The resource name of the user. - string name = 1; - - // The display_name of the user. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The email address of the user. - string email = 3 [(google.api.field_behavior) = REQUIRED]; - - // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The age of the user in years. - optional int32 age = 6; - - // The height of the user in feet. - optional double height_feet = 7; - - // The nickname of the user. - // - // (-- aip.dev/not-precedent: An empty string is a valid nickname. - // Ordinarily, proto3_optional should not be used on a `string` field. --) - optional string nickname = 8; - - // Enables the receiving of notifications. The default is true if unset. - // - // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) - optional bool enable_notifications = 9; -} - -// The request message for the google.showcase.v1beta1.Identity\CreateUser -// method. -message CreateUserRequest { - // The user to create. - User user = 1; -} - -// The request message for the google.showcase.v1beta1.Identity\GetUser -// method. -message GetUserRequest { - // The resource name of the requested user. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\UpdateUser -// method. -message UpdateUserRequest { - // The user to update. - User user = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Identity\DeleteUser -// method. -message DeleteUserRequest { - // The resource name of the user to delete. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersRequest { - // The maximum number of users to return. Server may return fewer users - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Identity\ListUsers` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersResponse { - // The list of users. - repeated User users = 1; - - // A token to retrieve next page of results. - // Pass this value in ListUsersRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Message\ListUsers` method to retrieve the - // next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline deleted file mode 100644 index 62196dfced39..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/messaging.proto.baseline +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/error_details.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple messaging service that implements chat rooms and profile posts. -// -// This messaging service showcases the features that API clients -// generated by gapic-generators implement. -service Messaging { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a room. - rpc CreateRoom(CreateRoomRequest) returns (Room) { - option (google.api.http) = { - post: "/v1beta1/rooms" - body: "*" - }; - option (google.api.method_signature) = "room.display_name,room.description"; - } - - // Retrieves the Room with the given resource name. - rpc GetRoom(GetRoomRequest) returns (Room) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a room. - rpc UpdateRoom(UpdateRoomRequest) returns (Room) { - option (google.api.http) = { - patch: "/v1beta1/{room.name=rooms/*}" - body: "room" - }; - } - - // Deletes a room and all of its blurbs. - rpc DeleteRoom(DeleteRoomRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all chat rooms. - rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) { - option (google.api.http) = { - get: "/v1beta1/rooms" - }; - } - - // Creates a blurb. If the parent is a room, the blurb is understood to be a - // message in that room. If the parent is a profile, the blurb is understood - // to be a post on the profile. - rpc CreateBlurb(CreateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,blurb.user,blurb.text"; - option (google.api.method_signature) = "parent,blurb.user,blurb.image"; - } - - // Retrieves the Blurb with the given resource name. - rpc GetBlurb(GetBlurbRequest) returns (Blurb) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a blurb. - rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "blurb" - additional_bindings: { - patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "blurb" - } - }; - } - - // Deletes a blurb. - rpc DeleteBlurb(DeleteBlurbRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - delete: "/v1beta1/{name=users/*/profile/blurbs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists blurbs for a specific chat room or user profile depending on the - // parent resource name. - rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } - }; - option (google.api.method_signature) = "parent"; - } - - // This method searches through all blurbs across all rooms and profiles - // for blurbs containing to words found in the query. Only posts that - // contain an exact match of a queried word will be returned. - rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:search" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:search" - } - }; - option (google.longrunning.operation_info) = { - response_type: "SearchBlurbsResponse" - metadata_type: "SearchBlurbsMetadata" - }; - option (google.api.method_signature) = "parent,query"; - } - - // This returns a stream that emits the blurbs that are created for a - // particular chat room or user profile. - rpc StreamBlurbs(StreamBlurbsRequest) returns (stream StreamBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=rooms/*}/blurbs:stream" - body: "*" - additional_bindings: { - post: "/v1beta1/{name=users/*/profile}/blurbs:stream" - body: "*" - } - }; - } - - // This is a stream to create multiple blurbs. If an invalid blurb is - // requested to be created, the stream will close with an error. - rpc SendBlurbs(stream CreateBlurbRequest) returns (SendBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:send" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:send" - body: "*" - } - }; - } - - // This method starts a bidirectional stream that receives all blurbs that - // are being created after the stream has started and sends requests to create - // blurbs. If an invalid blurb is requested to be created, the stream will - // close with an error. - rpc Connect(stream ConnectRequest) returns (stream StreamBlurbsResponse); -} - -// A chat room. -message Room { - option (google.api.resource) = { - type: "showcase.googleapis.com/Room" - pattern: "rooms/{room}" - }; - - // The resource name of the chat room. - string name = 1; - - // The human readable name of the chat room. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The description of the chat room. - string description = 3; - - // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateRoom -// method. -message CreateRoomRequest { - // The room to create. - Room room = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetRoom -// method. -message GetRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateRoom -// method. -message UpdateRoomRequest { - // The room to update. - Room room = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteRoom -// method. -message DeleteRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsRequest { - // The maximum number of rooms return. Server may return fewer rooms - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListRooms` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsResponse { - // The list of rooms. - repeated Room rooms = 1; - - // A token to retrieve next page of results. - // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// This protocol buffer message represents a blurb sent to a chat room or -// posted on a user profile. -message Blurb { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blurb" - pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" - pattern: "users/{user}/profile/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" - }; - - // The resource name of the chat room. - string name = 1; - - // The resource name of the blurb's author. - string user = 2 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; - - oneof content { - // The textual content of this blurb. - string text = 3; - - // The image content of this blurb. - bytes image = 4; - } - - // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. - // --) - oneof legacy_id { - // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern - // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` - string legacy_room_id = 7; - - // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern - // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` - string legacy_user_id = 8; - } -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateBlurb -// method. -message CreateBlurbRequest { - // The resource name of the chat room or user profile that this blurb will - // be tied to. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The blurb to create. - Blurb blurb = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetBlurb -// method. -message GetBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateBlurb -// method. -message UpdateBlurbRequest { - // The blurb to update. - Blurb blurb = 1; - - // The field mask to determine wich fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteBlurb -// method. -message DeleteBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsRequest { - // The resource name of the requested room or profile whos blurbs to list. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The maximum number of blurbs to return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 2; - - // The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListBlurbs` method. - string page_token = 3; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsResponse { - // The list of blurbs. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in ListBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\ListBlurbs` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\SearchBlurbs -// method. -message SearchBlurbsRequest { - // The query used to search for blurbs containing to words of this string. - // Only posts that contain an exact match of a queried word will be returned. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // The rooms or profiles to search. If unset, `SearchBlurbs` will search all - // rooms and all profiles. - string parent = 2 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - - // The maximum number of blurbs return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 3; - - // The value of - // google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - string page_token = 4; -} - -// The operation metadata message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsMetadata { - // This signals to the client when to next poll for response. - google.rpc.RetryInfo retry_info = 1; -} - -// The operation response message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsResponse { - // Blurbs that matched the search query. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in SearchBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\SearchBlurbs` method to - // retrieve the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsRequest { - // The resource name of a chat room or user profile whose blurbs to stream. - string name = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsResponse { - // The blurb that was either created, updated, or deleted. - Blurb blurb = 1; - - // The action that triggered the blurb to be returned. - enum Action { - ACTION_UNSPECIFIED = 0; - - // Specifies that the blurb was created. - CREATE = 1; - - // Specifies that the blurb was updated. - UPDATE = 2; - - // Specifies that the blurb was deleted. - DELETE = 3; - } - - // The action that triggered the blurb to be returned. - Action action = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\SendBlurbs -// method. -message SendBlurbsResponse { - // The names of successful blurb creations. - repeated string names = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\Connect -// method. -message ConnectRequest { - message ConnectConfig { - // The room or profile to follow and create messages for. - string parent = 1 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - } - - oneof request { - // Provides information that specifies how to process subsequent requests. - // The first `ConnectRequest` message must contain a `config` message. - ConnectConfig config = 1; - - // The blurb to be created. - Blurb blurb = 2; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline deleted file mode 100644 index 26158fdd861f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/sequence.proto.baseline +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -service SequenceService { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a sequence. - rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { - option (google.api.http) = { - post: "/v1beta1/sequences" - body: "sequence" - }; - option (google.api.method_signature) = "sequence"; - }; - - // Retrieves a sequence. - rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { - option (google.api.http) = { - get: "/v1beta1/{name=sequences/*/sequenceReport}" - }; - option (google.api.method_signature) = "name"; - }; - - // Attempts a sequence. - rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=sequences/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - }; -} - -message Sequence { - option (google.api.resource) = { - type: "showcase.googleapis.com/Sequence" - pattern: "sequences/{sequence}" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A server response to an RPC Attempt in a sequence. - message Response { - // The status to return for an individual attempt. - google.rpc.Status status = 1; - - // The amount of time to delay sending the response. - google.protobuf.Duration delay = 2; - } - - // Sequence of responses to return in order for each attempt. If empty, the - // default response is an immediate OK. - repeated Response responses = 2; -} - -message SequenceReport { - option (google.api.resource) = { - type: "showcase.googleapis.com/SequenceReport" - pattern: "sequences/{sequence}/sequenceReport" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains metrics on individual RPC Attempts in a sequence. - message Attempt { - // The attempt number - starting at 0. - int32 attempt_number = 1; - - // The deadline dictated by the attempt to the server. - google.protobuf.Timestamp attempt_deadline = 2; - - // The time that the server responded to the RPC attempt. Used for - // calculating attempt_delay. - google.protobuf.Timestamp response_time = 3; - - // The server perceived delay between sending the last response and - // receiving this attempt. Used for validating attempt delay backoff. - google.protobuf.Duration attempt_delay = 4; - - // The status returned to the attempt. - google.rpc.Status status = 5; - } - - // The set of RPC attempts received by the server for a Sequence. - repeated Attempt attempts = 2; -} - -message CreateSequenceRequest { - Sequence sequence = 1; -} - -message AttemptSequenceRequest { - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", - (google.api.field_behavior) = REQUIRED - ]; -} - -message GetSequenceReportRequest { - string name = 1 [ - (google.api.resource_reference).type = - "showcase.googleapis.com/SequenceReport", - (google.api.field_behavior) = REQUIRED - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline deleted file mode 100644 index dbfe134c6fb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/protos/google/showcase/v1beta1/testing.proto.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2018 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. - -edition = "2023"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A service to facilitate running discrete sets of tests -// against Showcase. -service Testing { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a new testing session. - rpc CreateSession(CreateSessionRequest) returns (Session) { - option (google.api.http) = { - post: "/v1beta1/sessions" - body: "session" - }; - } - - // Gets a testing session. - rpc GetSession(GetSessionRequest) returns (Session) { - option (google.api.http) = { - get: "/v1beta1/{name=sessions/*}" - }; - } - - // Lists the current test sessions. - rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { - option (google.api.http) = { - get: "/v1beta1/sessions" - }; - } - - // Delete a test session. - rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*}" - }; - } - - // Report on the status of a session. - // This generates a report detailing which tests have been completed, - // and an overall rollup. - rpc ReportSession(ReportSessionRequest) returns (ReportSessionResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*}:report" - }; - } - - // List the tests of a sessesion. - rpc ListTests(ListTestsRequest) returns (ListTestsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=sessions/*}/tests" - }; - } - - // Explicitly decline to implement a test. - // - // This removes the test from subsequent `ListTests` calls, and - // attempting to do the test will error. - // - // This method will error if attempting to delete a required test. - rpc DeleteTest(DeleteTestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*/tests/*}" - }; - } - - // Register a response to a test. - // - // In cases where a test involves registering a final answer at the - // end of the test, this method provides the means to do so. - rpc VerifyTest(VerifyTestRequest) returns (VerifyTestResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*/tests/*}:check" - }; - } -} - -// A session is a suite of tests, generally being made in the context -// of testing code generation. -// -// A session defines tests it may expect, based on which version of the -// code generation spec is in use. -message Session { - option (google.api.resource) = { - type: "showcase.googleapis.com/Session" - pattern: "sessions/{session}" - }; - - // The name of the session. The ID must conform to ^[a-z]+$ - // If this is not provided, Showcase chooses one at random. - string name = 1; - - // The specification versions understood by Showcase. - enum Version { - // Unspecified version. If passed on creation, the session will default - // to using the latest stable release. - VERSION_UNSPECIFIED = 0; - - // The latest v1. Currently, this is v1.0. - V1_LATEST = 1; - - // v1.0. (Until the spec is "GA", this will be a moving target.) - V1_0 = 2; - } - - // Required. The version this session is using. - Version version = 2; -} - -// The request for the CreateSession method. -message CreateSessionRequest { - // The session to be created. - // Sessions are immutable once they are created (although they can - // be deleted). - Session session = 1; -} - -// The request for the GetSession method. -message GetSessionRequest { - // The session to be retrieved. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// The request for the ListSessions method. -message ListSessionsRequest { - // The maximum number of sessions to return per page. - int32 page_size = 1; - - // The page token, for retrieving subsequent pages. - string page_token = 2; -} - -// Response for the ListSessions method. -message ListSessionsResponse { - // The sessions being returned. - repeated Session sessions = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// Request for the DeleteSession method. -message DeleteSessionRequest { - // The session to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Request message for reporting on a session. -message ReportSessionRequest { - // The session to be reported on. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Response message for reporting on a session. -message ReportSessionResponse { - // The topline state of the report. - enum Result { - RESULT_UNSPECIFIED = 0; - - // The session is complete, and everything passed. - PASSED = 1; - - // The session had an explicit failure. - FAILED = 2; - - // The session is incomplete. This is a failure response. - INCOMPLETE = 3; - } - - // The state of the report. - Result result = 1; - - // The test runs of this session. - repeated TestRun test_runs = 2; -} - -message Test { - option (google.api.resource) = { - type: "showcase.googleapis.com/Test" - pattern: "sessions/{session}/tests/{test}" - }; - - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string name = 1; - - // Whether or not a test is required, recommended, or optional. - enum ExpectationLevel { - EXPECTATION_LEVEL_UNSPECIFIED = 0; - - // This test is strictly required. - REQUIRED = 1; - - // This test is recommended. - // - // If a generator explicitly ignores a recommended test (see `DeleteTest`), - // then the report may still pass, but with a warning. - // - // If a generator skips a recommended test and does not explicitly - // express that intention, the report will fail. - RECOMMENDED = 2; - - // This test is optional. - // - // If a generator explicitly ignores an optional test (see `DeleteTest`), - // then the report may still pass, and no warning will be issued. - // - // If a generator skips an optional test and does not explicitly - // express that intention, the report may still pass, but with a - // warning. - OPTIONAL = 3; - } - - // The expectation level for this test. - ExpectationLevel expectation_level = 2; - - // A description of the test. - string description = 3; - - // A blueprint is an explicit definition of methods and requests that are needed - // to be made to test this specific test case. Ideally this would be represented - // by something more robust like CEL, but as of writing this, I am unsure if CEL - // is ready. - message Blueprint { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blueprint" - pattern: "sessions/{session}/tests/{test}/blueprints/{blueprint}" - }; - - // The name of this blueprint. - string name = 1; - - // A description of this blueprint. - string description = 2; - - // A message representing a method invocation. - message Invocation { - // The fully qualified name of the showcase method to be invoked. - string method = 1; - - // The request to be made if a specific request is necessary. - bytes serialized_request = 2; - } - - // The initial request to trigger this test. - Invocation request = 3; - - // An ordered list of method calls that can be called to trigger this test. - repeated Invocation additional_requests = 4; - } - - // The blueprints that will satisfy this test. There may be multiple blueprints - // that can signal to the server that this test case is being exercised. Although - // multiple blueprints are specified, only a single blueprint needs to be run to - // signal that the test case was exercised. - repeated Blueprint blueprints = 4; -} - -// An issue found in the test. -message Issue { - // The different potential types of issues. - enum Type { - TYPE_UNSPECIFIED = 0; - - // The test was never instrumented. - SKIPPED = 1; - - // The test was started but never confirmed. - PENDING = 2; - - // The test was instrumented, but Showcase got an unexpected - // value when the generator tried to confirm success. - INCORRECT_CONFIRMATION = 3; - } - - // The type of the issue. - Type type = 1; - - // Severity levels. - enum Severity { - SEVERITY_UNSPECIFIED = 0; - - // Errors. - ERROR = 1; - - // Warnings. - WARNING = 2; - } - - // The severity of the issue. - Severity severity = 2; - - // A description of the issue. - string description = 3; -} - -// The request for the ListTests method. -message ListTestsRequest { - // The session. - string parent = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; - - // The maximum number of tests to return per page. - int32 page_size = 2; - - // The page token, for retrieving subsequent pages. - string page_token = 3; -} - -// The response for the ListTests method. -message ListTestsResponse { - // The tests being returned. - repeated Test tests = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// A TestRun is the result of running a Test. -message TestRun { - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string test = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - - // An issue found with the test run. If empty, this test run was successful. - Issue issue = 2; -} - -// Request message for deleting a test. -message DeleteTestRequest { - // The test to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; -} - -message VerifyTestRequest { - // The test to have an answer registered to it. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - // The answer from the test. - bytes answer = 2; - - // The answers from the test if multiple are to be checked - repeated bytes answers = 3; -} - -message VerifyTestResponse { - // An issue if check answer was unsuccessful. This will be empty if the check answer succeeded. - Issue issue = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/index.ts.baseline deleted file mode 100644 index 55fd8ef14d16..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/index.ts.baseline +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const ComplianceClient = v1beta1.ComplianceClient; -type ComplianceClient = v1beta1.ComplianceClient; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -const IdentityClient = v1beta1.IdentityClient; -type IdentityClient = v1beta1.IdentityClient; -const MessagingClient = v1beta1.MessagingClient; -type MessagingClient = v1beta1.MessagingClient; -const SequenceServiceClient = v1beta1.SequenceServiceClient; -type SequenceServiceClient = v1beta1.SequenceServiceClient; -const TestingClient = v1beta1.TestingClient; -type TestingClient = v1beta1.TestingClient; -export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline deleted file mode 100644 index 74362bb329a2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client.ts.baseline +++ /dev/null @@ -1,1782 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/compliance_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './compliance_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format - * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped - * correctly. - * @class - * @memberof v1beta1 - */ -export class ComplianceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - complianceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ComplianceClient. - * - * @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://cloud.google.com/docs/authentication/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 ComplianceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ComplianceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, - 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.complianceStub) { - return this.complianceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Compliance. - this.complianceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Compliance, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const complianceStubMethods = - ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; - for (const methodName of complianceStubMethods) { - const callPromise = this.complianceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.complianceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * This method echoes the ComplianceData request. This method exercises - * sending the entire request object in the REST body. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async - */ - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBody request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBody response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBody(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBody response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending the a message-type field in the REST body. Per AIP-127, only - * top-level, non-repeated fields can be sent this way. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async - */ - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyInfo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyInfo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyInfo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyInfo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending all request fields as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async - */ - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataQuery request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataQuery response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending some parameters as "simple" path variables (i.e., of the form - * "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async - */ - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_int32': request.info!.fInt32 ?? '', - 'info.f_double': request.info!.fDouble ?? '', - 'info.f_bool': request.info!.fBool ?? '', - 'info.f_kingdom': request.info!.fKingdom ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataSimplePath request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataSimplePath response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataSimplePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataSimplePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a path resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async - */ - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - 'info.f_bool': request.info!.fBool ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathResource response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataPathResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataPathResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a trailing resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async - */ - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathTrailingResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataPathTrailingResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PUT method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async - */ - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPut request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPut response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyPut(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyPut response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PATCH method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async - */ - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPatch request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPatch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyPatch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyPatch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - * response from this RPC as the request to VerifyEnum() - * - * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {boolean} request.unknownEnum - * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.get_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async - */ - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('getEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getEnum response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, - {}|undefined - ]) => { - this._log.info('getEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - * with the same EnumResponse; otherwise, the RPC errors. - * - * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - * although they are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.EnumRequest} request.request - * The original request for a known or unknown enum from the server. - * @param {google.showcase.v1beta1.Continent} request.continent - * The actual enum the server provided. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.verify_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async - */ - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('verifyEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyEnum response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.verifyEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, - {}|undefined - ]) => { - this._log.info('verifyEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.complianceStub && !this._terminated) { - return this.complianceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline deleted file mode 100644 index 43582a4ff828..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Compliance": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "RepeatDataBody": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyInfo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataQuery": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataSimplePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathTrailingResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPut": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/compliance_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index 2b0064ef4bab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1675 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './echo_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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 EchoClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, - {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, - {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, - {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, - {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline deleted file mode 100644 index 8eeb4b4bce52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client.ts.baseline +++ /dev/null @@ -1,1308 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/identity_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './identity_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A simple identity service. - * @class - * @memberof v1beta1 - */ -export class IdentityClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - identityStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityClient. - * - * @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://cloud.google.com/docs/authentication/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 IdentityClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listUsers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'users') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Identity', gapicConfig as gax.ClientConfig, - 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.identityStub) { - return this.identityStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Identity. - this.identityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Identity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Identity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const identityStubMethods = - ['createUser', 'getUser', 'updateUser', 'deleteUser', 'listUsers']; - for (const methodName of identityStubMethods) { - const callPromise = this.identityStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.identityStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.create_user.js - * region_tag:localhost_v1beta1_generated_Identity_CreateUser_async - */ - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('createUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the User with the given uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested user. - * @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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.get_user.js - * region_tag:localhost_v1beta1_generated_Identity_GetUser_async - */ - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.update_user.js - * region_tag:localhost_v1beta1_generated_Identity_UpdateUser_async - */ - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'user.name': request.user!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a user, their profile, and all of their authored messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the user to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.delete_user.js - * region_tag:localhost_v1beta1_generated_Identity_DeleteUser_async - */ - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUser request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all users. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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 Array of {@link protos.google.showcase.v1beta1.User|User}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUsersAsync()` - * 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. - */ - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUsers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listUsers request %j', request); - return this.innerApiCalls - .listUsers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]) => { - this._log.info('listUsers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUsers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User} 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 `listUsersAsync()` - * 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. - */ - listUsersStream( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers stream %j', request); - return this.descriptors.page.listUsers.createStream( - this.innerApiCalls.listUsers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsers`, 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 {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User}. 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 include:samples/generated/v1beta1/identity.list_users.js - * region_tag:localhost_v1beta1_generated_Identity_ListUsers_async - */ - listUsersAsync( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers iterate %j', request); - return this.descriptors.page.listUsers.asyncIterate( - this.innerApiCalls['listUsers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.identityStub && !this._terminated) { - return this.identityStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client_config.json.baseline deleted file mode 100644 index 3a162c29cdc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Identity": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/identity_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/index.ts.baseline deleted file mode 100644 index f3bb4c129cce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {ComplianceClient} from './compliance_client'; -export {EchoClient} from './echo_client'; -export {IdentityClient} from './identity_client'; -export {MessagingClient} from './messaging_client'; -export {SequenceServiceClient} from './sequence_service_client'; -export {TestingClient} from './testing_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline deleted file mode 100644 index 319223c209b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client.ts.baseline +++ /dev/null @@ -1,2175 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/messaging_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './messaging_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A simple messaging service that implements chat rooms and profile posts. - * - * This messaging service showcases the features that API clients - * generated by gapic-generators implement. - * @class - * @memberof v1beta1 - */ -export class MessagingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - messagingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MessagingClient. - * - * @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://cloud.google.com/docs/authentication/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 MessagingClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MessagingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listRooms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rooms'), - listBlurbs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'blurbs') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const searchBlurbsResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsResponse') as gax.protobuf.Type; - const searchBlurbsMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - searchBlurbs: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - searchBlurbsResponse.decode.bind(searchBlurbsResponse), - searchBlurbsMetadata.decode.bind(searchBlurbsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Messaging', gapicConfig as gax.ClientConfig, - 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.messagingStub) { - return this.messagingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Messaging. - this.messagingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Messaging') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Messaging, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const messagingStubMethods = - ['createRoom', 'getRoom', 'updateRoom', 'deleteRoom', 'listRooms', 'createBlurb', 'getBlurb', 'updateBlurb', 'deleteBlurb', 'listBlurbs', 'searchBlurbs', 'streamBlurbs', 'sendBlurbs', 'connect']; - for (const methodName of messagingStubMethods) { - const callPromise = this.messagingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.messagingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_room.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateRoom_async - */ - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('createRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Room with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_room.js - * region_tag:localhost_v1beta1_generated_Messaging_GetRoom_async - */ - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('getRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_room.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateRoom_async - */ - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'room.name': request.room!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a room and all of its blurbs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_room.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteRoom_async - */ - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoom request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a blurb. If the parent is a room, the blurb is understood to be a - * message in that room. If the parent is a profile, the blurb is understood - * to be a post on the profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the chat room or user profile that this blurb will - * be tied to. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateBlurb_async - */ - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('createBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Blurb with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_GetBlurb_async - */ - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateBlurb_async - */ - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'blurb.name': request.blurb!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteBlurb_async - */ - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This returns a stream that emits the blurbs that are created for a - * particular chat room or user profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of a chat room or user profile whose blurbs to stream. - * @param {google.protobuf.Timestamp} request.expireTime - * The time at which this stream will close. - * @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 {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.stream_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_StreamBlurbs_async - */ - streamBlurbs( - request?: protos.google.showcase.v1beta1.IStreamBlurbsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('streamBlurbs stream %j', options); - return this.innerApiCalls.streamBlurbs(request, options); - } - -/** - * This is a stream to create multiple blurbs. If an invalid blurb is - * requested to be created, the stream will close with an error. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.CreateBlurbRequest|CreateBlurbRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.send_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SendBlurbs_async - */ - sendBlurbs( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('sendBlurbs stream %j', options); - return this.innerApiCalls.sendBlurbs(null, options, callback); - } - -/** - * This method starts a bidirectional stream that receives all blurbs that - * are being created after the stream has started and sends requests to create - * blurbs. If an invalid blurb is requested to be created, the stream will - * close with an error. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.ConnectRequest|ConnectRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.connect.js - * region_tag:localhost_v1beta1_generated_Messaging_Connect_async - */ - connect( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('connect stream %j', options); - return this.innerApiCalls.connect(null, options); - } - -/** - * This method searches through all blurbs across all rooms and profiles - * for blurbs containing to words found in the query. Only posts that - * contain an exact match of a queried word will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.query - * The query used to search for blurbs containing to words of this string. - * Only posts that contain an exact match of a queried word will be returned. - * @param {string} request.parent - * The rooms or profiles to search. If unset, `SearchBlurbs` will search all - * rooms and all profiles. - * @param {number} request.pageSize - * The maximum number of blurbs return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of - * google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('searchBlurbs response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('searchBlurbs request %j', request); - return this.innerApiCalls.searchBlurbs(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('searchBlurbs response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `searchBlurbs()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - async checkSearchBlurbsProgress(name: string): Promise>{ - this._log.info('searchBlurbs long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.searchBlurbs, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all chat rooms. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Room|Room}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoomsAsync()` - * 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. - */ - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRooms values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listRooms request %j', request); - return this.innerApiCalls - .listRooms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]) => { - this._log.info('listRooms values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRooms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room} 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 `listRoomsAsync()` - * 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. - */ - listRoomsStream( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms stream %j', request); - return this.descriptors.page.listRooms.createStream( - this.innerApiCalls.listRooms as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRooms`, 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 {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room}. 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 include:samples/generated/v1beta1/messaging.list_rooms.js - * region_tag:localhost_v1beta1_generated_Messaging_ListRooms_async - */ - listRoomsAsync( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms iterate %j', request); - return this.descriptors.page.listRooms.asyncIterate( - this.innerApiCalls['listRooms'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists blurbs for a specific chat room or user profile depending on the - * parent resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBlurbsAsync()` - * 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. - */ - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBlurbs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listBlurbs request %j', request); - return this.innerApiCalls - .listBlurbs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]) => { - this._log.info('listBlurbs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBlurbs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb} 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 `listBlurbsAsync()` - * 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. - */ - listBlurbsStream( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs stream %j', request); - return this.descriptors.page.listBlurbs.createStream( - this.innerApiCalls.listBlurbs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBlurbs`, 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 - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb}. 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 include:samples/generated/v1beta1/messaging.list_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_ListBlurbs_async - */ - listBlurbsAsync( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs iterate %j', request); - return this.descriptors.page.listBlurbs.asyncIterate( - this.innerApiCalls['listBlurbs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.messagingStub && !this._terminated) { - return this.messagingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client_config.json.baseline deleted file mode 100644 index 551a130c2342..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_client_config.json.baseline +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Messaging": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRooms": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SearchBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StreamBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Connect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/messaging_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline deleted file mode 100644 index 81d1cf10364c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client.ts.baseline +++ /dev/null @@ -1,1019 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/sequence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sequence_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta1 - */ -export class SequenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sequenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SequenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 SequenceServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SequenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, - 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.sequenceServiceStub) { - return this.sequenceServiceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.SequenceService. - this.sequenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.SequenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sequenceServiceStubMethods = - ['createSequence', 'getSequenceReport', 'attemptSequence']; - for (const methodName of sequenceServiceStubMethods) { - const callPromise = this.sequenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sequenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Sequence} request.sequence - * @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 {@link protos.google.showcase.v1beta1.Sequence|Sequence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async - */ - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSequence request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSequence response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.showcase.v1beta1.SequenceReport|SequenceReport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js - * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async - */ - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSequenceReport request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSequenceReport response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSequenceReport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSequenceReport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Attempts a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async - */ - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('attemptSequence request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('attemptSequence response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.attemptSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, - {}|undefined - ]) => { - this._log.info('attemptSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sequenceServiceStub && !this._terminated) { - return this.sequenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline deleted file mode 100644 index 77c80d32a901..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.SequenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSequenceReport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttemptSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/sequence_service_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline deleted file mode 100644 index fdb68229da8a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client.ts.baseline +++ /dev/null @@ -1,1694 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/testing_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './testing_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service to facilitate running discrete sets of tests - * against Showcase. - * @class - * @memberof v1beta1 - */ -export class TestingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - testingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestingClient. - * - * @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://cloud.google.com/docs/authentication/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 TestingClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listSessions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessions'), - listTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tests') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Testing', gapicConfig as gax.ClientConfig, - 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.testingStub) { - return this.testingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Testing. - this.testingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Testing') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Testing, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testingStubMethods = - ['createSession', 'getSession', 'listSessions', 'deleteSession', 'reportSession', 'listTests', 'deleteTest', 'verifyTest']; - for (const methodName of testingStubMethods) { - const callPromise = this.testingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.testingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Session} request.session - * The session to be created. - * Sessions are immutable once they are created (although they can - * be deleted). - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.create_session.js - * region_tag:localhost_v1beta1_generated_Testing_CreateSession_async - */ - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be retrieved. - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.get_session.js - * region_tag:localhost_v1beta1_generated_Testing_GetSession_async - */ - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete a test session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_session.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteSession_async - */ - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSession request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Report on the status of a session. - * This generates a report detailing which tests have been completed, - * and an overall rollup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be reported on. - * @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 {@link protos.google.showcase.v1beta1.ReportSessionResponse|ReportSessionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.report_session.js - * region_tag:localhost_v1beta1_generated_Testing_ReportSession_async - */ - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reportSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reportSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.reportSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('reportSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Explicitly decline to implement a test. - * - * This removes the test from subsequent `ListTests` calls, and - * attempting to do the test will error. - * - * This method will error if attempting to delete a required test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_test.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteTest_async - */ - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTest request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTest response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Register a response to a test. - * - * In cases where a test involves registering a final answer at the - * end of the test, this method provides the means to do so. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to have an answer registered to it. - * @param {Buffer} request.answer - * The answer from the test. - * @param {Buffer[]} request.answers - * The answers from the test if multiple are to be checked - * @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 {@link protos.google.showcase.v1beta1.VerifyTestResponse|VerifyTestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.verify_test.js - * region_tag:localhost_v1beta1_generated_Testing_VerifyTest_async - */ - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyTest request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyTest response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.verifyTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the current test sessions. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Session|Session}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionsAsync()` - * 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. - */ - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSessions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSessions request %j', request); - return this.innerApiCalls - .listSessions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]) => { - this._log.info('listSessions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSessions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session} 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 `listSessionsAsync()` - * 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. - */ - listSessionsStream( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions stream %j', request); - return this.descriptors.page.listSessions.createStream( - this.innerApiCalls.listSessions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessions`, 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 {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session}. 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 include:samples/generated/v1beta1/testing.list_sessions.js - * region_tag:localhost_v1beta1_generated_Testing_ListSessions_async - */ - listSessionsAsync( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions iterate %j', request); - return this.descriptors.page.listSessions.asyncIterate( - this.innerApiCalls['listSessions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the tests of a sessesion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Test|Test}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTestsAsync()` - * 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. - */ - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTests values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTests request %j', request); - return this.innerApiCalls - .listTests(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]) => { - this._log.info('listTests values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTests`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test} 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 `listTestsAsync()` - * 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. - */ - listTestsStream( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests stream %j', request); - return this.descriptors.page.listTests.createStream( - this.innerApiCalls.listTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTests`, 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 - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test}. 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 include:samples/generated/v1beta1/testing.list_tests.js - * region_tag:localhost_v1beta1_generated_Testing_ListTests_async - */ - listTestsAsync( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests iterate %j', request); - return this.descriptors.page.listTests.asyncIterate( - this.innerApiCalls['listTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testingStub && !this._terminated) { - return this.testingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client_config.json.baseline deleted file mode 100644 index 03815dc3f5e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Testing": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSessions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReportSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTests": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/src/v1beta1/testing_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline deleted file mode 100644 index 33c4db06519a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_compliance_v1beta1.ts.baseline +++ /dev/null @@ -1,1559 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as complianceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.ComplianceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new complianceModule.v1beta1.ComplianceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = complianceModule.v1beta1.ComplianceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - await client.initialize(); - assert(client.complianceStub); - }); - - it('has close method for the initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.complianceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('repeatDataBody', () => { - it('invokes repeatDataBody without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBody(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBody( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - - it('invokes repeatDataBody with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - }); - - describe('repeatDataBodyInfo', () => { - it('invokes repeatDataBodyInfo without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyInfo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyInfo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - - it('invokes repeatDataBodyInfo with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - }); - - describe('repeatDataQuery', () => { - it('invokes repeatDataQuery without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataQuery(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataQuery( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - - it('invokes repeatDataQuery with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - }); - - describe('repeatDataSimplePath', () => { - it('invokes repeatDataSimplePath without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataSimplePath(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataSimplePath( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - }); - }); - - describe('repeatDataPathResource', () => { - it('invokes repeatDataPathResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - }); - }); - - describe('repeatDataPathTrailingResource', () => { - it('invokes repeatDataPathTrailingResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathTrailingResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathTrailingResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - }); - }); - - describe('repeatDataBodyPut', () => { - it('invokes repeatDataBodyPut without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPut(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPut( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - - it('invokes repeatDataBodyPut with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - }); - - describe('repeatDataBodyPatch', () => { - it('invokes repeatDataBodyPatch without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPatch(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPatch( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - - it('invokes repeatDataBodyPatch with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - }); - - describe('getEnum', () => { - it('invokes getEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); - const [response] = await client.getEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnum(request), expectedError); - }); - - it('invokes getEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEnum(request), expectedError); - }); - }); - - describe('verifyEnum', () => { - it('invokes verifyEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); - const [response] = await client.verifyEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - - it('invokes verifyEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index 1f5a591bdcd3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1529 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new echoModule.v1beta1.EchoClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline deleted file mode 100644 index b938f6196ed4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_identity_v1beta1.ts.baseline +++ /dev/null @@ -1,1203 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as identityModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.IdentityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = identityModule.v1beta1.IdentityClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = identityModule.v1beta1.IdentityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new identityModule.v1beta1.IdentityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = identityModule.v1beta1.IdentityClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityModule.v1beta1.IdentityClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityModule.v1beta1.IdentityClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - await client.initialize(); - assert(client.identityStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.identityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createUser', () => { - it('invokes createUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCall(expectedResponse); - const [response] = await client.createUser(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUser(request), expectedError); - }); - - it('invokes createUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUser(request), expectedError); - }); - }); - - describe('getUser', () => { - it('invokes getUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCall(expectedResponse); - const [response] = await client.getUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUser(request), expectedError); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUser(request), expectedError); - }); - }); - - describe('updateUser', () => { - it('invokes updateUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCall(expectedResponse); - const [response] = await client.updateUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUser(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUser(request), expectedError); - }); - }); - - describe('deleteUser', () => { - it('invokes deleteUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUser( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUser(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUser(request), expectedError); - }); - }); - - describe('listUsers', () => { - it('invokes listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCall(expectedResponse); - const [response] = await client.listUsers(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsers( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUsers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsers(request), expectedError); - }); - - it('invokes listUsersStream without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('invokes listUsersStream with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('uses async iteration with listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IUser[] = []; - const iterable = client.listUsersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IUser[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline deleted file mode 100644 index d7b2ff9708e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_messaging_v1beta1.ts.baseline +++ /dev/null @@ -1,2356 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as messagingModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.MessagingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = messagingModule.v1beta1.MessagingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = messagingModule.v1beta1.MessagingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new messagingModule.v1beta1.MessagingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = messagingModule.v1beta1.MessagingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - await client.initialize(); - assert(client.messagingStub); - }); - - it('has close method for the initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.messagingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createRoom', () => { - it('invokes createRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCall(expectedResponse); - const [response] = await client.createRoom(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createRoom(request), expectedError); - }); - - it('invokes createRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createRoom(request), expectedError); - }); - }); - - describe('getRoom', () => { - it('invokes getRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCall(expectedResponse); - const [response] = await client.getRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoom(request), expectedError); - }); - }); - - describe('updateRoom', () => { - it('invokes updateRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoom(request), expectedError); - }); - }); - - describe('deleteRoom', () => { - it('invokes deleteRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoom( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoom(request), expectedError); - }); - }); - - describe('createBlurb', () => { - it('invokes createBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.createBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBlurb(request), expectedError); - }); - }); - - describe('getBlurb', () => { - it('invokes getBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.getBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBlurb(request), expectedError); - }); - }); - - describe('updateBlurb', () => { - it('invokes updateBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.updateBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBlurb(request), expectedError); - }); - }); - - describe('deleteBlurb', () => { - it('invokes deleteBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBlurb( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBlurb(request), expectedError); - }); - }); - - describe('searchBlurbs', () => { - it('invokes searchBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(expectedResponse); - const [operation] = await client.searchBlurbs(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchBlurbs( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with call error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.searchBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with LRO error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.searchBlurbs(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSearchBlurbsProgress without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSearchBlurbsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSearchBlurbsProgress with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSearchBlurbsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('streamBlurbs', () => { - it('invokes streamBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs without error and gaxServerStreamingRetries enabled', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(undefined, expectedError); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('connect', () => { - it('invokes connect without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.connect = stubBidiStreamingCall(expectedResponse); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes connect with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.connect = stubBidiStreamingCall(undefined, expectedError); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('sendBlurbs', () => { - it('invokes sendBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SendBlurbsResponse() - ); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes sendBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('listRooms', () => { - it('invokes listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCall(expectedResponse); - const [response] = await client.listRooms(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRooms( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listRooms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRooms(request), expectedError); - }); - - it('invokes listRoomsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('invokes listRoomsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('uses async iteration with listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - const iterable = client.listRoomsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoomsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listBlurbs', () => { - it('invokes listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCall(expectedResponse); - const [response] = await client.listBlurbs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBlurbs( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBlurbs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBlurbsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - const iterable = client.listBlurbsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBlurbsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline deleted file mode 100644 index e772cf81a761..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_sequence_service_v1beta1.ts.baseline +++ /dev/null @@ -1,869 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as sequenceserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.SequenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sequenceserviceModule.v1beta1.SequenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - await client.initialize(); - assert(client.sequenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sequenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSequence', () => { - it('invokes createSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); - const [response] = await client.createSequence(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSequence( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSequence(request), expectedError); - }); - - it('invokes createSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSequence(request), expectedError); - }); - }); - - describe('getSequenceReport', () => { - it('invokes getSequenceReport without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); - const [response] = await client.getSequenceReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSequenceReport( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSequenceReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSequenceReport(request), expectedError); - }); - }); - - describe('attemptSequence', () => { - it('invokes attemptSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); - const [response] = await client.attemptSequence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attemptSequence( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.attemptSequence(request), expectedError); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.attemptSequence(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline deleted file mode 100644 index 55e55cff9e27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/test/gapic_testing_v1beta1.ts.baseline +++ /dev/null @@ -1,1660 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testingModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.TestingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testingModule.v1beta1.TestingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testingModule.v1beta1.TestingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testingModule.v1beta1.TestingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testingModule.v1beta1.TestingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testingModule.v1beta1.TestingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testingModule.v1beta1.TestingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testingModule.v1beta1.TestingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testingModule.v1beta1.TestingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - await client.initialize(); - assert(client.testingStub); - }); - - it('has close method for the initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSession', () => { - it('invokes createSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCall(expectedResponse); - const [response] = await client.createSession(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSession(request), expectedError); - }); - - it('invokes createSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSession(request), expectedError); - }); - }); - - describe('getSession', () => { - it('invokes getSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCall(expectedResponse); - const [response] = await client.getSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSession(request), expectedError); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSession(request), expectedError); - }); - }); - - describe('deleteSession', () => { - it('invokes deleteSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSession( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSession(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSession(request), expectedError); - }); - }); - - describe('reportSession', () => { - it('invokes reportSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCall(expectedResponse); - const [response] = await client.reportSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reportSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IReportSessionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reportSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reportSession(request), expectedError); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reportSession(request), expectedError); - }); - }); - - describe('deleteTest', () => { - it('invokes deleteTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTest( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTest(request), expectedError); - }); - }); - - describe('verifyTest', () => { - it('invokes verifyTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCall(expectedResponse); - const [response] = await client.verifyTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyTest( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IVerifyTestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyTest(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyTest(request), expectedError); - }); - }); - - describe('listSessions', () => { - it('invokes listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCall(expectedResponse); - const [response] = await client.listSessions(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessions( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listSessions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessions(request), expectedError); - }); - - it('invokes listSessionsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('invokes listSessionsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('uses async iteration with listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ISession[] = []; - const iterable = client.listSessionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ISession[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listTests', () => { - it('invokes listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCall(expectedResponse); - const [response] = await client.listTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTests( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ITest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTestsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTestsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ITest[] = []; - const iterable = client.listTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ITest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/disable-packing-test/webpack.config.js.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/disable-packing-test/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.OwlBot.yaml.baseline deleted file mode 100644 index ec5105fb19ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/privacy/dlp/google-privacy-dlp-nodejs - dest: /owl-bot-staging/google-privacy-dlp - -api-name: dlp \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 54a7d7db0a50..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'dlp', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/README.md.baseline deleted file mode 100644 index 385d81b529f4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Dlp: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/dlp.svg)](https://www.npmjs.org/package/dlp) - -Dlp client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Dlp Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/dlp/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Dlp API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install dlp -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install dlp@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=dlp.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/index.ts.baseline deleted file mode 100644 index 409e88a67690..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2/index.js'; -const DlpServiceClient = v2.DlpServiceClient; -type DlpServiceClient = v2.DlpServiceClient; -export {v2, DlpServiceClient}; -export default {v2, DlpServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client.ts.baseline deleted file mode 100644 index 34c8964ef0a2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client.ts.baseline +++ /dev/null @@ -1,4881 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as dlp_service_client_config from './dlp_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * 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 = getJSON( - path.join(dirname, 'dlp_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', '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 - */ -export class DlpServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('dlp'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - dlpServiceStub?: Promise<{[name: string]: Function}>; - - /** - * 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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DlpServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'dlp.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - dlpJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/dlpJobs/{dlp_job}' - ), - jobTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/jobTriggers/{job_trigger}' - ), - 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}' - ), - 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}' - ), - projectInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/inspectTemplates/{inspect_template}' - ), - 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 as gax.ClientConfig, - 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 as protobuf.Root).lookupService('google.privacy.dlp.v2.DlpService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.privacy.dlp.v2.DlpService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // 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', 'getJobTrigger', 'listJobTriggers', 'deleteJobTrigger', 'activateJobTrigger', 'createDlpJob', 'listDlpJobs', 'getDlpJob', 'deleteDlpJob', 'cancelDlpJob', 'createStoredInfoType', 'updateStoredInfoType', 'getStoredInfoType', 'listStoredInfoTypes', 'deleteStoredInfoType']; - for (const methodName of dlpServiceStubMethods) { - const callPromise = this.dlpServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'dlp.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'dlp.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Finds potentially sensitive info in content. - * This method has limits on input size, processing time, and output size. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - * and https://cloud.google.com/dlp/docs/inspecting-text, - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to inspect. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process content inspection. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.InspectContentResponse|InspectContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.inspect_content.js - * region_tag:dlp_v2_generated_DlpService_InspectContent_async - */ - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('inspectContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('inspectContent response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.inspectContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]) => { - this._log.info('inspectContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Redacts potentially sensitive info from an image. - * This method has limits on input size, processing time, and output size. - * See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {string} request.locationId - * The geographic location to process the request. Reserved for future - * extensions. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {number[]} request.imageRedactionConfigs - * The configuration for specifying what content to redact from images. - * @param {boolean} request.includeFindings - * Whether the response should include findings along with the redacted - * image. - * @param {google.privacy.dlp.v2.ByteContentItem} request.byteItem - * The content must be PNG, JPEG, SVG or BMP. - * @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 {@link protos.google.privacy.dlp.v2.RedactImageResponse|RedactImageResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.redact_image.js - * region_tag:dlp_v2_generated_DlpService_RedactImage_async - */ - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('redactImage request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('redactImage response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.redactImage(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]) => { - this._log.info('redactImage response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * De-identifies potentially sensitive info from a ContentItem. - * This method has limits on input size and output size. - * See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.deidentifyConfig - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to de-identify. Will be treated as text. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.deidentifyTemplateName - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process de-identification. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyContentResponse|DeidentifyContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.deidentify_content.js - * region_tag:dlp_v2_generated_DlpService_DeidentifyContent_async - */ - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deidentifyContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deidentifyContent response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deidentifyContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]) => { - this._log.info('deidentifyContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Re-identifies content that has been de-identified. - * See - * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - * to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.reidentifyConfig - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to re-identify. Will be treated as text. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.reidentifyTemplateName - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process content reidentification. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.ReidentifyContentResponse|ReidentifyContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.reidentify_content.js - * region_tag:dlp_v2_generated_DlpService_ReidentifyContent_async - */ - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reidentifyContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reidentifyContent response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.reidentifyContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]) => { - this._log.info('reidentifyContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns a list of the sensitive information types that the DLP API - * supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.languageCode - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - * @param {string} request.filter - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - * @param {string} request.locationId - * The geographic location to list info types. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.ListInfoTypesResponse|ListInfoTypesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.list_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListInfoTypes_async - */ - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listInfoTypes request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listInfoTypes response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listInfoTypes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]) => { - this._log.info('listInfoTypes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates an InspectTemplate for re-using frequently used configuration - * for inspecting content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * Required. The InspectTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the inspection template. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_CreateInspectTemplate_async - */ - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('createInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * New InspectTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateInspectTemplate_async - */ - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('updateInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_GetInspectTemplate_async - */ - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('getInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteInspectTemplate_async - */ - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a DeidentifyTemplate for re-using frequently used configuration - * for de-identifying content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * Required. The DeidentifyTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the deidentification template. Reserved - * for future extensions. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async - */ - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('createDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * New DeidentifyTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async - */ - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('updateDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_GetDeidentifyTemplate_async - */ - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('getDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async - */ - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a job trigger to run DLP actions such as scanning storage for - * sensitive information on a set schedule. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * Required. The JobTrigger to create. - * @param {string} request.triggerId - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the job trigger. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_CreateJobTrigger_async - */ - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createJobTrigger response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]) => { - this._log.info('createJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * New JobTrigger value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_UpdateJobTrigger_async - */ - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateJobTrigger response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]) => { - this._log.info('updateJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_GetJobTrigger_async - */ - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getJobTrigger response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]) => { - this._log.info('getJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_DeleteJobTrigger_async - */ - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteJobTrigger response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Activate a job trigger. Causes the immediate execute of a trigger - * instead of waiting on the trigger event to occur. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.activate_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_ActivateJobTrigger_async - */ - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('activateJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('activateJobTrigger response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.activateJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]) => { - this._log.info('activateJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new job to inspect storage or calculate risk metrics. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.InspectJobConfig} request.inspectJob - * Set to control what and how to inspect. - * @param {google.privacy.dlp.v2.RiskAnalysisJobConfig} request.riskJob - * Set to choose what metric to calculate. - * @param {string} request.jobId - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store and process the job. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CreateDlpJob_async - */ - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createDlpJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]) => { - this._log.info('createDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the latest state of a long-running DlpJob. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_GetDlpJob_async - */ - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDlpJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]) => { - this._log.info('getDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a long-running DlpJob. This method indicates that the client is - * no longer interested in the DlpJob result. The job will be cancelled if - * possible. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_DeleteDlpJob_async - */ - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDlpJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Starts asynchronous cancellation on a long-running DlpJob. The server - * makes a best effort to cancel the DlpJob, but success is not - * guaranteed. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be cancelled. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.cancel_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CancelDlpJob_async - */ - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('cancelDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancelDlpJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.cancelDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]) => { - this._log.info('cancelDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a pre-built stored infoType to be used for inspection. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Required. Configuration of the storedInfoType to create. - * @param {string} request.storedInfoTypeId - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the stored infoType. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_CreateStoredInfoType_async - */ - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]) => { - this._log.info('createStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the stored infoType by creating a new version. The existing version - * will continue to be used until the new version is ready. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_UpdateStoredInfoType_async - */ - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]) => { - this._log.info('updateStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_GetStoredInfoType_async - */ - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]) => { - this._log.info('getStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_DeleteStoredInfoType_async - */ - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists InspectTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * 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. - */ - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInspectTemplates values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listInspectTemplates request %j', request); - return this.innerApiCalls - .listInspectTemplates(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]) => { - this._log.info('listInspectTemplates values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listInspectTemplates`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInspectTemplates stream %j', request); - return this.descriptors.page.listInspectTemplates.createStream( - this.innerApiCalls.listInspectTemplates as GaxCall, - 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 include:samples/generated/v2/dlp_service.list_inspect_templates.js - * region_tag:dlp_v2_generated_DlpService_ListInspectTemplates_async - */ - listInspectTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInspectTemplates iterate %j', request); - return this.descriptors.page.listInspectTemplates.asyncIterate( - this.innerApiCalls['listInspectTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DeidentifyTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDeidentifyTemplatesAsync()` - * 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. - */ - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDeidentifyTemplates values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listDeidentifyTemplates request %j', request); - return this.innerApiCalls - .listDeidentifyTemplates(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]) => { - this._log.info('listDeidentifyTemplates values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDeidentifyTemplates`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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.DeidentifyTemplate|DeidentifyTemplate} 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 `listDeidentifyTemplatesAsync()` - * 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. - */ - listDeidentifyTemplatesStream( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDeidentifyTemplates stream %j', request); - return this.descriptors.page.listDeidentifyTemplates.createStream( - this.innerApiCalls.listDeidentifyTemplates as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDeidentifyTemplates`, 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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.DeidentifyTemplate|DeidentifyTemplate}. 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 include:samples/generated/v2/dlp_service.list_deidentify_templates.js - * region_tag:dlp_v2_generated_DlpService_ListDeidentifyTemplates_async - */ - listDeidentifyTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDeidentifyTemplates iterate %j', request); - return this.descriptors.page.listDeidentifyTemplates.asyncIterate( - this.innerApiCalls['listDeidentifyTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists job triggers. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobTriggersAsync()` - * 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. - */ - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listJobTriggers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listJobTriggers request %j', request); - return this.innerApiCalls - .listJobTriggers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]) => { - this._log.info('listJobTriggers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listJobTriggers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.JobTrigger|JobTrigger} 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 `listJobTriggersAsync()` - * 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. - */ - listJobTriggersStream( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobTriggers stream %j', request); - return this.descriptors.page.listJobTriggers.createStream( - this.innerApiCalls.listJobTriggers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobTriggers`, 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. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.JobTrigger|JobTrigger}. 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 include:samples/generated/v2/dlp_service.list_job_triggers.js - * region_tag:dlp_v2_generated_DlpService_ListJobTriggers_async - */ - listJobTriggersAsync( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobTriggers iterate %j', request); - return this.descriptors.page.listJobTriggers.asyncIterate( - this.innerApiCalls['listJobTriggers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DlpJobs that match the specified filter in the request. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDlpJobsAsync()` - * 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. - */ - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDlpJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listDlpJobs request %j', request); - return this.innerApiCalls - .listDlpJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]) => { - this._log.info('listDlpJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDlpJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.DlpJob|DlpJob} 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 `listDlpJobsAsync()` - * 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. - */ - listDlpJobsStream( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDlpJobs stream %j', request); - return this.descriptors.page.listDlpJobs.createStream( - this.innerApiCalls.listDlpJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDlpJobs`, 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. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.DlpJob|DlpJob}. 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 include:samples/generated/v2/dlp_service.list_dlp_jobs.js - * region_tag:dlp_v2_generated_DlpService_ListDlpJobs_async - */ - listDlpJobsAsync( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDlpJobs iterate %j', request); - return this.descriptors.page.listDlpJobs.asyncIterate( - this.innerApiCalls['listDlpJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists stored infoTypes. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listStoredInfoTypesAsync()` - * 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. - */ - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listStoredInfoTypes values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listStoredInfoTypes request %j', request); - return this.innerApiCalls - .listStoredInfoTypes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]) => { - this._log.info('listStoredInfoTypes values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listStoredInfoTypes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.StoredInfoType|StoredInfoType} 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 `listStoredInfoTypesAsync()` - * 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. - */ - listStoredInfoTypesStream( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listStoredInfoTypes stream %j', request); - return this.descriptors.page.listStoredInfoTypes.createStream( - this.innerApiCalls.listStoredInfoTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStoredInfoTypes`, 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.StoredInfoType|StoredInfoType}. 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 include:samples/generated/v2/dlp_service.list_stored_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListStoredInfoTypes_async - */ - listStoredInfoTypesAsync( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listStoredInfoTypes iterate %j', request); - return this.descriptors.page.listStoredInfoTypes.asyncIterate( - this.innerApiCalls['listStoredInfoTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified dlpJob resource name string. - * - * @param {string} project - * @param {string} dlp_job - * @returns {string} Resource name string. - */ - dlpJobPath(project:string,dlpJob:string) { - return this.pathTemplates.dlpJobPathTemplate.render({ - project: project, - dlp_job: dlpJob, - }); - } - - /** - * Parse the project from DlpJob resource. - * - * @param {string} dlpJobName - * A fully-qualified path representing DlpJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDlpJobName(dlpJobName: string) { - return this.pathTemplates.dlpJobPathTemplate.match(dlpJobName).project; - } - - /** - * Parse the dlp_job from DlpJob resource. - * - * @param {string} dlpJobName - * A fully-qualified path representing DlpJob resource. - * @returns {string} A string representing the dlp_job. - */ - matchDlpJobFromDlpJobName(dlpJobName: string) { - return this.pathTemplates.dlpJobPathTemplate.match(dlpJobName).dlp_job; - } - - /** - * Return a fully-qualified jobTrigger resource name string. - * - * @param {string} project - * @param {string} job_trigger - * @returns {string} Resource name string. - */ - jobTriggerPath(project:string,jobTrigger:string) { - return this.pathTemplates.jobTriggerPathTemplate.render({ - project: project, - job_trigger: jobTrigger, - }); - } - - /** - * Parse the project from JobTrigger resource. - * - * @param {string} jobTriggerName - * A fully-qualified path representing JobTrigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobTriggerName(jobTriggerName: string) { - return this.pathTemplates.jobTriggerPathTemplate.match(jobTriggerName).project; - } - - /** - * Parse the job_trigger from JobTrigger resource. - * - * @param {string} jobTriggerName - * A fully-qualified path representing JobTrigger resource. - * @returns {string} A string representing the job_trigger. - */ - matchJobTriggerFromJobTriggerName(jobTriggerName: string) { - return this.pathTemplates.jobTriggerPathTemplate.match(jobTriggerName).job_trigger; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationDeidentifyTemplate resource name string. - * - * @param {string} organization - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - organizationDeidentifyTemplatePath(organization:string,deidentifyTemplate:string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.render({ - organization: organization, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the organization from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).organization; - } - - /** - * Parse the deidentify_template from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified organizationInspectTemplate resource name string. - * - * @param {string} organization - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - organizationInspectTemplatePath(organization:string,inspectTemplate:string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.render({ - organization: organization, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the organization from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).organization; - } - - /** - * Parse the inspect_template from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified organizationStoredInfoType resource name string. - * - * @param {string} organization - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - organizationStoredInfoTypePath(organization:string,storedInfoType:string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.render({ - organization: organization, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the organization from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).organization; - } - - /** - * Parse the stored_info_type from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).stored_info_type; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectDeidentifyTemplate resource name string. - * - * @param {string} project - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - projectDeidentifyTemplatePath(project:string,deidentifyTemplate:string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.render({ - project: project, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the project from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).project; - } - - /** - * Parse the deidentify_template from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified projectInspectTemplate resource name string. - * - * @param {string} project - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - projectInspectTemplatePath(project:string,inspectTemplate:string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.render({ - project: project, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the project from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).project; - } - - /** - * Parse the inspect_template from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified projectStoredInfoType resource name string. - * - * @param {string} project - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - projectStoredInfoTypePath(project:string,storedInfoType:string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.render({ - project: project, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the project from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).project; - } - - /** - * Parse the stored_info_type from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).stored_info_type; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dlpServiceStub && !this._terminated) { - return this.dlpServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client_config.json.baseline deleted file mode 100644 index 0bb30b7906b0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_client_config.json.baseline +++ /dev/null @@ -1,150 +0,0 @@ -{ - "interfaces": { - "google.privacy.dlp.v2.DlpService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "InspectContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RedactImage": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeidentifyContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReidentifyContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListInfoTypes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListInspectTemplates": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDeidentifyTemplates": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobTriggers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ActivateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDlpJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListStoredInfoTypes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_proto_list.json.baseline deleted file mode 100644 index 482924bde32a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/dlp_service_proto_list.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/privacy/dlp/v2/dlp.proto", - "../../protos/google/privacy/dlp/v2/storage.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/index.ts.baseline deleted file mode 100644 index 6dbc1b1c2fad..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/src/v2/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DlpServiceClient} from './dlp_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index de4514cb0cee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const dlp = require('dlp'); - -function main() { - const dlpServiceClient = new dlp.DlpServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 31844a3b61a1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as dlp from 'dlp'; - -function main() { - const dlpServiceClient = new dlp.DlpServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index d83930c09280..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {DlpServiceClient} from 'dlp'; - -// check that the client class type name can be used -function doStuffWithDlpServiceClient(client: DlpServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dlpServiceClient = new DlpServiceClient(); - doStuffWithDlpServiceClient(dlpServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/test/gapic_dlp_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/test/gapic_dlp_service_v2.ts.baseline deleted file mode 100644 index 3da7e9dfb6f2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/esm/test/gapic_dlp_service_v2.ts.baseline +++ /dev/null @@ -1,4883 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dlpserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.DlpServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'dlp.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = dlpserviceModule.v2.DlpServiceClient.servicePath; - assert.strictEqual(servicePath, 'dlp.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = dlpserviceModule.v2.DlpServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'dlp.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new dlpserviceModule.v2.DlpServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new dlpserviceModule.v2.DlpServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new dlpserviceModule.v2.DlpServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = dlpserviceModule.v2.DlpServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - await client.initialize(); - assert(client.dlpServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dlpServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('inspectContent', () => { - it('invokes inspectContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCall(expectedResponse); - const [response] = await client.inspectContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.inspectContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.inspectContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.inspectContent(request), expectedError); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.inspectContent(request), expectedError); - }); - }); - - describe('redactImage', () => { - it('invokes redactImage without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCall(expectedResponse); - const [response] = await client.redactImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.redactImage( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IRedactImageResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.redactImage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.redactImage(request), expectedError); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.redactImage(request), expectedError); - }); - }); - - describe('deidentifyContent', () => { - it('invokes deidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.deidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deidentifyContent(request), expectedError); - }); - }); - - describe('reidentifyContent', () => { - it('invokes reidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.reidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IReidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reidentifyContent(request), expectedError); - }); - }); - - describe('listInfoTypes', () => { - it('invokes listInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IListInfoTypesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listInfoTypes(request), expectedError); - }); - }); - - describe('createInspectTemplate', () => { - it('invokes createInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createInspectTemplate(request), expectedError); - }); - }); - - describe('updateInspectTemplate', () => { - it('invokes updateInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - }); - }); - - describe('getInspectTemplate', () => { - it('invokes getInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInspectTemplate(request), expectedError); - }); - }); - - describe('deleteInspectTemplate', () => { - it('invokes deleteInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInspectTemplate( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - }); - }); - - describe('createDeidentifyTemplate', () => { - it('invokes createDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - }); - }); - - describe('updateDeidentifyTemplate', () => { - it('invokes updateDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - }); - }); - - describe('getDeidentifyTemplate', () => { - it('invokes getDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - }); - }); - - describe('deleteDeidentifyTemplate', () => { - it('invokes deleteDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - }); - }); - - describe('createJobTrigger', () => { - it('invokes createJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.createJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createJobTrigger(request), expectedError); - }); - }); - - describe('updateJobTrigger', () => { - it('invokes updateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.updateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateJobTrigger(request), expectedError); - }); - }); - - describe('getJobTrigger', () => { - it('invokes getJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getJobTrigger(request), expectedError); - }); - }); - - describe('deleteJobTrigger', () => { - it('invokes deleteJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJobTrigger( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - }); - }); - - describe('activateJobTrigger', () => { - it('invokes activateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.activateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.activateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.activateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.activateJobTrigger(request), expectedError); - }); - }); - - describe('createDlpJob', () => { - it('invokes createDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.createDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDlpJob(request), expectedError); - }); - }); - - describe('getDlpJob', () => { - it('invokes getDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.getDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDlpJob(request), expectedError); - }); - }); - - describe('deleteDlpJob', () => { - it('invokes deleteDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDlpJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDlpJob(request), expectedError); - }); - }); - - describe('cancelDlpJob', () => { - it('invokes cancelDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelDlpJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelDlpJob(request), expectedError); - }); - }); - - describe('createStoredInfoType', () => { - it('invokes createStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.createStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createStoredInfoType(request), expectedError); - }); - }); - - describe('updateStoredInfoType', () => { - it('invokes updateStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.updateStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - }); - }); - - describe('getStoredInfoType', () => { - it('invokes getStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.getStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getStoredInfoType(request), expectedError); - }); - }); - - describe('deleteStoredInfoType', () => { - it('invokes deleteStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStoredInfoType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - }); - }); - - describe('listInspectTemplates', () => { - it('invokes listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listInspectTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInspectTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInspectTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInspectTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInspectTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - const iterable = client.listInspectTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInspectTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDeidentifyTemplates', () => { - it('invokes listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listDeidentifyTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeidentifyTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeidentifyTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDeidentifyTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - const iterable = client.listDeidentifyTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDeidentifyTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listJobTriggers', () => { - it('invokes listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listJobTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobTriggers( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobTriggers(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggersStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobTriggersStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - const iterable = client.listJobTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDlpJobs', () => { - it('invokes listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listDlpJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDlpJobs( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDlpJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDlpJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobsStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDlpJobsStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - const iterable = client.listDlpJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDlpJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStoredInfoTypes', () => { - it('invokes listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listStoredInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStoredInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStoredInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStoredInfoTypesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - const iterable = client.listStoredInfoTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStoredInfoTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('dlpJob', () => { - const fakePath = "/rendered/path/dlpJob"; - const expectedParameters = { - project: "projectValue", - dlp_job: "dlpJobValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.dlpJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dlpJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dlpJobPath', () => { - const result = client.dlpJobPath("projectValue", "dlpJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dlpJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDlpJobName', () => { - const result = client.matchProjectFromDlpJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDlpJobFromDlpJobName', () => { - const result = client.matchDlpJobFromDlpJobName(fakePath); - assert.strictEqual(result, "dlpJobValue"); - assert((client.pathTemplates.dlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('jobTrigger', () => { - const fakePath = "/rendered/path/jobTrigger"; - const expectedParameters = { - project: "projectValue", - job_trigger: "jobTriggerValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.jobTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobTriggerPath', () => { - const result = client.jobTriggerPath("projectValue", "jobTriggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobTriggerName', () => { - const result = client.matchProjectFromJobTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobTriggerFromJobTriggerName', () => { - const result = client.matchJobTriggerFromJobTriggerName(fakePath); - assert.strictEqual(result, "jobTriggerValue"); - assert((client.pathTemplates.jobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationDeidentifyTemplate', () => { - const fakePath = "/rendered/path/organizationDeidentifyTemplate"; - const expectedParameters = { - organization: "organizationValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationDeidentifyTemplatePath', () => { - const result = client.organizationDeidentifyTemplatePath("organizationValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchOrganizationFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationInspectTemplate', () => { - const fakePath = "/rendered/path/organizationInspectTemplate"; - const expectedParameters = { - organization: "organizationValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationInspectTemplatePath', () => { - const result = client.organizationInspectTemplatePath("organizationValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationInspectTemplateName', () => { - const result = client.matchOrganizationFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromOrganizationInspectTemplateName', () => { - const result = client.matchInspectTemplateFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationStoredInfoType', () => { - const fakePath = "/rendered/path/organizationStoredInfoType"; - const expectedParameters = { - organization: "organizationValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationStoredInfoTypePath', () => { - const result = client.organizationStoredInfoTypePath("organizationValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationStoredInfoTypeName', () => { - const result = client.matchOrganizationFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromOrganizationStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectDeidentifyTemplate', () => { - const fakePath = "/rendered/path/projectDeidentifyTemplate"; - const expectedParameters = { - project: "projectValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectDeidentifyTemplatePath', () => { - const result = client.projectDeidentifyTemplatePath("projectValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectDeidentifyTemplateName', () => { - const result = client.matchProjectFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromProjectDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectInspectTemplate', () => { - const fakePath = "/rendered/path/projectInspectTemplate"; - const expectedParameters = { - project: "projectValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectInspectTemplatePath', () => { - const result = client.projectInspectTemplatePath("projectValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectInspectTemplateName', () => { - const result = client.matchProjectFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromProjectInspectTemplateName', () => { - const result = client.matchInspectTemplateFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectStoredInfoType', () => { - const fakePath = "/rendered/path/projectStoredInfoType"; - const expectedParameters = { - project: "projectValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectStoredInfoTypePath', () => { - const result = client.projectStoredInfoTypePath("projectValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectStoredInfoTypeName', () => { - const result = client.matchProjectFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromProjectStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json b/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json deleted file mode 100644 index 7f1c4d87c4af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "dlp", - "version": "0.1.0", - "description": "Dlp client for Node.js", - "repository": "googleapis/nodejs-dlp", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google dlp", - "dlp", - "dlp service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/dlp.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/dlp.proto.baseline deleted file mode 100644 index f94df6e67529..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/dlp.proto.baseline +++ /dev/null @@ -1,3775 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.privacy.dlp.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/privacy/dlp/v2/storage.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; -option java_multiple_files = true; -option java_outer_classname = "DlpProto"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; - -// 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/. -service DlpService { - option (google.api.default_host) = "dlp.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Finds potentially sensitive info in content. - // This method has limits on input size, processing time, and output size. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - // and https://cloud.google.com/dlp/docs/inspecting-text, - rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:inspect" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:inspect" - body: "*" - } - }; - } - - // Redacts potentially sensitive info from an image. - // This method has limits on input size, processing time, and output size. - // See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc RedactImage(RedactImageRequest) returns (RedactImageResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/image:redact" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/image:redact" - body: "*" - } - }; - } - - // De-identifies potentially sensitive info from a ContentItem. - // This method has limits on input size and output size. - // See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:deidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:deidentify" - body: "*" - } - }; - } - - // Re-identifies content that has been de-identified. - // See - // https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - // to learn more. - rpc ReidentifyContent(ReidentifyContentRequest) returns (ReidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:reidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:reidentify" - body: "*" - } - }; - } - - // Returns a list of the sensitive information types that the DLP API - // supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - // learn more. - rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/infoTypes" - additional_bindings { - get: "/v2/locations/{location_id}/infoTypes" - } - }; - option (google.api.method_signature) = "location_id"; - } - - // Creates an InspectTemplate for re-using frequently used configuration - // for inspecting content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc CreateInspectTemplate(CreateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/inspectTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/inspectTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_template"; - option (google.api.method_signature) = "parent,inspect_template,location_id"; - } - - // Updates the InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc UpdateInspectTemplate(UpdateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/inspectTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,inspect_template,update_mask"; - } - - // Gets an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc GetInspectTemplate(GetInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists InspectTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc ListInspectTemplates(ListInspectTemplatesRequest) returns (ListInspectTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/inspectTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/inspectTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc DeleteInspectTemplate(DeleteInspectTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a DeidentifyTemplate for re-using frequently used configuration - // for de-identifying content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/deidentifyTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/deidentifyTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,deidentify_template"; - option (google.api.method_signature) = "parent,deidentify_template,location_id"; - } - - // Updates the DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc UpdateDeidentifyTemplate(UpdateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/deidentifyTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,deidentify_template,update_mask"; - } - - // Gets a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc GetDeidentifyTemplate(GetDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists DeidentifyTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc ListDeidentifyTemplates(ListDeidentifyTemplatesRequest) returns (ListDeidentifyTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/deidentifyTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/deidentifyTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc DeleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job trigger to run DLP actions such as scanning storage for - // sensitive information on a set schedule. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc CreateJobTrigger(CreateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/jobTriggers" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/jobTriggers" - body: "*" - } - }; - option (google.api.method_signature) = "parent,job_trigger"; - option (google.api.method_signature) = "parent,job_trigger,location_id"; - } - - // Updates a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc UpdateJobTrigger(UpdateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - patch: "/v2/{name=projects/*/jobTriggers/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,job_trigger,update_mask"; - } - - // Gets a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc GetJobTrigger(GetJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - get: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists job triggers. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc ListJobTriggers(ListJobTriggersRequest) returns (ListJobTriggersResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/jobTriggers" - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/jobTriggers" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc DeleteJobTrigger(DeleteJobTriggerRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Activate a job trigger. Causes the immediate execute of a trigger - // instead of waiting on the trigger event to occur. - rpc ActivateJobTrigger(ActivateJobTriggerRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{name=projects/*/jobTriggers/*}:activate" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:activate" - body: "*" - } - }; - } - - // Creates a new job to inspect storage or calculate risk metrics. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc CreateDlpJob(CreateDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/dlpJobs" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/dlpJobs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_job"; - option (google.api.method_signature) = "parent,inspect_job,location_id"; - option (google.api.method_signature) = "parent,risk_job"; - option (google.api.method_signature) = "parent,risk_job,location_id"; - } - - // Lists DlpJobs that match the specified filter in the request. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc ListDlpJobs(ListDlpJobsRequest) returns (ListDlpJobsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/dlpJobs" - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/dlpJobs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the latest state of a long-running DlpJob. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc GetDlpJob(GetDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - get: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a long-running DlpJob. This method indicates that the client is - // no longer interested in the DlpJob result. The job will be cancelled if - // possible. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc DeleteDlpJob(DeleteDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Starts asynchronous cancellation on a long-running DlpJob. The server - // makes a best effort to cancel the DlpJob, but success is not - // guaranteed. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc CancelDlpJob(CancelDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=projects/*/dlpJobs/*}:cancel" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:cancel" - body: "*" - } - }; - } - - // Creates a pre-built stored infoType to be used for inspection. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc CreateStoredInfoType(CreateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/storedInfoTypes" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/storedInfoTypes" - body: "*" - } - }; - option (google.api.method_signature) = "parent,config"; - option (google.api.method_signature) = "parent,config,location_id"; - } - - // Updates the stored infoType by creating a new version. The existing version - // will continue to be used until the new version is ready. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc UpdateStoredInfoType(UpdateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/storedInfoTypes/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,config,update_mask"; - } - - // Gets a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc GetStoredInfoType(GetStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists stored infoTypes. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc ListStoredInfoTypes(ListStoredInfoTypesRequest) returns (ListStoredInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/storedInfoTypes" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/storedInfoTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc DeleteStoredInfoType(DeleteStoredInfoTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// List of exclude infoTypes. -message ExcludeInfoTypes { - // InfoType list in ExclusionRule rule drops a finding when it overlaps or - // contained within with a finding of an infoType from this list. For - // example, for `InspectionRuleSet.info_types` containing "PHONE_NUMBER"` and - // `exclusion_rule` containing `exclude_info_types.info_types` with - // "EMAIL_ADDRESS" the phone number findings are dropped if they overlap - // with EMAIL_ADDRESS finding. - // That leads to "555-222-2222@example.org" to generate only a single - // finding, namely email address. - repeated InfoType info_types = 1; -} - -// The rule that specifies conditions when findings of infoTypes specified in -// `InspectionRuleSet` are removed from results. -message ExclusionRule { - // Exclusion rule types. - oneof type { - // Dictionary which defines the rule. - CustomInfoType.Dictionary dictionary = 1; - - // Regular expression which defines the rule. - CustomInfoType.Regex regex = 2; - - // Set of infoTypes for which findings would affect this rule. - ExcludeInfoTypes exclude_info_types = 3; - } - - // How the rule is applied, see MatchingType documentation for details. - MatchingType matching_type = 4; -} - -// A single inspection rule to be applied to infoTypes, specified in -// `InspectionRuleSet`. -message InspectionRule { - // Inspection rule types. - oneof type { - // Hotword-based detection rule. - CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1; - - // Exclusion rule. - ExclusionRule exclusion_rule = 2; - } -} - -// Rule set for modifying a set of infoTypes to alter behavior under certain -// circumstances, depending on the specific details of the rules within the set. -message InspectionRuleSet { - // List of infoTypes this rule set is applied to. - repeated InfoType info_types = 1; - - // Set of rules to be applied to infoTypes. The rules are applied in order. - repeated InspectionRule rules = 2; -} - -// Configuration description of the scanning process. -// When used with redactContent only info_types and min_likelihood are currently -// used. -message InspectConfig { - // Configuration to control the number of findings returned. - message FindingLimits { - // Max findings configuration per infoType, per content item or long - // running DlpJob. - message InfoTypeLimit { - // Type of information the findings limit applies to. Only one limit per - // info_type should be provided. If InfoTypeLimit does not have an - // info_type, the DLP API applies the limit against all info_types that - // are found but not specified in another InfoTypeLimit. - InfoType info_type = 1; - - // Max findings limit for the given infoType. - int32 max_findings = 2; - } - - // Max number of findings that will be returned for each item scanned. - // When set within `InspectDataSourceRequest`, - // the maximum returned is 2000 regardless if this is set higher. - // When set within `InspectContentRequest`, this field is ignored. - int32 max_findings_per_item = 1; - - // Max number of findings that will be returned per request/job. - // When set within `InspectContentRequest`, the maximum returned is 2000 - // regardless if this is set higher. - int32 max_findings_per_request = 2; - - // Configuration of findings limit given for specified infoTypes. - repeated InfoTypeLimit max_findings_per_info_type = 3; - } - - // Restricts what info_types to look for. The values must correspond to - // InfoType values returned by ListInfoTypes or listed at - // https://cloud.google.com/dlp/docs/infotypes-reference. - // - // When no InfoTypes or CustomInfoTypes are specified in a request, the - // system may automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // If you need precise control and predictability as to what detectors are - // run you should specify specific InfoTypes listed in the reference, - // otherwise a default list will be used, which may change over time. - repeated InfoType info_types = 1; - - // Only returns findings equal or above this threshold. The default is - // POSSIBLE. - // See https://cloud.google.com/dlp/docs/likelihood to learn more. - Likelihood min_likelihood = 2; - - // Configuration to control the number of findings returned. - FindingLimits limits = 3; - - // When true, a contextual quote from the data that triggered a finding is - // included in the response; see Finding.quote. - bool include_quote = 4; - - // When true, excludes type information of the findings. - bool exclude_info_types = 5; - - // CustomInfoTypes provided by the user. See - // https://cloud.google.com/dlp/docs/creating-custom-infotypes to learn more. - repeated CustomInfoType custom_info_types = 6; - - // List of options defining data content to scan. - // If empty, text, images, and other content will be included. - repeated ContentOption content_options = 8; - - // Set of rules to apply to the findings for this InspectConfig. - // Exclusion rules, contained in the set are executed in the end, other - // rules are executed in the order they are specified for each info type. - repeated InspectionRuleSet rule_set = 10; -} - -// Container for bytes to inspect or redact. -message ByteContentItem { - // The type of data being sent to in data. - enum BytesType { - // Unused - BYTES_TYPE_UNSPECIFIED = 0; - - // Any image type. - IMAGE = 6; - - // jpeg - IMAGE_JPEG = 1; - - // bmp - IMAGE_BMP = 2; - - // png - IMAGE_PNG = 3; - - // svg - IMAGE_SVG = 4; - - // plain text - TEXT_UTF8 = 5; - - // avro - AVRO = 11; - } - - // The type of data stored in the bytes string. Default will be TEXT_UTF8. - BytesType type = 1; - - // Content data to inspect or redact. - bytes data = 2; -} - -// Container structure for the content to inspect. -message ContentItem { - // Data of the item either in the byte array or UTF-8 string form, or table. - oneof data_item { - // String data to inspect or redact. - string value = 3; - - // Structured content for inspection. See - // https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to - // learn more. - Table table = 4; - - // Content data to inspect or redact. Replaces `type` and `data`. - ByteContentItem byte_item = 5; - } -} - -// Structured content to inspect. Up to 50,000 `Value`s per request allowed. -// See https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to -// learn more. -message Table { - // Values of the row. - message Row { - // Individual cells. - repeated Value values = 1; - } - - // Headers of the table. - repeated FieldId headers = 1; - - // Rows of the table. - repeated Row rows = 2; -} - -// All the findings for a single scanned item. -message InspectResult { - // List of findings for an item. - repeated Finding findings = 1; - - // If true, then this item might have more findings than were returned, - // and the findings returned are an arbitrary subset of all findings. - // The findings list might be truncated because the input items were too - // large, or because the server reached the maximum amount of resources - // allowed for a single API call. For best results, divide the input into - // smaller batches. - bool findings_truncated = 2; -} - -// Represents a piece of potentially sensitive content. -message Finding { - // The content that was found. Even if the content is not textual, it - // may be converted to a textual representation here. - // Provided if `include_quote` is true and the finding is - // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes - // in length, the quote may be omitted. - string quote = 1; - - // The type of content that might have been found. - // Provided if `excluded_types` is false. - InfoType info_type = 2; - - // Confidence of how likely it is that the `info_type` is correct. - Likelihood likelihood = 3; - - // Where the content was found. - Location location = 4; - - // Timestamp when finding was detected. - google.protobuf.Timestamp create_time = 6; - - // Contains data parsed from quotes. Only populated if include_quote was set - // to true and a supported infoType was requested. Currently supported - // infoTypes: DATE, DATE_OF_BIRTH and TIME. - QuoteInfo quote_info = 7; -} - -// Specifies the location of the finding. -message Location { - // Zero-based byte offsets delimiting the finding. - // These are relative to the finding's containing element. - // Note that when the content is not textual, this references - // the UTF-8 encoded textual representation of the content. - // Omitted if content is an image. - Range byte_range = 1; - - // Unicode character offsets delimiting the finding. - // These are relative to the finding's containing element. - // Provided when the content is text. - Range codepoint_range = 2; - - // List of nested objects pointing to the precise location of the finding - // within the file or record. - repeated ContentLocation content_locations = 7; -} - -// Findings container location data. -message ContentLocation { - // Name of the container where the finding is located. - // The top level name is the source file name or table name. Names of some - // common storage containers are formatted as follows: - // - // * BigQuery tables: `{project_id}:{dataset_id}.{table_id}` - // * Cloud Storage files: `gs://{bucket}/{path}` - // * Datastore namespace: {namespace} - // - // Nested names could be absent if the embedded object has no string - // identifier (for an example an image contained within a document). - string container_name = 1; - - // Type of the container within the file with location of the finding. - oneof location { - // Location within a row or record of a database table. - RecordLocation record_location = 2; - - // Location within an image's pixels. - ImageLocation image_location = 3; - - // Location data for document files. - DocumentLocation document_location = 5; - } - - // Findings container modification timestamp, if applicable. - // For Google Cloud Storage contains last file modification timestamp. - // For BigQuery table contains last_modified_time property. - // For Datastore - not populated. - google.protobuf.Timestamp container_timestamp = 6; - - // Findings container version, if available - // ("generation" for Google Cloud Storage). - string container_version = 7; -} - -// Location of a finding within a document. -message DocumentLocation { - // Offset of the line, from the beginning of the file, where the finding - // is located. - int64 file_offset = 1; -} - -// Location of a finding within a row or record. -message RecordLocation { - // Key of the finding. - RecordKey record_key = 1; - - // Field id of the field containing the finding. - FieldId field_id = 2; - - // Location within a `ContentItem.Table`. - TableLocation table_location = 3; -} - -// Location of a finding within a table. -message TableLocation { - // The zero-based index of the row where the finding is located. - int64 row_index = 1; -} - -// Generic half-open interval [start, end) -message Range { - // Index of the first character of the range (inclusive). - int64 start = 1; - - // Index of the last character of the range (exclusive). - int64 end = 2; -} - -// Location of the finding within an image. -message ImageLocation { - // Bounding boxes locating the pixels within the image containing the finding. - repeated BoundingBox bounding_boxes = 1; -} - -// Bounding box encompassing detected text within an image. -message BoundingBox { - // Top coordinate of the bounding box. (0,0) is upper left. - int32 top = 1; - - // Left coordinate of the bounding box. (0,0) is upper left. - int32 left = 2; - - // Width of the bounding box in pixels. - int32 width = 3; - - // Height of the bounding box in pixels. - int32 height = 4; -} - -// Request to search for potentially sensitive info in an image and redact it -// by covering it with a colored rectangle. -message RedactImageRequest { - // Configuration for determining how redaction of images should occur. - message ImageRedactionConfig { - // Type of information to redact from images. - oneof target { - // Only one per info_type should be provided per request. If not - // specified, and redact_all_text is false, the DLP API will redact all - // text that it matches against all info_types that are found, but not - // specified in another ImageRedactionConfig. - InfoType info_type = 1; - - // If true, all text found in the image, regardless whether it matches an - // info_type, is redacted. Only one should be provided. - bool redact_all_text = 2; - } - - // The color to use when redacting content from an image. If not specified, - // the default is black. - Color redaction_color = 3; - } - - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // The geographic location to process the request. Reserved for future - // extensions. - string location_id = 8; - - // Configuration for the inspector. - InspectConfig inspect_config = 2; - - // The configuration for specifying what content to redact from images. - repeated ImageRedactionConfig image_redaction_configs = 5; - - // Whether the response should include findings along with the redacted - // image. - bool include_findings = 6; - - // The content must be PNG, JPEG, SVG or BMP. - ByteContentItem byte_item = 7; -} - -// Represents a color in the RGB color space. -message Color { - // The amount of red in the color as a value in the interval [0, 1]. - float red = 1; - - // The amount of green in the color as a value in the interval [0, 1]. - float green = 2; - - // The amount of blue in the color as a value in the interval [0, 1]. - float blue = 3; -} - -// Results of redacting an image. -message RedactImageResponse { - // The redacted image. The type will be the same as the original image. - bytes redacted_image = 1; - - // If an image was being inspected and the InspectConfig's include_quote was - // set to true, then this field will include all text, if any, that was found - // in the image. - string extracted_text = 2; - - // The findings. Populated when include_findings in the request is true. - InspectResult inspect_result = 3; -} - -// Request to de-identify a list of items. -message DeidentifyContentRequest { - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // Configuration for the de-identification of the content item. - // Items specified here will override the template referenced by the - // deidentify_template_name argument. - DeidentifyConfig deidentify_config = 2; - - // Configuration for the inspector. - // Items specified here will override the template referenced by the - // inspect_template_name argument. - InspectConfig inspect_config = 3; - - // The item to de-identify. Will be treated as text. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. Any configuration directly specified in - // deidentify_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string deidentify_template_name = 6; - - // The geographic location to process de-identification. Reserved for future - // extensions. - string location_id = 7; -} - -// Results of de-identifying a ContentItem. -message DeidentifyContentResponse { - // The de-identified item. - ContentItem item = 1; - - // An overview of the changes that were made on the `item`. - TransformationOverview overview = 2; -} - -// Request to re-identify an item. -message ReidentifyContentRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Configuration for the re-identification of the content item. - // This field shares the same proto message type that is used for - // de-identification, however its usage here is for the reversal of the - // previous de-identification. Re-identification is performed by examining - // the transformations used to de-identify the items and executing the - // reverse. This requires that only reversible transformations - // be provided here. The reversible transformations are: - // - // - `CryptoDeterministicConfig` - // - `CryptoReplaceFfxFpeConfig` - DeidentifyConfig reidentify_config = 2; - - // Configuration for the inspector. - InspectConfig inspect_config = 3; - - // The item to re-identify. Will be treated as text. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // `inspect_config` will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. References an instance of `DeidentifyTemplate`. - // Any configuration directly specified in `reidentify_config` or - // `inspect_config` will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string reidentify_template_name = 6; - - // The geographic location to process content reidentification. Reserved for - // future extensions. - string location_id = 7; -} - -// Results of re-identifying a item. -message ReidentifyContentResponse { - // The re-identified item. - ContentItem item = 1; - - // An overview of the changes that were made to the `item`. - TransformationOverview overview = 2; -} - -// Request to search for potentially sensitive info in a ContentItem. -message InspectContentRequest { - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // Configuration for the inspector. What specified here will override - // the template referenced by the inspect_template_name argument. - InspectConfig inspect_config = 2; - - // The item to inspect. - ContentItem item = 3; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 4; - - // The geographic location to process content inspection. Reserved for future - // extensions. - string location_id = 5; -} - -// Results of inspecting an item. -message InspectContentResponse { - // The findings. - InspectResult result = 1; -} - -// Cloud repository for storing output. -message OutputStorageConfig { - // Predefined schemas for storing findings. - enum OutputSchema { - // Unused. - OUTPUT_SCHEMA_UNSPECIFIED = 0; - - // Basic schema including only `info_type`, `quote`, `certainty`, and - // `timestamp`. - BASIC_COLUMNS = 1; - - // Schema tailored to findings from scanning Google Cloud Storage. - GCS_COLUMNS = 2; - - // Schema tailored to findings from scanning Google Datastore. - DATASTORE_COLUMNS = 3; - - // Schema tailored to findings from scanning Google BigQuery. - BIG_QUERY_COLUMNS = 4; - - // Schema containing all columns. - ALL_COLUMNS = 5; - } - - // Output storage types. - oneof type { - // Store findings in an existing table or a new table in an existing - // dataset. If table_id is not set a new one will be generated - // for you with the following format: - // dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific timezone will be used for - // generating the date details. - // - // For Inspect, each column in an existing output table must have the same - // name, type, and mode of a field in the `Finding` object. - // - // For Risk, an existing output table should be the output of a previous - // Risk analysis job run on the same source table, with the same privacy - // metric and quasi-identifiers. Risk jobs that analyze the same table but - // compute a different privacy metric, or use different sets of - // quasi-identifiers, cannot store their results in the same table. - BigQueryTable table = 1; - } - - // Schema used for writing the findings for Inspect jobs. This field is only - // used for Inspect and must be unspecified for Risk jobs. Columns are derived - // from the `Finding` object. If appending to an existing table, any columns - // from the predefined schema that are missing will be added. No columns in - // the existing table will be deleted. - // - // If unspecified, then all available columns will be used for a new table or - // an (existing) table with no schema, and no changes will be made to an - // existing table that has a schema. - OutputSchema output_schema = 3; -} - -// Statistics regarding a specific InfoType. -message InfoTypeStats { - // The type of finding this stat is for. - InfoType info_type = 1; - - // Number of findings for this infoType. - int64 count = 2; -} - -// The results of an inspect DataSource job. -message InspectDataSourceDetails { - // Snapshot of the inspection configuration. - message RequestedOptions { - // If run with an InspectTemplate, a snapshot of its state at the time of - // this run. - InspectTemplate snapshot_inspect_template = 1; - - // Inspect config. - InspectJobConfig job_config = 3; - } - - // All result fields mentioned below are updated while the job is processing. - message Result { - // Total size in bytes that were processed. - int64 processed_bytes = 1; - - // Estimate of the number of bytes to process. - int64 total_estimated_bytes = 2; - - // Statistics of how many instances of each info type were found during - // inspect job. - repeated InfoTypeStats info_type_stats = 3; - } - - // The configuration used for this job. - RequestedOptions requested_options = 2; - - // A summary of the outcome of this inspect job. - Result result = 3; -} - -// InfoType description. -message InfoTypeDescription { - // Internal name of the infoType. - string name = 1; - - // Human readable form of the infoType name. - string display_name = 2; - - // Which parts of the API supports this InfoType. - repeated InfoTypeSupportedBy supported_by = 3; - - // Description of the infotype. Translated when language is provided in the - // request. - string description = 4; -} - -// Request for the list of infoTypes. -message ListInfoTypesRequest { - // BCP-47 language code for localized infoType friendly - // names. If omitted, or if localized strings are not available, - // en-US strings will be returned. - string language_code = 1; - - // filter to only return infoTypes supported by certain parts of the - // API. Defaults to supported_by=INSPECT. - string filter = 2; - - // The geographic location to list info types. Reserved for future - // extensions. - string location_id = 3; -} - -// Response to the ListInfoTypes request. -message ListInfoTypesResponse { - // Set of sensitive infoTypes. - repeated InfoTypeDescription info_types = 1; -} - -// Configuration for a risk analysis job. See -// https://cloud.google.com/dlp/docs/concepts-risk-analysis to learn more. -message RiskAnalysisJobConfig { - // Privacy metric to compute. - PrivacyMetric privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable source_table = 2; - - // Actions to execute at the completion of the job. Are executed in the order - // provided. - repeated Action actions = 3; -} - -// A column with a semantic tag attached. -message QuasiId { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } -} - -// An auxiliary table containing statistical information on the relative -// frequency of different quasi-identifiers values. It has one or several -// quasi-identifiers columns, and one column that indicates the relative -// frequency of each quasi-identifier tuple. -// If a tuple is present in the data but not in the auxiliary table, the -// corresponding relative frequency is assumed to be zero (and thus, the -// tuple is highly reidentifiable). -message StatisticalTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdentifierField { - // Identifies the column. - FieldId field = 1; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdentifierField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Privacy metric to compute for reidentification risk analysis. -message PrivacyMetric { - // Compute numerical stats over an individual column, including - // min, max, and quantiles. - message NumericalStatsConfig { - // Field to compute numerical stats on. Supported types are - // integer, float, date, datetime, timestamp, time. - FieldId field = 1; - } - - // Compute numerical stats over an individual column, including - // number of distinct values and value count distribution. - message CategoricalStatsConfig { - // Field to compute categorical stats on. All column types are - // supported except for arrays and structs. However, it may be more - // informative to use NumericalStats when the field type is supported, - // depending on the data. - FieldId field = 1; - } - - // k-anonymity metric, used for analysis of reidentification risk. - message KAnonymityConfig { - // Set of fields to compute k-anonymity over. When multiple fields are - // specified, they are considered a single composite key. Structs and - // repeated data types are not supported; however, nested fields are - // supported so long as they are not structs themselves or nested within - // a repeated field. - repeated FieldId quasi_ids = 1; - - // Message indicating that multiple rows might be associated to a - // single individual. If the same entity_id is associated to multiple - // quasi-identifier tuples over distinct rows, we consider the entire - // collection of tuples as the composite quasi-identifier. This collection - // is a multiset: the order in which the different tuples appear in the - // dataset is ignored, but their frequency is taken into account. - // - // Important note: a maximum of 1000 rows can be associated to a single - // entity ID. If more rows are associated with the same entity ID, some - // might be ignored. - EntityId entity_id = 2; - } - - // l-diversity metric, used for analysis of reidentification risk. - message LDiversityConfig { - // Set of quasi-identifiers indicating how equivalence classes are - // defined for the l-diversity computation. When multiple fields are - // specified, they are considered a single composite key. - repeated FieldId quasi_ids = 1; - - // Sensitive field for computing the l-value. - FieldId sensitive_attribute = 2; - } - - // Reidentifiability metric. This corresponds to a risk model similar to what - // is called "journalist risk" in the literature, except the attack dataset is - // statistically modeled instead of being perfectly known. This can be done - // using publicly available data (like the US Census), or using a custom - // statistical model (indicated as one or several BigQuery tables), or by - // extrapolating from the distribution of values in the input dataset. - message KMapEstimationConfig { - // A column with a semantic tag attached. - message TaggedField { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } - } - - // An auxiliary table contains statistical information on the relative - // frequency of different quasi-identifiers values. It has one or several - // quasi-identifiers columns, and one column that indicates the relative - // frequency of each quasi-identifier tuple. - // If a tuple is present in the data but not in the auxiliary table, the - // corresponding relative frequency is assumed to be zero (and thus, the - // tuple is highly reidentifiable). - message AuxiliaryTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdField { - // Identifies the column. - FieldId field = 1; - - // A auxiliary field. - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Fields considered to be quasi-identifiers. No two columns can have the - // same tag. - repeated TaggedField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers column must appear in exactly one column - // of one auxiliary table. - repeated AuxiliaryTable auxiliary_tables = 3; - } - - // δ-presence metric, used to estimate how likely it is for an attacker to - // figure out that one given individual appears in a de-identified dataset. - // Similarly to the k-map metric, we cannot compute δ-presence exactly without - // knowing the attack dataset, so we use a statistical model instead. - message DeltaPresenceEstimationConfig { - // Required. Fields considered to be quasi-identifiers. No two fields can have the - // same tag. - repeated QuasiId quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers field must appear in exactly one - // field of one auxiliary table. - repeated StatisticalTable auxiliary_tables = 3; - } - - // Types of analysis. - oneof type { - // Numerical stats - NumericalStatsConfig numerical_stats_config = 1; - - // Categorical stats - CategoricalStatsConfig categorical_stats_config = 2; - - // K-anonymity - KAnonymityConfig k_anonymity_config = 3; - - // l-diversity - LDiversityConfig l_diversity_config = 4; - - // k-map - KMapEstimationConfig k_map_estimation_config = 5; - - // delta-presence - DeltaPresenceEstimationConfig delta_presence_estimation_config = 6; - } -} - -// Result of a risk analysis operation request. -message AnalyzeDataSourceRiskDetails { - // Result of the numerical stats computation. - message NumericalStatsResult { - // Minimum value appearing in the column. - Value min_value = 1; - - // Maximum value appearing in the column. - Value max_value = 2; - - // List of 99 values that partition the set of field values into 100 equal - // sized buckets. - repeated Value quantile_values = 4; - } - - // Result of the categorical stats computation. - message CategoricalStatsResult { - // Histogram of value frequencies in the column. - message CategoricalStatsHistogramBucket { - // Lower bound on the value frequency of the values in this bucket. - int64 value_frequency_lower_bound = 1; - - // Upper bound on the value frequency of the values in this bucket. - int64 value_frequency_upper_bound = 2; - - // Total number of values in this bucket. - int64 bucket_size = 3; - - // Sample of value frequencies in this bucket. The total number of - // values returned per bucket is capped at 20. - repeated ValueFrequency bucket_values = 4; - - // Total number of distinct values in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of value frequencies in the column. - repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; - } - - // Result of the k-anonymity computation. - message KAnonymityResult { - // The set of columns' values that share the same ldiversity value - message KAnonymityEquivalenceClass { - // Set of values defining the equivalence class. One value per - // quasi-identifier column in the original KAnonymity metric message. - // The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the equivalence class, for example number of rows with the - // above set of values. - int64 equivalence_class_size = 2; - } - - // Histogram of k-anonymity equivalence classes. - message KAnonymityHistogramBucket { - // Lower bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_lower_bound = 1; - - // Upper bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated KAnonymityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of k-anonymity equivalence classes. - repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; - } - - // Result of the l-diversity computation. - message LDiversityResult { - // The set of columns' values that share the same ldiversity value. - message LDiversityEquivalenceClass { - // Quasi-identifier values defining the k-anonymity equivalence - // class. The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the k-anonymity equivalence class. - int64 equivalence_class_size = 2; - - // Number of distinct sensitive values in this equivalence class. - int64 num_distinct_sensitive_values = 3; - - // Estimated frequencies of top sensitive values. - repeated ValueFrequency top_sensitive_values = 4; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - message LDiversityHistogramBucket { - // Lower bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_lower_bound = 1; - - // Upper bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated LDiversityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; - } - - // Result of the reidentifiability analysis. Note that these results are an - // estimation, not exact values. - message KMapEstimationResult { - // A tuple of values for the quasi-identifier columns. - message KMapEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated anonymity for these quasi-identifier values. - int64 estimated_anonymity = 2; - } - - // A KMapEstimationHistogramBucket message with the following values: - // min_anonymity: 3 - // max_anonymity: 5 - // frequency: 42 - // means that there are 42 records whose quasi-identifier values correspond - // to 3, 4 or 5 people in the overlying population. An important particular - // case is when min_anonymity = max_anonymity = 1: the frequency field then - // corresponds to the number of uniquely identifiable records. - message KMapEstimationHistogramBucket { - // Always positive. - int64 min_anonymity = 1; - - // Always greater than or equal to min_anonymity. - int64 max_anonymity = 2; - - // Number of records within these anonymity bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated KMapEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_anonymity, max_anonymity] do not overlap. If a value - // doesn't correspond to any such interval, the associated frequency is - // zero. For example, the following records: - // {min_anonymity: 1, max_anonymity: 1, frequency: 17} - // {min_anonymity: 2, max_anonymity: 3, frequency: 42} - // {min_anonymity: 5, max_anonymity: 10, frequency: 99} - // mean that there are no record with an estimated anonymity of 4, 5, or - // larger than 10. - repeated KMapEstimationHistogramBucket k_map_estimation_histogram = 1; - } - - // Result of the δ-presence computation. Note that these results are an - // estimation, not exact values. - message DeltaPresenceEstimationResult { - // A tuple of values for the quasi-identifier columns. - message DeltaPresenceEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated probability that a given individual sharing these - // quasi-identifier values is in the dataset. This value, typically called - // δ, is the ratio between the number of records in the dataset with these - // quasi-identifier values, and the total number of individuals (inside - // *and* outside the dataset) with these quasi-identifier values. - // For example, if there are 15 individuals in the dataset who share the - // same quasi-identifier values, and an estimated 100 people in the entire - // population with these values, then δ is 0.15. - double estimated_probability = 2; - } - - // A DeltaPresenceEstimationHistogramBucket message with the following - // values: - // min_probability: 0.1 - // max_probability: 0.2 - // frequency: 42 - // means that there are 42 records for which δ is in [0.1, 0.2). An - // important particular case is when min_probability = max_probability = 1: - // then, every individual who shares this quasi-identifier combination is in - // the dataset. - message DeltaPresenceEstimationHistogramBucket { - // Between 0 and 1. - double min_probability = 1; - - // Always greater than or equal to min_probability. - double max_probability = 2; - - // Number of records within these probability bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated DeltaPresenceEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_probability, max_probability) do not overlap. If a - // value doesn't correspond to any such interval, the associated frequency - // is zero. For example, the following records: - // {min_probability: 0, max_probability: 0.1, frequency: 17} - // {min_probability: 0.2, max_probability: 0.3, frequency: 42} - // {min_probability: 0.3, max_probability: 0.4, frequency: 99} - // mean that there are no record with an estimated probability in [0.1, 0.2) - // nor larger or equal to 0.4. - repeated DeltaPresenceEstimationHistogramBucket delta_presence_estimation_histogram = 1; - } - - // Privacy metric to compute. - PrivacyMetric requested_privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable requested_source_table = 2; - - // Values associated with this metric. - oneof result { - // Numerical stats result - NumericalStatsResult numerical_stats_result = 3; - - // Categorical stats result - CategoricalStatsResult categorical_stats_result = 4; - - // K-anonymity result - KAnonymityResult k_anonymity_result = 5; - - // L-divesity result - LDiversityResult l_diversity_result = 6; - - // K-map result - KMapEstimationResult k_map_estimation_result = 7; - - // Delta-presence result - DeltaPresenceEstimationResult delta_presence_estimation_result = 9; - } -} - -// A value of a field, including its frequency. -message ValueFrequency { - // A value contained in the field in question. - Value value = 1; - - // How many times the value is contained in the field. - int64 count = 2; -} - -// Set of primitive values supported by the system. -// Note that for the purposes of inspection or transformation, the number -// of bytes considered to comprise a 'Value' is based on its representation -// as a UTF-8 encoded string. For example, if 'integer_value' is set to -// 123456789, the number of bytes would be counted as 9, even though an -// int64 only holds up to 8 bytes of data. -message Value { - // Value types - oneof type { - // integer - int64 integer_value = 1; - - // float - double float_value = 2; - - // string - string string_value = 3; - - // boolean - bool boolean_value = 4; - - // timestamp - google.protobuf.Timestamp timestamp_value = 5; - - // time of day - google.type.TimeOfDay time_value = 6; - - // date - google.type.Date date_value = 7; - - // day of week - google.type.DayOfWeek day_of_week_value = 8; - } -} - -// Message for infoType-dependent details parsed from quote. -message QuoteInfo { - // Object representation of the quote. - oneof parsed_quote { - // The date time indicated by the quote. - DateTime date_time = 2; - } -} - -// Message for a date time object. -// e.g. 2018-01-01, 5th August. -message DateTime { - // Time zone of the date time object. - message TimeZone { - // Set only if the offset can be determined. Positive for time ahead of UTC. - // E.g. For "UTC-9", this value is -540. - int32 offset_minutes = 1; - } - - // One or more of the following must be set. - // Must be a valid date or time value. - google.type.Date date = 1; - - // Day of week - google.type.DayOfWeek day_of_week = 2; - - // Time of day - google.type.TimeOfDay time = 3; - - // Time zone - TimeZone time_zone = 4; -} - -// The configuration that controls how the data will change. -message DeidentifyConfig { - oneof transformation { - // Treat the dataset as free-form text and apply the same free text - // transformation everywhere. - InfoTypeTransformations info_type_transformations = 1; - - // Treat the dataset as structured. Transformations can be applied to - // specific locations within structured datasets, such as transforming - // a column within a table. - RecordTransformations record_transformations = 2; - } -} - -// A rule for transforming a value. -message PrimitiveTransformation { - oneof transformation { - // Replace - ReplaceValueConfig replace_config = 1; - - // Redact - RedactConfig redact_config = 2; - - // Mask - CharacterMaskConfig character_mask_config = 3; - - // Ffx-Fpe - CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; - - // Fixed size bucketing - FixedSizeBucketingConfig fixed_size_bucketing_config = 5; - - // Bucketing - BucketingConfig bucketing_config = 6; - - // Replace with infotype - ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; - - // Time extraction - TimePartConfig time_part_config = 8; - - // Crypto - CryptoHashConfig crypto_hash_config = 9; - - // Date Shift - DateShiftConfig date_shift_config = 11; - - // Deterministic Crypto - CryptoDeterministicConfig crypto_deterministic_config = 12; - } -} - -// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a -// portion of the value. -message TimePartConfig { - // Components that make up time. - enum TimePart { - // Unused - TIME_PART_UNSPECIFIED = 0; - - // [0-9999] - YEAR = 1; - - // [1-12] - MONTH = 2; - - // [1-31] - DAY_OF_MONTH = 3; - - // [1-7] - DAY_OF_WEEK = 4; - - // [1-53] - WEEK_OF_YEAR = 5; - - // [0-23] - HOUR_OF_DAY = 6; - } - - // The part of the time to keep. - TimePart part_to_extract = 1; -} - -// Pseudonymization method that generates surrogates via cryptographic hashing. -// Uses SHA-256. -// The key size must be either 32 or 64 bytes. -// Outputs a base64 encoded representation of the hashed output -// (for example, L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=). -// Currently, only string and integer values can be hashed. -// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. -message CryptoHashConfig { - // The key used by the hash function. - CryptoKey crypto_key = 1; -} - -// Pseudonymization method that generates deterministic encryption for the given -// input. Outputs a base64 encoded representation of the encrypted output. -// Uses AES-SIV based on the RFC https://tools.ietf.org/html/rfc5297. -message CryptoDeterministicConfig { - // The key used by the encryption function. - CryptoKey crypto_key = 1; - - // The custom info type to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom info type followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: {info type name}({surrogate character count}):{surrogate} - // - // For example, if the name of custom info type is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom info type 'Surrogate'. This facilitates reversal of the - // surrogate when it occurs in free text. - // - // Note: For record transformations where the entire cell in a table is being - // transformed, surrogates are not mandatory. Surrogates are used to denote - // the location of the token and are necessary for re-identification in free - // form text. - // - // In order for inspection to work properly, the name of this info type must - // not occur naturally anywhere in your data; otherwise, inspection may either - // - // - reverse a surrogate that does not correspond to an actual identifier - // - be unable to parse the surrogate and result in an error - // - // Therefore, choose your custom info type name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE. - InfoType surrogate_info_type = 2; - - // A context may be used for higher security and maintaining - // referential integrity such that the same identifier in two different - // contexts will be given a distinct surrogate. The context is appended to - // plaintext value being encrypted. On decryption the provided context is - // validated against the value used during encryption. If a context was - // provided during encryption, same context must be provided during decryption - // as well. - // - // If the context is not set, plaintext would be used as is for encryption. - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 2. the field is not present when transforming a given value, - // - // plaintext would be used as is for encryption. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and non-structured `ContentItem`s. - FieldId context = 3; -} - -// Replace each input value with a given `Value`. -message ReplaceValueConfig { - // Value to replace it with. - Value new_value = 1; -} - -// Replace each matching finding with the name of the info_type. -message ReplaceWithInfoTypeConfig { - -} - -// Redact a given value. For example, if used with an `InfoTypeTransformation` -// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the -// output would be 'My phone number is '. -message RedactConfig { - -} - -// Characters to skip when doing deidentification of a value. These will be left -// alone and skipped. -message CharsToIgnore { - // Convenience enum for indication common characters to not transform. - enum CommonCharsToIgnore { - // Unused. - COMMON_CHARS_TO_IGNORE_UNSPECIFIED = 0; - - // 0-9 - NUMERIC = 1; - - // A-Z - ALPHA_UPPER_CASE = 2; - - // a-z - ALPHA_LOWER_CASE = 3; - - // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ - PUNCTUATION = 4; - - // Whitespace character, one of [ \t\n\x0B\f\r] - WHITESPACE = 5; - } - - oneof characters { - // Characters to not transform when masking. - string characters_to_skip = 1; - - // Common characters to not transform when masking. Useful to avoid removing - // punctuation. - CommonCharsToIgnore common_characters_to_ignore = 2; - } -} - -// Partially mask a string by replacing a given number of characters with a -// fixed character. Masking can start from the beginning or end of the string. -// This can be used on data of any type (numbers, longs, and so on) and when -// de-identifying structured data we'll attempt to preserve the original data's -// type. (This allows you to take a long like 123 and modify it to a string like -// **3. -message CharacterMaskConfig { - // Character to use to mask the sensitive values—for example, `*` for an - // alphabetic string such as a name, or `0` for a numeric string such as ZIP - // code or credit card number. This string must have a length of 1. If not - // supplied, this value defaults to `*` for strings, and `0` for digits. - string masking_character = 1; - - // Number of characters to mask. If not set, all matching chars will be - // masked. Skipped characters do not count towards this tally. - int32 number_to_mask = 2; - - // Mask characters in reverse order. For example, if `masking_character` is - // `0`, `number_to_mask` is `14`, and `reverse_order` is `false`, then the - // input string `1234-5678-9012-3456` is masked as `00000000000000-3456`. - // If `masking_character` is `*`, `number_to_mask` is `3`, and `reverse_order` - // is `true`, then the string `12345` is masked as `12***`. - bool reverse_order = 3; - - // When masking a string, items in this list will be skipped when replacing - // characters. For example, if the input string is `555-555-5555` and you - // instruct Cloud DLP to skip `-` and mask 5 characters with `*`, Cloud DLP - // returns `***-**5-5555`. - repeated CharsToIgnore characters_to_ignore = 4; -} - -// Buckets values based on fixed size ranges. The -// Bucketing transformation can provide all of this functionality, -// but requires more configuration. This message is provided as a convenience to -// the user for simple bucketing strategies. -// -// The transformed value will be a hyphenated string of -// {lower_bound}-{upper_bound}, i.e if lower_bound = 10 and upper_bound = 20 -// all values that are within this bucket will be replaced with "10-20". -// -// This can be used on data of type: double, long. -// -// If the bound Value type differs from the type of data -// being transformed, we will first attempt converting the type of the data to -// be transformed to match the type of the bound before comparing. -// -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message FixedSizeBucketingConfig { - // Required. Lower bound value of buckets. All values less than `lower_bound` are - // grouped together into a single bucket; for example if `lower_bound` = 10, - // then all values less than 10 are replaced with the value “-10”. - Value lower_bound = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Upper bound value of buckets. All values greater than upper_bound are - // grouped together into a single bucket; for example if `upper_bound` = 89, - // then all values greater than 89 are replaced with the value “89+”. - Value upper_bound = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Size of each bucket (except for minimum and maximum buckets). So if - // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the - // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, - // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. - double bucket_size = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Generalization function that buckets values based on ranges. The ranges and -// replacement values are dynamically provided by the user for custom behavior, -// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH -// This can be used on -// data of type: number, long, string, timestamp. -// If the bound `Value` type differs from the type of data being transformed, we -// will first attempt converting the type of the data to be transformed to match -// the type of the bound before comparing. -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message BucketingConfig { - // Bucket is represented as a range, along with replacement values. - message Bucket { - // Lower bound of the range, inclusive. Type should be the same as max if - // used. - Value min = 1; - - // Upper bound of the range, exclusive; type must match min. - Value max = 2; - - // Replacement value for this bucket. If not provided - // the default behavior will be to hyphenate the min-max range. - Value replacement_value = 3; - } - - // Set of buckets. Ranges must be non-overlapping. - repeated Bucket buckets = 1; -} - -// Replaces an identifier with a surrogate using Format Preserving Encryption -// (FPE) with the FFX mode of operation; however when used in the -// `ReidentifyContent` API method, it serves the opposite function by reversing -// the surrogate back into the original identifier. The identifier must be -// encoded as ASCII. For a given crypto key and context, the same identifier -// will be replaced with the same surrogate. Identifiers must be at least two -// characters long. In the case that the identifier is the empty string, it will -// be skipped. See https://cloud.google.com/dlp/docs/pseudonymization to learn -// more. -// -// Note: We recommend using CryptoDeterministicConfig for all use cases which -// do not require preserving the input alphabet space and size, plus warrant -// referential integrity. -message CryptoReplaceFfxFpeConfig { - // These are commonly used subsets of the alphabet that the FFX mode - // natively supports. In the algorithm, the alphabet is selected using - // the "radix". Therefore each corresponds to particular radix. - enum FfxCommonNativeAlphabet { - // Unused. - FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; - - // [0-9] (radix of 10) - NUMERIC = 1; - - // [0-9A-F] (radix of 16) - HEXADECIMAL = 2; - - // [0-9A-Z] (radix of 36) - UPPER_CASE_ALPHA_NUMERIC = 3; - - // [0-9A-Za-z] (radix of 62) - ALPHA_NUMERIC = 4; - } - - // Required. The key used by the encryption algorithm. - CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // The 'tweak', a context may be used for higher security since the same - // identifier in two different contexts won't be given the same surrogate. If - // the context is not set, a default tweak will be used. - // - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 1. the field is not present when transforming a given value, - // - // a default tweak will be used. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and non-structured `ContentItem`s. - // Currently, the referenced field may be of value type integer or string. - // - // The tweak is constructed as a sequence of bytes in big endian byte order - // such that: - // - // - a 64 bit integer is encoded followed by a single byte of value 1 - // - a string is encoded in UTF-8 format followed by a single byte of value 2 - FieldId context = 2; - - // Choose an alphabet which the data being transformed will be made up of. - oneof alphabet { - // Common alphabets. - FfxCommonNativeAlphabet common_alphabet = 4; - - // This is supported by mapping these to the alphanumeric characters - // that the FFX mode natively supports. This happens before/after - // encryption/decryption. - // Each character listed must appear only once. - // Number of characters must be in the range [2, 95]. - // This must be encoded as ASCII. - // The order of characters does not matter. - string custom_alphabet = 5; - - // The native way to select the alphabet. Must be in the range [2, 95]. - int32 radix = 6; - } - - // The custom infoType to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom infoType followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: info_type_name(surrogate_character_count):surrogate - // - // For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom infoType - // [`SurrogateType`](/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). - // This facilitates reversal of the surrogate when it occurs in free text. - // - // In order for inspection to work properly, the name of this infoType must - // not occur naturally anywhere in your data; otherwise, inspection may - // find a surrogate that does not correspond to an actual identifier. - // Therefore, choose your custom infoType name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE - InfoType surrogate_info_type = 8; -} - -// This is a data encryption key (DEK) (as opposed to -// a key encryption key (KEK) stored by KMS). -// When using KMS to wrap/unwrap DEKs, be sure to set an appropriate -// IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot -// unwrap the data crypto key. -message CryptoKey { - // Sources of crypto keys. - oneof source { - // Transient crypto key - TransientCryptoKey transient = 1; - - // Unwrapped crypto key - UnwrappedCryptoKey unwrapped = 2; - - // Kms wrapped key - KmsWrappedCryptoKey kms_wrapped = 3; - } -} - -// Use this to have a random data crypto key generated. -// It will be discarded after the request finishes. -message TransientCryptoKey { - // Required. Name of the key. - // This is an arbitrary string used to differentiate different keys. - // A unique key is generated per name: two separate `TransientCryptoKey` - // protos share the same generated key if their names are the same. - // When the data crypto key is generated, this name is not used in any way - // (repeating the api call will result in a different key being generated). - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Using raw keys is prone to security risks due to accidentally -// leaking the key. Choose another type of key if possible. -message UnwrappedCryptoKey { - // Required. A 128/192/256 bit key. - bytes key = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Include to use an existing data crypto key wrapped by KMS. -// The wrapped key must be a 128/192/256 bit key. -// Authorization requires the following IAM permissions when sending a request -// to perform a crypto transformation using a kms-wrapped crypto key: -// dlp.kms.encrypt -message KmsWrappedCryptoKey { - // Required. The wrapped data crypto key. - bytes wrapped_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource name of the KMS CryptoKey to use for unwrapping. - string crypto_key_name = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Shifts dates by random number of days, with option to be consistent for the -// same context. See https://cloud.google.com/dlp/docs/concepts-date-shifting -// to learn more. -message DateShiftConfig { - // Required. Range of shift in days. Actual shift will be selected at random within this - // range (inclusive ends). Negative means shift to earlier in time. Must not - // be more than 365250 days (1000 years) each direction. - // - // For example, 3 means shift date to at most 3 days into the future. - int32 upper_bound_days = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. For example, -5 means shift date to at most 5 days back in the past. - int32 lower_bound_days = 2 [(google.api.field_behavior) = REQUIRED]; - - // Points to the field that contains the context, for example, an entity id. - // If set, must also set cryptoKey. If set, shift will be consistent for the - // given context. - FieldId context = 3; - - // Method for calculating shift that takes context into consideration. If - // set, must also set context. Can only be applied to table items. - oneof method { - // Causes the shift to be computed based on this key and the context. This - // results in the same shift for the same context and crypto_key. If - // set, must also set context. Can only be applied to table items. - CryptoKey crypto_key = 4; - } -} - -// A type of transformation that will scan unstructured text and -// apply various `PrimitiveTransformation`s to each finding, where the -// transformation is applied to only values that were identified as a specific -// info_type. -message InfoTypeTransformations { - // A transformation to apply to text that is identified as a specific - // info_type. - message InfoTypeTransformation { - // InfoTypes to apply the transformation to. An empty list will cause - // this transformation to apply to all findings that correspond to - // infoTypes that were requested in `InspectConfig`. - repeated InfoType info_types = 1; - - // Required. Primitive transformation to apply to the infoType. - PrimitiveTransformation primitive_transformation = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Transformation for each infoType. Cannot specify more than one - // for a given infoType. - repeated InfoTypeTransformation transformations = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The transformation to apply to the field. -message FieldTransformation { - // Required. Input field(s) to apply the transformation to. - repeated FieldId fields = 1 [(google.api.field_behavior) = REQUIRED]; - - // Only apply the transformation if the condition evaluates to true for the - // given `RecordCondition`. The conditions are allowed to reference fields - // that are not used in the actual transformation. - // - // Example Use Cases: - // - // - Apply a different bucket transformation to an age column if the zip code - // column for the same record is within a specific range. - // - Redact a field if the date of birth field is greater than 85. - RecordCondition condition = 3; - - // Transformation to apply. [required] - oneof transformation { - // Apply the transformation to the entire field. - PrimitiveTransformation primitive_transformation = 4; - - // Treat the contents of the field as free text, and selectively - // transform content that matches an `InfoType`. - InfoTypeTransformations info_type_transformations = 5; - } -} - -// A type of transformation that is applied over structured data such as a -// table. -message RecordTransformations { - // Transform the record by applying various field transformations. - repeated FieldTransformation field_transformations = 1; - - // Configuration defining which records get suppressed entirely. Records that - // match any suppression rule are omitted from the output. - repeated RecordSuppression record_suppressions = 2; -} - -// Configuration to suppress records whose suppression conditions evaluate to -// true. -message RecordSuppression { - // A condition that when it evaluates to true will result in the record being - // evaluated to be suppressed from the transformed content. - RecordCondition condition = 1; -} - -// A condition for determining whether a transformation should be applied to -// a field. -message RecordCondition { - // The field type of `value` and `field` do not need to match to be - // considered equal, but not all comparisons are possible. - // EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types, - // but all other comparisons are invalid with incompatible types. - // A `value` of type: - // - // - `string` can be compared against all other types - // - `boolean` can only be compared against other booleans - // - `integer` can be compared against doubles or a string if the string value - // can be parsed as an integer. - // - `double` can be compared against integers or a string if the string can - // be parsed as a double. - // - `Timestamp` can be compared against strings in RFC 3339 date string - // format. - // - `TimeOfDay` can be compared against timestamps and strings in the format - // of 'HH:mm:ss'. - // - // If we fail to compare do to type mismatch, a warning will be given and - // the condition will evaluate to false. - message Condition { - // Required. Field within the record this condition is evaluated against. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Operator used to compare the field or infoType to the value. - RelationalOperator operator = 3 [(google.api.field_behavior) = REQUIRED]; - - // Value to compare against. [Mandatory, except for `EXISTS` tests.] - Value value = 4; - } - - // A collection of conditions. - message Conditions { - // A collection of conditions. - repeated Condition conditions = 1; - } - - // An expression, consisting or an operator and conditions. - message Expressions { - // Logical operators for conditional checks. - enum LogicalOperator { - // Unused - LOGICAL_OPERATOR_UNSPECIFIED = 0; - - // Conditional AND - AND = 1; - } - - // The operator to apply to the result of conditions. Default and currently - // only supported value is `AND`. - LogicalOperator logical_operator = 1; - - // Expression types. - oneof type { - // Conditions to apply to the expression. - Conditions conditions = 3; - } - } - - // An expression. - Expressions expressions = 3; -} - -// Overview of the modifications that occurred. -message TransformationOverview { - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 2; - - // Transformations applied to the dataset. - repeated TransformationSummary transformation_summaries = 3; -} - -// Summary of a single transformation. -// Only one of 'transformation', 'field_transformation', or 'record_suppress' -// will be set. -message TransformationSummary { - // A collection that informs the user the number of times a particular - // `TransformationResultCode` and error details occurred. - message SummaryResult { - // Number of transformations counted by this result. - int64 count = 1; - - // Outcome of the transformation. - TransformationResultCode code = 2; - - // A place for warnings or errors to show up if a transformation didn't - // work as expected. - string details = 3; - } - - // Possible outcomes of transformations. - enum TransformationResultCode { - // Unused - TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; - - // Transformation completed without an error. - SUCCESS = 1; - - // Transformation had an error. - ERROR = 2; - } - - // Set if the transformation was limited to a specific InfoType. - InfoType info_type = 1; - - // Set if the transformation was limited to a specific FieldId. - FieldId field = 2; - - // The specific transformation these stats apply to. - PrimitiveTransformation transformation = 3; - - // The field transformation that was applied. - // If multiple field transformations are requested for a single field, - // this list will contain all of them; otherwise, only one is supplied. - repeated FieldTransformation field_transformations = 5; - - // The specific suppression option these stats apply to. - RecordSuppression record_suppress = 6; - - // Collection of all transformations that took place or had an error. - repeated SummaryResult results = 4; - - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 7; -} - -// Schedule for triggeredJobs. -message Schedule { - oneof option { - // With this option a job is started a regular periodic basis. For - // example: every day (86400 seconds). - // - // A scheduled start time will be skipped if the previous - // execution has not ended when its scheduled time occurs. - // - // This value must be set to a time duration greater than or equal - // to 1 day and can be no longer than 60 days. - google.protobuf.Duration recurrence_period_duration = 1; - } -} - -// The inspectTemplate contains a configuration (set of types of sensitive data -// to be detected) to be used anywhere you otherwise would normally specify -// InspectConfig. See https://cloud.google.com/dlp/docs/concepts-templates -// to learn more. -message InspectTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/InspectTemplate" - pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" - pattern: "projects/{project}/inspectTemplates/{inspect_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID`; - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The core content of the template. Configuration of the scanning process. - InspectConfig inspect_config = 6; -} - -// DeidentifyTemplates contains instructions on how to de-identify content. -// See https://cloud.google.com/dlp/docs/concepts-templates to learn more. -message DeidentifyTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - pattern: "organizations/{organization}/deidentifyTemplates/{deidentify_template}" - pattern: "projects/{project}/deidentifyTemplates/{deidentify_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // ///////////// // The core content of the template // /////////////// - DeidentifyConfig deidentify_config = 6; -} - -// Details information about an error encountered during job execution or -// the results of an unsuccessful activation of the JobTrigger. -message Error { - // Detailed error codes and messages. - google.rpc.Status details = 1; - - // The times the error occurred. - repeated google.protobuf.Timestamp timestamps = 2; -} - -// Contains a configuration to make dlp api calls on a repeating basis. -// See https://cloud.google.com/dlp/docs/concepts-job-triggers to learn more. -message JobTrigger { - option (google.api.resource) = { - type: "dlp.googleapis.com/JobTrigger" - pattern: "projects/{project}/jobTriggers/{job_trigger}" - }; - - // What event needs to occur for a new job to be started. - message Trigger { - oneof trigger { - // Create a job on a repeating basis based on the elapse of time. - Schedule schedule = 1; - } - } - - // Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs - // will be created with this configuration. The service may automatically - // pause triggers experiencing frequent errors. To restart a job, set the - // status to HEALTHY after correcting user errors. - enum Status { - // Unused. - STATUS_UNSPECIFIED = 0; - - // Trigger is healthy. - HEALTHY = 1; - - // Trigger is temporarily paused. - PAUSED = 2; - - // Trigger is cancelled and can not be resumed. - CANCELLED = 3; - } - - // Unique resource name for the triggeredJob, assigned by the service when the - // triggeredJob is created, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1; - - // Display name (max 100 chars) - string display_name = 2; - - // User provided description (max 256 chars) - string description = 3; - - // The configuration details for the specific type of job to run. - oneof job { - // For inspect jobs, a snapshot of the configuration. - InspectJobConfig inspect_job = 4; - } - - // A list of triggers which will be OR'ed together. Only one in the list - // needs to trigger for a job to be started. The list may contain only - // a single Schedule trigger and must have at least one object. - repeated Trigger triggers = 5; - - // Output only. A stream of errors encountered when the trigger was activated. Repeated - // errors may result in the JobTrigger automatically being paused. - // Will return the last 100 errors. Whenever the JobTrigger is modified - // this list will be cleared. - repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation timestamp of a triggeredJob. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a triggeredJob. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp of the last time this trigger executed. - google.protobuf.Timestamp last_run_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. A status for this trigger. - Status status = 10 [(google.api.field_behavior) = REQUIRED]; -} - -// A task to execute on the completion of a job. -// See https://cloud.google.com/dlp/docs/concepts-actions to learn more. -message Action { - // If set, the detailed findings will be persisted to the specified - // OutputStorageConfig. Only a single instance of this action can be - // specified. - // Compatible with: Inspect, Risk - message SaveFindings { - // Location to store findings outside of DLP. - OutputStorageConfig output_config = 1; - } - - // Publish a message into given Pub/Sub topic when DlpJob has completed. The - // message contains a single field, `DlpJobName`, which is equal to the - // finished job's - // [`DlpJob.name`](/dlp/docs/reference/rest/v2/projects.dlpJobs#DlpJob). - // Compatible with: Inspect, Risk - message PublishToPubSub { - // Cloud Pub/Sub topic to send notifications to. The topic must have given - // publishing access rights to the DLP API service account executing - // the long running DlpJob sending the notifications. - // Format is projects/{project}/topics/{topic}. - string topic = 1; - } - - // Publish the result summary of a DlpJob to the Cloud Security - // Command Center (CSCC Alpha). - // This action is only available for projects which are parts of - // an organization and whitelisted for the alpha Cloud Security Command - // Center. - // The action will publish count of finding instances and their info types. - // The summary of findings will be persisted in CSCC and are governed by CSCC - // service-specific policy, see https://cloud.google.com/terms/service-terms - // Only a single instance of this action can be specified. - // Compatible with: Inspect - message PublishSummaryToCscc { - - } - - // Publish findings of a DlpJob to Cloud Data Catalog. Labels summarizing the - // results of the DlpJob will be applied to the entry for the resource scanned - // in Cloud Data Catalog. Any labels previously written by another DlpJob will - // be deleted. InfoType naming patterns are strictly enforced when using this - // feature. Note that the findings will be persisted in Cloud Data Catalog - // storage and are governed by Data Catalog service-specific policy, see - // https://cloud.google.com/terms/service-terms - // Only a single instance of this action can be specified and only allowed if - // all resources being scanned are BigQuery tables. - // Compatible with: Inspect - message PublishFindingsToCloudDataCatalog { - - } - - // Enable email notification to project owners and editors on jobs's - // completion/failure. - message JobNotificationEmails { - - } - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. This - // will publish a metric to stack driver on each infotype requested and - // how many findings were found for it. CustomDetectors will be bucketed - // as 'Custom' under the Stackdriver label 'info_type'. - message PublishToStackdriver { - - } - - oneof action { - // Save resulting findings in a provided location. - SaveFindings save_findings = 1; - - // Publish a notification to a pubsub topic. - PublishToPubSub pub_sub = 2; - - // Publish summary to Cloud Security Command Center (Alpha). - PublishSummaryToCscc publish_summary_to_cscc = 3; - - // Publish findings to Cloud Datahub. - PublishFindingsToCloudDataCatalog publish_findings_to_cloud_data_catalog = 5; - - // Enable email notification for project owners and editors on job's - // completion/failure. - JobNotificationEmails job_notification_emails = 8; - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. - PublishToStackdriver publish_to_stackdriver = 9; - } -} - -// Request message for CreateInspectTemplate. -message CreateInspectTemplateRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Required. The InspectTemplate to create. - InspectTemplate inspect_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // The geographic location to store the inspection template. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for UpdateInspectTemplate. -message UpdateInspectTemplateRequest { - // Required. Resource name of organization and inspectTemplate to be updated, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // New InspectTemplate value. - InspectTemplate inspect_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetInspectTemplate. -message GetInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be read, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for ListInspectTemplates. -message ListInspectTemplatesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListInspectTemplates`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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 time the template was created. - // - `update_time`: corresponds to time the template was last updated. - // - `name`: corresponds to template's name. - // - `display_name`: corresponds to template's display name. - string order_by = 4; - - // The geographic location where inspection templates will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListInspectTemplates. -message ListInspectTemplatesResponse { - // List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. - repeated InspectTemplate inspect_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListInspectTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteInspectTemplate. -message DeleteInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be deleted, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for CreateJobTrigger. -message CreateJobTriggerRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The JobTrigger to create. - JobTrigger job_trigger = 2 [(google.api.field_behavior) = REQUIRED]; - - // The trigger id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string trigger_id = 3; - - // The geographic location to store the job trigger. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for ActivateJobTrigger. -message ActivateJobTriggerRequest { - // Required. Resource name of the trigger to activate, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for UpdateJobTrigger. -message UpdateJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // New JobTrigger value. - JobTrigger job_trigger = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetJobTrigger. -message GetJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for CreateDlpJobRequest. Used to initiate long running -// jobs such as calculating risk metrics or inspecting Google Cloud -// Storage. -message CreateDlpJobRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The configuration details for the specific type of job to run. - oneof job { - // Set to control what and how to inspect. - InspectJobConfig inspect_job = 2; - - // Set to choose what metric to calculate. - RiskAnalysisJobConfig risk_job = 3; - } - - // The job id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string job_id = 4; - - // The geographic location to store and process the job. Reserved for - // future extensions. - string location_id = 5; -} - -// Request message for ListJobTriggers. -message ListJobTriggersRequest { - // Required. The parent resource name, for example `projects/my-project-id`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to ListJobTriggers. `order_by` field must not - // change for subsequent calls. - string page_token = 2; - - // Size of the page, can be limited by a server. - int32 page_size = 3; - - // Comma separated list of triggeredJob 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 time the JobTrigger was created. - // - `update_time`: corresponds to time the JobTrigger was last updated. - // - `last_run_time`: corresponds to the last time the JobTrigger ran. - // - `name`: corresponds to JobTrigger's name. - // - `display_name`: corresponds to JobTrigger's display name. - // - `status`: corresponds to JobTrigger's status. - string order_by = 4; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect jobs: - // - `status` - HEALTHY|PAUSED|CANCELLED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - // quotation marks. Nanoseconds are ignored. - // - 'error_count' - Number of errors that have occurred while running. - // * The operator must be `=` or `!=` for status and inspected_storage. - // - // Examples: - // - // * inspected_storage = cloud_storage AND status = HEALTHY - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - // * last_run_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 5; - - // The geographic location where job triggers will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 7; -} - -// Response message for ListJobTriggers. -message ListJobTriggersResponse { - // List of triggeredJobs, up to page_size in ListJobTriggersRequest. - repeated JobTrigger job_triggers = 1; - - // If the next page is available then the next page token to be used - // in following ListJobTriggers request. - string next_page_token = 2; -} - -// Request message for DeleteJobTrigger. -message DeleteJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Controls what and how to inspect for findings. -message InspectJobConfig { - // The data to scan. - StorageConfig storage_config = 1; - - // How and what to scan for. - InspectConfig inspect_config = 2; - - // If provided, will be used as the default for all values in InspectConfig. - // `inspect_config` will be merged into the values persisted as part of the - // template. - string inspect_template_name = 3; - - // Actions to execute at the completion of the job. - repeated Action actions = 4; -} - -// Combines all of the information about a DLP job. -message DlpJob { - option (google.api.resource) = { - type: "dlp.googleapis.com/DlpJob" - pattern: "projects/{project}/dlpJobs/{dlp_job}" - }; - - // Possible states of a job. - enum JobState { - // Unused. - JOB_STATE_UNSPECIFIED = 0; - - // The job has not yet started. - PENDING = 1; - - // The job is currently running. - RUNNING = 2; - - // The job is no longer running. - DONE = 3; - - // The job was canceled before it could complete. - CANCELED = 4; - - // The job had an error and did not complete. - FAILED = 5; - } - - // The server-assigned name. - string name = 1; - - // The type of job. - DlpJobType type = 2; - - // State of a job. - JobState state = 3; - - oneof details { - // Results from analyzing risk of a data source. - AnalyzeDataSourceRiskDetails risk_details = 4; - - // Results from inspecting a data source. - InspectDataSourceDetails inspect_details = 5; - } - - // Time when the job was created. - google.protobuf.Timestamp create_time = 6; - - // Time when the job started. - google.protobuf.Timestamp start_time = 7; - - // Time when the job finished. - google.protobuf.Timestamp end_time = 8; - - // If created by a job trigger, the resource name of the trigger that - // instantiated the job. - string job_trigger_name = 10; - - // A stream of errors encountered running the job. - repeated Error errors = 11; -} - -// The request message for [DlpJobs.GetDlpJob][]. -message GetDlpJobRequest { - // Required. The name of the DlpJob resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for listing DLP jobs. -message ListDlpJobsRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect jobs: - // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - `trigger_name` - The resource name of the trigger that created job. - // - 'end_time` - Corresponds to time the job finished. - // - 'start_time` - Corresponds to time the job finished. - // * Supported fields for risk analysis jobs: - // - `state` - RUNNING|CANCELED|FINISHED|FAILED - // - 'end_time` - Corresponds to time the job finished. - // - 'start_time` - Corresponds to time the job finished. - // * The operator must be `=` or `!=`. - // - // Examples: - // - // * inspected_storage = cloud_storage AND state = done - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = done OR state = canceled) - // * end_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 1; - - // The standard list page size. - int32 page_size = 2; - - // The standard list page token. - string page_token = 3; - - // The type of job. Defaults to `DlpJobType.INSPECT` - DlpJobType type = 5; - - // 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, end_time asc, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to time the job was created. - // - `end_time`: corresponds to time the job ended. - // - `name`: corresponds to job's name. - // - `state`: corresponds to `state` - string order_by = 6; - - // The geographic location where jobs will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 7; -} - -// The response message for listing DLP jobs. -message ListDlpJobsResponse { - // A list of DlpJobs that matches the specified filter in the request. - repeated DlpJob jobs = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for canceling a DLP job. -message CancelDlpJobRequest { - // Required. The name of the DlpJob resource to be cancelled. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for deleting a DLP job. -message DeleteDlpJobRequest { - // Required. The name of the DlpJob resource to be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// Request message for CreateDeidentifyTemplate. -message CreateDeidentifyTemplateRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Required. The DeidentifyTemplate to create. - DeidentifyTemplate deidentify_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // The geographic location to store the deidentification template. Reserved - // for future extensions. - string location_id = 4; -} - -// Request message for UpdateDeidentifyTemplate. -message UpdateDeidentifyTemplateRequest { - // Required. Resource name of organization and deidentify template to be updated, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // New DeidentifyTemplate value. - DeidentifyTemplate deidentify_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetDeidentifyTemplate. -message GetDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be read, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Request message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListDeidentifyTemplates`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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 time the template was created. - // - `update_time`: corresponds to time the template was last updated. - // - `name`: corresponds to template's name. - // - `display_name`: corresponds to template's display name. - string order_by = 4; - - // The geographic location where deidentifications templates will be retrieved - // from. Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesResponse { - // List of deidentify templates, up to page_size in - // ListDeidentifyTemplatesRequest. - repeated DeidentifyTemplate deidentify_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListDeidentifyTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteDeidentifyTemplate. -message DeleteDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be deleted, - // for example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Configuration for a custom dictionary created from a data source of any size -// up to the maximum size defined in the -// [limits](https://cloud.google.com/dlp/limits) page. The artifacts of -// dictionary creation are stored in the specified Google Cloud Storage -// location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries -// that satisfy the size requirements. -message LargeCustomDictionaryConfig { - // Location to store dictionary artifacts in Google Cloud Storage. These files - // will only be accessible by project owners and the DLP API. If any of these - // artifacts are modified, the dictionary is considered invalid and can no - // longer be used. - CloudStoragePath output_path = 1; - - oneof source { - // Set of files containing newline-delimited lists of dictionary phrases. - CloudStorageFileSet cloud_storage_file_set = 2; - - // Field in a BigQuery table where each cell represents a dictionary phrase. - BigQueryField big_query_field = 3; - } -} - -// Summary statistics of a custom dictionary. -message LargeCustomDictionaryStats { - // Approximate number of distinct phrases in the dictionary. - int64 approx_num_phrases = 1; -} - -// Configuration for stored infoTypes. All fields and subfield are provided -// by the user. For more information, see -// https://cloud.google.com/dlp/docs/creating-custom-infotypes. -message StoredInfoTypeConfig { - // Display name of the StoredInfoType (max 256 characters). - string display_name = 1; - - // Description of the StoredInfoType (max 256 characters). - string description = 2; - - // Stored infotype types. - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryConfig large_custom_dictionary = 3; - } -} - -// Statistics for a StoredInfoType. -message StoredInfoTypeStats { - // Stat types - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryStats large_custom_dictionary = 1; - } -} - -// Version of a StoredInfoType, including the configuration used to build it, -// create timestamp, and current state. -message StoredInfoTypeVersion { - // StoredInfoType configuration. - StoredInfoTypeConfig config = 1; - - // Create timestamp of the version. Read-only, determined by the system - // when the version is created. - google.protobuf.Timestamp create_time = 2; - - // Stored info type version state. Read-only, updated by the system - // during dictionary creation. - StoredInfoTypeState state = 3; - - // Errors that occurred when creating this storedInfoType version, or - // anomalies detected in the storedInfoType data that render it unusable. Only - // the five most recent errors will be displayed, with the most recent error - // appearing first. - // - // For example, some of the data for stored custom dictionaries is put in - // the user's Google Cloud Storage bucket, and if this data is modified or - // deleted by the user or another system, the dictionary becomes invalid. - // - // If any errors occur, fix the problem indicated by the error message and - // use the UpdateStoredInfoType API method to create another version of the - // storedInfoType to continue using it, reusing the same `config` if it was - // not the source of the error. - repeated Error errors = 4; - - // Statistics about this storedInfoType version. - StoredInfoTypeStats stats = 5; -} - -// StoredInfoType resource message that contains information about the current -// version and any pending updates. -message StoredInfoType { - option (google.api.resource) = { - type: "dlp.googleapis.com/StoredInfoType" - pattern: "organizations/{organization}/storedInfoTypes/{stored_info_type}" - pattern: "projects/{project}/storedInfoTypes/{stored_info_type}" - }; - - // Resource name. - string name = 1; - - // Current version of the stored info type. - StoredInfoTypeVersion current_version = 2; - - // Pending versions of the stored info type. Empty if no versions are - // pending. - repeated StoredInfoTypeVersion pending_versions = 3; -} - -// Request message for CreateStoredInfoType. -message CreateStoredInfoTypeRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Required. Configuration of the storedInfoType to create. - StoredInfoTypeConfig config = 2 [(google.api.field_behavior) = REQUIRED]; - - // The storedInfoType ID can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string stored_info_type_id = 3; - - // The geographic location to store the stored infoType. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for UpdateStoredInfoType. -message UpdateStoredInfoTypeRequest { - // Required. Resource name of organization and storedInfoType to be updated, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Updated configuration for the storedInfoType. If not provided, a new - // version of the storedInfoType will be created with the existing - // configuration. - StoredInfoTypeConfig config = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetStoredInfoType. -message GetStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be read, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Request message for ListStoredInfoTypes. -message ListStoredInfoTypesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListStoredInfoTypes`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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, display_name, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to time the most recent version of the - // resource was created. - // - `state`: corresponds to the state of the resource. - // - `name`: corresponds to resource name. - // - `display_name`: corresponds to info type's display name. - string order_by = 4; - - // The geographic location where stored infoTypes will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListStoredInfoTypes. -message ListStoredInfoTypesResponse { - // List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. - repeated StoredInfoType stored_info_types = 1; - - // If the next page is available then the next page token to be used - // in following ListStoredInfoTypes request. - string next_page_token = 2; -} - -// Request message for DeleteStoredInfoType. -message DeleteStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be deleted, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Operators available for comparing the value of fields. -enum RelationalOperator { - // Unused - RELATIONAL_OPERATOR_UNSPECIFIED = 0; - - // Equal. Attempts to match even with incompatible types. - EQUAL_TO = 1; - - // Not equal to. Attempts to match even with incompatible types. - NOT_EQUAL_TO = 2; - - // Greater than. - GREATER_THAN = 3; - - // Less than. - LESS_THAN = 4; - - // Greater than or equals. - GREATER_THAN_OR_EQUALS = 5; - - // Less than or equals. - LESS_THAN_OR_EQUALS = 6; - - // Exists - EXISTS = 7; -} - -// Type of the match which can be applied to different ways of matching, like -// Dictionary, regular expression and intersecting with findings of another -// info type. -enum MatchingType { - // Invalid. - MATCHING_TYPE_UNSPECIFIED = 0; - - // Full match. - // - // - Dictionary: join of Dictionary results matched complete finding quote - // - Regex: all regex matches fill a finding quote start to end - // - Exclude info type: completely inside affecting info types findings - MATCHING_TYPE_FULL_MATCH = 1; - - // Partial match. - // - // - Dictionary: at least one of the tokens in the finding matches - // - Regex: substring of the finding matches - // - Exclude info type: intersects with affecting info types findings - MATCHING_TYPE_PARTIAL_MATCH = 2; - - // Inverse match. - // - // - Dictionary: no tokens in the finding match the dictionary - // - Regex: finding doesn't match the regex - // - Exclude info type: no intersection with affecting info types findings - MATCHING_TYPE_INVERSE_MATCH = 3; -} - -// Options describing which parts of the provided content should be scanned. -enum ContentOption { - // Includes entire content of a file or a data stream. - CONTENT_UNSPECIFIED = 0; - - // Text content within the data, excluding any metadata. - CONTENT_TEXT = 1; - - // Images found in the data. - CONTENT_IMAGE = 2; -} - -// Parts of the APIs which use certain infoTypes. -enum InfoTypeSupportedBy { - // Unused. - ENUM_TYPE_UNSPECIFIED = 0; - - // Supported by the inspect operations. - INSPECT = 1; - - // Supported by the risk analysis operations. - RISK_ANALYSIS = 2; -} - -// An enum to represent the various types of DLP jobs. -enum DlpJobType { - // Unused - DLP_JOB_TYPE_UNSPECIFIED = 0; - - // The job inspected Google Cloud for sensitive data. - INSPECT_JOB = 1; - - // The job executed a Risk Analysis computation. - RISK_ANALYSIS_JOB = 2; -} - -// State of a StoredInfoType version. -enum StoredInfoTypeState { - // Unused - STORED_INFO_TYPE_STATE_UNSPECIFIED = 0; - - // StoredInfoType version is being created. - PENDING = 1; - - // StoredInfoType version is ready for use. - READY = 2; - - // StoredInfoType creation failed. All relevant error messages are returned in - // the `StoredInfoTypeVersion` message. - FAILED = 3; - - // StoredInfoType is no longer valid because artifacts stored in - // user-controlled storage were modified. To fix an invalid StoredInfoType, - // use the `UpdateStoredInfoType` method to create a new version. - INVALID = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/storage.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/storage.proto.baseline deleted file mode 100644 index f23430c7219b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/protos/google/privacy/dlp/v2/storage.proto.baseline +++ /dev/null @@ -1,648 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.privacy.dlp.v2; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; -option java_multiple_files = true; -option java_outer_classname = "DlpStorage"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; - -// Type of information detected by the API. -message InfoType { - // Name of the information type. Either a name of your choosing when - // creating a CustomInfoType, or one of the names listed - // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying - // a built-in type. InfoType names should conform to the pattern - // [a-zA-Z0-9_]{1,64}. - string name = 1; -} - -// A reference to a StoredInfoType to use with scanning. -message StoredType { - // Resource name of the requested `StoredInfoType`, for example - // `organizations/433245324/storedInfoTypes/432452342` or - // `projects/project-id/storedInfoTypes/432452342`. - string name = 1; - - // Timestamp indicating when the version of the `StoredInfoType` used for - // inspection was created. Output-only field, populated by the system. - google.protobuf.Timestamp create_time = 2; -} - -// Categorization of results based on how likely they are to represent a match, -// based on the number of elements they contain which imply a match. -enum Likelihood { - // Default value; same as POSSIBLE. - LIKELIHOOD_UNSPECIFIED = 0; - - // Few matching elements. - VERY_UNLIKELY = 1; - - UNLIKELY = 2; - - // Some matching elements. - POSSIBLE = 3; - - LIKELY = 4; - - // Many matching elements. - VERY_LIKELY = 5; -} - -// Custom information type provided by the user. Used to find domain-specific -// sensitive information configurable to the data in question. -message CustomInfoType { - // Custom information type based on a dictionary of words or phrases. This can - // be used to match sensitive information specific to the data, such as a list - // of employee IDs or job titles. - // - // Dictionary words are case-insensitive and all characters other than letters - // and digits in the unicode [Basic Multilingual - // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) - // will be replaced with whitespace when scanning for matches, so the - // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", - // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters - // surrounding any match must be of a different type than the adjacent - // characters within the word, so letters must be next to non-letters and - // digits next to non-digits. For example, the dictionary word "jen" will - // match the first three letters of the text "jen123" but will return no - // matches for "jennifer". - // - // Dictionary words containing a large number of characters that are not - // letters or digits may result in unexpected findings because such characters - // are treated as whitespace. The - // [limits](https://cloud.google.com/dlp/limits) page contains details about - // the size limits of dictionaries. For dictionaries that do not fit within - // these constraints, consider using `LargeCustomDictionaryConfig` in the - // `StoredInfoType` API. - message Dictionary { - // Message defining a list of words or phrases to search for in the data. - message WordList { - // Words or phrases defining the dictionary. The dictionary must contain - // at least one phrase and every phrase must contain at least 2 characters - // that are letters or digits. [required] - repeated string words = 1; - } - - oneof source { - // List of words or phrases to search for. - WordList word_list = 1; - - // Newline-delimited file of words in Cloud Storage. Only a single file - // is accepted. - CloudStoragePath cloud_storage_path = 3; - } - } - - // Message defining a custom regular expression. - message Regex { - // Pattern defining the regular expression. Its syntax - // (https://github.com/google/re2/wiki/Syntax) can be found under the - // google/re2 repository on GitHub. - string pattern = 1; - - // The index of the submatch to extract as findings. When not - // specified, the entire match is returned. No more than 3 may be included. - repeated int32 group_indexes = 2; - } - - // Message for detecting output from deidentification transformations - // such as - // [`CryptoReplaceFfxFpeConfig`](/dlp/docs/reference/rest/v2/organizations.deidentifyTemplates#cryptoreplaceffxfpeconfig). - // These types of transformations are - // those that perform pseudonymization, thereby producing a "surrogate" as - // output. This should be used in conjunction with a field on the - // transformation such as `surrogate_info_type`. This CustomInfoType does - // not support the use of `detection_rules`. - message SurrogateType { - - } - - // Deprecated; use `InspectionRuleSet` instead. Rule for modifying a - // `CustomInfoType` to alter behavior under certain circumstances, depending - // on the specific details of the rule. Not supported for the `surrogate_type` - // custom infoType. - message DetectionRule { - // Message for specifying a window around a finding to apply a detection - // rule. - message Proximity { - // Number of characters before the finding to consider. - int32 window_before = 1; - - // Number of characters after the finding to consider. - int32 window_after = 2; - } - - // Message for specifying an adjustment to the likelihood of a finding as - // part of a detection rule. - message LikelihoodAdjustment { - oneof adjustment { - // Set the likelihood of a finding to a fixed value. - Likelihood fixed_likelihood = 1; - - // Increase or decrease the likelihood by the specified number of - // levels. For example, if a finding would be `POSSIBLE` without the - // detection rule and `relative_likelihood` is 1, then it is upgraded to - // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. - // Likelihood may never drop below `VERY_UNLIKELY` or exceed - // `VERY_LIKELY`, so applying an adjustment of 1 followed by an - // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in - // a final likelihood of `LIKELY`. - int32 relative_likelihood = 2; - } - } - - // The rule that adjusts the likelihood of findings within a certain - // proximity of hotwords. - message HotwordRule { - // Regular expression pattern defining what qualifies as a hotword. - Regex hotword_regex = 1; - - // Proximity of the finding within which the entire hotword must reside. - // The total length of the window cannot exceed 1000 characters. Note that - // the finding itself will be included in the window, so that hotwords may - // be used to match substrings of the finding itself. For example, the - // certainty of a phone number regex "\(\d{3}\) \d{3}-\d{4}" could be - // adjusted upwards if the area code is known to be the local area code of - // a company office using the hotword regex "\(xxx\)", where "xxx" - // is the area code in question. - Proximity proximity = 2; - - // Likelihood adjustment to apply to all matching findings. - LikelihoodAdjustment likelihood_adjustment = 3; - } - - oneof type { - // Hotword-based detection rule. - HotwordRule hotword_rule = 1; - } - } - - enum ExclusionType { - // A finding of this custom info type will not be excluded from results. - EXCLUSION_TYPE_UNSPECIFIED = 0; - - // A finding of this custom info type will be excluded from final results, - // but can still affect rule execution. - EXCLUSION_TYPE_EXCLUDE = 1; - } - - // CustomInfoType can either be a new infoType, or an extension of built-in - // infoType, when the name matches one of existing infoTypes and that infoType - // is specified in `InspectContent.info_types` field. Specifying the latter - // adds findings to the one detected by the system. If built-in info type is - // not specified in `InspectContent.info_types` list then the name is treated - // as a custom info type. - InfoType info_type = 1; - - // Likelihood to return for this CustomInfoType. This base value can be - // altered by a detection rule if the finding meets the criteria specified by - // the rule. Defaults to `VERY_LIKELY` if not specified. - Likelihood likelihood = 6; - - oneof type { - // A list of phrases to detect as a CustomInfoType. - Dictionary dictionary = 2; - - // Regular expression based CustomInfoType. - Regex regex = 3; - - // Message for detecting output from deidentification transformations that - // support reversing. - SurrogateType surrogate_type = 4; - - // Load an existing `StoredInfoType` resource for use in - // `InspectDataSource`. Not currently supported in `InspectContent`. - StoredType stored_type = 5; - } - - // Set of detection rules to apply to all findings of this CustomInfoType. - // Rules are applied in order that they are specified. Not supported for the - // `surrogate_type` CustomInfoType. - repeated DetectionRule detection_rules = 7; - - // If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding - // to be returned. It still can be used for rules matching. - ExclusionType exclusion_type = 8; -} - -// General identifier of a data field in a storage service. -message FieldId { - // Name describing the field. - string name = 1; -} - -// Datastore partition ID. -// A partition ID identifies a grouping of entities. The grouping is always -// by project and namespace, however the namespace ID may be empty. -// -// A partition ID contains several dimensions: -// project ID and namespace ID. -message PartitionId { - // The ID of the project to which the entities belong. - string project_id = 2; - - // If not empty, the ID of the namespace to which the entities belong. - string namespace_id = 4; -} - -// A representation of a Datastore kind. -message KindExpression { - // The name of the kind. - string name = 1; -} - -// Options defining a data set within Google Cloud Datastore. -message DatastoreOptions { - // A partition ID identifies a grouping of entities. The grouping is always - // by project and namespace, however the namespace ID may be empty. - PartitionId partition_id = 1; - - // The kind to process. - KindExpression kind = 2; -} - -// Message representing a set of files in a Cloud Storage bucket. Regular -// expressions are used to allow fine-grained control over which files in the -// bucket to include. -// -// Included files are those that match at least one item in `include_regex` and -// do not match any items in `exclude_regex`. Note that a file that matches -// items from both lists will _not_ be included. For a match to occur, the -// entire file path (i.e., everything in the url after the bucket name) must -// match the regular expression. -// -// For example, given the input `{bucket_name: "mybucket", include_regex: -// ["directory1/.*"], exclude_regex: -// ["directory1/excluded.*"]}`: -// -// * `gs://mybucket/directory1/myfile` will be included -// * `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches -// across `/`) -// * `gs://mybucket/directory0/directory1/myfile` will _not_ be included (the -// full path doesn't match any items in `include_regex`) -// * `gs://mybucket/directory1/excludedfile` will _not_ be included (the path -// matches an item in `exclude_regex`) -// -// If `include_regex` is left empty, it will match all files by default -// (this is equivalent to setting `include_regex: [".*"]`). -// -// Some other common use cases: -// -// * `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all -// files in `mybucket` except for .pdf files -// * `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will -// include all files directly under `gs://mybucket/directory/`, without matching -// across `/` -message CloudStorageRegexFileSet { - // The name of a Cloud Storage bucket. Required. - string bucket_name = 1; - - // A list of regular expressions matching file paths to include. All files in - // the bucket that match at least one of these regular expressions will be - // included in the set of files, except for those that also match an item in - // `exclude_regex`. Leaving this field empty will match all files by default - // (this is equivalent to including `.*` in the list). - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string include_regex = 2; - - // A list of regular expressions matching file paths to exclude. All files in - // the bucket that match at least one of these regular expressions will be - // excluded from the scan. - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string exclude_regex = 3; -} - -// Options defining a file or a set of files within a Google Cloud Storage -// bucket. -message CloudStorageOptions { - // Set of files to scan. - message FileSet { - // The Cloud Storage url of the file(s) to scan, in the format - // `gs:///`. Trailing wildcard in the path is allowed. - // - // If the url ends in a trailing slash, the bucket or directory represented - // by the url will be scanned non-recursively (content in sub-directories - // will not be scanned). This means that `gs://mybucket/` is equivalent to - // `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to - // `gs://mybucket/directory/*`. - // - // Exactly one of `url` or `regex_file_set` must be set. - string url = 1; - - // The regex-filtered set of files to scan. Exactly one of `url` or - // `regex_file_set` must be set. - CloudStorageRegexFileSet regex_file_set = 2; - } - - // How to sample bytes if not all bytes are scanned. Meaningful only when used - // in conjunction with bytes_limit_per_file. If not specified, scanning would - // start from the top. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan from the top (default). - TOP = 1; - - // For each file larger than bytes_limit_per_file, randomly pick the offset - // to start scanning. The scanned bytes are contiguous. - RANDOM_START = 2; - } - - // The set of one or more files to scan. - FileSet file_set = 1; - - // Max number of bytes to scan from a file. If a scanned file's size is bigger - // than this value then the rest of the bytes are omitted. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - int64 bytes_limit_per_file = 4; - - // Max percentage of bytes to scan from a file. The rest are omitted. The - // number of bytes scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - int32 bytes_limit_per_file_percent = 8; - - // List of file type groups to include in the scan. - // If empty, all files are scanned and available data format processors - // are applied. In addition, the binary content of the selected files - // is always scanned as well. - repeated FileType file_types = 5; - - SampleMethod sample_method = 6; - - // Limits the number of files to scan to this percentage of the input FileSet. - // Number of files scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. - int32 files_limit_percent = 7; -} - -// Message representing a set of files in Cloud Storage. -message CloudStorageFileSet { - // The url, in the format `gs:///`. Trailing wildcard in the - // path is allowed. - string url = 1; -} - -// Message representing a single file or path in Cloud Storage. -message CloudStoragePath { - // A url representing a file or path (no wildcards) in Cloud Storage. - // Example: gs://[BUCKET_NAME]/dictionary.txt - string path = 1; -} - -// Options defining BigQuery table and row identifiers. -message BigQueryOptions { - // How to sample rows if not all rows are scanned. Meaningful only when used - // in conjunction with either rows_limit or rows_limit_percent. If not - // specified, scanning would start from the top. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan from the top (default). - TOP = 1; - - // Randomly pick the row to start scanning. The scanned rows are contiguous. - RANDOM_START = 2; - } - - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // References to fields uniquely identifying rows within the table. - // Nested fields in the format, like `person.birthdate.year`, are allowed. - repeated FieldId identifying_fields = 2; - - // Max number of rows to scan. If the table has more rows than this value, the - // rest of the rows are omitted. If not set, or if set to 0, all rows will be - // scanned. Only one of rows_limit and rows_limit_percent can be specified. - // Cannot be used in conjunction with TimespanConfig. - int64 rows_limit = 3; - - // Max percentage of rows to scan. The rest are omitted. The number of rows - // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and - // 100 means no limit. Defaults to 0. Only one of rows_limit and - // rows_limit_percent can be specified. Cannot be used in conjunction with - // TimespanConfig. - int32 rows_limit_percent = 6; - - SampleMethod sample_method = 4; - - // References to fields excluded from scanning. This allows you to skip - // inspection of entire columns which you know have no findings. - repeated FieldId excluded_fields = 5; -} - -// Shared message indicating Cloud storage type. -message StorageConfig { - // Configuration of the timespan of the items to include in scanning. - // Currently only supported when inspecting Google Cloud Storage and BigQuery. - message TimespanConfig { - // Exclude files or rows older than this value. - google.protobuf.Timestamp start_time = 1; - - // Exclude files or rows newer than this value. - // If set to zero, no upper time limit is applied. - google.protobuf.Timestamp end_time = 2; - - // Specification of the field containing the timestamp of scanned items. - // Used for data sources like Datastore and BigQuery. - // - // For BigQuery: - // Required to filter out rows based on the given start and - // end times. If not specified and the table was modified between the given - // start and end times, the entire table will be scanned. - // The valid data types of the timestamp field are: `INTEGER`, `DATE`, - // `TIMESTAMP`, or `DATETIME` BigQuery column. - // - // For Datastore. - // Valid data types of the timestamp field are: `TIMESTAMP`. - // Datastore entity will be scanned if the timestamp property does not - // exist or its value is empty or invalid. - FieldId timestamp_field = 3; - - // When the job is started by a JobTrigger we will automatically figure out - // a valid start_time to avoid scanning files that have not been modified - // since the last time the JobTrigger executed. This will be based on the - // time of the execution of the last run of the JobTrigger. - bool enable_auto_population_of_timespan_config = 4; - } - - oneof type { - // Google Cloud Datastore options specification. - DatastoreOptions datastore_options = 2; - - // Google Cloud Storage options specification. - CloudStorageOptions cloud_storage_options = 3; - - // BigQuery options specification. - BigQueryOptions big_query_options = 4; - } - - TimespanConfig timespan_config = 6; -} - -// Definitions of file type groups to scan. -enum FileType { - // Includes all files. - FILE_TYPE_UNSPECIFIED = 0; - - // Includes all file extensions not covered by text file types. - BINARY_FILE = 1; - - // Included file extensions: - // asc, brf, c, cc, cpp, csv, cxx, c++, cs, css, dart, eml, go, h, hh, hpp, - // hxx, h++, hs, html, htm, shtml, shtm, xhtml, lhs, ini, java, js, json, - // ocaml, md, mkd, markdown, m, ml, mli, pl, pm, php, phtml, pht, py, pyw, - // rb, rbw, rs, rc, scala, sh, sql, tex, txt, text, tsv, vcard, vcs, wml, - // xml, xsl, xsd, yml, yaml. - TEXT_FILE = 2; - - // Included file extensions: - // bmp, gif, jpg, jpeg, jpe, png. - // bytes_limit_per_file has no effect on image files. - IMAGE = 3; - - // Included file extensions: - // avro - AVRO = 7; -} - -// Row key for identifying a record in BigQuery table. -message BigQueryKey { - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // Absolute number of the row from the beginning of the table at the time - // of scanning. - int64 row_number = 2; -} - -// Record key for a finding in Cloud Datastore. -message DatastoreKey { - // Datastore entity key. - Key entity_key = 1; -} - -// A unique identifier for a Datastore entity. -// If a key's partition ID or any of its path kinds or names are -// reserved/read-only, the key is reserved/read-only. -// A reserved/read-only key is forbidden in certain documented contexts. -message Key { - // A (kind, ID/name) pair used to construct a key path. - // - // If either name or ID is set, the element is complete. - // If neither is set, the element is incomplete. - message PathElement { - // The kind of the entity. - // A kind matching regex `__.*__` is reserved/read-only. - // A kind must not contain more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string kind = 1; - - // The type of ID. - oneof id_type { - // The auto-allocated ID of the entity. - // Never equal to zero. Values less than zero are discouraged and may not - // be supported in the future. - int64 id = 2; - - // The name of the entity. - // A name matching regex `__.*__` is reserved/read-only. - // A name must not be more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string name = 3; - } - } - - // Entities are partitioned into subsets, currently identified by a project - // ID and namespace ID. - // Queries are scoped to a single partition. - PartitionId partition_id = 1; - - // The entity path. - // An entity path consists of one or more elements composed of a kind and a - // string or numerical identifier, which identify entities. The first - // element identifies a _root entity_, the second element identifies - // a _child_ of the root entity, the third element identifies a child of the - // second entity, and so forth. The entities identified by all prefixes of - // the path are called the element's _ancestors_. - // - // A path can never be empty, and a path can have at most 100 elements. - repeated PathElement path = 2; -} - -// Message for a unique key indicating a record that contains a finding. -message RecordKey { - oneof type { - DatastoreKey datastore_key = 2; - - BigQueryKey big_query_key = 3; - } - - // Values of identifying columns in the given row. Order of values matches - // the order of field identifiers specified in the scanning request. - repeated string id_values = 5; -} - -// Message defining the location of a BigQuery table. A table is uniquely -// identified by its project_id, dataset_id, and table_name. Within a query -// a table is often referenced with a string in the format of: -// `:.` or -// `..`. -message BigQueryTable { - // The Google Cloud Platform project ID of the project containing the table. - // If omitted, project ID is inferred from the API call. - string project_id = 1; - - // Dataset ID of the table. - string dataset_id = 2; - - // Name of the table. - string table_id = 3; -} - -// Message defining a field of a BigQuery table. -message BigQueryField { - // Source table of the field. - BigQueryTable table = 1; - - // Designated field in the BigQuery table. - FieldId field = 2; -} - -// An entity in a dataset is a field or set of fields that correspond to a -// single person. For example, in medical records the `EntityId` might be a -// patient identifier, or for financial records it might be an account -// identifier. This message is used when generalizations or analysis must take -// into account that multiple rows correspond to the same entity. -message EntityId { - // Composite key indicating which field contains the entity identifier. - FieldId field = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline deleted file mode 100644 index b5b445c0c60e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_ActivateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callActivateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.activateJobTrigger(request); - console.log(response); - } - - callActivateJobTrigger(); - // [END dlp_v2_generated_DlpService_ActivateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline deleted file mode 100644 index 47b434df56af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_CancelDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource to be cancelled. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCancelDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.cancelDlpJob(request); - console.log(response); - } - - callCancelDlpJob(); - // [END dlp_v2_generated_DlpService_CancelDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline deleted file mode 100644 index 2685e142586c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, deidentifyTemplate) { - // [START dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. The DeidentifyTemplate to create. - */ - // const deidentifyTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - /** - * The geographic location to store the deidentification template. Reserved - * for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDeidentifyTemplate() { - // Construct request - const request = { - parent, - deidentifyTemplate, - }; - - // Run request - const response = await dlpClient.createDeidentifyTemplate(request); - console.log(response); - } - - callCreateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_dlp_job.js.baseline deleted file mode 100644 index a6943675b570..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_dlp_job.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_CreateDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Set to control what and how to inspect. - */ - // const inspectJob = {} - /** - * Set to choose what metric to calculate. - */ - // const riskJob = {} - /** - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const jobId = 'abc123' - /** - * The geographic location to store and process the job. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDlpJob() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.createDlpJob(request); - console.log(response); - } - - callCreateDlpJob(); - // [END dlp_v2_generated_DlpService_CreateDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_inspect_template.js.baseline deleted file mode 100644 index f682c0fec447..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_inspect_template.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inspectTemplate) { - // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. The InspectTemplate to create. - */ - // const inspectTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - /** - * The geographic location to store the inspection template. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateInspectTemplate() { - // Construct request - const request = { - parent, - inspectTemplate, - }; - - // Run request - const response = await dlpClient.createInspectTemplate(request); - console.log(response); - } - - callCreateInspectTemplate(); - // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_job_trigger.js.baseline deleted file mode 100644 index 653488b701b7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_job_trigger.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, jobTrigger) { - // [START dlp_v2_generated_DlpService_CreateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Required. The JobTrigger to create. - */ - // const jobTrigger = {} - /** - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const triggerId = 'abc123' - /** - * The geographic location to store the job trigger. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateJobTrigger() { - // Construct request - const request = { - parent, - jobTrigger, - }; - - // Run request - const response = await dlpClient.createJobTrigger(request); - console.log(response); - } - - callCreateJobTrigger(); - // [END dlp_v2_generated_DlpService_CreateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline deleted file mode 100644 index af5ef9532dbd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, config) { - // [START dlp_v2_generated_DlpService_CreateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. Configuration of the storedInfoType to create. - */ - // const config = {} - /** - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const storedInfoTypeId = 'abc123' - /** - * The geographic location to store the stored infoType. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateStoredInfoType() { - // Construct request - const request = { - parent, - config, - }; - - // Run request - const response = await dlpClient.createStoredInfoType(request); - console.log(response); - } - - callCreateStoredInfoType(); - // [END dlp_v2_generated_DlpService_CreateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.deidentify_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.deidentify_content.js.baseline deleted file mode 100644 index 68aacb308f32..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.deidentify_content.js.baseline +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_DeidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - */ - // const deidentifyConfig = {} - /** - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to de-identify. Will be treated as text. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const deidentifyTemplateName = 'abc123' - /** - * The geographic location to process de-identification. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeidentifyContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.deidentifyContent(request); - console.log(response); - } - - callDeidentifyContent(); - // [END dlp_v2_generated_DlpService_DeidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline deleted file mode 100644 index 9832555f263e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDeidentifyTemplate(request); - console.log(response); - } - - callDeleteDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline deleted file mode 100644 index 447e30908c4e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource to be deleted. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDlpJob(request); - console.log(response); - } - - callDeleteDlpJob(); - // [END dlp_v2_generated_DlpService_DeleteDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline deleted file mode 100644 index cdc3772c5ba6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteInspectTemplate(request); - console.log(response); - } - - callDeleteInspectTemplate(); - // [END dlp_v2_generated_DlpService_DeleteInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline deleted file mode 100644 index 2fbdc72404ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteJobTrigger(request); - console.log(response); - } - - callDeleteJobTrigger(); - // [END dlp_v2_generated_DlpService_DeleteJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline deleted file mode 100644 index fe200b40d889..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteStoredInfoType(request); - console.log(response); - } - - callDeleteStoredInfoType(); - // [END dlp_v2_generated_DlpService_DeleteStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline deleted file mode 100644 index f385f82fbc26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDeidentifyTemplate(request); - console.log(response); - } - - callGetDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_dlp_job.js.baseline deleted file mode 100644 index 0518c84fd8ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDlpJob(request); - console.log(response); - } - - callGetDlpJob(); - // [END dlp_v2_generated_DlpService_GetDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_inspect_template.js.baseline deleted file mode 100644 index 9df0038d360e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_inspect_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getInspectTemplate(request); - console.log(response); - } - - callGetInspectTemplate(); - // [END dlp_v2_generated_DlpService_GetInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_job_trigger.js.baseline deleted file mode 100644 index d5b8dbce803f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getJobTrigger(request); - console.log(response); - } - - callGetJobTrigger(); - // [END dlp_v2_generated_DlpService_GetJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline deleted file mode 100644 index 59c3246e903f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getStoredInfoType(request); - console.log(response); - } - - callGetStoredInfoType(); - // [END dlp_v2_generated_DlpService_GetStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.inspect_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.inspect_content.js.baseline deleted file mode 100644 index 404760b19076..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.inspect_content.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_InspectContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to inspect. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * The geographic location to process content inspection. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callInspectContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.inspectContent(request); - console.log(response); - } - - callInspectContent(); - // [END dlp_v2_generated_DlpService_InspectContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline deleted file mode 100644 index 0740067f6f4a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDeidentifyTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listDeidentifyTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDeidentifyTemplates(); - // [END dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline deleted file mode 100644 index 07c9bcda6359..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListDlpJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * Examples: - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - /** - * The type of job. Defaults to `DlpJobType.INSPECT` - */ - // const type = {} - /** - * 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, end_time asc, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - */ - // const orderBy = 'abc123' - /** - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDlpJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listDlpJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDlpJobs(); - // [END dlp_v2_generated_DlpService_ListDlpJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_info_types.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_info_types.js.baseline deleted file mode 100644 index 1cffe8d3cc7e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_info_types.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_ListInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - */ - // const languageCode = 'abc123' - /** - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - */ - // const filter = 'abc123' - /** - * The geographic location to list info types. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInfoTypes() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.listInfoTypes(request); - console.log(response); - } - - callListInfoTypes(); - // [END dlp_v2_generated_DlpService_ListInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline deleted file mode 100644 index 7dce51a645ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListInspectTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInspectTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listInspectTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInspectTemplates(); - // [END dlp_v2_generated_DlpService_ListInspectTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_job_triggers.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_job_triggers.js.baseline deleted file mode 100644 index f109b44fbeea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_job_triggers.js.baseline +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListJobTriggers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example `projects/my-project-id`. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by a server. - */ - // const pageSize = 1234 - /** - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - */ - // const orderBy = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * Examples: - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListJobTriggers() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listJobTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobTriggers(); - // [END dlp_v2_generated_DlpService_ListJobTriggers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline deleted file mode 100644 index ac35aa07a842..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListStoredInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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, display_name, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListStoredInfoTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listStoredInfoTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStoredInfoTypes(); - // [END dlp_v2_generated_DlpService_ListStoredInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.redact_image.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.redact_image.js.baseline deleted file mode 100644 index a83c9dacd249..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.redact_image.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_RedactImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * The geographic location to process the request. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The configuration for specifying what content to redact from images. - */ - // const imageRedactionConfigs = [1,2,3,4] - /** - * Whether the response should include findings along with the redacted - * image. - */ - // const includeFindings = true - /** - * The content must be PNG, JPEG, SVG or BMP. - */ - // const byteItem = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callRedactImage() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.redactImage(request); - console.log(response); - } - - callRedactImage(); - // [END dlp_v2_generated_DlpService_RedactImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.reidentify_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.reidentify_content.js.baseline deleted file mode 100644 index fd15ba53ab2f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.reidentify_content.js.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ReidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name. - */ - // const parent = 'abc123' - /** - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - */ - // const reidentifyConfig = {} - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The item to re-identify. Will be treated as text. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const reidentifyTemplateName = 'abc123' - /** - * The geographic location to process content reidentification. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callReidentifyContent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.reidentifyContent(request); - console.log(response); - } - - callReidentifyContent(); - // [END dlp_v2_generated_DlpService_ReidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline deleted file mode 100644 index 1adcf9cf8af0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - /** - * New DeidentifyTemplate value. - */ - // const deidentifyTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateDeidentifyTemplate(request); - console.log(response); - } - - callUpdateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_inspect_template.js.baseline deleted file mode 100644 index 327d9d94bd37..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_inspect_template.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - /** - * New InspectTemplate value. - */ - // const inspectTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateInspectTemplate(request); - console.log(response); - } - - callUpdateInspectTemplate(); - // [END dlp_v2_generated_DlpService_UpdateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_job_trigger.js.baseline deleted file mode 100644 index 3db941a8b878..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_job_trigger.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - /** - * New JobTrigger value. - */ - // const jobTrigger = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateJobTrigger(request); - console.log(response); - } - - callUpdateJobTrigger(); - // [END dlp_v2_generated_DlpService_UpdateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline deleted file mode 100644 index 2ca0268ae2ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - /** - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - */ - // const config = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateStoredInfoType(request); - console.log(response); - } - - callUpdateStoredInfoType(); - // [END dlp_v2_generated_DlpService_UpdateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline deleted file mode 100644 index 1dd4ff44c0f6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline +++ /dev/null @@ -1,1535 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dlp", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.privacy.dlp.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "dlp_v2_generated_DlpService_InspectContent_async", - "title": "DlpService inspectContent Sample", - "origin": "API_DEFINITION", - "description": " Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated. For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,", - "canonical": true, - "file": "dlp_service.inspect_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_RedactImage_async", - "title": "DlpService redactImage Sample", - "origin": "API_DEFINITION", - "description": " Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.redact_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "image_redaction_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "include_findings", - "type": "TYPE_BOOL" - }, - { - "name": "byte_item", - "type": ".google.privacy.dlp.v2.ByteContentItem" - } - ], - "resultType": ".google.privacy.dlp.v2.RedactImageResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeidentifyContent_async", - "title": "DlpService deidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.deidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 89, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ReidentifyContent_async", - "title": "DlpService reidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " Re-identifies content that has been de-identified. See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.", - "canonical": true, - "file": "dlp_service.reidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 95, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ReidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInfoTypes_async", - "title": "DlpService listInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of the sensitive information types that the DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.", - "canonical": true, - "file": "dlp_service.list_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "async": true, - "parameters": [ - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateInspectTemplate_async", - "title": "DlpService createInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.create_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateInspectTemplate_async", - "title": "DlpService updateInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.update_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetInspectTemplate_async", - "title": "DlpService getInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.get_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInspectTemplates_async", - "title": "DlpService listInspectTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.list_inspect_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInspectTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteInspectTemplate_async", - "title": "DlpService deleteInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.delete_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async", - "title": "DlpService createDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.create_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async", - "title": "DlpService updateDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.update_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDeidentifyTemplate_async", - "title": "DlpService getDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.get_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDeidentifyTemplates_async", - "title": "DlpService listDeidentifyTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.list_deidentify_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDeidentifyTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async", - "title": "DlpService deleteDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.delete_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateJobTrigger_async", - "title": "DlpService createJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.create_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateJobTrigger_async", - "title": "DlpService updateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.update_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetJobTrigger_async", - "title": "DlpService getJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.get_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListJobTriggers_async", - "title": "DlpService listJobTriggers Sample", - "origin": "API_DEFINITION", - "description": " Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.list_job_triggers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListJobTriggersResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteJobTrigger_async", - "title": "DlpService deleteJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.delete_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ActivateJobTrigger_async", - "title": "DlpService activateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.", - "canonical": true, - "file": "dlp_service.activate_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDlpJob_async", - "title": "DlpService createDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.create_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_job", - "type": ".google.privacy.dlp.v2.InspectJobConfig" - }, - { - "name": "risk_job", - "type": ".google.privacy.dlp.v2.RiskAnalysisJobConfig" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDlpJobs_async", - "title": "DlpService listDlpJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists DlpJobs that match the specified filter in the request. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.list_dlp_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 111, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": ".google.privacy.dlp.v2.DlpJobType" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDlpJobsResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDlpJob_async", - "title": "DlpService getDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the latest state of a long-running DlpJob. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.get_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDlpJob_async", - "title": "DlpService deleteDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.delete_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CancelDlpJob_async", - "title": "DlpService cancelDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.cancel_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateStoredInfoType_async", - "title": "DlpService createStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.create_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "stored_info_type_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateStoredInfoType_async", - "title": "DlpService updateStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Updates the stored infoType by creating a new version. The existing version will continue to be used until the new version is ready. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.update_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetStoredInfoType_async", - "title": "DlpService getStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.get_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListStoredInfoTypes_async", - "title": "DlpService listStoredInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.list_stored_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListStoredInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteStoredInfoType_async", - "title": "DlpService deleteStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.delete_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/dlp-esm/webpack.config.cjs.baseline deleted file mode 100644 index 4eaa3715661d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DlpService', - filename: './dlp-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.OwlBot.yaml.baseline deleted file mode 100644 index ec5105fb19ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/privacy/dlp/google-privacy-dlp-nodejs - dest: /owl-bot-staging/google-privacy-dlp - -api-name: dlp \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.jsdoc.js.baseline deleted file mode 100644 index a8ba345a7c51..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'dlp', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/README.md.baseline deleted file mode 100644 index 385d81b529f4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Dlp: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/dlp.svg)](https://www.npmjs.org/package/dlp) - -Dlp client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Dlp Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/dlp/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Dlp API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install dlp -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install dlp@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=dlp.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-privacy-dlp diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/package.json b/core/generator/gapic-generator-typescript/baselines/dlp/package.json deleted file mode 100644 index 9de123fa37a0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "dlp", - "version": "0.1.0", - "description": "Dlp client for Node.js", - "repository": "googleapis/nodejs-dlp", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google dlp", - "dlp", - "dlp service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/dlp.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/dlp.proto.baseline deleted file mode 100644 index f94df6e67529..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/dlp.proto.baseline +++ /dev/null @@ -1,3775 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.privacy.dlp.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/privacy/dlp/v2/storage.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; -import "google/type/dayofweek.proto"; -import "google/type/timeofday.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; -option java_multiple_files = true; -option java_outer_classname = "DlpProto"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; - -// 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/. -service DlpService { - option (google.api.default_host) = "dlp.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Finds potentially sensitive info in content. - // This method has limits on input size, processing time, and output size. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - // and https://cloud.google.com/dlp/docs/inspecting-text, - rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:inspect" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:inspect" - body: "*" - } - }; - } - - // Redacts potentially sensitive info from an image. - // This method has limits on input size, processing time, and output size. - // See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc RedactImage(RedactImageRequest) returns (RedactImageResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/image:redact" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/image:redact" - body: "*" - } - }; - } - - // De-identifies potentially sensitive info from a ContentItem. - // This method has limits on input size and output size. - // See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - // learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in this request, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:deidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:deidentify" - body: "*" - } - }; - } - - // Re-identifies content that has been de-identified. - // See - // https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - // to learn more. - rpc ReidentifyContent(ReidentifyContentRequest) returns (ReidentifyContentResponse) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/content:reidentify" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/content:reidentify" - body: "*" - } - }; - } - - // Returns a list of the sensitive information types that the DLP API - // supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - // learn more. - rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/infoTypes" - additional_bindings { - get: "/v2/locations/{location_id}/infoTypes" - } - }; - option (google.api.method_signature) = "location_id"; - } - - // Creates an InspectTemplate for re-using frequently used configuration - // for inspecting content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc CreateInspectTemplate(CreateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/inspectTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/inspectTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/inspectTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_template"; - option (google.api.method_signature) = "parent,inspect_template,location_id"; - } - - // Updates the InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc UpdateInspectTemplate(UpdateInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/inspectTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/inspectTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,inspect_template,update_mask"; - } - - // Gets an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc GetInspectTemplate(GetInspectTemplateRequest) returns (InspectTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists InspectTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc ListInspectTemplates(ListInspectTemplatesRequest) returns (ListInspectTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/inspectTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/inspectTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/inspectTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an InspectTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates to learn more. - rpc DeleteInspectTemplate(DeleteInspectTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/inspectTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/inspectTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/inspectTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a DeidentifyTemplate for re-using frequently used configuration - // for de-identifying content, images, and storage. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/deidentifyTemplates" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/deidentifyTemplates" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/deidentifyTemplates" - body: "*" - } - }; - option (google.api.method_signature) = "parent,deidentify_template"; - option (google.api.method_signature) = "parent,deidentify_template,location_id"; - } - - // Updates the DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc UpdateDeidentifyTemplate(UpdateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/deidentifyTemplates/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/deidentifyTemplates/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,deidentify_template,update_mask"; - } - - // Gets a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc GetDeidentifyTemplate(GetDeidentifyTemplateRequest) returns (DeidentifyTemplate) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists DeidentifyTemplates. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc ListDeidentifyTemplates(ListDeidentifyTemplatesRequest) returns (ListDeidentifyTemplatesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/deidentifyTemplates" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/deidentifyTemplates" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/deidentifyTemplates" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a DeidentifyTemplate. - // See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - // more. - rpc DeleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/deidentifyTemplates/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/deidentifyTemplates/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/deidentifyTemplates/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a job trigger to run DLP actions such as scanning storage for - // sensitive information on a set schedule. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc CreateJobTrigger(CreateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/jobTriggers" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/jobTriggers" - body: "*" - } - }; - option (google.api.method_signature) = "parent,job_trigger"; - option (google.api.method_signature) = "parent,job_trigger,location_id"; - } - - // Updates a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc UpdateJobTrigger(UpdateJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - patch: "/v2/{name=projects/*/jobTriggers/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,job_trigger,update_mask"; - } - - // Gets a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc GetJobTrigger(GetJobTriggerRequest) returns (JobTrigger) { - option (google.api.http) = { - get: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists job triggers. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc ListJobTriggers(ListJobTriggersRequest) returns (ListJobTriggersResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/jobTriggers" - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/jobTriggers" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a job trigger. - // See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - rpc DeleteJobTrigger(DeleteJobTriggerRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/jobTriggers/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/jobTriggers/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Activate a job trigger. Causes the immediate execute of a trigger - // instead of waiting on the trigger event to occur. - rpc ActivateJobTrigger(ActivateJobTriggerRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{name=projects/*/jobTriggers/*}:activate" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/jobTriggers/*}:activate" - body: "*" - } - }; - } - - // Creates a new job to inspect storage or calculate risk metrics. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - // - // When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - // system will automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - rpc CreateDlpJob(CreateDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - post: "/v2/{parent=projects/*}/dlpJobs" - body: "*" - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/dlpJobs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,inspect_job"; - option (google.api.method_signature) = "parent,inspect_job,location_id"; - option (google.api.method_signature) = "parent,risk_job"; - option (google.api.method_signature) = "parent,risk_job,location_id"; - } - - // Lists DlpJobs that match the specified filter in the request. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc ListDlpJobs(ListDlpJobsRequest) returns (ListDlpJobsResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*}/dlpJobs" - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/dlpJobs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the latest state of a long-running DlpJob. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc GetDlpJob(GetDlpJobRequest) returns (DlpJob) { - option (google.api.http) = { - get: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a long-running DlpJob. This method indicates that the client is - // no longer interested in the DlpJob result. The job will be cancelled if - // possible. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc DeleteDlpJob(DeleteDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/dlpJobs/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/dlpJobs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Starts asynchronous cancellation on a long-running DlpJob. The server - // makes a best effort to cancel the DlpJob, but success is not - // guaranteed. - // See https://cloud.google.com/dlp/docs/inspecting-storage and - // https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - rpc CancelDlpJob(CancelDlpJobRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=projects/*/dlpJobs/*}:cancel" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/dlpJobs/*}:cancel" - body: "*" - } - }; - } - - // Creates a pre-built stored infoType to be used for inspection. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc CreateStoredInfoType(CreateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - post: "/v2/{parent=organizations/*}/storedInfoTypes" - body: "*" - additional_bindings { - post: "/v2/{parent=organizations/*}/locations/{location_id}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/storedInfoTypes" - body: "*" - } - additional_bindings { - post: "/v2/{parent=projects/*}/locations/{location_id}/storedInfoTypes" - body: "*" - } - }; - option (google.api.method_signature) = "parent,config"; - option (google.api.method_signature) = "parent,config,location_id"; - } - - // Updates the stored infoType by creating a new version. The existing version - // will continue to be used until the new version is ready. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc UpdateStoredInfoType(UpdateStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - patch: "/v2/{name=organizations/*/storedInfoTypes/*}" - body: "*" - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/storedInfoTypes/*}" - body: "*" - } - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - body: "*" - } - }; - option (google.api.method_signature) = "name,config,update_mask"; - } - - // Gets a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc GetStoredInfoType(GetStoredInfoTypeRequest) returns (StoredInfoType) { - option (google.api.http) = { - get: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - get: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists stored infoTypes. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc ListStoredInfoTypes(ListStoredInfoTypesRequest) returns (ListStoredInfoTypesResponse) { - option (google.api.http) = { - get: "/v2/{parent=organizations/*}/storedInfoTypes" - additional_bindings { - get: "/v2/{parent=organizations/*}/locations/{location_id}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*}/storedInfoTypes" - } - additional_bindings { - get: "/v2/{parent=projects/*}/locations/{location_id}/storedInfoTypes" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a stored infoType. - // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - // learn more. - rpc DeleteStoredInfoType(DeleteStoredInfoTypeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=organizations/*/storedInfoTypes/*}" - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/storedInfoTypes/*}" - } - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/storedInfoTypes/*}" - } - }; - option (google.api.method_signature) = "name"; - } -} - -// List of exclude infoTypes. -message ExcludeInfoTypes { - // InfoType list in ExclusionRule rule drops a finding when it overlaps or - // contained within with a finding of an infoType from this list. For - // example, for `InspectionRuleSet.info_types` containing "PHONE_NUMBER"` and - // `exclusion_rule` containing `exclude_info_types.info_types` with - // "EMAIL_ADDRESS" the phone number findings are dropped if they overlap - // with EMAIL_ADDRESS finding. - // That leads to "555-222-2222@example.org" to generate only a single - // finding, namely email address. - repeated InfoType info_types = 1; -} - -// The rule that specifies conditions when findings of infoTypes specified in -// `InspectionRuleSet` are removed from results. -message ExclusionRule { - // Exclusion rule types. - oneof type { - // Dictionary which defines the rule. - CustomInfoType.Dictionary dictionary = 1; - - // Regular expression which defines the rule. - CustomInfoType.Regex regex = 2; - - // Set of infoTypes for which findings would affect this rule. - ExcludeInfoTypes exclude_info_types = 3; - } - - // How the rule is applied, see MatchingType documentation for details. - MatchingType matching_type = 4; -} - -// A single inspection rule to be applied to infoTypes, specified in -// `InspectionRuleSet`. -message InspectionRule { - // Inspection rule types. - oneof type { - // Hotword-based detection rule. - CustomInfoType.DetectionRule.HotwordRule hotword_rule = 1; - - // Exclusion rule. - ExclusionRule exclusion_rule = 2; - } -} - -// Rule set for modifying a set of infoTypes to alter behavior under certain -// circumstances, depending on the specific details of the rules within the set. -message InspectionRuleSet { - // List of infoTypes this rule set is applied to. - repeated InfoType info_types = 1; - - // Set of rules to be applied to infoTypes. The rules are applied in order. - repeated InspectionRule rules = 2; -} - -// Configuration description of the scanning process. -// When used with redactContent only info_types and min_likelihood are currently -// used. -message InspectConfig { - // Configuration to control the number of findings returned. - message FindingLimits { - // Max findings configuration per infoType, per content item or long - // running DlpJob. - message InfoTypeLimit { - // Type of information the findings limit applies to. Only one limit per - // info_type should be provided. If InfoTypeLimit does not have an - // info_type, the DLP API applies the limit against all info_types that - // are found but not specified in another InfoTypeLimit. - InfoType info_type = 1; - - // Max findings limit for the given infoType. - int32 max_findings = 2; - } - - // Max number of findings that will be returned for each item scanned. - // When set within `InspectDataSourceRequest`, - // the maximum returned is 2000 regardless if this is set higher. - // When set within `InspectContentRequest`, this field is ignored. - int32 max_findings_per_item = 1; - - // Max number of findings that will be returned per request/job. - // When set within `InspectContentRequest`, the maximum returned is 2000 - // regardless if this is set higher. - int32 max_findings_per_request = 2; - - // Configuration of findings limit given for specified infoTypes. - repeated InfoTypeLimit max_findings_per_info_type = 3; - } - - // Restricts what info_types to look for. The values must correspond to - // InfoType values returned by ListInfoTypes or listed at - // https://cloud.google.com/dlp/docs/infotypes-reference. - // - // When no InfoTypes or CustomInfoTypes are specified in a request, the - // system may automatically choose what detectors to run. By default this may - // be all types, but may change over time as detectors are updated. - // - // If you need precise control and predictability as to what detectors are - // run you should specify specific InfoTypes listed in the reference, - // otherwise a default list will be used, which may change over time. - repeated InfoType info_types = 1; - - // Only returns findings equal or above this threshold. The default is - // POSSIBLE. - // See https://cloud.google.com/dlp/docs/likelihood to learn more. - Likelihood min_likelihood = 2; - - // Configuration to control the number of findings returned. - FindingLimits limits = 3; - - // When true, a contextual quote from the data that triggered a finding is - // included in the response; see Finding.quote. - bool include_quote = 4; - - // When true, excludes type information of the findings. - bool exclude_info_types = 5; - - // CustomInfoTypes provided by the user. See - // https://cloud.google.com/dlp/docs/creating-custom-infotypes to learn more. - repeated CustomInfoType custom_info_types = 6; - - // List of options defining data content to scan. - // If empty, text, images, and other content will be included. - repeated ContentOption content_options = 8; - - // Set of rules to apply to the findings for this InspectConfig. - // Exclusion rules, contained in the set are executed in the end, other - // rules are executed in the order they are specified for each info type. - repeated InspectionRuleSet rule_set = 10; -} - -// Container for bytes to inspect or redact. -message ByteContentItem { - // The type of data being sent to in data. - enum BytesType { - // Unused - BYTES_TYPE_UNSPECIFIED = 0; - - // Any image type. - IMAGE = 6; - - // jpeg - IMAGE_JPEG = 1; - - // bmp - IMAGE_BMP = 2; - - // png - IMAGE_PNG = 3; - - // svg - IMAGE_SVG = 4; - - // plain text - TEXT_UTF8 = 5; - - // avro - AVRO = 11; - } - - // The type of data stored in the bytes string. Default will be TEXT_UTF8. - BytesType type = 1; - - // Content data to inspect or redact. - bytes data = 2; -} - -// Container structure for the content to inspect. -message ContentItem { - // Data of the item either in the byte array or UTF-8 string form, or table. - oneof data_item { - // String data to inspect or redact. - string value = 3; - - // Structured content for inspection. See - // https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to - // learn more. - Table table = 4; - - // Content data to inspect or redact. Replaces `type` and `data`. - ByteContentItem byte_item = 5; - } -} - -// Structured content to inspect. Up to 50,000 `Value`s per request allowed. -// See https://cloud.google.com/dlp/docs/inspecting-text#inspecting_a_table to -// learn more. -message Table { - // Values of the row. - message Row { - // Individual cells. - repeated Value values = 1; - } - - // Headers of the table. - repeated FieldId headers = 1; - - // Rows of the table. - repeated Row rows = 2; -} - -// All the findings for a single scanned item. -message InspectResult { - // List of findings for an item. - repeated Finding findings = 1; - - // If true, then this item might have more findings than were returned, - // and the findings returned are an arbitrary subset of all findings. - // The findings list might be truncated because the input items were too - // large, or because the server reached the maximum amount of resources - // allowed for a single API call. For best results, divide the input into - // smaller batches. - bool findings_truncated = 2; -} - -// Represents a piece of potentially sensitive content. -message Finding { - // The content that was found. Even if the content is not textual, it - // may be converted to a textual representation here. - // Provided if `include_quote` is true and the finding is - // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes - // in length, the quote may be omitted. - string quote = 1; - - // The type of content that might have been found. - // Provided if `excluded_types` is false. - InfoType info_type = 2; - - // Confidence of how likely it is that the `info_type` is correct. - Likelihood likelihood = 3; - - // Where the content was found. - Location location = 4; - - // Timestamp when finding was detected. - google.protobuf.Timestamp create_time = 6; - - // Contains data parsed from quotes. Only populated if include_quote was set - // to true and a supported infoType was requested. Currently supported - // infoTypes: DATE, DATE_OF_BIRTH and TIME. - QuoteInfo quote_info = 7; -} - -// Specifies the location of the finding. -message Location { - // Zero-based byte offsets delimiting the finding. - // These are relative to the finding's containing element. - // Note that when the content is not textual, this references - // the UTF-8 encoded textual representation of the content. - // Omitted if content is an image. - Range byte_range = 1; - - // Unicode character offsets delimiting the finding. - // These are relative to the finding's containing element. - // Provided when the content is text. - Range codepoint_range = 2; - - // List of nested objects pointing to the precise location of the finding - // within the file or record. - repeated ContentLocation content_locations = 7; -} - -// Findings container location data. -message ContentLocation { - // Name of the container where the finding is located. - // The top level name is the source file name or table name. Names of some - // common storage containers are formatted as follows: - // - // * BigQuery tables: `{project_id}:{dataset_id}.{table_id}` - // * Cloud Storage files: `gs://{bucket}/{path}` - // * Datastore namespace: {namespace} - // - // Nested names could be absent if the embedded object has no string - // identifier (for an example an image contained within a document). - string container_name = 1; - - // Type of the container within the file with location of the finding. - oneof location { - // Location within a row or record of a database table. - RecordLocation record_location = 2; - - // Location within an image's pixels. - ImageLocation image_location = 3; - - // Location data for document files. - DocumentLocation document_location = 5; - } - - // Findings container modification timestamp, if applicable. - // For Google Cloud Storage contains last file modification timestamp. - // For BigQuery table contains last_modified_time property. - // For Datastore - not populated. - google.protobuf.Timestamp container_timestamp = 6; - - // Findings container version, if available - // ("generation" for Google Cloud Storage). - string container_version = 7; -} - -// Location of a finding within a document. -message DocumentLocation { - // Offset of the line, from the beginning of the file, where the finding - // is located. - int64 file_offset = 1; -} - -// Location of a finding within a row or record. -message RecordLocation { - // Key of the finding. - RecordKey record_key = 1; - - // Field id of the field containing the finding. - FieldId field_id = 2; - - // Location within a `ContentItem.Table`. - TableLocation table_location = 3; -} - -// Location of a finding within a table. -message TableLocation { - // The zero-based index of the row where the finding is located. - int64 row_index = 1; -} - -// Generic half-open interval [start, end) -message Range { - // Index of the first character of the range (inclusive). - int64 start = 1; - - // Index of the last character of the range (exclusive). - int64 end = 2; -} - -// Location of the finding within an image. -message ImageLocation { - // Bounding boxes locating the pixels within the image containing the finding. - repeated BoundingBox bounding_boxes = 1; -} - -// Bounding box encompassing detected text within an image. -message BoundingBox { - // Top coordinate of the bounding box. (0,0) is upper left. - int32 top = 1; - - // Left coordinate of the bounding box. (0,0) is upper left. - int32 left = 2; - - // Width of the bounding box in pixels. - int32 width = 3; - - // Height of the bounding box in pixels. - int32 height = 4; -} - -// Request to search for potentially sensitive info in an image and redact it -// by covering it with a colored rectangle. -message RedactImageRequest { - // Configuration for determining how redaction of images should occur. - message ImageRedactionConfig { - // Type of information to redact from images. - oneof target { - // Only one per info_type should be provided per request. If not - // specified, and redact_all_text is false, the DLP API will redact all - // text that it matches against all info_types that are found, but not - // specified in another ImageRedactionConfig. - InfoType info_type = 1; - - // If true, all text found in the image, regardless whether it matches an - // info_type, is redacted. Only one should be provided. - bool redact_all_text = 2; - } - - // The color to use when redacting content from an image. If not specified, - // the default is black. - Color redaction_color = 3; - } - - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // The geographic location to process the request. Reserved for future - // extensions. - string location_id = 8; - - // Configuration for the inspector. - InspectConfig inspect_config = 2; - - // The configuration for specifying what content to redact from images. - repeated ImageRedactionConfig image_redaction_configs = 5; - - // Whether the response should include findings along with the redacted - // image. - bool include_findings = 6; - - // The content must be PNG, JPEG, SVG or BMP. - ByteContentItem byte_item = 7; -} - -// Represents a color in the RGB color space. -message Color { - // The amount of red in the color as a value in the interval [0, 1]. - float red = 1; - - // The amount of green in the color as a value in the interval [0, 1]. - float green = 2; - - // The amount of blue in the color as a value in the interval [0, 1]. - float blue = 3; -} - -// Results of redacting an image. -message RedactImageResponse { - // The redacted image. The type will be the same as the original image. - bytes redacted_image = 1; - - // If an image was being inspected and the InspectConfig's include_quote was - // set to true, then this field will include all text, if any, that was found - // in the image. - string extracted_text = 2; - - // The findings. Populated when include_findings in the request is true. - InspectResult inspect_result = 3; -} - -// Request to de-identify a list of items. -message DeidentifyContentRequest { - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // Configuration for the de-identification of the content item. - // Items specified here will override the template referenced by the - // deidentify_template_name argument. - DeidentifyConfig deidentify_config = 2; - - // Configuration for the inspector. - // Items specified here will override the template referenced by the - // inspect_template_name argument. - InspectConfig inspect_config = 3; - - // The item to de-identify. Will be treated as text. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. Any configuration directly specified in - // deidentify_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string deidentify_template_name = 6; - - // The geographic location to process de-identification. Reserved for future - // extensions. - string location_id = 7; -} - -// Results of de-identifying a ContentItem. -message DeidentifyContentResponse { - // The de-identified item. - ContentItem item = 1; - - // An overview of the changes that were made on the `item`. - TransformationOverview overview = 2; -} - -// Request to re-identify an item. -message ReidentifyContentRequest { - // Required. The parent resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Configuration for the re-identification of the content item. - // This field shares the same proto message type that is used for - // de-identification, however its usage here is for the reversal of the - // previous de-identification. Re-identification is performed by examining - // the transformations used to de-identify the items and executing the - // reverse. This requires that only reversible transformations - // be provided here. The reversible transformations are: - // - // - `CryptoDeterministicConfig` - // - `CryptoReplaceFfxFpeConfig` - DeidentifyConfig reidentify_config = 2; - - // Configuration for the inspector. - InspectConfig inspect_config = 3; - - // The item to re-identify. Will be treated as text. - ContentItem item = 4; - - // Template to use. Any configuration directly specified in - // `inspect_config` will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 5; - - // Template to use. References an instance of `DeidentifyTemplate`. - // Any configuration directly specified in `reidentify_config` or - // `inspect_config` will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string reidentify_template_name = 6; - - // The geographic location to process content reidentification. Reserved for - // future extensions. - string location_id = 7; -} - -// Results of re-identifying a item. -message ReidentifyContentResponse { - // The re-identified item. - ContentItem item = 1; - - // An overview of the changes that were made to the `item`. - TransformationOverview overview = 2; -} - -// Request to search for potentially sensitive info in a ContentItem. -message InspectContentRequest { - // The parent resource name, for example projects/my-project-id. - string parent = 1 [(google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - }]; - - // Configuration for the inspector. What specified here will override - // the template referenced by the inspect_template_name argument. - InspectConfig inspect_config = 2; - - // The item to inspect. - ContentItem item = 3; - - // Template to use. Any configuration directly specified in - // inspect_config will override those set in the template. Singular fields - // that are set in this request will replace their corresponding fields in the - // template. Repeated fields are appended. Singular sub-messages and groups - // are recursively merged. - string inspect_template_name = 4; - - // The geographic location to process content inspection. Reserved for future - // extensions. - string location_id = 5; -} - -// Results of inspecting an item. -message InspectContentResponse { - // The findings. - InspectResult result = 1; -} - -// Cloud repository for storing output. -message OutputStorageConfig { - // Predefined schemas for storing findings. - enum OutputSchema { - // Unused. - OUTPUT_SCHEMA_UNSPECIFIED = 0; - - // Basic schema including only `info_type`, `quote`, `certainty`, and - // `timestamp`. - BASIC_COLUMNS = 1; - - // Schema tailored to findings from scanning Google Cloud Storage. - GCS_COLUMNS = 2; - - // Schema tailored to findings from scanning Google Datastore. - DATASTORE_COLUMNS = 3; - - // Schema tailored to findings from scanning Google BigQuery. - BIG_QUERY_COLUMNS = 4; - - // Schema containing all columns. - ALL_COLUMNS = 5; - } - - // Output storage types. - oneof type { - // Store findings in an existing table or a new table in an existing - // dataset. If table_id is not set a new one will be generated - // for you with the following format: - // dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific timezone will be used for - // generating the date details. - // - // For Inspect, each column in an existing output table must have the same - // name, type, and mode of a field in the `Finding` object. - // - // For Risk, an existing output table should be the output of a previous - // Risk analysis job run on the same source table, with the same privacy - // metric and quasi-identifiers. Risk jobs that analyze the same table but - // compute a different privacy metric, or use different sets of - // quasi-identifiers, cannot store their results in the same table. - BigQueryTable table = 1; - } - - // Schema used for writing the findings for Inspect jobs. This field is only - // used for Inspect and must be unspecified for Risk jobs. Columns are derived - // from the `Finding` object. If appending to an existing table, any columns - // from the predefined schema that are missing will be added. No columns in - // the existing table will be deleted. - // - // If unspecified, then all available columns will be used for a new table or - // an (existing) table with no schema, and no changes will be made to an - // existing table that has a schema. - OutputSchema output_schema = 3; -} - -// Statistics regarding a specific InfoType. -message InfoTypeStats { - // The type of finding this stat is for. - InfoType info_type = 1; - - // Number of findings for this infoType. - int64 count = 2; -} - -// The results of an inspect DataSource job. -message InspectDataSourceDetails { - // Snapshot of the inspection configuration. - message RequestedOptions { - // If run with an InspectTemplate, a snapshot of its state at the time of - // this run. - InspectTemplate snapshot_inspect_template = 1; - - // Inspect config. - InspectJobConfig job_config = 3; - } - - // All result fields mentioned below are updated while the job is processing. - message Result { - // Total size in bytes that were processed. - int64 processed_bytes = 1; - - // Estimate of the number of bytes to process. - int64 total_estimated_bytes = 2; - - // Statistics of how many instances of each info type were found during - // inspect job. - repeated InfoTypeStats info_type_stats = 3; - } - - // The configuration used for this job. - RequestedOptions requested_options = 2; - - // A summary of the outcome of this inspect job. - Result result = 3; -} - -// InfoType description. -message InfoTypeDescription { - // Internal name of the infoType. - string name = 1; - - // Human readable form of the infoType name. - string display_name = 2; - - // Which parts of the API supports this InfoType. - repeated InfoTypeSupportedBy supported_by = 3; - - // Description of the infotype. Translated when language is provided in the - // request. - string description = 4; -} - -// Request for the list of infoTypes. -message ListInfoTypesRequest { - // BCP-47 language code for localized infoType friendly - // names. If omitted, or if localized strings are not available, - // en-US strings will be returned. - string language_code = 1; - - // filter to only return infoTypes supported by certain parts of the - // API. Defaults to supported_by=INSPECT. - string filter = 2; - - // The geographic location to list info types. Reserved for future - // extensions. - string location_id = 3; -} - -// Response to the ListInfoTypes request. -message ListInfoTypesResponse { - // Set of sensitive infoTypes. - repeated InfoTypeDescription info_types = 1; -} - -// Configuration for a risk analysis job. See -// https://cloud.google.com/dlp/docs/concepts-risk-analysis to learn more. -message RiskAnalysisJobConfig { - // Privacy metric to compute. - PrivacyMetric privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable source_table = 2; - - // Actions to execute at the completion of the job. Are executed in the order - // provided. - repeated Action actions = 3; -} - -// A column with a semantic tag attached. -message QuasiId { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } -} - -// An auxiliary table containing statistical information on the relative -// frequency of different quasi-identifiers values. It has one or several -// quasi-identifiers columns, and one column that indicates the relative -// frequency of each quasi-identifier tuple. -// If a tuple is present in the data but not in the auxiliary table, the -// corresponding relative frequency is assumed to be zero (and thus, the -// tuple is highly reidentifiable). -message StatisticalTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdentifierField { - // Identifies the column. - FieldId field = 1; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdentifierField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Privacy metric to compute for reidentification risk analysis. -message PrivacyMetric { - // Compute numerical stats over an individual column, including - // min, max, and quantiles. - message NumericalStatsConfig { - // Field to compute numerical stats on. Supported types are - // integer, float, date, datetime, timestamp, time. - FieldId field = 1; - } - - // Compute numerical stats over an individual column, including - // number of distinct values and value count distribution. - message CategoricalStatsConfig { - // Field to compute categorical stats on. All column types are - // supported except for arrays and structs. However, it may be more - // informative to use NumericalStats when the field type is supported, - // depending on the data. - FieldId field = 1; - } - - // k-anonymity metric, used for analysis of reidentification risk. - message KAnonymityConfig { - // Set of fields to compute k-anonymity over. When multiple fields are - // specified, they are considered a single composite key. Structs and - // repeated data types are not supported; however, nested fields are - // supported so long as they are not structs themselves or nested within - // a repeated field. - repeated FieldId quasi_ids = 1; - - // Message indicating that multiple rows might be associated to a - // single individual. If the same entity_id is associated to multiple - // quasi-identifier tuples over distinct rows, we consider the entire - // collection of tuples as the composite quasi-identifier. This collection - // is a multiset: the order in which the different tuples appear in the - // dataset is ignored, but their frequency is taken into account. - // - // Important note: a maximum of 1000 rows can be associated to a single - // entity ID. If more rows are associated with the same entity ID, some - // might be ignored. - EntityId entity_id = 2; - } - - // l-diversity metric, used for analysis of reidentification risk. - message LDiversityConfig { - // Set of quasi-identifiers indicating how equivalence classes are - // defined for the l-diversity computation. When multiple fields are - // specified, they are considered a single composite key. - repeated FieldId quasi_ids = 1; - - // Sensitive field for computing the l-value. - FieldId sensitive_attribute = 2; - } - - // Reidentifiability metric. This corresponds to a risk model similar to what - // is called "journalist risk" in the literature, except the attack dataset is - // statistically modeled instead of being perfectly known. This can be done - // using publicly available data (like the US Census), or using a custom - // statistical model (indicated as one or several BigQuery tables), or by - // extrapolating from the distribution of values in the input dataset. - message KMapEstimationConfig { - // A column with a semantic tag attached. - message TaggedField { - // Required. Identifies the column. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Semantic tag that identifies what a column contains, to determine which - // statistical model to use to estimate the reidentifiability of each - // value. [required] - oneof tag { - // A column can be tagged with a InfoType to use the relevant public - // dataset as a statistical model of population, if available. We - // currently support US ZIP codes, region codes, ages and genders. - // To programmatically obtain the list of supported InfoTypes, use - // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. - InfoType info_type = 2; - - // A column can be tagged with a custom tag. In this case, the user must - // indicate an auxiliary table that contains statistical information on - // the possible values of this column (below). - string custom_tag = 3; - - // If no semantic tag is indicated, we infer the statistical model from - // the distribution of values in the input data - google.protobuf.Empty inferred = 4; - } - } - - // An auxiliary table contains statistical information on the relative - // frequency of different quasi-identifiers values. It has one or several - // quasi-identifiers columns, and one column that indicates the relative - // frequency of each quasi-identifier tuple. - // If a tuple is present in the data but not in the auxiliary table, the - // corresponding relative frequency is assumed to be zero (and thus, the - // tuple is highly reidentifiable). - message AuxiliaryTable { - // A quasi-identifier column has a custom_tag, used to know which column - // in the data corresponds to which column in the statistical model. - message QuasiIdField { - // Identifies the column. - FieldId field = 1; - - // A auxiliary field. - string custom_tag = 2; - } - - // Required. Auxiliary table location. - BigQueryTable table = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Quasi-identifier columns. - repeated QuasiIdField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The relative frequency column must contain a floating-point number - // between 0 and 1 (inclusive). Null values are assumed to be zero. - FieldId relative_frequency = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Fields considered to be quasi-identifiers. No two columns can have the - // same tag. - repeated TaggedField quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers column must appear in exactly one column - // of one auxiliary table. - repeated AuxiliaryTable auxiliary_tables = 3; - } - - // δ-presence metric, used to estimate how likely it is for an attacker to - // figure out that one given individual appears in a de-identified dataset. - // Similarly to the k-map metric, we cannot compute δ-presence exactly without - // knowing the attack dataset, so we use a statistical model instead. - message DeltaPresenceEstimationConfig { - // Required. Fields considered to be quasi-identifiers. No two fields can have the - // same tag. - repeated QuasiId quasi_ids = 1 [(google.api.field_behavior) = REQUIRED]; - - // ISO 3166-1 alpha-2 region code to use in the statistical modeling. - // Set if no column is tagged with a region-specific InfoType (like - // US_ZIP_5) or a region code. - string region_code = 2; - - // Several auxiliary tables can be used in the analysis. Each custom_tag - // used to tag a quasi-identifiers field must appear in exactly one - // field of one auxiliary table. - repeated StatisticalTable auxiliary_tables = 3; - } - - // Types of analysis. - oneof type { - // Numerical stats - NumericalStatsConfig numerical_stats_config = 1; - - // Categorical stats - CategoricalStatsConfig categorical_stats_config = 2; - - // K-anonymity - KAnonymityConfig k_anonymity_config = 3; - - // l-diversity - LDiversityConfig l_diversity_config = 4; - - // k-map - KMapEstimationConfig k_map_estimation_config = 5; - - // delta-presence - DeltaPresenceEstimationConfig delta_presence_estimation_config = 6; - } -} - -// Result of a risk analysis operation request. -message AnalyzeDataSourceRiskDetails { - // Result of the numerical stats computation. - message NumericalStatsResult { - // Minimum value appearing in the column. - Value min_value = 1; - - // Maximum value appearing in the column. - Value max_value = 2; - - // List of 99 values that partition the set of field values into 100 equal - // sized buckets. - repeated Value quantile_values = 4; - } - - // Result of the categorical stats computation. - message CategoricalStatsResult { - // Histogram of value frequencies in the column. - message CategoricalStatsHistogramBucket { - // Lower bound on the value frequency of the values in this bucket. - int64 value_frequency_lower_bound = 1; - - // Upper bound on the value frequency of the values in this bucket. - int64 value_frequency_upper_bound = 2; - - // Total number of values in this bucket. - int64 bucket_size = 3; - - // Sample of value frequencies in this bucket. The total number of - // values returned per bucket is capped at 20. - repeated ValueFrequency bucket_values = 4; - - // Total number of distinct values in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of value frequencies in the column. - repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; - } - - // Result of the k-anonymity computation. - message KAnonymityResult { - // The set of columns' values that share the same ldiversity value - message KAnonymityEquivalenceClass { - // Set of values defining the equivalence class. One value per - // quasi-identifier column in the original KAnonymity metric message. - // The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the equivalence class, for example number of rows with the - // above set of values. - int64 equivalence_class_size = 2; - } - - // Histogram of k-anonymity equivalence classes. - message KAnonymityHistogramBucket { - // Lower bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_lower_bound = 1; - - // Upper bound on the size of the equivalence classes in this bucket. - int64 equivalence_class_size_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated KAnonymityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of k-anonymity equivalence classes. - repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; - } - - // Result of the l-diversity computation. - message LDiversityResult { - // The set of columns' values that share the same ldiversity value. - message LDiversityEquivalenceClass { - // Quasi-identifier values defining the k-anonymity equivalence - // class. The order is always the same as the original request. - repeated Value quasi_ids_values = 1; - - // Size of the k-anonymity equivalence class. - int64 equivalence_class_size = 2; - - // Number of distinct sensitive values in this equivalence class. - int64 num_distinct_sensitive_values = 3; - - // Estimated frequencies of top sensitive values. - repeated ValueFrequency top_sensitive_values = 4; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - message LDiversityHistogramBucket { - // Lower bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_lower_bound = 1; - - // Upper bound on the sensitive value frequencies of the equivalence - // classes in this bucket. - int64 sensitive_value_frequency_upper_bound = 2; - - // Total number of equivalence classes in this bucket. - int64 bucket_size = 3; - - // Sample of equivalence classes in this bucket. The total number of - // classes returned per bucket is capped at 20. - repeated LDiversityEquivalenceClass bucket_values = 4; - - // Total number of distinct equivalence classes in this bucket. - int64 bucket_value_count = 5; - } - - // Histogram of l-diversity equivalence class sensitive value frequencies. - repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; - } - - // Result of the reidentifiability analysis. Note that these results are an - // estimation, not exact values. - message KMapEstimationResult { - // A tuple of values for the quasi-identifier columns. - message KMapEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated anonymity for these quasi-identifier values. - int64 estimated_anonymity = 2; - } - - // A KMapEstimationHistogramBucket message with the following values: - // min_anonymity: 3 - // max_anonymity: 5 - // frequency: 42 - // means that there are 42 records whose quasi-identifier values correspond - // to 3, 4 or 5 people in the overlying population. An important particular - // case is when min_anonymity = max_anonymity = 1: the frequency field then - // corresponds to the number of uniquely identifiable records. - message KMapEstimationHistogramBucket { - // Always positive. - int64 min_anonymity = 1; - - // Always greater than or equal to min_anonymity. - int64 max_anonymity = 2; - - // Number of records within these anonymity bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated KMapEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_anonymity, max_anonymity] do not overlap. If a value - // doesn't correspond to any such interval, the associated frequency is - // zero. For example, the following records: - // {min_anonymity: 1, max_anonymity: 1, frequency: 17} - // {min_anonymity: 2, max_anonymity: 3, frequency: 42} - // {min_anonymity: 5, max_anonymity: 10, frequency: 99} - // mean that there are no record with an estimated anonymity of 4, 5, or - // larger than 10. - repeated KMapEstimationHistogramBucket k_map_estimation_histogram = 1; - } - - // Result of the δ-presence computation. Note that these results are an - // estimation, not exact values. - message DeltaPresenceEstimationResult { - // A tuple of values for the quasi-identifier columns. - message DeltaPresenceEstimationQuasiIdValues { - // The quasi-identifier values. - repeated Value quasi_ids_values = 1; - - // The estimated probability that a given individual sharing these - // quasi-identifier values is in the dataset. This value, typically called - // δ, is the ratio between the number of records in the dataset with these - // quasi-identifier values, and the total number of individuals (inside - // *and* outside the dataset) with these quasi-identifier values. - // For example, if there are 15 individuals in the dataset who share the - // same quasi-identifier values, and an estimated 100 people in the entire - // population with these values, then δ is 0.15. - double estimated_probability = 2; - } - - // A DeltaPresenceEstimationHistogramBucket message with the following - // values: - // min_probability: 0.1 - // max_probability: 0.2 - // frequency: 42 - // means that there are 42 records for which δ is in [0.1, 0.2). An - // important particular case is when min_probability = max_probability = 1: - // then, every individual who shares this quasi-identifier combination is in - // the dataset. - message DeltaPresenceEstimationHistogramBucket { - // Between 0 and 1. - double min_probability = 1; - - // Always greater than or equal to min_probability. - double max_probability = 2; - - // Number of records within these probability bounds. - int64 bucket_size = 5; - - // Sample of quasi-identifier tuple values in this bucket. The total - // number of classes returned per bucket is capped at 20. - repeated DeltaPresenceEstimationQuasiIdValues bucket_values = 6; - - // Total number of distinct quasi-identifier tuple values in this bucket. - int64 bucket_value_count = 7; - } - - // The intervals [min_probability, max_probability) do not overlap. If a - // value doesn't correspond to any such interval, the associated frequency - // is zero. For example, the following records: - // {min_probability: 0, max_probability: 0.1, frequency: 17} - // {min_probability: 0.2, max_probability: 0.3, frequency: 42} - // {min_probability: 0.3, max_probability: 0.4, frequency: 99} - // mean that there are no record with an estimated probability in [0.1, 0.2) - // nor larger or equal to 0.4. - repeated DeltaPresenceEstimationHistogramBucket delta_presence_estimation_histogram = 1; - } - - // Privacy metric to compute. - PrivacyMetric requested_privacy_metric = 1; - - // Input dataset to compute metrics over. - BigQueryTable requested_source_table = 2; - - // Values associated with this metric. - oneof result { - // Numerical stats result - NumericalStatsResult numerical_stats_result = 3; - - // Categorical stats result - CategoricalStatsResult categorical_stats_result = 4; - - // K-anonymity result - KAnonymityResult k_anonymity_result = 5; - - // L-divesity result - LDiversityResult l_diversity_result = 6; - - // K-map result - KMapEstimationResult k_map_estimation_result = 7; - - // Delta-presence result - DeltaPresenceEstimationResult delta_presence_estimation_result = 9; - } -} - -// A value of a field, including its frequency. -message ValueFrequency { - // A value contained in the field in question. - Value value = 1; - - // How many times the value is contained in the field. - int64 count = 2; -} - -// Set of primitive values supported by the system. -// Note that for the purposes of inspection or transformation, the number -// of bytes considered to comprise a 'Value' is based on its representation -// as a UTF-8 encoded string. For example, if 'integer_value' is set to -// 123456789, the number of bytes would be counted as 9, even though an -// int64 only holds up to 8 bytes of data. -message Value { - // Value types - oneof type { - // integer - int64 integer_value = 1; - - // float - double float_value = 2; - - // string - string string_value = 3; - - // boolean - bool boolean_value = 4; - - // timestamp - google.protobuf.Timestamp timestamp_value = 5; - - // time of day - google.type.TimeOfDay time_value = 6; - - // date - google.type.Date date_value = 7; - - // day of week - google.type.DayOfWeek day_of_week_value = 8; - } -} - -// Message for infoType-dependent details parsed from quote. -message QuoteInfo { - // Object representation of the quote. - oneof parsed_quote { - // The date time indicated by the quote. - DateTime date_time = 2; - } -} - -// Message for a date time object. -// e.g. 2018-01-01, 5th August. -message DateTime { - // Time zone of the date time object. - message TimeZone { - // Set only if the offset can be determined. Positive for time ahead of UTC. - // E.g. For "UTC-9", this value is -540. - int32 offset_minutes = 1; - } - - // One or more of the following must be set. - // Must be a valid date or time value. - google.type.Date date = 1; - - // Day of week - google.type.DayOfWeek day_of_week = 2; - - // Time of day - google.type.TimeOfDay time = 3; - - // Time zone - TimeZone time_zone = 4; -} - -// The configuration that controls how the data will change. -message DeidentifyConfig { - oneof transformation { - // Treat the dataset as free-form text and apply the same free text - // transformation everywhere. - InfoTypeTransformations info_type_transformations = 1; - - // Treat the dataset as structured. Transformations can be applied to - // specific locations within structured datasets, such as transforming - // a column within a table. - RecordTransformations record_transformations = 2; - } -} - -// A rule for transforming a value. -message PrimitiveTransformation { - oneof transformation { - // Replace - ReplaceValueConfig replace_config = 1; - - // Redact - RedactConfig redact_config = 2; - - // Mask - CharacterMaskConfig character_mask_config = 3; - - // Ffx-Fpe - CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; - - // Fixed size bucketing - FixedSizeBucketingConfig fixed_size_bucketing_config = 5; - - // Bucketing - BucketingConfig bucketing_config = 6; - - // Replace with infotype - ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; - - // Time extraction - TimePartConfig time_part_config = 8; - - // Crypto - CryptoHashConfig crypto_hash_config = 9; - - // Date Shift - DateShiftConfig date_shift_config = 11; - - // Deterministic Crypto - CryptoDeterministicConfig crypto_deterministic_config = 12; - } -} - -// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a -// portion of the value. -message TimePartConfig { - // Components that make up time. - enum TimePart { - // Unused - TIME_PART_UNSPECIFIED = 0; - - // [0-9999] - YEAR = 1; - - // [1-12] - MONTH = 2; - - // [1-31] - DAY_OF_MONTH = 3; - - // [1-7] - DAY_OF_WEEK = 4; - - // [1-53] - WEEK_OF_YEAR = 5; - - // [0-23] - HOUR_OF_DAY = 6; - } - - // The part of the time to keep. - TimePart part_to_extract = 1; -} - -// Pseudonymization method that generates surrogates via cryptographic hashing. -// Uses SHA-256. -// The key size must be either 32 or 64 bytes. -// Outputs a base64 encoded representation of the hashed output -// (for example, L7k0BHmF1ha5U3NfGykjro4xWi1MPVQPjhMAZbSV9mM=). -// Currently, only string and integer values can be hashed. -// See https://cloud.google.com/dlp/docs/pseudonymization to learn more. -message CryptoHashConfig { - // The key used by the hash function. - CryptoKey crypto_key = 1; -} - -// Pseudonymization method that generates deterministic encryption for the given -// input. Outputs a base64 encoded representation of the encrypted output. -// Uses AES-SIV based on the RFC https://tools.ietf.org/html/rfc5297. -message CryptoDeterministicConfig { - // The key used by the encryption function. - CryptoKey crypto_key = 1; - - // The custom info type to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom info type followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: {info type name}({surrogate character count}):{surrogate} - // - // For example, if the name of custom info type is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom info type 'Surrogate'. This facilitates reversal of the - // surrogate when it occurs in free text. - // - // Note: For record transformations where the entire cell in a table is being - // transformed, surrogates are not mandatory. Surrogates are used to denote - // the location of the token and are necessary for re-identification in free - // form text. - // - // In order for inspection to work properly, the name of this info type must - // not occur naturally anywhere in your data; otherwise, inspection may either - // - // - reverse a surrogate that does not correspond to an actual identifier - // - be unable to parse the surrogate and result in an error - // - // Therefore, choose your custom info type name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE. - InfoType surrogate_info_type = 2; - - // A context may be used for higher security and maintaining - // referential integrity such that the same identifier in two different - // contexts will be given a distinct surrogate. The context is appended to - // plaintext value being encrypted. On decryption the provided context is - // validated against the value used during encryption. If a context was - // provided during encryption, same context must be provided during decryption - // as well. - // - // If the context is not set, plaintext would be used as is for encryption. - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 2. the field is not present when transforming a given value, - // - // plaintext would be used as is for encryption. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and non-structured `ContentItem`s. - FieldId context = 3; -} - -// Replace each input value with a given `Value`. -message ReplaceValueConfig { - // Value to replace it with. - Value new_value = 1; -} - -// Replace each matching finding with the name of the info_type. -message ReplaceWithInfoTypeConfig { - -} - -// Redact a given value. For example, if used with an `InfoTypeTransformation` -// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the -// output would be 'My phone number is '. -message RedactConfig { - -} - -// Characters to skip when doing deidentification of a value. These will be left -// alone and skipped. -message CharsToIgnore { - // Convenience enum for indication common characters to not transform. - enum CommonCharsToIgnore { - // Unused. - COMMON_CHARS_TO_IGNORE_UNSPECIFIED = 0; - - // 0-9 - NUMERIC = 1; - - // A-Z - ALPHA_UPPER_CASE = 2; - - // a-z - ALPHA_LOWER_CASE = 3; - - // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ - PUNCTUATION = 4; - - // Whitespace character, one of [ \t\n\x0B\f\r] - WHITESPACE = 5; - } - - oneof characters { - // Characters to not transform when masking. - string characters_to_skip = 1; - - // Common characters to not transform when masking. Useful to avoid removing - // punctuation. - CommonCharsToIgnore common_characters_to_ignore = 2; - } -} - -// Partially mask a string by replacing a given number of characters with a -// fixed character. Masking can start from the beginning or end of the string. -// This can be used on data of any type (numbers, longs, and so on) and when -// de-identifying structured data we'll attempt to preserve the original data's -// type. (This allows you to take a long like 123 and modify it to a string like -// **3. -message CharacterMaskConfig { - // Character to use to mask the sensitive values—for example, `*` for an - // alphabetic string such as a name, or `0` for a numeric string such as ZIP - // code or credit card number. This string must have a length of 1. If not - // supplied, this value defaults to `*` for strings, and `0` for digits. - string masking_character = 1; - - // Number of characters to mask. If not set, all matching chars will be - // masked. Skipped characters do not count towards this tally. - int32 number_to_mask = 2; - - // Mask characters in reverse order. For example, if `masking_character` is - // `0`, `number_to_mask` is `14`, and `reverse_order` is `false`, then the - // input string `1234-5678-9012-3456` is masked as `00000000000000-3456`. - // If `masking_character` is `*`, `number_to_mask` is `3`, and `reverse_order` - // is `true`, then the string `12345` is masked as `12***`. - bool reverse_order = 3; - - // When masking a string, items in this list will be skipped when replacing - // characters. For example, if the input string is `555-555-5555` and you - // instruct Cloud DLP to skip `-` and mask 5 characters with `*`, Cloud DLP - // returns `***-**5-5555`. - repeated CharsToIgnore characters_to_ignore = 4; -} - -// Buckets values based on fixed size ranges. The -// Bucketing transformation can provide all of this functionality, -// but requires more configuration. This message is provided as a convenience to -// the user for simple bucketing strategies. -// -// The transformed value will be a hyphenated string of -// {lower_bound}-{upper_bound}, i.e if lower_bound = 10 and upper_bound = 20 -// all values that are within this bucket will be replaced with "10-20". -// -// This can be used on data of type: double, long. -// -// If the bound Value type differs from the type of data -// being transformed, we will first attempt converting the type of the data to -// be transformed to match the type of the bound before comparing. -// -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message FixedSizeBucketingConfig { - // Required. Lower bound value of buckets. All values less than `lower_bound` are - // grouped together into a single bucket; for example if `lower_bound` = 10, - // then all values less than 10 are replaced with the value “-10”. - Value lower_bound = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Upper bound value of buckets. All values greater than upper_bound are - // grouped together into a single bucket; for example if `upper_bound` = 89, - // then all values greater than 89 are replaced with the value “89+”. - Value upper_bound = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Size of each bucket (except for minimum and maximum buckets). So if - // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the - // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, - // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. - double bucket_size = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Generalization function that buckets values based on ranges. The ranges and -// replacement values are dynamically provided by the user for custom behavior, -// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH -// This can be used on -// data of type: number, long, string, timestamp. -// If the bound `Value` type differs from the type of data being transformed, we -// will first attempt converting the type of the data to be transformed to match -// the type of the bound before comparing. -// See https://cloud.google.com/dlp/docs/concepts-bucketing to learn more. -message BucketingConfig { - // Bucket is represented as a range, along with replacement values. - message Bucket { - // Lower bound of the range, inclusive. Type should be the same as max if - // used. - Value min = 1; - - // Upper bound of the range, exclusive; type must match min. - Value max = 2; - - // Replacement value for this bucket. If not provided - // the default behavior will be to hyphenate the min-max range. - Value replacement_value = 3; - } - - // Set of buckets. Ranges must be non-overlapping. - repeated Bucket buckets = 1; -} - -// Replaces an identifier with a surrogate using Format Preserving Encryption -// (FPE) with the FFX mode of operation; however when used in the -// `ReidentifyContent` API method, it serves the opposite function by reversing -// the surrogate back into the original identifier. The identifier must be -// encoded as ASCII. For a given crypto key and context, the same identifier -// will be replaced with the same surrogate. Identifiers must be at least two -// characters long. In the case that the identifier is the empty string, it will -// be skipped. See https://cloud.google.com/dlp/docs/pseudonymization to learn -// more. -// -// Note: We recommend using CryptoDeterministicConfig for all use cases which -// do not require preserving the input alphabet space and size, plus warrant -// referential integrity. -message CryptoReplaceFfxFpeConfig { - // These are commonly used subsets of the alphabet that the FFX mode - // natively supports. In the algorithm, the alphabet is selected using - // the "radix". Therefore each corresponds to particular radix. - enum FfxCommonNativeAlphabet { - // Unused. - FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; - - // [0-9] (radix of 10) - NUMERIC = 1; - - // [0-9A-F] (radix of 16) - HEXADECIMAL = 2; - - // [0-9A-Z] (radix of 36) - UPPER_CASE_ALPHA_NUMERIC = 3; - - // [0-9A-Za-z] (radix of 62) - ALPHA_NUMERIC = 4; - } - - // Required. The key used by the encryption algorithm. - CryptoKey crypto_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // The 'tweak', a context may be used for higher security since the same - // identifier in two different contexts won't be given the same surrogate. If - // the context is not set, a default tweak will be used. - // - // If the context is set but: - // - // 1. there is no record present when transforming a given value or - // 1. the field is not present when transforming a given value, - // - // a default tweak will be used. - // - // Note that case (1) is expected when an `InfoTypeTransformation` is - // applied to both structured and non-structured `ContentItem`s. - // Currently, the referenced field may be of value type integer or string. - // - // The tweak is constructed as a sequence of bytes in big endian byte order - // such that: - // - // - a 64 bit integer is encoded followed by a single byte of value 1 - // - a string is encoded in UTF-8 format followed by a single byte of value 2 - FieldId context = 2; - - // Choose an alphabet which the data being transformed will be made up of. - oneof alphabet { - // Common alphabets. - FfxCommonNativeAlphabet common_alphabet = 4; - - // This is supported by mapping these to the alphanumeric characters - // that the FFX mode natively supports. This happens before/after - // encryption/decryption. - // Each character listed must appear only once. - // Number of characters must be in the range [2, 95]. - // This must be encoded as ASCII. - // The order of characters does not matter. - string custom_alphabet = 5; - - // The native way to select the alphabet. Must be in the range [2, 95]. - int32 radix = 6; - } - - // The custom infoType to annotate the surrogate with. - // This annotation will be applied to the surrogate by prefixing it with - // the name of the custom infoType followed by the number of - // characters comprising the surrogate. The following scheme defines the - // format: info_type_name(surrogate_character_count):surrogate - // - // For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and - // the surrogate is 'abc', the full replacement value - // will be: 'MY_TOKEN_INFO_TYPE(3):abc' - // - // This annotation identifies the surrogate when inspecting content using the - // custom infoType - // [`SurrogateType`](/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). - // This facilitates reversal of the surrogate when it occurs in free text. - // - // In order for inspection to work properly, the name of this infoType must - // not occur naturally anywhere in your data; otherwise, inspection may - // find a surrogate that does not correspond to an actual identifier. - // Therefore, choose your custom infoType name carefully after considering - // what your data looks like. One way to select a name that has a high chance - // of yielding reliable detection is to include one or more unicode characters - // that are highly improbable to exist in your data. - // For example, assuming your data is entered from a regular ASCII keyboard, - // the symbol with the hex code point 29DD might be used like so: - // ⧝MY_TOKEN_TYPE - InfoType surrogate_info_type = 8; -} - -// This is a data encryption key (DEK) (as opposed to -// a key encryption key (KEK) stored by KMS). -// When using KMS to wrap/unwrap DEKs, be sure to set an appropriate -// IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot -// unwrap the data crypto key. -message CryptoKey { - // Sources of crypto keys. - oneof source { - // Transient crypto key - TransientCryptoKey transient = 1; - - // Unwrapped crypto key - UnwrappedCryptoKey unwrapped = 2; - - // Kms wrapped key - KmsWrappedCryptoKey kms_wrapped = 3; - } -} - -// Use this to have a random data crypto key generated. -// It will be discarded after the request finishes. -message TransientCryptoKey { - // Required. Name of the key. - // This is an arbitrary string used to differentiate different keys. - // A unique key is generated per name: two separate `TransientCryptoKey` - // protos share the same generated key if their names are the same. - // When the data crypto key is generated, this name is not used in any way - // (repeating the api call will result in a different key being generated). - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Using raw keys is prone to security risks due to accidentally -// leaking the key. Choose another type of key if possible. -message UnwrappedCryptoKey { - // Required. A 128/192/256 bit key. - bytes key = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Include to use an existing data crypto key wrapped by KMS. -// The wrapped key must be a 128/192/256 bit key. -// Authorization requires the following IAM permissions when sending a request -// to perform a crypto transformation using a kms-wrapped crypto key: -// dlp.kms.encrypt -message KmsWrappedCryptoKey { - // Required. The wrapped data crypto key. - bytes wrapped_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The resource name of the KMS CryptoKey to use for unwrapping. - string crypto_key_name = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Shifts dates by random number of days, with option to be consistent for the -// same context. See https://cloud.google.com/dlp/docs/concepts-date-shifting -// to learn more. -message DateShiftConfig { - // Required. Range of shift in days. Actual shift will be selected at random within this - // range (inclusive ends). Negative means shift to earlier in time. Must not - // be more than 365250 days (1000 years) each direction. - // - // For example, 3 means shift date to at most 3 days into the future. - int32 upper_bound_days = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. For example, -5 means shift date to at most 5 days back in the past. - int32 lower_bound_days = 2 [(google.api.field_behavior) = REQUIRED]; - - // Points to the field that contains the context, for example, an entity id. - // If set, must also set cryptoKey. If set, shift will be consistent for the - // given context. - FieldId context = 3; - - // Method for calculating shift that takes context into consideration. If - // set, must also set context. Can only be applied to table items. - oneof method { - // Causes the shift to be computed based on this key and the context. This - // results in the same shift for the same context and crypto_key. If - // set, must also set context. Can only be applied to table items. - CryptoKey crypto_key = 4; - } -} - -// A type of transformation that will scan unstructured text and -// apply various `PrimitiveTransformation`s to each finding, where the -// transformation is applied to only values that were identified as a specific -// info_type. -message InfoTypeTransformations { - // A transformation to apply to text that is identified as a specific - // info_type. - message InfoTypeTransformation { - // InfoTypes to apply the transformation to. An empty list will cause - // this transformation to apply to all findings that correspond to - // infoTypes that were requested in `InspectConfig`. - repeated InfoType info_types = 1; - - // Required. Primitive transformation to apply to the infoType. - PrimitiveTransformation primitive_transformation = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Required. Transformation for each infoType. Cannot specify more than one - // for a given infoType. - repeated InfoTypeTransformation transformations = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The transformation to apply to the field. -message FieldTransformation { - // Required. Input field(s) to apply the transformation to. - repeated FieldId fields = 1 [(google.api.field_behavior) = REQUIRED]; - - // Only apply the transformation if the condition evaluates to true for the - // given `RecordCondition`. The conditions are allowed to reference fields - // that are not used in the actual transformation. - // - // Example Use Cases: - // - // - Apply a different bucket transformation to an age column if the zip code - // column for the same record is within a specific range. - // - Redact a field if the date of birth field is greater than 85. - RecordCondition condition = 3; - - // Transformation to apply. [required] - oneof transformation { - // Apply the transformation to the entire field. - PrimitiveTransformation primitive_transformation = 4; - - // Treat the contents of the field as free text, and selectively - // transform content that matches an `InfoType`. - InfoTypeTransformations info_type_transformations = 5; - } -} - -// A type of transformation that is applied over structured data such as a -// table. -message RecordTransformations { - // Transform the record by applying various field transformations. - repeated FieldTransformation field_transformations = 1; - - // Configuration defining which records get suppressed entirely. Records that - // match any suppression rule are omitted from the output. - repeated RecordSuppression record_suppressions = 2; -} - -// Configuration to suppress records whose suppression conditions evaluate to -// true. -message RecordSuppression { - // A condition that when it evaluates to true will result in the record being - // evaluated to be suppressed from the transformed content. - RecordCondition condition = 1; -} - -// A condition for determining whether a transformation should be applied to -// a field. -message RecordCondition { - // The field type of `value` and `field` do not need to match to be - // considered equal, but not all comparisons are possible. - // EQUAL_TO and NOT_EQUAL_TO attempt to compare even with incompatible types, - // but all other comparisons are invalid with incompatible types. - // A `value` of type: - // - // - `string` can be compared against all other types - // - `boolean` can only be compared against other booleans - // - `integer` can be compared against doubles or a string if the string value - // can be parsed as an integer. - // - `double` can be compared against integers or a string if the string can - // be parsed as a double. - // - `Timestamp` can be compared against strings in RFC 3339 date string - // format. - // - `TimeOfDay` can be compared against timestamps and strings in the format - // of 'HH:mm:ss'. - // - // If we fail to compare do to type mismatch, a warning will be given and - // the condition will evaluate to false. - message Condition { - // Required. Field within the record this condition is evaluated against. - FieldId field = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Operator used to compare the field or infoType to the value. - RelationalOperator operator = 3 [(google.api.field_behavior) = REQUIRED]; - - // Value to compare against. [Mandatory, except for `EXISTS` tests.] - Value value = 4; - } - - // A collection of conditions. - message Conditions { - // A collection of conditions. - repeated Condition conditions = 1; - } - - // An expression, consisting or an operator and conditions. - message Expressions { - // Logical operators for conditional checks. - enum LogicalOperator { - // Unused - LOGICAL_OPERATOR_UNSPECIFIED = 0; - - // Conditional AND - AND = 1; - } - - // The operator to apply to the result of conditions. Default and currently - // only supported value is `AND`. - LogicalOperator logical_operator = 1; - - // Expression types. - oneof type { - // Conditions to apply to the expression. - Conditions conditions = 3; - } - } - - // An expression. - Expressions expressions = 3; -} - -// Overview of the modifications that occurred. -message TransformationOverview { - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 2; - - // Transformations applied to the dataset. - repeated TransformationSummary transformation_summaries = 3; -} - -// Summary of a single transformation. -// Only one of 'transformation', 'field_transformation', or 'record_suppress' -// will be set. -message TransformationSummary { - // A collection that informs the user the number of times a particular - // `TransformationResultCode` and error details occurred. - message SummaryResult { - // Number of transformations counted by this result. - int64 count = 1; - - // Outcome of the transformation. - TransformationResultCode code = 2; - - // A place for warnings or errors to show up if a transformation didn't - // work as expected. - string details = 3; - } - - // Possible outcomes of transformations. - enum TransformationResultCode { - // Unused - TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; - - // Transformation completed without an error. - SUCCESS = 1; - - // Transformation had an error. - ERROR = 2; - } - - // Set if the transformation was limited to a specific InfoType. - InfoType info_type = 1; - - // Set if the transformation was limited to a specific FieldId. - FieldId field = 2; - - // The specific transformation these stats apply to. - PrimitiveTransformation transformation = 3; - - // The field transformation that was applied. - // If multiple field transformations are requested for a single field, - // this list will contain all of them; otherwise, only one is supplied. - repeated FieldTransformation field_transformations = 5; - - // The specific suppression option these stats apply to. - RecordSuppression record_suppress = 6; - - // Collection of all transformations that took place or had an error. - repeated SummaryResult results = 4; - - // Total size in bytes that were transformed in some way. - int64 transformed_bytes = 7; -} - -// Schedule for triggeredJobs. -message Schedule { - oneof option { - // With this option a job is started a regular periodic basis. For - // example: every day (86400 seconds). - // - // A scheduled start time will be skipped if the previous - // execution has not ended when its scheduled time occurs. - // - // This value must be set to a time duration greater than or equal - // to 1 day and can be no longer than 60 days. - google.protobuf.Duration recurrence_period_duration = 1; - } -} - -// The inspectTemplate contains a configuration (set of types of sensitive data -// to be detected) to be used anywhere you otherwise would normally specify -// InspectConfig. See https://cloud.google.com/dlp/docs/concepts-templates -// to learn more. -message InspectTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/InspectTemplate" - pattern: "organizations/{organization}/inspectTemplates/{inspect_template}" - pattern: "projects/{project}/inspectTemplates/{inspect_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID`; - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The core content of the template. Configuration of the scanning process. - InspectConfig inspect_config = 6; -} - -// DeidentifyTemplates contains instructions on how to de-identify content. -// See https://cloud.google.com/dlp/docs/concepts-templates to learn more. -message DeidentifyTemplate { - option (google.api.resource) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - pattern: "organizations/{organization}/deidentifyTemplates/{deidentify_template}" - pattern: "projects/{project}/deidentifyTemplates/{deidentify_template}" - }; - - // Output only. The template name. - // - // The template will have one of the following formats: - // `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR - // `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Display name (max 256 chars). - string display_name = 2; - - // Short description (max 256 chars). - string description = 3; - - // Output only. The creation timestamp of an inspectTemplate. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of an inspectTemplate. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // ///////////// // The core content of the template // /////////////// - DeidentifyConfig deidentify_config = 6; -} - -// Details information about an error encountered during job execution or -// the results of an unsuccessful activation of the JobTrigger. -message Error { - // Detailed error codes and messages. - google.rpc.Status details = 1; - - // The times the error occurred. - repeated google.protobuf.Timestamp timestamps = 2; -} - -// Contains a configuration to make dlp api calls on a repeating basis. -// See https://cloud.google.com/dlp/docs/concepts-job-triggers to learn more. -message JobTrigger { - option (google.api.resource) = { - type: "dlp.googleapis.com/JobTrigger" - pattern: "projects/{project}/jobTriggers/{job_trigger}" - }; - - // What event needs to occur for a new job to be started. - message Trigger { - oneof trigger { - // Create a job on a repeating basis based on the elapse of time. - Schedule schedule = 1; - } - } - - // Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs - // will be created with this configuration. The service may automatically - // pause triggers experiencing frequent errors. To restart a job, set the - // status to HEALTHY after correcting user errors. - enum Status { - // Unused. - STATUS_UNSPECIFIED = 0; - - // Trigger is healthy. - HEALTHY = 1; - - // Trigger is temporarily paused. - PAUSED = 2; - - // Trigger is cancelled and can not be resumed. - CANCELLED = 3; - } - - // Unique resource name for the triggeredJob, assigned by the service when the - // triggeredJob is created, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1; - - // Display name (max 100 chars) - string display_name = 2; - - // User provided description (max 256 chars) - string description = 3; - - // The configuration details for the specific type of job to run. - oneof job { - // For inspect jobs, a snapshot of the configuration. - InspectJobConfig inspect_job = 4; - } - - // A list of triggers which will be OR'ed together. Only one in the list - // needs to trigger for a job to be started. The list may contain only - // a single Schedule trigger and must have at least one object. - repeated Trigger triggers = 5; - - // Output only. A stream of errors encountered when the trigger was activated. Repeated - // errors may result in the JobTrigger automatically being paused. - // Will return the last 100 errors. Whenever the JobTrigger is modified - // this list will be cleared. - repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation timestamp of a triggeredJob. - google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of a triggeredJob. - google.protobuf.Timestamp update_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The timestamp of the last time this trigger executed. - google.protobuf.Timestamp last_run_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. A status for this trigger. - Status status = 10 [(google.api.field_behavior) = REQUIRED]; -} - -// A task to execute on the completion of a job. -// See https://cloud.google.com/dlp/docs/concepts-actions to learn more. -message Action { - // If set, the detailed findings will be persisted to the specified - // OutputStorageConfig. Only a single instance of this action can be - // specified. - // Compatible with: Inspect, Risk - message SaveFindings { - // Location to store findings outside of DLP. - OutputStorageConfig output_config = 1; - } - - // Publish a message into given Pub/Sub topic when DlpJob has completed. The - // message contains a single field, `DlpJobName`, which is equal to the - // finished job's - // [`DlpJob.name`](/dlp/docs/reference/rest/v2/projects.dlpJobs#DlpJob). - // Compatible with: Inspect, Risk - message PublishToPubSub { - // Cloud Pub/Sub topic to send notifications to. The topic must have given - // publishing access rights to the DLP API service account executing - // the long running DlpJob sending the notifications. - // Format is projects/{project}/topics/{topic}. - string topic = 1; - } - - // Publish the result summary of a DlpJob to the Cloud Security - // Command Center (CSCC Alpha). - // This action is only available for projects which are parts of - // an organization and whitelisted for the alpha Cloud Security Command - // Center. - // The action will publish count of finding instances and their info types. - // The summary of findings will be persisted in CSCC and are governed by CSCC - // service-specific policy, see https://cloud.google.com/terms/service-terms - // Only a single instance of this action can be specified. - // Compatible with: Inspect - message PublishSummaryToCscc { - - } - - // Publish findings of a DlpJob to Cloud Data Catalog. Labels summarizing the - // results of the DlpJob will be applied to the entry for the resource scanned - // in Cloud Data Catalog. Any labels previously written by another DlpJob will - // be deleted. InfoType naming patterns are strictly enforced when using this - // feature. Note that the findings will be persisted in Cloud Data Catalog - // storage and are governed by Data Catalog service-specific policy, see - // https://cloud.google.com/terms/service-terms - // Only a single instance of this action can be specified and only allowed if - // all resources being scanned are BigQuery tables. - // Compatible with: Inspect - message PublishFindingsToCloudDataCatalog { - - } - - // Enable email notification to project owners and editors on jobs's - // completion/failure. - message JobNotificationEmails { - - } - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. This - // will publish a metric to stack driver on each infotype requested and - // how many findings were found for it. CustomDetectors will be bucketed - // as 'Custom' under the Stackdriver label 'info_type'. - message PublishToStackdriver { - - } - - oneof action { - // Save resulting findings in a provided location. - SaveFindings save_findings = 1; - - // Publish a notification to a pubsub topic. - PublishToPubSub pub_sub = 2; - - // Publish summary to Cloud Security Command Center (Alpha). - PublishSummaryToCscc publish_summary_to_cscc = 3; - - // Publish findings to Cloud Datahub. - PublishFindingsToCloudDataCatalog publish_findings_to_cloud_data_catalog = 5; - - // Enable email notification for project owners and editors on job's - // completion/failure. - JobNotificationEmails job_notification_emails = 8; - - // Enable Stackdriver metric dlp.googleapis.com/finding_count. - PublishToStackdriver publish_to_stackdriver = 9; - } -} - -// Request message for CreateInspectTemplate. -message CreateInspectTemplateRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Required. The InspectTemplate to create. - InspectTemplate inspect_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // The geographic location to store the inspection template. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for UpdateInspectTemplate. -message UpdateInspectTemplateRequest { - // Required. Resource name of organization and inspectTemplate to be updated, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // New InspectTemplate value. - InspectTemplate inspect_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetInspectTemplate. -message GetInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be read, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for ListInspectTemplates. -message ListInspectTemplatesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/InspectTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListInspectTemplates`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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 time the template was created. - // - `update_time`: corresponds to time the template was last updated. - // - `name`: corresponds to template's name. - // - `display_name`: corresponds to template's display name. - string order_by = 4; - - // The geographic location where inspection templates will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListInspectTemplates. -message ListInspectTemplatesResponse { - // List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. - repeated InspectTemplate inspect_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListInspectTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteInspectTemplate. -message DeleteInspectTemplateRequest { - // Required. Resource name of the organization and inspectTemplate to be deleted, for - // example `organizations/433245324/inspectTemplates/432452342` or - // projects/project-id/inspectTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/InspectTemplate" - } - ]; -} - -// Request message for CreateJobTrigger. -message CreateJobTriggerRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The JobTrigger to create. - JobTrigger job_trigger = 2 [(google.api.field_behavior) = REQUIRED]; - - // The trigger id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string trigger_id = 3; - - // The geographic location to store the job trigger. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for ActivateJobTrigger. -message ActivateJobTriggerRequest { - // Required. Resource name of the trigger to activate, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for UpdateJobTrigger. -message UpdateJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; - - // New JobTrigger value. - JobTrigger job_trigger = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetJobTrigger. -message GetJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Request message for CreateDlpJobRequest. Used to initiate long running -// jobs such as calculating risk metrics or inspecting Google Cloud -// Storage. -message CreateDlpJobRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The configuration details for the specific type of job to run. - oneof job { - // Set to control what and how to inspect. - InspectJobConfig inspect_job = 2; - - // Set to choose what metric to calculate. - RiskAnalysisJobConfig risk_job = 3; - } - - // The job id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string job_id = 4; - - // The geographic location to store and process the job. Reserved for - // future extensions. - string location_id = 5; -} - -// Request message for ListJobTriggers. -message ListJobTriggersRequest { - // Required. The parent resource name, for example `projects/my-project-id`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to ListJobTriggers. `order_by` field must not - // change for subsequent calls. - string page_token = 2; - - // Size of the page, can be limited by a server. - int32 page_size = 3; - - // Comma separated list of triggeredJob 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 time the JobTrigger was created. - // - `update_time`: corresponds to time the JobTrigger was last updated. - // - `last_run_time`: corresponds to the last time the JobTrigger ran. - // - `name`: corresponds to JobTrigger's name. - // - `display_name`: corresponds to JobTrigger's display name. - // - `status`: corresponds to JobTrigger's status. - string order_by = 4; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect jobs: - // - `status` - HEALTHY|PAUSED|CANCELLED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - // quotation marks. Nanoseconds are ignored. - // - 'error_count' - Number of errors that have occurred while running. - // * The operator must be `=` or `!=` for status and inspected_storage. - // - // Examples: - // - // * inspected_storage = cloud_storage AND status = HEALTHY - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - // * last_run_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 5; - - // The geographic location where job triggers will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 7; -} - -// Response message for ListJobTriggers. -message ListJobTriggersResponse { - // List of triggeredJobs, up to page_size in ListJobTriggersRequest. - repeated JobTrigger job_triggers = 1; - - // If the next page is available then the next page token to be used - // in following ListJobTriggers request. - string next_page_token = 2; -} - -// Request message for DeleteJobTrigger. -message DeleteJobTriggerRequest { - // Required. Resource name of the project and the triggeredJob, for example - // `projects/dlp-test-project/jobTriggers/53234423`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/JobTrigger" - } - ]; -} - -// Controls what and how to inspect for findings. -message InspectJobConfig { - // The data to scan. - StorageConfig storage_config = 1; - - // How and what to scan for. - InspectConfig inspect_config = 2; - - // If provided, will be used as the default for all values in InspectConfig. - // `inspect_config` will be merged into the values persisted as part of the - // template. - string inspect_template_name = 3; - - // Actions to execute at the completion of the job. - repeated Action actions = 4; -} - -// Combines all of the information about a DLP job. -message DlpJob { - option (google.api.resource) = { - type: "dlp.googleapis.com/DlpJob" - pattern: "projects/{project}/dlpJobs/{dlp_job}" - }; - - // Possible states of a job. - enum JobState { - // Unused. - JOB_STATE_UNSPECIFIED = 0; - - // The job has not yet started. - PENDING = 1; - - // The job is currently running. - RUNNING = 2; - - // The job is no longer running. - DONE = 3; - - // The job was canceled before it could complete. - CANCELED = 4; - - // The job had an error and did not complete. - FAILED = 5; - } - - // The server-assigned name. - string name = 1; - - // The type of job. - DlpJobType type = 2; - - // State of a job. - JobState state = 3; - - oneof details { - // Results from analyzing risk of a data source. - AnalyzeDataSourceRiskDetails risk_details = 4; - - // Results from inspecting a data source. - InspectDataSourceDetails inspect_details = 5; - } - - // Time when the job was created. - google.protobuf.Timestamp create_time = 6; - - // Time when the job started. - google.protobuf.Timestamp start_time = 7; - - // Time when the job finished. - google.protobuf.Timestamp end_time = 8; - - // If created by a job trigger, the resource name of the trigger that - // instantiated the job. - string job_trigger_name = 10; - - // A stream of errors encountered running the job. - repeated Error errors = 11; -} - -// The request message for [DlpJobs.GetDlpJob][]. -message GetDlpJobRequest { - // Required. The name of the DlpJob resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for listing DLP jobs. -message ListDlpJobsRequest { - // Required. The parent resource name, for example projects/my-project-id. - string parent = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Allows filtering. - // - // Supported syntax: - // - // * Filter expressions are made up of one or more restrictions. - // * Restrictions can be combined by `AND` or `OR` logical operators. A - // sequence of restrictions implicitly uses `AND`. - // * A restriction has the form of `{field} {operator} {value}`. - // * Supported fields/values for inspect jobs: - // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - // - `trigger_name` - The resource name of the trigger that created job. - // - 'end_time` - Corresponds to time the job finished. - // - 'start_time` - Corresponds to time the job finished. - // * Supported fields for risk analysis jobs: - // - `state` - RUNNING|CANCELED|FINISHED|FAILED - // - 'end_time` - Corresponds to time the job finished. - // - 'start_time` - Corresponds to time the job finished. - // * The operator must be `=` or `!=`. - // - // Examples: - // - // * inspected_storage = cloud_storage AND state = done - // * inspected_storage = cloud_storage OR inspected_storage = bigquery - // * inspected_storage = cloud_storage AND (state = done OR state = canceled) - // * end_time > \"2017-12-12T00:00:00+00:00\" - // - // The length of this field should be no more than 500 characters. - string filter = 1; - - // The standard list page size. - int32 page_size = 2; - - // The standard list page token. - string page_token = 3; - - // The type of job. Defaults to `DlpJobType.INSPECT` - DlpJobType type = 5; - - // 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, end_time asc, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to time the job was created. - // - `end_time`: corresponds to time the job ended. - // - `name`: corresponds to job's name. - // - `state`: corresponds to `state` - string order_by = 6; - - // The geographic location where jobs will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 7; -} - -// The response message for listing DLP jobs. -message ListDlpJobsResponse { - // A list of DlpJobs that matches the specified filter in the request. - repeated DlpJob jobs = 1; - - // The standard List next-page token. - string next_page_token = 2; -} - -// The request message for canceling a DLP job. -message CancelDlpJobRequest { - // Required. The name of the DlpJob resource to be cancelled. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// The request message for deleting a DLP job. -message DeleteDlpJobRequest { - // Required. The name of the DlpJob resource to be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DlpJob" - } - ]; -} - -// Request message for CreateDeidentifyTemplate. -message CreateDeidentifyTemplateRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Required. The DeidentifyTemplate to create. - DeidentifyTemplate deidentify_template = 2 [(google.api.field_behavior) = REQUIRED]; - - // The template id can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string template_id = 3; - - // The geographic location to store the deidentification template. Reserved - // for future extensions. - string location_id = 4; -} - -// Request message for UpdateDeidentifyTemplate. -message UpdateDeidentifyTemplateRequest { - // Required. Resource name of organization and deidentify template to be updated, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // New DeidentifyTemplate value. - DeidentifyTemplate deidentify_template = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetDeidentifyTemplate. -message GetDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be read, for - // example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Request message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListDeidentifyTemplates`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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 time the template was created. - // - `update_time`: corresponds to time the template was last updated. - // - `name`: corresponds to template's name. - // - `display_name`: corresponds to template's display name. - string order_by = 4; - - // The geographic location where deidentifications templates will be retrieved - // from. Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListDeidentifyTemplates. -message ListDeidentifyTemplatesResponse { - // List of deidentify templates, up to page_size in - // ListDeidentifyTemplatesRequest. - repeated DeidentifyTemplate deidentify_templates = 1; - - // If the next page is available then the next page token to be used - // in following ListDeidentifyTemplates request. - string next_page_token = 2; -} - -// Request message for DeleteDeidentifyTemplate. -message DeleteDeidentifyTemplateRequest { - // Required. Resource name of the organization and deidentify template to be deleted, - // for example `organizations/433245324/deidentifyTemplates/432452342` or - // projects/project-id/deidentifyTemplates/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/DeidentifyTemplate" - } - ]; -} - -// Configuration for a custom dictionary created from a data source of any size -// up to the maximum size defined in the -// [limits](https://cloud.google.com/dlp/limits) page. The artifacts of -// dictionary creation are stored in the specified Google Cloud Storage -// location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries -// that satisfy the size requirements. -message LargeCustomDictionaryConfig { - // Location to store dictionary artifacts in Google Cloud Storage. These files - // will only be accessible by project owners and the DLP API. If any of these - // artifacts are modified, the dictionary is considered invalid and can no - // longer be used. - CloudStoragePath output_path = 1; - - oneof source { - // Set of files containing newline-delimited lists of dictionary phrases. - CloudStorageFileSet cloud_storage_file_set = 2; - - // Field in a BigQuery table where each cell represents a dictionary phrase. - BigQueryField big_query_field = 3; - } -} - -// Summary statistics of a custom dictionary. -message LargeCustomDictionaryStats { - // Approximate number of distinct phrases in the dictionary. - int64 approx_num_phrases = 1; -} - -// Configuration for stored infoTypes. All fields and subfield are provided -// by the user. For more information, see -// https://cloud.google.com/dlp/docs/creating-custom-infotypes. -message StoredInfoTypeConfig { - // Display name of the StoredInfoType (max 256 characters). - string display_name = 1; - - // Description of the StoredInfoType (max 256 characters). - string description = 2; - - // Stored infotype types. - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryConfig large_custom_dictionary = 3; - } -} - -// Statistics for a StoredInfoType. -message StoredInfoTypeStats { - // Stat types - oneof type { - // StoredInfoType where findings are defined by a dictionary of phrases. - LargeCustomDictionaryStats large_custom_dictionary = 1; - } -} - -// Version of a StoredInfoType, including the configuration used to build it, -// create timestamp, and current state. -message StoredInfoTypeVersion { - // StoredInfoType configuration. - StoredInfoTypeConfig config = 1; - - // Create timestamp of the version. Read-only, determined by the system - // when the version is created. - google.protobuf.Timestamp create_time = 2; - - // Stored info type version state. Read-only, updated by the system - // during dictionary creation. - StoredInfoTypeState state = 3; - - // Errors that occurred when creating this storedInfoType version, or - // anomalies detected in the storedInfoType data that render it unusable. Only - // the five most recent errors will be displayed, with the most recent error - // appearing first. - // - // For example, some of the data for stored custom dictionaries is put in - // the user's Google Cloud Storage bucket, and if this data is modified or - // deleted by the user or another system, the dictionary becomes invalid. - // - // If any errors occur, fix the problem indicated by the error message and - // use the UpdateStoredInfoType API method to create another version of the - // storedInfoType to continue using it, reusing the same `config` if it was - // not the source of the error. - repeated Error errors = 4; - - // Statistics about this storedInfoType version. - StoredInfoTypeStats stats = 5; -} - -// StoredInfoType resource message that contains information about the current -// version and any pending updates. -message StoredInfoType { - option (google.api.resource) = { - type: "dlp.googleapis.com/StoredInfoType" - pattern: "organizations/{organization}/storedInfoTypes/{stored_info_type}" - pattern: "projects/{project}/storedInfoTypes/{stored_info_type}" - }; - - // Resource name. - string name = 1; - - // Current version of the stored info type. - StoredInfoTypeVersion current_version = 2; - - // Pending versions of the stored info type. Empty if no versions are - // pending. - repeated StoredInfoTypeVersion pending_versions = 3; -} - -// Request message for CreateStoredInfoType. -message CreateStoredInfoTypeRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Required. Configuration of the storedInfoType to create. - StoredInfoTypeConfig config = 2 [(google.api.field_behavior) = REQUIRED]; - - // The storedInfoType ID can contain uppercase and lowercase letters, - // numbers, and hyphens; that is, it must match the regular - // expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - // characters. Can be empty to allow the system to generate one. - string stored_info_type_id = 3; - - // The geographic location to store the stored infoType. Reserved for - // future extensions. - string location_id = 4; -} - -// Request message for UpdateStoredInfoType. -message UpdateStoredInfoTypeRequest { - // Required. Resource name of organization and storedInfoType to be updated, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Updated configuration for the storedInfoType. If not provided, a new - // version of the storedInfoType will be created with the existing - // configuration. - StoredInfoTypeConfig config = 2; - - // Mask to control which fields get updated. - google.protobuf.FieldMask update_mask = 3; -} - -// Request message for GetStoredInfoType. -message GetStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be read, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Request message for ListStoredInfoTypes. -message ListStoredInfoTypesRequest { - // Required. The parent resource name, for example projects/my-project-id or - // organizations/my-org-id. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "dlp.googleapis.com/StoredInfoType" - } - ]; - - // Page token to continue retrieval. Comes from previous call - // to `ListStoredInfoTypes`. - string page_token = 2; - - // Size of the page, can be limited by server. If zero server returns - // a page of max size 100. - int32 page_size = 3; - - // 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, display_name, create_time desc` - // - // Supported fields are: - // - // - `create_time`: corresponds to time the most recent version of the - // resource was created. - // - `state`: corresponds to the state of the resource. - // - `name`: corresponds to resource name. - // - `display_name`: corresponds to info type's display name. - string order_by = 4; - - // The geographic location where stored infoTypes will be retrieved from. - // Use `-` for all locations. Reserved for future extensions. - string location_id = 5; -} - -// Response message for ListStoredInfoTypes. -message ListStoredInfoTypesResponse { - // List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. - repeated StoredInfoType stored_info_types = 1; - - // If the next page is available then the next page token to be used - // in following ListStoredInfoTypes request. - string next_page_token = 2; -} - -// Request message for DeleteStoredInfoType. -message DeleteStoredInfoTypeRequest { - // Required. Resource name of the organization and storedInfoType to be deleted, for - // example `organizations/433245324/storedInfoTypes/432452342` or - // projects/project-id/storedInfoTypes/432452342. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "dlp.googleapis.com/StoredInfoType" - } - ]; -} - -// Operators available for comparing the value of fields. -enum RelationalOperator { - // Unused - RELATIONAL_OPERATOR_UNSPECIFIED = 0; - - // Equal. Attempts to match even with incompatible types. - EQUAL_TO = 1; - - // Not equal to. Attempts to match even with incompatible types. - NOT_EQUAL_TO = 2; - - // Greater than. - GREATER_THAN = 3; - - // Less than. - LESS_THAN = 4; - - // Greater than or equals. - GREATER_THAN_OR_EQUALS = 5; - - // Less than or equals. - LESS_THAN_OR_EQUALS = 6; - - // Exists - EXISTS = 7; -} - -// Type of the match which can be applied to different ways of matching, like -// Dictionary, regular expression and intersecting with findings of another -// info type. -enum MatchingType { - // Invalid. - MATCHING_TYPE_UNSPECIFIED = 0; - - // Full match. - // - // - Dictionary: join of Dictionary results matched complete finding quote - // - Regex: all regex matches fill a finding quote start to end - // - Exclude info type: completely inside affecting info types findings - MATCHING_TYPE_FULL_MATCH = 1; - - // Partial match. - // - // - Dictionary: at least one of the tokens in the finding matches - // - Regex: substring of the finding matches - // - Exclude info type: intersects with affecting info types findings - MATCHING_TYPE_PARTIAL_MATCH = 2; - - // Inverse match. - // - // - Dictionary: no tokens in the finding match the dictionary - // - Regex: finding doesn't match the regex - // - Exclude info type: no intersection with affecting info types findings - MATCHING_TYPE_INVERSE_MATCH = 3; -} - -// Options describing which parts of the provided content should be scanned. -enum ContentOption { - // Includes entire content of a file or a data stream. - CONTENT_UNSPECIFIED = 0; - - // Text content within the data, excluding any metadata. - CONTENT_TEXT = 1; - - // Images found in the data. - CONTENT_IMAGE = 2; -} - -// Parts of the APIs which use certain infoTypes. -enum InfoTypeSupportedBy { - // Unused. - ENUM_TYPE_UNSPECIFIED = 0; - - // Supported by the inspect operations. - INSPECT = 1; - - // Supported by the risk analysis operations. - RISK_ANALYSIS = 2; -} - -// An enum to represent the various types of DLP jobs. -enum DlpJobType { - // Unused - DLP_JOB_TYPE_UNSPECIFIED = 0; - - // The job inspected Google Cloud for sensitive data. - INSPECT_JOB = 1; - - // The job executed a Risk Analysis computation. - RISK_ANALYSIS_JOB = 2; -} - -// State of a StoredInfoType version. -enum StoredInfoTypeState { - // Unused - STORED_INFO_TYPE_STATE_UNSPECIFIED = 0; - - // StoredInfoType version is being created. - PENDING = 1; - - // StoredInfoType version is ready for use. - READY = 2; - - // StoredInfoType creation failed. All relevant error messages are returned in - // the `StoredInfoTypeVersion` message. - FAILED = 3; - - // StoredInfoType is no longer valid because artifacts stored in - // user-controlled storage were modified. To fix an invalid StoredInfoType, - // use the `UpdateStoredInfoType` method to create a new version. - INVALID = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/storage.proto.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/storage.proto.baseline deleted file mode 100644 index f23430c7219b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/protos/google/privacy/dlp/v2/storage.proto.baseline +++ /dev/null @@ -1,648 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.privacy.dlp.v2; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Dlp.V2"; -option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; -option java_multiple_files = true; -option java_outer_classname = "DlpStorage"; -option java_package = "com.google.privacy.dlp.v2"; -option php_namespace = "Google\\Cloud\\Dlp\\V2"; - -// Type of information detected by the API. -message InfoType { - // Name of the information type. Either a name of your choosing when - // creating a CustomInfoType, or one of the names listed - // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying - // a built-in type. InfoType names should conform to the pattern - // [a-zA-Z0-9_]{1,64}. - string name = 1; -} - -// A reference to a StoredInfoType to use with scanning. -message StoredType { - // Resource name of the requested `StoredInfoType`, for example - // `organizations/433245324/storedInfoTypes/432452342` or - // `projects/project-id/storedInfoTypes/432452342`. - string name = 1; - - // Timestamp indicating when the version of the `StoredInfoType` used for - // inspection was created. Output-only field, populated by the system. - google.protobuf.Timestamp create_time = 2; -} - -// Categorization of results based on how likely they are to represent a match, -// based on the number of elements they contain which imply a match. -enum Likelihood { - // Default value; same as POSSIBLE. - LIKELIHOOD_UNSPECIFIED = 0; - - // Few matching elements. - VERY_UNLIKELY = 1; - - UNLIKELY = 2; - - // Some matching elements. - POSSIBLE = 3; - - LIKELY = 4; - - // Many matching elements. - VERY_LIKELY = 5; -} - -// Custom information type provided by the user. Used to find domain-specific -// sensitive information configurable to the data in question. -message CustomInfoType { - // Custom information type based on a dictionary of words or phrases. This can - // be used to match sensitive information specific to the data, such as a list - // of employee IDs or job titles. - // - // Dictionary words are case-insensitive and all characters other than letters - // and digits in the unicode [Basic Multilingual - // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) - // will be replaced with whitespace when scanning for matches, so the - // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", - // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters - // surrounding any match must be of a different type than the adjacent - // characters within the word, so letters must be next to non-letters and - // digits next to non-digits. For example, the dictionary word "jen" will - // match the first three letters of the text "jen123" but will return no - // matches for "jennifer". - // - // Dictionary words containing a large number of characters that are not - // letters or digits may result in unexpected findings because such characters - // are treated as whitespace. The - // [limits](https://cloud.google.com/dlp/limits) page contains details about - // the size limits of dictionaries. For dictionaries that do not fit within - // these constraints, consider using `LargeCustomDictionaryConfig` in the - // `StoredInfoType` API. - message Dictionary { - // Message defining a list of words or phrases to search for in the data. - message WordList { - // Words or phrases defining the dictionary. The dictionary must contain - // at least one phrase and every phrase must contain at least 2 characters - // that are letters or digits. [required] - repeated string words = 1; - } - - oneof source { - // List of words or phrases to search for. - WordList word_list = 1; - - // Newline-delimited file of words in Cloud Storage. Only a single file - // is accepted. - CloudStoragePath cloud_storage_path = 3; - } - } - - // Message defining a custom regular expression. - message Regex { - // Pattern defining the regular expression. Its syntax - // (https://github.com/google/re2/wiki/Syntax) can be found under the - // google/re2 repository on GitHub. - string pattern = 1; - - // The index of the submatch to extract as findings. When not - // specified, the entire match is returned. No more than 3 may be included. - repeated int32 group_indexes = 2; - } - - // Message for detecting output from deidentification transformations - // such as - // [`CryptoReplaceFfxFpeConfig`](/dlp/docs/reference/rest/v2/organizations.deidentifyTemplates#cryptoreplaceffxfpeconfig). - // These types of transformations are - // those that perform pseudonymization, thereby producing a "surrogate" as - // output. This should be used in conjunction with a field on the - // transformation such as `surrogate_info_type`. This CustomInfoType does - // not support the use of `detection_rules`. - message SurrogateType { - - } - - // Deprecated; use `InspectionRuleSet` instead. Rule for modifying a - // `CustomInfoType` to alter behavior under certain circumstances, depending - // on the specific details of the rule. Not supported for the `surrogate_type` - // custom infoType. - message DetectionRule { - // Message for specifying a window around a finding to apply a detection - // rule. - message Proximity { - // Number of characters before the finding to consider. - int32 window_before = 1; - - // Number of characters after the finding to consider. - int32 window_after = 2; - } - - // Message for specifying an adjustment to the likelihood of a finding as - // part of a detection rule. - message LikelihoodAdjustment { - oneof adjustment { - // Set the likelihood of a finding to a fixed value. - Likelihood fixed_likelihood = 1; - - // Increase or decrease the likelihood by the specified number of - // levels. For example, if a finding would be `POSSIBLE` without the - // detection rule and `relative_likelihood` is 1, then it is upgraded to - // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. - // Likelihood may never drop below `VERY_UNLIKELY` or exceed - // `VERY_LIKELY`, so applying an adjustment of 1 followed by an - // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in - // a final likelihood of `LIKELY`. - int32 relative_likelihood = 2; - } - } - - // The rule that adjusts the likelihood of findings within a certain - // proximity of hotwords. - message HotwordRule { - // Regular expression pattern defining what qualifies as a hotword. - Regex hotword_regex = 1; - - // Proximity of the finding within which the entire hotword must reside. - // The total length of the window cannot exceed 1000 characters. Note that - // the finding itself will be included in the window, so that hotwords may - // be used to match substrings of the finding itself. For example, the - // certainty of a phone number regex "\(\d{3}\) \d{3}-\d{4}" could be - // adjusted upwards if the area code is known to be the local area code of - // a company office using the hotword regex "\(xxx\)", where "xxx" - // is the area code in question. - Proximity proximity = 2; - - // Likelihood adjustment to apply to all matching findings. - LikelihoodAdjustment likelihood_adjustment = 3; - } - - oneof type { - // Hotword-based detection rule. - HotwordRule hotword_rule = 1; - } - } - - enum ExclusionType { - // A finding of this custom info type will not be excluded from results. - EXCLUSION_TYPE_UNSPECIFIED = 0; - - // A finding of this custom info type will be excluded from final results, - // but can still affect rule execution. - EXCLUSION_TYPE_EXCLUDE = 1; - } - - // CustomInfoType can either be a new infoType, or an extension of built-in - // infoType, when the name matches one of existing infoTypes and that infoType - // is specified in `InspectContent.info_types` field. Specifying the latter - // adds findings to the one detected by the system. If built-in info type is - // not specified in `InspectContent.info_types` list then the name is treated - // as a custom info type. - InfoType info_type = 1; - - // Likelihood to return for this CustomInfoType. This base value can be - // altered by a detection rule if the finding meets the criteria specified by - // the rule. Defaults to `VERY_LIKELY` if not specified. - Likelihood likelihood = 6; - - oneof type { - // A list of phrases to detect as a CustomInfoType. - Dictionary dictionary = 2; - - // Regular expression based CustomInfoType. - Regex regex = 3; - - // Message for detecting output from deidentification transformations that - // support reversing. - SurrogateType surrogate_type = 4; - - // Load an existing `StoredInfoType` resource for use in - // `InspectDataSource`. Not currently supported in `InspectContent`. - StoredType stored_type = 5; - } - - // Set of detection rules to apply to all findings of this CustomInfoType. - // Rules are applied in order that they are specified. Not supported for the - // `surrogate_type` CustomInfoType. - repeated DetectionRule detection_rules = 7; - - // If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding - // to be returned. It still can be used for rules matching. - ExclusionType exclusion_type = 8; -} - -// General identifier of a data field in a storage service. -message FieldId { - // Name describing the field. - string name = 1; -} - -// Datastore partition ID. -// A partition ID identifies a grouping of entities. The grouping is always -// by project and namespace, however the namespace ID may be empty. -// -// A partition ID contains several dimensions: -// project ID and namespace ID. -message PartitionId { - // The ID of the project to which the entities belong. - string project_id = 2; - - // If not empty, the ID of the namespace to which the entities belong. - string namespace_id = 4; -} - -// A representation of a Datastore kind. -message KindExpression { - // The name of the kind. - string name = 1; -} - -// Options defining a data set within Google Cloud Datastore. -message DatastoreOptions { - // A partition ID identifies a grouping of entities. The grouping is always - // by project and namespace, however the namespace ID may be empty. - PartitionId partition_id = 1; - - // The kind to process. - KindExpression kind = 2; -} - -// Message representing a set of files in a Cloud Storage bucket. Regular -// expressions are used to allow fine-grained control over which files in the -// bucket to include. -// -// Included files are those that match at least one item in `include_regex` and -// do not match any items in `exclude_regex`. Note that a file that matches -// items from both lists will _not_ be included. For a match to occur, the -// entire file path (i.e., everything in the url after the bucket name) must -// match the regular expression. -// -// For example, given the input `{bucket_name: "mybucket", include_regex: -// ["directory1/.*"], exclude_regex: -// ["directory1/excluded.*"]}`: -// -// * `gs://mybucket/directory1/myfile` will be included -// * `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches -// across `/`) -// * `gs://mybucket/directory0/directory1/myfile` will _not_ be included (the -// full path doesn't match any items in `include_regex`) -// * `gs://mybucket/directory1/excludedfile` will _not_ be included (the path -// matches an item in `exclude_regex`) -// -// If `include_regex` is left empty, it will match all files by default -// (this is equivalent to setting `include_regex: [".*"]`). -// -// Some other common use cases: -// -// * `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all -// files in `mybucket` except for .pdf files -// * `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will -// include all files directly under `gs://mybucket/directory/`, without matching -// across `/` -message CloudStorageRegexFileSet { - // The name of a Cloud Storage bucket. Required. - string bucket_name = 1; - - // A list of regular expressions matching file paths to include. All files in - // the bucket that match at least one of these regular expressions will be - // included in the set of files, except for those that also match an item in - // `exclude_regex`. Leaving this field empty will match all files by default - // (this is equivalent to including `.*` in the list). - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string include_regex = 2; - - // A list of regular expressions matching file paths to exclude. All files in - // the bucket that match at least one of these regular expressions will be - // excluded from the scan. - // - // Regular expressions use RE2 - // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found - // under the google/re2 repository on GitHub. - repeated string exclude_regex = 3; -} - -// Options defining a file or a set of files within a Google Cloud Storage -// bucket. -message CloudStorageOptions { - // Set of files to scan. - message FileSet { - // The Cloud Storage url of the file(s) to scan, in the format - // `gs:///`. Trailing wildcard in the path is allowed. - // - // If the url ends in a trailing slash, the bucket or directory represented - // by the url will be scanned non-recursively (content in sub-directories - // will not be scanned). This means that `gs://mybucket/` is equivalent to - // `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to - // `gs://mybucket/directory/*`. - // - // Exactly one of `url` or `regex_file_set` must be set. - string url = 1; - - // The regex-filtered set of files to scan. Exactly one of `url` or - // `regex_file_set` must be set. - CloudStorageRegexFileSet regex_file_set = 2; - } - - // How to sample bytes if not all bytes are scanned. Meaningful only when used - // in conjunction with bytes_limit_per_file. If not specified, scanning would - // start from the top. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan from the top (default). - TOP = 1; - - // For each file larger than bytes_limit_per_file, randomly pick the offset - // to start scanning. The scanned bytes are contiguous. - RANDOM_START = 2; - } - - // The set of one or more files to scan. - FileSet file_set = 1; - - // Max number of bytes to scan from a file. If a scanned file's size is bigger - // than this value then the rest of the bytes are omitted. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - int64 bytes_limit_per_file = 4; - - // Max percentage of bytes to scan from a file. The rest are omitted. The - // number of bytes scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one - // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. - int32 bytes_limit_per_file_percent = 8; - - // List of file type groups to include in the scan. - // If empty, all files are scanned and available data format processors - // are applied. In addition, the binary content of the selected files - // is always scanned as well. - repeated FileType file_types = 5; - - SampleMethod sample_method = 6; - - // Limits the number of files to scan to this percentage of the input FileSet. - // Number of files scanned is rounded down. Must be between 0 and 100, - // inclusively. Both 0 and 100 means no limit. Defaults to 0. - int32 files_limit_percent = 7; -} - -// Message representing a set of files in Cloud Storage. -message CloudStorageFileSet { - // The url, in the format `gs:///`. Trailing wildcard in the - // path is allowed. - string url = 1; -} - -// Message representing a single file or path in Cloud Storage. -message CloudStoragePath { - // A url representing a file or path (no wildcards) in Cloud Storage. - // Example: gs://[BUCKET_NAME]/dictionary.txt - string path = 1; -} - -// Options defining BigQuery table and row identifiers. -message BigQueryOptions { - // How to sample rows if not all rows are scanned. Meaningful only when used - // in conjunction with either rows_limit or rows_limit_percent. If not - // specified, scanning would start from the top. - enum SampleMethod { - SAMPLE_METHOD_UNSPECIFIED = 0; - - // Scan from the top (default). - TOP = 1; - - // Randomly pick the row to start scanning. The scanned rows are contiguous. - RANDOM_START = 2; - } - - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // References to fields uniquely identifying rows within the table. - // Nested fields in the format, like `person.birthdate.year`, are allowed. - repeated FieldId identifying_fields = 2; - - // Max number of rows to scan. If the table has more rows than this value, the - // rest of the rows are omitted. If not set, or if set to 0, all rows will be - // scanned. Only one of rows_limit and rows_limit_percent can be specified. - // Cannot be used in conjunction with TimespanConfig. - int64 rows_limit = 3; - - // Max percentage of rows to scan. The rest are omitted. The number of rows - // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and - // 100 means no limit. Defaults to 0. Only one of rows_limit and - // rows_limit_percent can be specified. Cannot be used in conjunction with - // TimespanConfig. - int32 rows_limit_percent = 6; - - SampleMethod sample_method = 4; - - // References to fields excluded from scanning. This allows you to skip - // inspection of entire columns which you know have no findings. - repeated FieldId excluded_fields = 5; -} - -// Shared message indicating Cloud storage type. -message StorageConfig { - // Configuration of the timespan of the items to include in scanning. - // Currently only supported when inspecting Google Cloud Storage and BigQuery. - message TimespanConfig { - // Exclude files or rows older than this value. - google.protobuf.Timestamp start_time = 1; - - // Exclude files or rows newer than this value. - // If set to zero, no upper time limit is applied. - google.protobuf.Timestamp end_time = 2; - - // Specification of the field containing the timestamp of scanned items. - // Used for data sources like Datastore and BigQuery. - // - // For BigQuery: - // Required to filter out rows based on the given start and - // end times. If not specified and the table was modified between the given - // start and end times, the entire table will be scanned. - // The valid data types of the timestamp field are: `INTEGER`, `DATE`, - // `TIMESTAMP`, or `DATETIME` BigQuery column. - // - // For Datastore. - // Valid data types of the timestamp field are: `TIMESTAMP`. - // Datastore entity will be scanned if the timestamp property does not - // exist or its value is empty or invalid. - FieldId timestamp_field = 3; - - // When the job is started by a JobTrigger we will automatically figure out - // a valid start_time to avoid scanning files that have not been modified - // since the last time the JobTrigger executed. This will be based on the - // time of the execution of the last run of the JobTrigger. - bool enable_auto_population_of_timespan_config = 4; - } - - oneof type { - // Google Cloud Datastore options specification. - DatastoreOptions datastore_options = 2; - - // Google Cloud Storage options specification. - CloudStorageOptions cloud_storage_options = 3; - - // BigQuery options specification. - BigQueryOptions big_query_options = 4; - } - - TimespanConfig timespan_config = 6; -} - -// Definitions of file type groups to scan. -enum FileType { - // Includes all files. - FILE_TYPE_UNSPECIFIED = 0; - - // Includes all file extensions not covered by text file types. - BINARY_FILE = 1; - - // Included file extensions: - // asc, brf, c, cc, cpp, csv, cxx, c++, cs, css, dart, eml, go, h, hh, hpp, - // hxx, h++, hs, html, htm, shtml, shtm, xhtml, lhs, ini, java, js, json, - // ocaml, md, mkd, markdown, m, ml, mli, pl, pm, php, phtml, pht, py, pyw, - // rb, rbw, rs, rc, scala, sh, sql, tex, txt, text, tsv, vcard, vcs, wml, - // xml, xsl, xsd, yml, yaml. - TEXT_FILE = 2; - - // Included file extensions: - // bmp, gif, jpg, jpeg, jpe, png. - // bytes_limit_per_file has no effect on image files. - IMAGE = 3; - - // Included file extensions: - // avro - AVRO = 7; -} - -// Row key for identifying a record in BigQuery table. -message BigQueryKey { - // Complete BigQuery table reference. - BigQueryTable table_reference = 1; - - // Absolute number of the row from the beginning of the table at the time - // of scanning. - int64 row_number = 2; -} - -// Record key for a finding in Cloud Datastore. -message DatastoreKey { - // Datastore entity key. - Key entity_key = 1; -} - -// A unique identifier for a Datastore entity. -// If a key's partition ID or any of its path kinds or names are -// reserved/read-only, the key is reserved/read-only. -// A reserved/read-only key is forbidden in certain documented contexts. -message Key { - // A (kind, ID/name) pair used to construct a key path. - // - // If either name or ID is set, the element is complete. - // If neither is set, the element is incomplete. - message PathElement { - // The kind of the entity. - // A kind matching regex `__.*__` is reserved/read-only. - // A kind must not contain more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string kind = 1; - - // The type of ID. - oneof id_type { - // The auto-allocated ID of the entity. - // Never equal to zero. Values less than zero are discouraged and may not - // be supported in the future. - int64 id = 2; - - // The name of the entity. - // A name matching regex `__.*__` is reserved/read-only. - // A name must not be more than 1500 bytes when UTF-8 encoded. - // Cannot be `""`. - string name = 3; - } - } - - // Entities are partitioned into subsets, currently identified by a project - // ID and namespace ID. - // Queries are scoped to a single partition. - PartitionId partition_id = 1; - - // The entity path. - // An entity path consists of one or more elements composed of a kind and a - // string or numerical identifier, which identify entities. The first - // element identifies a _root entity_, the second element identifies - // a _child_ of the root entity, the third element identifies a child of the - // second entity, and so forth. The entities identified by all prefixes of - // the path are called the element's _ancestors_. - // - // A path can never be empty, and a path can have at most 100 elements. - repeated PathElement path = 2; -} - -// Message for a unique key indicating a record that contains a finding. -message RecordKey { - oneof type { - DatastoreKey datastore_key = 2; - - BigQueryKey big_query_key = 3; - } - - // Values of identifying columns in the given row. Order of values matches - // the order of field identifiers specified in the scanning request. - repeated string id_values = 5; -} - -// Message defining the location of a BigQuery table. A table is uniquely -// identified by its project_id, dataset_id, and table_name. Within a query -// a table is often referenced with a string in the format of: -// `:.` or -// `..`. -message BigQueryTable { - // The Google Cloud Platform project ID of the project containing the table. - // If omitted, project ID is inferred from the API call. - string project_id = 1; - - // Dataset ID of the table. - string dataset_id = 2; - - // Name of the table. - string table_id = 3; -} - -// Message defining a field of a BigQuery table. -message BigQueryField { - // Source table of the field. - BigQueryTable table = 1; - - // Designated field in the BigQuery table. - FieldId field = 2; -} - -// An entity in a dataset is a field or set of fields that correspond to a -// single person. For example, in medical records the `EntityId` might be a -// patient identifier, or for financial records it might be an account -// identifier. This message is used when generalizations or analysis must take -// into account that multiple rows correspond to the same entity. -message EntityId { - // Composite key indicating which field contains the entity identifier. - FieldId field = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline deleted file mode 100644 index b5b445c0c60e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.activate_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_ActivateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callActivateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.activateJobTrigger(request); - console.log(response); - } - - callActivateJobTrigger(); - // [END dlp_v2_generated_DlpService_ActivateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline deleted file mode 100644 index 47b434df56af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.cancel_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_CancelDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource to be cancelled. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCancelDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.cancelDlpJob(request); - console.log(response); - } - - callCancelDlpJob(); - // [END dlp_v2_generated_DlpService_CancelDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline deleted file mode 100644 index 2685e142586c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_deidentify_template.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, deidentifyTemplate) { - // [START dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. The DeidentifyTemplate to create. - */ - // const deidentifyTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - /** - * The geographic location to store the deidentification template. Reserved - * for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDeidentifyTemplate() { - // Construct request - const request = { - parent, - deidentifyTemplate, - }; - - // Run request - const response = await dlpClient.createDeidentifyTemplate(request); - console.log(response); - } - - callCreateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_dlp_job.js.baseline deleted file mode 100644 index a6943675b570..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_dlp_job.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_CreateDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Set to control what and how to inspect. - */ - // const inspectJob = {} - /** - * Set to choose what metric to calculate. - */ - // const riskJob = {} - /** - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const jobId = 'abc123' - /** - * The geographic location to store and process the job. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateDlpJob() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.createDlpJob(request); - console.log(response); - } - - callCreateDlpJob(); - // [END dlp_v2_generated_DlpService_CreateDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_inspect_template.js.baseline deleted file mode 100644 index f682c0fec447..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_inspect_template.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inspectTemplate) { - // [START dlp_v2_generated_DlpService_CreateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. The InspectTemplate to create. - */ - // const inspectTemplate = {} - /** - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const templateId = 'abc123' - /** - * The geographic location to store the inspection template. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateInspectTemplate() { - // Construct request - const request = { - parent, - inspectTemplate, - }; - - // Run request - const response = await dlpClient.createInspectTemplate(request); - console.log(response); - } - - callCreateInspectTemplate(); - // [END dlp_v2_generated_DlpService_CreateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_job_trigger.js.baseline deleted file mode 100644 index 653488b701b7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_job_trigger.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, jobTrigger) { - // [START dlp_v2_generated_DlpService_CreateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Required. The JobTrigger to create. - */ - // const jobTrigger = {} - /** - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const triggerId = 'abc123' - /** - * The geographic location to store the job trigger. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateJobTrigger() { - // Construct request - const request = { - parent, - jobTrigger, - }; - - // Run request - const response = await dlpClient.createJobTrigger(request); - console.log(response); - } - - callCreateJobTrigger(); - // [END dlp_v2_generated_DlpService_CreateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline deleted file mode 100644 index af5ef9532dbd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.create_stored_info_type.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, config) { - // [START dlp_v2_generated_DlpService_CreateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Required. Configuration of the storedInfoType to create. - */ - // const config = {} - /** - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - */ - // const storedInfoTypeId = 'abc123' - /** - * The geographic location to store the stored infoType. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callCreateStoredInfoType() { - // Construct request - const request = { - parent, - config, - }; - - // Run request - const response = await dlpClient.createStoredInfoType(request); - console.log(response); - } - - callCreateStoredInfoType(); - // [END dlp_v2_generated_DlpService_CreateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.deidentify_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.deidentify_content.js.baseline deleted file mode 100644 index 68aacb308f32..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.deidentify_content.js.baseline +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_DeidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - */ - // const deidentifyConfig = {} - /** - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to de-identify. Will be treated as text. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const deidentifyTemplateName = 'abc123' - /** - * The geographic location to process de-identification. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeidentifyContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.deidentifyContent(request); - console.log(response); - } - - callDeidentifyContent(); - // [END dlp_v2_generated_DlpService_DeidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline deleted file mode 100644 index 9832555f263e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_deidentify_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDeidentifyTemplate(request); - console.log(response); - } - - callDeleteDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline deleted file mode 100644 index 447e30908c4e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource to be deleted. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteDlpJob(request); - console.log(response); - } - - callDeleteDlpJob(); - // [END dlp_v2_generated_DlpService_DeleteDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline deleted file mode 100644 index cdc3772c5ba6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_inspect_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteInspectTemplate(request); - console.log(response); - } - - callDeleteInspectTemplate(); - // [END dlp_v2_generated_DlpService_DeleteInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline deleted file mode 100644 index 2fbdc72404ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteJobTrigger(request); - console.log(response); - } - - callDeleteJobTrigger(); - // [END dlp_v2_generated_DlpService_DeleteJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline deleted file mode 100644 index fe200b40d889..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.delete_stored_info_type.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_DeleteStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callDeleteStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.deleteStoredInfoType(request); - console.log(response); - } - - callDeleteStoredInfoType(); - // [END dlp_v2_generated_DlpService_DeleteStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline deleted file mode 100644 index f385f82fbc26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_deidentify_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDeidentifyTemplate(request); - console.log(response); - } - - callGetDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_GetDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_dlp_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_dlp_job.js.baseline deleted file mode 100644 index 0518c84fd8ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_dlp_job.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetDlpJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the DlpJob resource. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetDlpJob() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getDlpJob(request); - console.log(response); - } - - callGetDlpJob(); - // [END dlp_v2_generated_DlpService_GetDlpJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_inspect_template.js.baseline deleted file mode 100644 index 9df0038d360e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_inspect_template.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getInspectTemplate(request); - console.log(response); - } - - callGetInspectTemplate(); - // [END dlp_v2_generated_DlpService_GetInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_job_trigger.js.baseline deleted file mode 100644 index d5b8dbce803f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_job_trigger.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getJobTrigger(request); - console.log(response); - } - - callGetJobTrigger(); - // [END dlp_v2_generated_DlpService_GetJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline deleted file mode 100644 index 59c3246e903f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.get_stored_info_type.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_GetStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the organization and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callGetStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.getStoredInfoType(request); - console.log(response); - } - - callGetStoredInfoType(); - // [END dlp_v2_generated_DlpService_GetStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.inspect_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.inspect_content.js.baseline deleted file mode 100644 index 404760b19076..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.inspect_content.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_InspectContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - */ - // const inspectConfig = {} - /** - * The item to inspect. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * The geographic location to process content inspection. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callInspectContent() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.inspectContent(request); - console.log(response); - } - - callInspectContent(); - // [END dlp_v2_generated_DlpService_InspectContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline deleted file mode 100644 index 0740067f6f4a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_deidentify_templates.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDeidentifyTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listDeidentifyTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDeidentifyTemplates(); - // [END dlp_v2_generated_DlpService_ListDeidentifyTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline deleted file mode 100644 index 07c9bcda6359..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_dlp_jobs.js.baseline +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListDlpJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * Examples: - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - /** - * The type of job. Defaults to `DlpJobType.INSPECT` - */ - // const type = {} - /** - * 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, end_time asc, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - */ - // const orderBy = 'abc123' - /** - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListDlpJobs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listDlpJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListDlpJobs(); - // [END dlp_v2_generated_DlpService_ListDlpJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_info_types.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_info_types.js.baseline deleted file mode 100644 index 1cffe8d3cc7e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_info_types.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_ListInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - */ - // const languageCode = 'abc123' - /** - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - */ - // const filter = 'abc123' - /** - * The geographic location to list info types. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInfoTypes() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.listInfoTypes(request); - console.log(response); - } - - callListInfoTypes(); - // [END dlp_v2_generated_DlpService_ListInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline deleted file mode 100644 index 7dce51a645ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_inspect_templates.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListInspectTemplates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListInspectTemplates`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListInspectTemplates() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listInspectTemplatesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInspectTemplates(); - // [END dlp_v2_generated_DlpService_ListInspectTemplates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_job_triggers.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_job_triggers.js.baseline deleted file mode 100644 index f109b44fbeea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_job_triggers.js.baseline +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListJobTriggers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example `projects/my-project-id`. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by a server. - */ - // const pageSize = 1234 - /** - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - */ - // const orderBy = 'abc123' - /** - * Allows filtering. - * Supported syntax: - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * Examples: - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * The length of this field should be no more than 500 characters. - */ - // const filter = 'abc123' - /** - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListJobTriggers() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listJobTriggersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListJobTriggers(); - // [END dlp_v2_generated_DlpService_ListJobTriggers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline deleted file mode 100644 index ac35aa07a842..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.list_stored_info_types.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ListStoredInfoTypes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - */ - // const parent = 'abc123' - /** - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - */ - // const pageToken = 'abc123' - /** - * Size of the page, can be limited by server. If zero server returns - * a page of max size 100. - */ - // const pageSize = 1234 - /** - * 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, display_name, create_time desc` - * Supported fields are: - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - */ - // const orderBy = 'abc123' - /** - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callListStoredInfoTypes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = dlpClient.listStoredInfoTypesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStoredInfoTypes(); - // [END dlp_v2_generated_DlpService_ListStoredInfoTypes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.redact_image.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.redact_image.js.baseline deleted file mode 100644 index a83c9dacd249..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.redact_image.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START dlp_v2_generated_DlpService_RedactImage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent resource name, for example projects/my-project-id. - */ - // const parent = 'abc123' - /** - * The geographic location to process the request. Reserved for future - * extensions. - */ - // const locationId = 'abc123' - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The configuration for specifying what content to redact from images. - */ - // const imageRedactionConfigs = [1,2,3,4] - /** - * Whether the response should include findings along with the redacted - * image. - */ - // const includeFindings = true - /** - * The content must be PNG, JPEG, SVG or BMP. - */ - // const byteItem = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callRedactImage() { - // Construct request - const request = { - }; - - // Run request - const response = await dlpClient.redactImage(request); - console.log(response); - } - - callRedactImage(); - // [END dlp_v2_generated_DlpService_RedactImage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.reidentify_content.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.reidentify_content.js.baseline deleted file mode 100644 index fd15ba53ab2f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.reidentify_content.js.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START dlp_v2_generated_DlpService_ReidentifyContent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource name. - */ - // const parent = 'abc123' - /** - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - */ - // const reidentifyConfig = {} - /** - * Configuration for the inspector. - */ - // const inspectConfig = {} - /** - * The item to re-identify. Will be treated as text. - */ - // const item = {} - /** - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const inspectTemplateName = 'abc123' - /** - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - */ - // const reidentifyTemplateName = 'abc123' - /** - * The geographic location to process content reidentification. Reserved for - * future extensions. - */ - // const locationId = 'abc123' - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callReidentifyContent() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await dlpClient.reidentifyContent(request); - console.log(response); - } - - callReidentifyContent(); - // [END dlp_v2_generated_DlpService_ReidentifyContent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline deleted file mode 100644 index 1adcf9cf8af0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_deidentify_template.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - */ - // const name = 'abc123' - /** - * New DeidentifyTemplate value. - */ - // const deidentifyTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateDeidentifyTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateDeidentifyTemplate(request); - console.log(response); - } - - callUpdateDeidentifyTemplate(); - // [END dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_inspect_template.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_inspect_template.js.baseline deleted file mode 100644 index 327d9d94bd37..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_inspect_template.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateInspectTemplate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - */ - // const name = 'abc123' - /** - * New InspectTemplate value. - */ - // const inspectTemplate = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateInspectTemplate() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateInspectTemplate(request); - console.log(response); - } - - callUpdateInspectTemplate(); - // [END dlp_v2_generated_DlpService_UpdateInspectTemplate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_job_trigger.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_job_trigger.js.baseline deleted file mode 100644 index 3db941a8b878..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_job_trigger.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateJobTrigger_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - */ - // const name = 'abc123' - /** - * New JobTrigger value. - */ - // const jobTrigger = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateJobTrigger() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateJobTrigger(request); - console.log(response); - } - - callUpdateJobTrigger(); - // [END dlp_v2_generated_DlpService_UpdateJobTrigger_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline deleted file mode 100644 index 2ca0268ae2ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/dlp_service.update_stored_info_type.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START dlp_v2_generated_DlpService_UpdateStoredInfoType_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - */ - // const name = 'abc123' - /** - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - */ - // const config = {} - /** - * Mask to control which fields get updated. - */ - // const updateMask = {} - - // Imports the Dlp library - const {DlpServiceClient} = require('dlp').v2; - - // Instantiates a client - const dlpClient = new DlpServiceClient(); - - async function callUpdateStoredInfoType() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await dlpClient.updateStoredInfoType(request); - console.log(response); - } - - callUpdateStoredInfoType(); - // [END dlp_v2_generated_DlpService_UpdateStoredInfoType_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline deleted file mode 100644 index 1dd4ff44c0f6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/samples/generated/v2/snippet_metadata_google.privacy.dlp.v2.json.baseline +++ /dev/null @@ -1,1535 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-dlp", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.privacy.dlp.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "dlp_v2_generated_DlpService_InspectContent_async", - "title": "DlpService inspectContent Sample", - "origin": "API_DEFINITION", - "description": " Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated. For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,", - "canonical": true, - "file": "dlp_service.inspect_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "InspectContent", - "fullName": "google.privacy.dlp.v2.DlpService.InspectContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_RedactImage_async", - "title": "DlpService redactImage Sample", - "origin": "API_DEFINITION", - "description": " Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.redact_image.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "image_redaction_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "include_findings", - "type": "TYPE_BOOL" - }, - { - "name": "byte_item", - "type": ".google.privacy.dlp.v2.ByteContentItem" - } - ], - "resultType": ".google.privacy.dlp.v2.RedactImageResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "RedactImage", - "fullName": "google.privacy.dlp.v2.DlpService.RedactImage", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeidentifyContent_async", - "title": "DlpService deidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more. When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.deidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 89, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.DeidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ReidentifyContent_async", - "title": "DlpService reidentifyContent Sample", - "origin": "API_DEFINITION", - "description": " Re-identifies content that has been de-identified. See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.", - "canonical": true, - "file": "dlp_service.reidentify_content.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 95, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_config", - "type": ".google.privacy.dlp.v2.DeidentifyConfig" - }, - { - "name": "inspect_config", - "type": ".google.privacy.dlp.v2.InspectConfig" - }, - { - "name": "item", - "type": ".google.privacy.dlp.v2.ContentItem" - }, - { - "name": "inspect_template_name", - "type": "TYPE_STRING" - }, - { - "name": "reidentify_template_name", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ReidentifyContentResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ReidentifyContent", - "fullName": "google.privacy.dlp.v2.DlpService.ReidentifyContent", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInfoTypes_async", - "title": "DlpService listInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of the sensitive information types that the DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.", - "canonical": true, - "file": "dlp_service.list_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "async": true, - "parameters": [ - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateInspectTemplate_async", - "title": "DlpService createInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.create_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateInspectTemplate_async", - "title": "DlpService updateInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.update_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "inspect_template", - "type": ".google.privacy.dlp.v2.InspectTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetInspectTemplate_async", - "title": "DlpService getInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.get_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.InspectTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListInspectTemplates_async", - "title": "DlpService listInspectTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.list_inspect_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListInspectTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListInspectTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListInspectTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteInspectTemplate_async", - "title": "DlpService deleteInspectTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.", - "canonical": true, - "file": "dlp_service.delete_inspect_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteInspectTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteInspectTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async", - "title": "DlpService createDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.create_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "template_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async", - "title": "DlpService updateDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.update_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "deidentify_template", - "type": ".google.privacy.dlp.v2.DeidentifyTemplate" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDeidentifyTemplate_async", - "title": "DlpService getDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.get_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DeidentifyTemplate", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.GetDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDeidentifyTemplates_async", - "title": "DlpService listDeidentifyTemplates Sample", - "origin": "API_DEFINITION", - "description": " Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.list_deidentify_templates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDeidentifyTemplatesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDeidentifyTemplates", - "fullName": "google.privacy.dlp.v2.DlpService.ListDeidentifyTemplates", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async", - "title": "DlpService deleteDeidentifyTemplate Sample", - "origin": "API_DEFINITION", - "description": " Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.", - "canonical": true, - "file": "dlp_service.delete_deidentify_template.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDeidentifyTemplate", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDeidentifyTemplate", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateJobTrigger_async", - "title": "DlpService createJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.create_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "trigger_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.CreateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateJobTrigger_async", - "title": "DlpService updateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.update_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "job_trigger", - "type": ".google.privacy.dlp.v2.JobTrigger" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetJobTrigger_async", - "title": "DlpService getJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.get_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.JobTrigger", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.GetJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListJobTriggers_async", - "title": "DlpService listJobTriggers Sample", - "origin": "API_DEFINITION", - "description": " Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.list_job_triggers.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListJobTriggersResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListJobTriggers", - "fullName": "google.privacy.dlp.v2.DlpService.ListJobTriggers", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteJobTrigger_async", - "title": "DlpService deleteJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.", - "canonical": true, - "file": "dlp_service.delete_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ActivateJobTrigger_async", - "title": "DlpService activateJobTrigger Sample", - "origin": "API_DEFINITION", - "description": " Activate a job trigger. Causes the immediate execute of a trigger instead of waiting on the trigger event to occur.", - "canonical": true, - "file": "dlp_service.activate_job_trigger.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ActivateJobTrigger", - "fullName": "google.privacy.dlp.v2.DlpService.ActivateJobTrigger", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateDlpJob_async", - "title": "DlpService createDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.", - "canonical": true, - "file": "dlp_service.create_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "inspect_job", - "type": ".google.privacy.dlp.v2.InspectJobConfig" - }, - { - "name": "risk_job", - "type": ".google.privacy.dlp.v2.RiskAnalysisJobConfig" - }, - { - "name": "job_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CreateDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListDlpJobs_async", - "title": "DlpService listDlpJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists DlpJobs that match the specified filter in the request. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.list_dlp_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 111, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": ".google.privacy.dlp.v2.DlpJobType" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListDlpJobsResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListDlpJobs", - "fullName": "google.privacy.dlp.v2.DlpService.ListDlpJobs", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetDlpJob_async", - "title": "DlpService getDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Gets the latest state of a long-running DlpJob. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.get_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.DlpJob", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.GetDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteDlpJob_async", - "title": "DlpService deleteDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.delete_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CancelDlpJob_async", - "title": "DlpService cancelDlpJob Sample", - "origin": "API_DEFINITION", - "description": " Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.", - "canonical": true, - "file": "dlp_service.cancel_dlp_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CancelDlpJob", - "fullName": "google.privacy.dlp.v2.DlpService.CancelDlpJob", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_CreateStoredInfoType_async", - "title": "DlpService createStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Creates a pre-built stored infoType to be used for inspection. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.create_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "stored_info_type_id", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "CreateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.CreateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_UpdateStoredInfoType_async", - "title": "DlpService updateStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Updates the stored infoType by creating a new version. The existing version will continue to be used until the new version is ready. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.update_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "config", - "type": ".google.privacy.dlp.v2.StoredInfoTypeConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "UpdateStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.UpdateStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_GetStoredInfoType_async", - "title": "DlpService getStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Gets a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.get_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.StoredInfoType", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "GetStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.GetStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_ListStoredInfoTypes_async", - "title": "DlpService listStoredInfoTypes Sample", - "origin": "API_DEFINITION", - "description": " Lists stored infoTypes. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.list_stored_info_types.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.privacy.dlp.v2.ListStoredInfoTypesResponse", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "ListStoredInfoTypes", - "fullName": "google.privacy.dlp.v2.DlpService.ListStoredInfoTypes", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - }, - { - "regionTag": "dlp_v2_generated_DlpService_DeleteStoredInfoType_async", - "title": "DlpService deleteStoredInfoType Sample", - "origin": "API_DEFINITION", - "description": " Deletes a stored infoType. See https://cloud.google.com/dlp/docs/creating-stored-infotypes to learn more.", - "canonical": true, - "file": "dlp_service.delete_stored_info_type.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "DlpServiceClient", - "fullName": "google.privacy.dlp.v2.DlpServiceClient" - }, - "method": { - "shortName": "DeleteStoredInfoType", - "fullName": "google.privacy.dlp.v2.DlpService.DeleteStoredInfoType", - "service": { - "shortName": "DlpService", - "fullName": "google.privacy.dlp.v2.DlpService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/src/index.ts.baseline deleted file mode 100644 index 71974c943a92..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2'; -const DlpServiceClient = v2.DlpServiceClient; -type DlpServiceClient = v2.DlpServiceClient; -export {v2, DlpServiceClient}; -export default {v2, DlpServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client.ts.baseline deleted file mode 100644 index 073ba1d4679f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client.ts.baseline +++ /dev/null @@ -1,4887 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * 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. - */ -import * as gapicConfig from './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 - */ -export class DlpServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('dlp'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - dlpServiceStub?: Promise<{[name: string]: Function}>; - - /** - * 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://cloud.google.com/docs/authentication/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?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DlpServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'dlp.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - dlpJobPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/dlpJobs/{dlp_job}' - ), - jobTriggerPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/jobTriggers/{job_trigger}' - ), - 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}' - ), - 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}' - ), - projectInspectTemplatePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/inspectTemplates/{inspect_template}' - ), - 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 as gax.ClientConfig, - 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 as protobuf.Root).lookupService('google.privacy.dlp.v2.DlpService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.privacy.dlp.v2.DlpService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // 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', 'getJobTrigger', 'listJobTriggers', 'deleteJobTrigger', 'activateJobTrigger', 'createDlpJob', 'listDlpJobs', 'getDlpJob', 'deleteDlpJob', 'cancelDlpJob', 'createStoredInfoType', 'updateStoredInfoType', 'getStoredInfoType', 'listStoredInfoTypes', 'deleteStoredInfoType']; - for (const methodName of dlpServiceStubMethods) { - const callPromise = this.dlpServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'dlp.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'dlp.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Finds potentially sensitive info in content. - * This method has limits on input size, processing time, and output size. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images - * and https://cloud.google.com/dlp/docs/inspecting-text, - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. What specified here will override - * the template referenced by the inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to inspect. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process content inspection. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.InspectContentResponse|InspectContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.inspect_content.js - * region_tag:dlp_v2_generated_DlpService_InspectContent_async - */ - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request: protos.google.privacy.dlp.v2.IInspectContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): void; - inspectContent( - request?: protos.google.privacy.dlp.v2.IInspectContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('inspectContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('inspectContent response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.inspectContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectContentResponse, - protos.google.privacy.dlp.v2.IInspectContentRequest|undefined, - {}|undefined - ]) => { - this._log.info('inspectContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Redacts potentially sensitive info from an image. - * This method has limits on input size, processing time, and output size. - * See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {string} request.locationId - * The geographic location to process the request. Reserved for future - * extensions. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {number[]} request.imageRedactionConfigs - * The configuration for specifying what content to redact from images. - * @param {boolean} request.includeFindings - * Whether the response should include findings along with the redacted - * image. - * @param {google.privacy.dlp.v2.ByteContentItem} request.byteItem - * The content must be PNG, JPEG, SVG or BMP. - * @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 {@link protos.google.privacy.dlp.v2.RedactImageResponse|RedactImageResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.redact_image.js - * region_tag:dlp_v2_generated_DlpService_RedactImage_async - */ - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request: protos.google.privacy.dlp.v2.IRedactImageRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): void; - redactImage( - request?: protos.google.privacy.dlp.v2.IRedactImageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('redactImage request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('redactImage response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.redactImage(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IRedactImageResponse, - protos.google.privacy.dlp.v2.IRedactImageRequest|undefined, - {}|undefined - ]) => { - this._log.info('redactImage response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * De-identifies potentially sensitive info from a ContentItem. - * This method has limits on input size and output size. - * See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to - * learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in this request, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.deidentifyConfig - * Configuration for the de-identification of the content item. - * Items specified here will override the template referenced by the - * deidentify_template_name argument. - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * Items specified here will override the template referenced by the - * inspect_template_name argument. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to de-identify. Will be treated as text. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * inspect_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.deidentifyTemplateName - * Template to use. Any configuration directly specified in - * deidentify_config will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process de-identification. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyContentResponse|DeidentifyContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.deidentify_content.js - * region_tag:dlp_v2_generated_DlpService_DeidentifyContent_async - */ - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - deidentifyContent( - request?: protos.google.privacy.dlp.v2.IDeidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deidentifyContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deidentifyContent response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deidentifyContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyContentResponse, - protos.google.privacy.dlp.v2.IDeidentifyContentRequest|undefined, - {}|undefined - ]) => { - this._log.info('deidentifyContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Re-identifies content that has been de-identified. - * See - * https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example - * to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name. - * @param {google.privacy.dlp.v2.DeidentifyConfig} request.reidentifyConfig - * Configuration for the re-identification of the content item. - * This field shares the same proto message type that is used for - * de-identification, however its usage here is for the reversal of the - * previous de-identification. Re-identification is performed by examining - * the transformations used to de-identify the items and executing the - * reverse. This requires that only reversible transformations - * be provided here. The reversible transformations are: - * - * - `CryptoDeterministicConfig` - * - `CryptoReplaceFfxFpeConfig` - * @param {google.privacy.dlp.v2.InspectConfig} request.inspectConfig - * Configuration for the inspector. - * @param {google.privacy.dlp.v2.ContentItem} request.item - * The item to re-identify. Will be treated as text. - * @param {string} request.inspectTemplateName - * Template to use. Any configuration directly specified in - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.reidentifyTemplateName - * Template to use. References an instance of `DeidentifyTemplate`. - * Any configuration directly specified in `reidentify_config` or - * `inspect_config` will override those set in the template. Singular fields - * that are set in this request will replace their corresponding fields in the - * template. Repeated fields are appended. Singular sub-messages and groups - * are recursively merged. - * @param {string} request.locationId - * The geographic location to process content reidentification. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.ReidentifyContentResponse|ReidentifyContentResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.reidentify_content.js - * region_tag:dlp_v2_generated_DlpService_ReidentifyContent_async - */ - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): void; - reidentifyContent( - request?: protos.google.privacy.dlp.v2.IReidentifyContentRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reidentifyContent request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reidentifyContent response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.reidentifyContent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IReidentifyContentResponse, - protos.google.privacy.dlp.v2.IReidentifyContentRequest|undefined, - {}|undefined - ]) => { - this._log.info('reidentifyContent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns a list of the sensitive information types that the DLP API - * supports. See https://cloud.google.com/dlp/docs/infotypes-reference to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.languageCode - * BCP-47 language code for localized infoType friendly - * names. If omitted, or if localized strings are not available, - * en-US strings will be returned. - * @param {string} request.filter - * filter to only return infoTypes supported by certain parts of the - * API. Defaults to supported_by=INSPECT. - * @param {string} request.locationId - * The geographic location to list info types. Reserved for future - * extensions. - * @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 {@link protos.google.privacy.dlp.v2.ListInfoTypesResponse|ListInfoTypesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.list_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListInfoTypes_async - */ - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): void; - listInfoTypes( - request?: protos.google.privacy.dlp.v2.IListInfoTypesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listInfoTypes request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listInfoTypes response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listInfoTypes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IListInfoTypesResponse, - protos.google.privacy.dlp.v2.IListInfoTypesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listInfoTypes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates an InspectTemplate for re-using frequently used configuration - * for inspecting content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * Required. The InspectTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the inspection template. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_CreateInspectTemplate_async - */ - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - createInspectTemplate( - request?: protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.ICreateInspectTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('createInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and inspectTemplate to be updated, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @param {google.privacy.dlp.v2.InspectTemplate} request.inspectTemplate - * New InspectTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateInspectTemplate_async - */ - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateInspectTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IUpdateInspectTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be read, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @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 {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_GetInspectTemplate_async - */ - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - getInspectTemplate( - request?: protos.google.privacy.dlp.v2.IGetInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IInspectTemplate, - protos.google.privacy.dlp.v2.IGetInspectTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an InspectTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and inspectTemplate to be deleted, for - * example `organizations/433245324/inspectTemplates/432452342` or - * projects/project-id/inspectTemplates/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_inspect_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteInspectTemplate_async - */ - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteInspectTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteInspectTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteInspectTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteInspectTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteInspectTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteInspectTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a DeidentifyTemplate for re-using frequently used configuration - * for de-identifying content, images, and storage. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * Required. The DeidentifyTemplate to create. - * @param {string} request.templateId - * The template id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the deidentification template. Reserved - * for future extensions. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_CreateDeidentifyTemplate_async - */ - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - createDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.ICreateDeidentifyTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and deidentify template to be updated, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @param {google.privacy.dlp.v2.DeidentifyTemplate} request.deidentifyTemplate - * New DeidentifyTemplate value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_UpdateDeidentifyTemplate_async - */ - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - updateDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IUpdateDeidentifyTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be read, for - * example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @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 {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_GetDeidentifyTemplate_async - */ - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - getDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate, - protos.google.privacy.dlp.v2.IGetDeidentifyTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a DeidentifyTemplate. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and deidentify template to be deleted, - * for example `organizations/433245324/deidentifyTemplates/432452342` or - * projects/project-id/deidentifyTemplates/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_deidentify_template.js - * region_tag:dlp_v2_generated_DlpService_DeleteDeidentifyTemplate_async - */ - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): void; - deleteDeidentifyTemplate( - request?: protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDeidentifyTemplate request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDeidentifyTemplate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteDeidentifyTemplate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDeidentifyTemplateRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDeidentifyTemplate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a job trigger to run DLP actions such as scanning storage for - * sensitive information on a set schedule. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * Required. The JobTrigger to create. - * @param {string} request.triggerId - * The trigger id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the job trigger. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_CreateJobTrigger_async - */ - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - createJobTrigger( - request?: protos.google.privacy.dlp.v2.ICreateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createJobTrigger response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.ICreateJobTriggerRequest|undefined, - {}|undefined - ]) => { - this._log.info('createJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @param {google.privacy.dlp.v2.JobTrigger} request.jobTrigger - * New JobTrigger value. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_UpdateJobTrigger_async - */ - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - updateJobTrigger( - request?: protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateJobTrigger response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IUpdateJobTriggerRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_GetJobTrigger_async - */ - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - getJobTrigger( - request?: protos.google.privacy.dlp.v2.IGetJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getJobTrigger response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IJobTrigger, - protos.google.privacy.dlp.v2.IGetJobTriggerRequest|undefined, - {}|undefined - ]) => { - this._log.info('getJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a job trigger. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the project and the triggeredJob, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_DeleteJobTrigger_async - */ - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - deleteJobTrigger( - request?: protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteJobTrigger response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteJobTriggerRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Activate a job trigger. Causes the immediate execute of a trigger - * instead of waiting on the trigger event to occur. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the trigger to activate, for example - * `projects/dlp-test-project/jobTriggers/53234423`. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.activate_job_trigger.js - * region_tag:dlp_v2_generated_DlpService_ActivateJobTrigger_async - */ - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): void; - activateJobTrigger( - request?: protos.google.privacy.dlp.v2.IActivateJobTriggerRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('activateJobTrigger request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('activateJobTrigger response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.activateJobTrigger(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IActivateJobTriggerRequest|undefined, - {}|undefined - ]) => { - this._log.info('activateJobTrigger response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new job to inspect storage or calculate risk metrics. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the - * system will automatically choose what detectors to run. By default this may - * be all types, but may change over time as detectors are updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {google.privacy.dlp.v2.InspectJobConfig} request.inspectJob - * Set to control what and how to inspect. - * @param {google.privacy.dlp.v2.RiskAnalysisJobConfig} request.riskJob - * Set to choose what metric to calculate. - * @param {string} request.jobId - * The job id can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store and process the job. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CreateDlpJob_async - */ - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): void; - createDlpJob( - request?: protos.google.privacy.dlp.v2.ICreateDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createDlpJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.ICreateDlpJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('createDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the latest state of a long-running DlpJob. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource. - * @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 {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_GetDlpJob_async - */ - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): void; - getDlpJob( - request?: protos.google.privacy.dlp.v2.IGetDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDlpJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IDlpJob, - protos.google.privacy.dlp.v2.IGetDlpJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a long-running DlpJob. This method indicates that the client is - * no longer interested in the DlpJob result. The job will be cancelled if - * possible. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_DeleteDlpJob_async - */ - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): void; - deleteDlpJob( - request?: protos.google.privacy.dlp.v2.IDeleteDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteDlpJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteDlpJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Starts asynchronous cancellation on a long-running DlpJob. The server - * makes a best effort to cancel the DlpJob, but success is not - * guaranteed. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the DlpJob resource to be cancelled. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.cancel_dlp_job.js - * region_tag:dlp_v2_generated_DlpService_CancelDlpJob_async - */ - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): void; - cancelDlpJob( - request?: protos.google.privacy.dlp.v2.ICancelDlpJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('cancelDlpJob request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancelDlpJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.cancelDlpJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.ICancelDlpJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancelDlpJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a pre-built stored infoType to be used for inspection. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Required. Configuration of the storedInfoType to create. - * @param {string} request.storedInfoTypeId - * The storedInfoType ID can contain uppercase and lowercase letters, - * numbers, and hyphens; that is, it must match the regular - * expression: `[a-zA-Z\\d-_]+`. The maximum length is 100 - * characters. Can be empty to allow the system to generate one. - * @param {string} request.locationId - * The geographic location to store the stored infoType. Reserved for - * future extensions. - * @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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.create_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_CreateStoredInfoType_async - */ - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - createStoredInfoType( - request?: protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.ICreateStoredInfoTypeRequest|undefined, - {}|undefined - ]) => { - this._log.info('createStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the stored infoType by creating a new version. The existing version - * will continue to be used until the new version is ready. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of organization and storedInfoType to be updated, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @param {google.privacy.dlp.v2.StoredInfoTypeConfig} request.config - * Updated configuration for the storedInfoType. If not provided, a new - * version of the storedInfoType will be created with the existing - * configuration. - * @param {google.protobuf.FieldMask} request.updateMask - * Mask to control which fields get 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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.update_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_UpdateStoredInfoType_async - */ - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - updateStoredInfoType( - request?: protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IUpdateStoredInfoTypeRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be read, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @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 {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.get_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_GetStoredInfoType_async - */ - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - callback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - getStoredInfoType( - request?: protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.privacy.dlp.v2.IStoredInfoType, - protos.google.privacy.dlp.v2.IGetStoredInfoTypeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a stored infoType. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the organization and storedInfoType to be deleted, for - * example `organizations/433245324/storedInfoTypes/432452342` or - * projects/project-id/storedInfoTypes/432452342. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/dlp_service.delete_stored_info_type.js - * region_tag:dlp_v2_generated_DlpService_DeleteStoredInfoType_async - */ - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): void; - deleteStoredInfoType( - request?: protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteStoredInfoType request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteStoredInfoType response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteStoredInfoType(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.privacy.dlp.v2.IDeleteStoredInfoTypeRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteStoredInfoType response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists InspectTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.InspectTemplate|InspectTemplate}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * 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. - */ - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): void; - listInspectTemplates( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IInspectTemplate>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInspectTemplates values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listInspectTemplates request %j', request); - return this.innerApiCalls - .listInspectTemplates(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IInspectTemplate[], - protos.google.privacy.dlp.v2.IListInspectTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListInspectTemplatesResponse - ]) => { - this._log.info('listInspectTemplates values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listInspectTemplates`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInspectTemplates stream %j', request); - return this.descriptors.page.listInspectTemplates.createStream( - this.innerApiCalls.listInspectTemplates as GaxCall, - 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @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 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where inspection templates will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 include:samples/generated/v2/dlp_service.list_inspect_templates.js - * region_tag:dlp_v2_generated_DlpService_ListInspectTemplates_async - */ - listInspectTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListInspectTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listInspectTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInspectTemplates iterate %j', request); - return this.descriptors.page.listInspectTemplates.asyncIterate( - this.innerApiCalls['listInspectTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DeidentifyTemplates. - * See https://cloud.google.com/dlp/docs/creating-templates-deid to learn - * more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.DeidentifyTemplate|DeidentifyTemplate}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDeidentifyTemplatesAsync()` - * 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. - */ - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): void; - listDeidentifyTemplates( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>): - Promise<[ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse|null|undefined, - protos.google.privacy.dlp.v2.IDeidentifyTemplate>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDeidentifyTemplates values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listDeidentifyTemplates request %j', request); - return this.innerApiCalls - .listDeidentifyTemplates(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IDeidentifyTemplate[], - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest|null, - protos.google.privacy.dlp.v2.IListDeidentifyTemplatesResponse - ]) => { - this._log.info('listDeidentifyTemplates values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDeidentifyTemplates`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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.DeidentifyTemplate|DeidentifyTemplate} 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 `listDeidentifyTemplatesAsync()` - * 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. - */ - listDeidentifyTemplatesStream( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDeidentifyTemplates stream %j', request); - return this.descriptors.page.listDeidentifyTemplates.createStream( - this.innerApiCalls.listDeidentifyTemplates as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDeidentifyTemplates`, 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListDeidentifyTemplates`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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 time the template was created. - * - `update_time`: corresponds to time the template was last updated. - * - `name`: corresponds to template's name. - * - `display_name`: corresponds to template's display name. - * @param {string} request.locationId - * The geographic location where deidentifications templates will be retrieved - * from. Use `-` for all locations. Reserved for future extensions. - * @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.DeidentifyTemplate|DeidentifyTemplate}. 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 include:samples/generated/v2/dlp_service.list_deidentify_templates.js - * region_tag:dlp_v2_generated_DlpService_ListDeidentifyTemplates_async - */ - listDeidentifyTemplatesAsync( - request?: protos.google.privacy.dlp.v2.IListDeidentifyTemplatesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDeidentifyTemplates']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDeidentifyTemplates iterate %j', request); - return this.descriptors.page.listDeidentifyTemplates.asyncIterate( - this.innerApiCalls['listDeidentifyTemplates'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists job triggers. - * See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.JobTrigger|JobTrigger}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listJobTriggersAsync()` - * 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. - */ - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): void; - listJobTriggers( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>): - Promise<[ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListJobTriggersRequest, - protos.google.privacy.dlp.v2.IListJobTriggersResponse|null|undefined, - protos.google.privacy.dlp.v2.IJobTrigger>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listJobTriggers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listJobTriggers request %j', request); - return this.innerApiCalls - .listJobTriggers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IJobTrigger[], - protos.google.privacy.dlp.v2.IListJobTriggersRequest|null, - protos.google.privacy.dlp.v2.IListJobTriggersResponse - ]) => { - this._log.info('listJobTriggers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listJobTriggers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.JobTrigger|JobTrigger} 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 `listJobTriggersAsync()` - * 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. - */ - listJobTriggersStream( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobTriggers stream %j', request); - return this.descriptors.page.listJobTriggers.createStream( - this.innerApiCalls.listJobTriggers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listJobTriggers`, 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. The parent resource name, for example `projects/my-project-id`. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to ListJobTriggers. `order_by` field must not - * change for subsequent calls. - * @param {number} request.pageSize - * Size of the page, can be limited by a server. - * @param {string} request.orderBy - * Comma separated list of triggeredJob 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 time the JobTrigger was created. - * - `update_time`: corresponds to time the JobTrigger was last updated. - * - `last_run_time`: corresponds to the last time the JobTrigger ran. - * - `name`: corresponds to JobTrigger's name. - * - `display_name`: corresponds to JobTrigger's display name. - * - `status`: corresponds to JobTrigger's status. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `status` - HEALTHY|PAUSED|CANCELLED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - 'last_run_time` - RFC 3339 formatted timestamp, surrounded by - * quotation marks. Nanoseconds are ignored. - * - 'error_count' - Number of errors that have occurred while running. - * * The operator must be `=` or `!=` for status and inspected_storage. - * - * Examples: - * - * * inspected_storage = cloud_storage AND status = HEALTHY - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = PAUSED OR state = HEALTHY) - * * last_run_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {string} request.locationId - * The geographic location where job triggers will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.JobTrigger|JobTrigger}. 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 include:samples/generated/v2/dlp_service.list_job_triggers.js - * region_tag:dlp_v2_generated_DlpService_ListJobTriggers_async - */ - listJobTriggersAsync( - request?: protos.google.privacy.dlp.v2.IListJobTriggersRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listJobTriggers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listJobTriggers iterate %j', request); - return this.descriptors.page.listJobTriggers.asyncIterate( - this.innerApiCalls['listJobTriggers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists DlpJobs that match the specified filter in the request. - * See https://cloud.google.com/dlp/docs/inspecting-storage and - * https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.DlpJob|DlpJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDlpJobsAsync()` - * 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. - */ - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): void; - listDlpJobs( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>): - Promise<[ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListDlpJobsRequest, - protos.google.privacy.dlp.v2.IListDlpJobsResponse|null|undefined, - protos.google.privacy.dlp.v2.IDlpJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listDlpJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listDlpJobs request %j', request); - return this.innerApiCalls - .listDlpJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IDlpJob[], - protos.google.privacy.dlp.v2.IListDlpJobsRequest|null, - protos.google.privacy.dlp.v2.IListDlpJobsResponse - ]) => { - this._log.info('listDlpJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listDlpJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.DlpJob|DlpJob} 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 `listDlpJobsAsync()` - * 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. - */ - listDlpJobsStream( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDlpJobs stream %j', request); - return this.descriptors.page.listDlpJobs.createStream( - this.innerApiCalls.listDlpJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listDlpJobs`, 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. The parent resource name, for example projects/my-project-id. - * @param {string} request.filter - * Allows filtering. - * - * Supported syntax: - * - * * Filter expressions are made up of one or more restrictions. - * * Restrictions can be combined by `AND` or `OR` logical operators. A - * sequence of restrictions implicitly uses `AND`. - * * A restriction has the form of `{field} {operator} {value}`. - * * Supported fields/values for inspect jobs: - * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED - * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY - * - `trigger_name` - The resource name of the trigger that created job. - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * Supported fields for risk analysis jobs: - * - `state` - RUNNING|CANCELED|FINISHED|FAILED - * - 'end_time` - Corresponds to time the job finished. - * - 'start_time` - Corresponds to time the job finished. - * * The operator must be `=` or `!=`. - * - * Examples: - * - * * inspected_storage = cloud_storage AND state = done - * * inspected_storage = cloud_storage OR inspected_storage = bigquery - * * inspected_storage = cloud_storage AND (state = done OR state = canceled) - * * end_time > \"2017-12-12T00:00:00+00:00\" - * - * The length of this field should be no more than 500 characters. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {google.privacy.dlp.v2.DlpJobType} request.type - * The type of job. Defaults to `DlpJobType.INSPECT` - * @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, end_time asc, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the job was created. - * - `end_time`: corresponds to time the job ended. - * - `name`: corresponds to job's name. - * - `state`: corresponds to `state` - * @param {string} request.locationId - * The geographic location where jobs will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.DlpJob|DlpJob}. 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 include:samples/generated/v2/dlp_service.list_dlp_jobs.js - * region_tag:dlp_v2_generated_DlpService_ListDlpJobs_async - */ - listDlpJobsAsync( - request?: protos.google.privacy.dlp.v2.IListDlpJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listDlpJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listDlpJobs iterate %j', request); - return this.descriptors.page.listDlpJobs.asyncIterate( - this.innerApiCalls['listDlpJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists stored infoTypes. - * See https://cloud.google.com/dlp/docs/creating-stored-infotypes to - * learn more. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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 Array of {@link protos.google.privacy.dlp.v2.StoredInfoType|StoredInfoType}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listStoredInfoTypesAsync()` - * 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. - */ - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - callback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): void; - listStoredInfoTypes( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>, - callback?: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>): - Promise<[ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse|null|undefined, - protos.google.privacy.dlp.v2.IStoredInfoType>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listStoredInfoTypes values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listStoredInfoTypes request %j', request); - return this.innerApiCalls - .listStoredInfoTypes(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.privacy.dlp.v2.IStoredInfoType[], - protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest|null, - protos.google.privacy.dlp.v2.IListStoredInfoTypesResponse - ]) => { - this._log.info('listStoredInfoTypes values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listStoredInfoTypes`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.StoredInfoType|StoredInfoType} 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 `listStoredInfoTypesAsync()` - * 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. - */ - listStoredInfoTypesStream( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listStoredInfoTypes stream %j', request); - return this.descriptors.page.listStoredInfoTypes.createStream( - this.innerApiCalls.listStoredInfoTypes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStoredInfoTypes`, 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. The parent resource name, for example projects/my-project-id or - * organizations/my-org-id. - * @param {string} request.pageToken - * Page token to continue retrieval. Comes from previous call - * to `ListStoredInfoTypes`. - * @param {number} request.pageSize - * Size of the page, can be limited by 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, display_name, create_time desc` - * - * Supported fields are: - * - * - `create_time`: corresponds to time the most recent version of the - * resource was created. - * - `state`: corresponds to the state of the resource. - * - `name`: corresponds to resource name. - * - `display_name`: corresponds to info type's display name. - * @param {string} request.locationId - * The geographic location where stored infoTypes will be retrieved from. - * Use `-` for all locations. Reserved for future extensions. - * @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.StoredInfoType|StoredInfoType}. 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 include:samples/generated/v2/dlp_service.list_stored_info_types.js - * region_tag:dlp_v2_generated_DlpService_ListStoredInfoTypes_async - */ - listStoredInfoTypesAsync( - request?: protos.google.privacy.dlp.v2.IListStoredInfoTypesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - 'location_id': request.locationId?.toString() ?? '', - }); - const defaultCallSettings = this._defaults['listStoredInfoTypes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listStoredInfoTypes iterate %j', request); - return this.descriptors.page.listStoredInfoTypes.asyncIterate( - this.innerApiCalls['listStoredInfoTypes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified dlpJob resource name string. - * - * @param {string} project - * @param {string} dlp_job - * @returns {string} Resource name string. - */ - dlpJobPath(project:string,dlpJob:string) { - return this.pathTemplates.dlpJobPathTemplate.render({ - project: project, - dlp_job: dlpJob, - }); - } - - /** - * Parse the project from DlpJob resource. - * - * @param {string} dlpJobName - * A fully-qualified path representing DlpJob resource. - * @returns {string} A string representing the project. - */ - matchProjectFromDlpJobName(dlpJobName: string) { - return this.pathTemplates.dlpJobPathTemplate.match(dlpJobName).project; - } - - /** - * Parse the dlp_job from DlpJob resource. - * - * @param {string} dlpJobName - * A fully-qualified path representing DlpJob resource. - * @returns {string} A string representing the dlp_job. - */ - matchDlpJobFromDlpJobName(dlpJobName: string) { - return this.pathTemplates.dlpJobPathTemplate.match(dlpJobName).dlp_job; - } - - /** - * Return a fully-qualified jobTrigger resource name string. - * - * @param {string} project - * @param {string} job_trigger - * @returns {string} Resource name string. - */ - jobTriggerPath(project:string,jobTrigger:string) { - return this.pathTemplates.jobTriggerPathTemplate.render({ - project: project, - job_trigger: jobTrigger, - }); - } - - /** - * Parse the project from JobTrigger resource. - * - * @param {string} jobTriggerName - * A fully-qualified path representing JobTrigger resource. - * @returns {string} A string representing the project. - */ - matchProjectFromJobTriggerName(jobTriggerName: string) { - return this.pathTemplates.jobTriggerPathTemplate.match(jobTriggerName).project; - } - - /** - * Parse the job_trigger from JobTrigger resource. - * - * @param {string} jobTriggerName - * A fully-qualified path representing JobTrigger resource. - * @returns {string} A string representing the job_trigger. - */ - matchJobTriggerFromJobTriggerName(jobTriggerName: string) { - return this.pathTemplates.jobTriggerPathTemplate.match(jobTriggerName).job_trigger; - } - - /** - * Return a fully-qualified organization resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationPath(organization:string) { - return this.pathTemplates.organizationPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from Organization resource. - * - * @param {string} organizationName - * A fully-qualified path representing Organization resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationName(organizationName: string) { - return this.pathTemplates.organizationPathTemplate.match(organizationName).organization; - } - - /** - * Return a fully-qualified organizationDeidentifyTemplate resource name string. - * - * @param {string} organization - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - organizationDeidentifyTemplatePath(organization:string,deidentifyTemplate:string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.render({ - organization: organization, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the organization from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).organization; - } - - /** - * Parse the deidentify_template from OrganizationDeidentifyTemplate resource. - * - * @param {string} organizationDeidentifyTemplateName - * A fully-qualified path representing organization_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(organizationDeidentifyTemplateName: string) { - return this.pathTemplates.organizationDeidentifyTemplatePathTemplate.match(organizationDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified organizationInspectTemplate resource name string. - * - * @param {string} organization - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - organizationInspectTemplatePath(organization:string,inspectTemplate:string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.render({ - organization: organization, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the organization from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).organization; - } - - /** - * Parse the inspect_template from OrganizationInspectTemplate resource. - * - * @param {string} organizationInspectTemplateName - * A fully-qualified path representing organization_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromOrganizationInspectTemplateName(organizationInspectTemplateName: string) { - return this.pathTemplates.organizationInspectTemplatePathTemplate.match(organizationInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified organizationStoredInfoType resource name string. - * - * @param {string} organization - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - organizationStoredInfoTypePath(organization:string,storedInfoType:string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.render({ - organization: organization, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the organization from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).organization; - } - - /** - * Parse the stored_info_type from OrganizationStoredInfoType resource. - * - * @param {string} organizationStoredInfoTypeName - * A fully-qualified path representing organization_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromOrganizationStoredInfoTypeName(organizationStoredInfoTypeName: string) { - return this.pathTemplates.organizationStoredInfoTypePathTemplate.match(organizationStoredInfoTypeName).stored_info_type; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectDeidentifyTemplate resource name string. - * - * @param {string} project - * @param {string} deidentify_template - * @returns {string} Resource name string. - */ - projectDeidentifyTemplatePath(project:string,deidentifyTemplate:string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.render({ - project: project, - deidentify_template: deidentifyTemplate, - }); - } - - /** - * Parse the project from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).project; - } - - /** - * Parse the deidentify_template from ProjectDeidentifyTemplate resource. - * - * @param {string} projectDeidentifyTemplateName - * A fully-qualified path representing project_deidentify_template resource. - * @returns {string} A string representing the deidentify_template. - */ - matchDeidentifyTemplateFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName: string) { - return this.pathTemplates.projectDeidentifyTemplatePathTemplate.match(projectDeidentifyTemplateName).deidentify_template; - } - - /** - * Return a fully-qualified projectInspectTemplate resource name string. - * - * @param {string} project - * @param {string} inspect_template - * @returns {string} Resource name string. - */ - projectInspectTemplatePath(project:string,inspectTemplate:string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.render({ - project: project, - inspect_template: inspectTemplate, - }); - } - - /** - * Parse the project from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).project; - } - - /** - * Parse the inspect_template from ProjectInspectTemplate resource. - * - * @param {string} projectInspectTemplateName - * A fully-qualified path representing project_inspect_template resource. - * @returns {string} A string representing the inspect_template. - */ - matchInspectTemplateFromProjectInspectTemplateName(projectInspectTemplateName: string) { - return this.pathTemplates.projectInspectTemplatePathTemplate.match(projectInspectTemplateName).inspect_template; - } - - /** - * Return a fully-qualified projectStoredInfoType resource name string. - * - * @param {string} project - * @param {string} stored_info_type - * @returns {string} Resource name string. - */ - projectStoredInfoTypePath(project:string,storedInfoType:string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.render({ - project: project, - stored_info_type: storedInfoType, - }); - } - - /** - * Parse the project from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).project; - } - - /** - * Parse the stored_info_type from ProjectStoredInfoType resource. - * - * @param {string} projectStoredInfoTypeName - * A fully-qualified path representing project_stored_info_type resource. - * @returns {string} A string representing the stored_info_type. - */ - matchStoredInfoTypeFromProjectStoredInfoTypeName(projectStoredInfoTypeName: string) { - return this.pathTemplates.projectStoredInfoTypePathTemplate.match(projectStoredInfoTypeName).stored_info_type; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.dlpServiceStub && !this._terminated) { - return this.dlpServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client_config.json.baseline deleted file mode 100644 index 0bb30b7906b0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_client_config.json.baseline +++ /dev/null @@ -1,150 +0,0 @@ -{ - "interfaces": { - "google.privacy.dlp.v2.DlpService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "InspectContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RedactImage": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeidentifyContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReidentifyContent": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListInfoTypes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListInspectTemplates": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInspectTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDeidentifyTemplates": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDeidentifyTemplate": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListJobTriggers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ActivateJobTrigger": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListDlpJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CancelDlpJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListStoredInfoTypes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteStoredInfoType": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_proto_list.json.baseline deleted file mode 100644 index 482924bde32a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/dlp_service_proto_list.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/privacy/dlp/v2/dlp.proto", - "../../protos/google/privacy/dlp/v2/storage.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/index.ts.baseline deleted file mode 100644 index 676584dc4e43..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/src/v2/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DlpServiceClient} from './dlp_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 7a1ee11ebd0c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const dlp = require('dlp'); - -function main() { - const dlpServiceClient = new dlp.DlpServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 9a3099a6afc2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {DlpServiceClient} from 'dlp'; - -// check that the client class type name can be used -function doStuffWithDlpServiceClient(client: DlpServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const dlpServiceClient = new DlpServiceClient(); - doStuffWithDlpServiceClient(dlpServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline deleted file mode 100644 index 0952f9f499eb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/test/gapic_dlp_service_v2.ts.baseline +++ /dev/null @@ -1,4874 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as dlpserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.DlpServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'dlp.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = dlpserviceModule.v2.DlpServiceClient.servicePath; - assert.strictEqual(servicePath, 'dlp.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = dlpserviceModule.v2.DlpServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'dlp.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new dlpserviceModule.v2.DlpServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new dlpserviceModule.v2.DlpServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'dlp.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new dlpserviceModule.v2.DlpServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = dlpserviceModule.v2.DlpServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new dlpserviceModule.v2.DlpServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - await client.initialize(); - assert(client.dlpServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dlpServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dlpServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('inspectContent', () => { - it('invokes inspectContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCall(expectedResponse); - const [response] = await client.inspectContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentResponse() - ); - client.innerApiCalls.inspectContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.inspectContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.inspectContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.inspectContent(request), expectedError); - const actualRequest = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.inspectContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes inspectContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.InspectContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.inspectContent(request), expectedError); - }); - }); - - describe('redactImage', () => { - it('invokes redactImage without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCall(expectedResponse); - const [response] = await client.redactImage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageResponse() - ); - client.innerApiCalls.redactImage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.redactImage( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IRedactImageResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.redactImage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.redactImage(request), expectedError); - const actualRequest = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.redactImage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes redactImage with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.RedactImageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.RedactImageRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.redactImage(request), expectedError); - }); - }); - - describe('deidentifyContent', () => { - it('invokes deidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.deidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentResponse() - ); - client.innerApiCalls.deidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deidentifyContent(request), expectedError); - }); - }); - - describe('reidentifyContent', () => { - it('invokes reidentifyContent without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCall(expectedResponse); - const [response] = await client.reidentifyContent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentResponse() - ); - client.innerApiCalls.reidentifyContent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reidentifyContent( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IReidentifyContentResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reidentifyContent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reidentifyContent(request), expectedError); - const actualRequest = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reidentifyContent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reidentifyContent with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ReidentifyContentRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ReidentifyContentRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reidentifyContent(request), expectedError); - }); - }); - - describe('listInfoTypes', () => { - it('invokes listInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesResponse() - ); - client.innerApiCalls.listInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IListInfoTypesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedHeaderRequestParams = `location_id=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInfoTypes with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInfoTypesRequest', ['locationId']); - request.locationId = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listInfoTypes(request), expectedError); - }); - }); - - describe('createInspectTemplate', () => { - it('invokes createInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.createInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateInspectTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createInspectTemplate(request), expectedError); - }); - }); - - describe('updateInspectTemplate', () => { - it('invokes updateInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.updateInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateInspectTemplate(request), expectedError); - }); - }); - - describe('getInspectTemplate', () => { - it('invokes getInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.InspectTemplate() - ); - client.innerApiCalls.getInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInspectTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInspectTemplate(request), expectedError); - }); - }); - - describe('deleteInspectTemplate', () => { - it('invokes deleteInspectTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteInspectTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInspectTemplate( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInspectTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInspectTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInspectTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteInspectTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteInspectTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteInspectTemplate(request), expectedError); - }); - }); - - describe('createDeidentifyTemplate', () => { - it('invokes createDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.createDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDeidentifyTemplateRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDeidentifyTemplate(request), expectedError); - }); - }); - - describe('updateDeidentifyTemplate', () => { - it('invokes updateDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.updateDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateDeidentifyTemplate(request), expectedError); - }); - }); - - describe('getDeidentifyTemplate', () => { - it('invokes getDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.getDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeidentifyTemplate() - ); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDeidentifyTemplate(request), expectedError); - }); - }); - - describe('deleteDeidentifyTemplate', () => { - it('invokes deleteDeidentifyTemplate without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDeidentifyTemplate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDeidentifyTemplate( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDeidentifyTemplate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDeidentifyTemplate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDeidentifyTemplate with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDeidentifyTemplate(request), expectedError); - }); - }); - - describe('createJobTrigger', () => { - it('invokes createJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.createJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.createJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateJobTriggerRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createJobTrigger(request), expectedError); - }); - }); - - describe('updateJobTrigger', () => { - it('invokes updateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.updateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.updateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateJobTrigger(request), expectedError); - }); - }); - - describe('getJobTrigger', () => { - it('invokes getJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.getJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.JobTrigger() - ); - client.innerApiCalls.getJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getJobTrigger(request), expectedError); - }); - }); - - describe('deleteJobTrigger', () => { - it('invokes deleteJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.deleteJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteJobTrigger( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteJobTrigger(request), expectedError); - }); - }); - - describe('activateJobTrigger', () => { - it('invokes activateJobTrigger without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(expectedResponse); - const [response] = await client.activateJobTrigger(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.activateJobTrigger = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.activateJobTrigger( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.activateJobTrigger = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.activateJobTrigger(request), expectedError); - const actualRequest = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.activateJobTrigger as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes activateJobTrigger with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ActivateJobTriggerRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ActivateJobTriggerRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.activateJobTrigger(request), expectedError); - }); - }); - - describe('createDlpJob', () => { - it('invokes createDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.createDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.createDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateDlpJobRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createDlpJob(request), expectedError); - }); - }); - - describe('getDlpJob', () => { - it('invokes getDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.getDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.DlpJob() - ); - client.innerApiCalls.getDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDlpJob( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDlpJob(request), expectedError); - }); - }); - - describe('deleteDlpJob', () => { - it('invokes deleteDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.deleteDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteDlpJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteDlpJob(request), expectedError); - }); - }); - - describe('cancelDlpJob', () => { - it('invokes cancelDlpJob without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(expectedResponse); - const [response] = await client.cancelDlpJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancelDlpJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancelDlpJob( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancelDlpJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancelDlpJob(request), expectedError); - const actualRequest = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancelDlpJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancelDlpJob with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CancelDlpJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CancelDlpJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancelDlpJob(request), expectedError); - }); - }); - - describe('createStoredInfoType', () => { - it('invokes createStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.createStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.createStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.CreateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.CreateStoredInfoTypeRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createStoredInfoType(request), expectedError); - }); - }); - - describe('updateStoredInfoType', () => { - it('invokes updateStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.updateStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.updateStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.UpdateStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateStoredInfoType(request), expectedError); - }); - }); - - describe('getStoredInfoType', () => { - it('invokes getStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.getStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.privacy.dlp.v2.StoredInfoType() - ); - client.innerApiCalls.getStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStoredInfoType( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.GetStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.GetStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getStoredInfoType(request), expectedError); - }); - }); - - describe('deleteStoredInfoType', () => { - it('invokes deleteStoredInfoType without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(expectedResponse); - const [response] = await client.deleteStoredInfoType(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStoredInfoType( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStoredInfoType = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStoredInfoType as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStoredInfoType with closed client', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.DeleteStoredInfoTypeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteStoredInfoType(request), expectedError); - }); - }); - - describe('listInspectTemplates', () => { - it('invokes listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listInspectTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.innerApiCalls.listInspectTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInspectTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IInspectTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInspectTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInspectTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInspectTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInspectTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInspectTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInspectTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.InspectTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.InspectTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInspectTemplates, request)); - assert( - (client.descriptors.page.listInspectTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.InspectTemplate()), - ]; - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - const iterable = client.listInspectTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInspectTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListInspectTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListInspectTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInspectTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInspectTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IInspectTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInspectTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDeidentifyTemplates', () => { - it('invokes listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(expectedResponse); - const [response] = await client.listDeidentifyTemplates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDeidentifyTemplates( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDeidentifyTemplate[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDeidentifyTemplates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDeidentifyTemplates(request), expectedError); - const actualRequest = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDeidentifyTemplates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDeidentifyTemplatesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDeidentifyTemplatesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDeidentifyTemplatesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DeidentifyTemplate[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DeidentifyTemplate) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDeidentifyTemplates, request)); - assert( - (client.descriptors.page.listDeidentifyTemplates.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DeidentifyTemplate()), - ]; - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - const iterable = client.listDeidentifyTemplatesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDeidentifyTemplates with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDeidentifyTemplatesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDeidentifyTemplates.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDeidentifyTemplatesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDeidentifyTemplate[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDeidentifyTemplates.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listJobTriggers', () => { - it('invokes listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCall(expectedResponse); - const [response] = await client.listJobTriggers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.innerApiCalls.listJobTriggers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listJobTriggers( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IJobTrigger[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listJobTriggers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listJobTriggers(request), expectedError); - const actualRequest = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listJobTriggers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listJobTriggersStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listJobTriggersStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listJobTriggersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.JobTrigger[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.JobTrigger) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listJobTriggers, request)); - assert( - (client.descriptors.page.listJobTriggers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - generateSampleMessage(new protos.google.privacy.dlp.v2.JobTrigger()), - ]; - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - const iterable = client.listJobTriggersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listJobTriggers with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListJobTriggersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListJobTriggersRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listJobTriggers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listJobTriggersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IJobTrigger[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listJobTriggers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listDlpJobs', () => { - it('invokes listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listDlpJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.innerApiCalls.listDlpJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDlpJobs( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IDlpJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDlpJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDlpJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDlpJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listDlpJobsStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listDlpJobsStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDlpJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.DlpJob[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.DlpJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDlpJobs, request)); - assert( - (client.descriptors.page.listDlpJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - generateSampleMessage(new protos.google.privacy.dlp.v2.DlpJob()), - ]; - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - const iterable = client.listDlpJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDlpJobs with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListDlpJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListDlpJobsRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDlpJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDlpJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IDlpJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDlpJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStoredInfoTypes', () => { - it('invokes listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(expectedResponse); - const [response] = await client.listStoredInfoTypes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes without error using callback', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.innerApiCalls.listStoredInfoTypes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStoredInfoTypes( - request, - (err?: Error|null, result?: protos.google.privacy.dlp.v2.IStoredInfoType[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStoredInfoTypes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStoredInfoTypes(request), expectedError); - const actualRequest = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStoredInfoTypes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStoredInfoTypesStream without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStoredInfoTypesStream with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStoredInfoTypesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.privacy.dlp.v2.StoredInfoType[] = []; - stream.on('data', (response: protos.google.privacy.dlp.v2.StoredInfoType) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStoredInfoTypes, request)); - assert( - (client.descriptors.page.listStoredInfoTypes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes without error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - generateSampleMessage(new protos.google.privacy.dlp.v2.StoredInfoType()), - ]; - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - const iterable = client.listStoredInfoTypesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStoredInfoTypes with error', async () => { - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.privacy.dlp.v2.ListStoredInfoTypesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['parent']); - request.parent = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.privacy.dlp.v2.ListStoredInfoTypesRequest', ['locationId']); - request.locationId = defaultValue2; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }&location_id=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listStoredInfoTypes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStoredInfoTypesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.privacy.dlp.v2.IStoredInfoType[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStoredInfoTypes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('dlpJob', async () => { - const fakePath = "/rendered/path/dlpJob"; - const expectedParameters = { - project: "projectValue", - dlp_job: "dlpJobValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dlpJobPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dlpJobPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dlpJobPath', () => { - const result = client.dlpJobPath("projectValue", "dlpJobValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dlpJobPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromDlpJobName', () => { - const result = client.matchProjectFromDlpJobName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.dlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDlpJobFromDlpJobName', () => { - const result = client.matchDlpJobFromDlpJobName(fakePath); - assert.strictEqual(result, "dlpJobValue"); - assert((client.pathTemplates.dlpJobPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('jobTrigger', async () => { - const fakePath = "/rendered/path/jobTrigger"; - const expectedParameters = { - project: "projectValue", - job_trigger: "jobTriggerValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.jobTriggerPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.jobTriggerPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('jobTriggerPath', () => { - const result = client.jobTriggerPath("projectValue", "jobTriggerValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.jobTriggerPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromJobTriggerName', () => { - const result = client.matchProjectFromJobTriggerName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.jobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchJobTriggerFromJobTriggerName', () => { - const result = client.matchJobTriggerFromJobTriggerName(fakePath); - assert.strictEqual(result, "jobTriggerValue"); - assert((client.pathTemplates.jobTriggerPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organization', async () => { - const fakePath = "/rendered/path/organization"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationPath', () => { - const result = client.organizationPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationName', () => { - const result = client.matchOrganizationFromOrganizationName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationDeidentifyTemplate', async () => { - const fakePath = "/rendered/path/organizationDeidentifyTemplate"; - const expectedParameters = { - organization: "organizationValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationDeidentifyTemplatePath', () => { - const result = client.organizationDeidentifyTemplatePath("organizationValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchOrganizationFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.organizationDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationInspectTemplate', async () => { - const fakePath = "/rendered/path/organizationInspectTemplate"; - const expectedParameters = { - organization: "organizationValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationInspectTemplatePath', () => { - const result = client.organizationInspectTemplatePath("organizationValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationInspectTemplateName', () => { - const result = client.matchOrganizationFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromOrganizationInspectTemplateName', () => { - const result = client.matchInspectTemplateFromOrganizationInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.organizationInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationStoredInfoType', async () => { - const fakePath = "/rendered/path/organizationStoredInfoType"; - const expectedParameters = { - organization: "organizationValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationStoredInfoTypePath', () => { - const result = client.organizationStoredInfoTypePath("organizationValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationStoredInfoTypeName', () => { - const result = client.matchOrganizationFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromOrganizationStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromOrganizationStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.organizationStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectDeidentifyTemplate', async () => { - const fakePath = "/rendered/path/projectDeidentifyTemplate"; - const expectedParameters = { - project: "projectValue", - deidentify_template: "deidentifyTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectDeidentifyTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectDeidentifyTemplatePath', () => { - const result = client.projectDeidentifyTemplatePath("projectValue", "deidentifyTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectDeidentifyTemplateName', () => { - const result = client.matchProjectFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDeidentifyTemplateFromProjectDeidentifyTemplateName', () => { - const result = client.matchDeidentifyTemplateFromProjectDeidentifyTemplateName(fakePath); - assert.strictEqual(result, "deidentifyTemplateValue"); - assert((client.pathTemplates.projectDeidentifyTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectInspectTemplate', async () => { - const fakePath = "/rendered/path/projectInspectTemplate"; - const expectedParameters = { - project: "projectValue", - inspect_template: "inspectTemplateValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectInspectTemplatePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectInspectTemplatePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectInspectTemplatePath', () => { - const result = client.projectInspectTemplatePath("projectValue", "inspectTemplateValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectInspectTemplateName', () => { - const result = client.matchProjectFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInspectTemplateFromProjectInspectTemplateName', () => { - const result = client.matchInspectTemplateFromProjectInspectTemplateName(fakePath); - assert.strictEqual(result, "inspectTemplateValue"); - assert((client.pathTemplates.projectInspectTemplatePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectStoredInfoType', async () => { - const fakePath = "/rendered/path/projectStoredInfoType"; - const expectedParameters = { - project: "projectValue", - stored_info_type: "storedInfoTypeValue", - }; - const client = new dlpserviceModule.v2.DlpServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectStoredInfoTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectStoredInfoTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectStoredInfoTypePath', () => { - const result = client.projectStoredInfoTypePath("projectValue", "storedInfoTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectStoredInfoTypeName', () => { - const result = client.matchProjectFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStoredInfoTypeFromProjectStoredInfoTypeName', () => { - const result = client.matchStoredInfoTypeFromProjectStoredInfoTypeName(fakePath); - assert.strictEqual(result, "storedInfoTypeValue"); - assert((client.pathTemplates.projectStoredInfoTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/dlp/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/dlp/webpack.config.js.baseline deleted file mode 100644 index 4eaa3715661d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/dlp/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DlpService', - filename: './dlp-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 5dac9f4a2490..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/duplicate_methods_test/google-duplicate_methods_test-nodejs - dest: /owl-bot-staging/google-duplicate_methods_test - -api-name: duplicate_methods_test \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.jsdoc.cjs.baseline deleted file mode 100644 index e049b518ce90..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'duplicate-methods-test', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/README.md.baseline deleted file mode 100644 index fa4497f8102b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Duplicate Methods Test Service API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/duplicate-methods-test.svg)](https://www.npmjs.org/package/duplicate-methods-test) - -Duplicate Methods Test Service API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Duplicate Methods Test Service API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/duplicate_methods_test/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Duplicate Methods Test Service API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install duplicate-methods-test -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install duplicate-methods-test@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=duplicatemethodstest.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/index.ts.baseline deleted file mode 100644 index 2f77a6060187..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -type DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -export {v1, DuplicateMethodsTestServiceClient}; -export default {v1, DuplicateMethodsTestServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts.baseline deleted file mode 100644 index e2576720d4e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client.ts.baseline +++ /dev/null @@ -1,917 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as duplicate_methods_test_service_client_config from './duplicate_methods_test_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/duplicate_methods_test_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'duplicate_methods_test_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * @class - * @memberof v1 - */ -export class DuplicateMethodsTestServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('duplicate-methods-test'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - duplicateMethodsTestServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DuplicateMethodsTestServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 DuplicateMethodsTestServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DuplicateMethodsTestServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'duplicatemethodstest.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listLocations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'locations') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.duplicate_methods_test.v1.DuplicateMethodsTestService', gapicConfig as gax.ClientConfig, - 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.duplicateMethodsTestServiceStub) { - return this.duplicateMethodsTestServiceStub; - } - - // Put together the "service stub" for - // google.duplicate_methods_test.v1.DuplicateMethodsTestService. - this.duplicateMethodsTestServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.duplicate_methods_test.v1.DuplicateMethodsTestService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.duplicate_methods_test.v1.DuplicateMethodsTestService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const duplicateMethodsTestServiceStubMethods = - ['getIamPolicy', 'listLocations', 'echo']; - for (const methodName of duplicateMethodsTestServiceStubMethods) { - const callPromise = this.duplicateMethodsTestServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.duplicateMethodsTestServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getIamPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('getIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Another native method to ensure the service is valid and has other methods. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * @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 {@link protos.google.duplicate_methods_test.v1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.echo.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async - */ - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Native ListLocations method that conflicts with the Locations mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 Array of {@link protos.google.cloud.location.Location|Location}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLocationsAsync()` - * 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. - */ - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>, - callback?: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLocations values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listLocations request %j', request); - return this.innerApiCalls - .listLocations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]) => { - this._log.info('listLocations values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLocations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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.cloud.location.Location|Location} 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 `listLocationsAsync()` - * 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. - */ - listLocationsStream( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations stream %j', request); - return this.descriptors.page.listLocations.createStream( - this.innerApiCalls.listLocations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLocations`, 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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.cloud.location.Location|Location}. 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 include:samples/generated/v1/duplicate_methods_test_service.list_locations.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async - */ - listLocationsAsync( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations iterate %j', request); - return this.descriptors.page.listLocations.asyncIterate( - this.innerApiCalls['listLocations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @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 {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.duplicateMethodsTestServiceStub && !this._terminated) { - return this.duplicateMethodsTestServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json.baseline deleted file mode 100644 index be7baac93862..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.duplicate_methods_test.v1.DuplicateMethodsTestService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLocations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json.baseline deleted file mode 100644 index d3ee7abc5dbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/duplicate_methods_test_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 0104bde3222f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DuplicateMethodsTestServiceClient} from './duplicate_methods_test_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index d42714603ce2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const duplicate-methods-test = require('duplicate-methods-test'); - -function main() { - const duplicateMethodsTestServiceClient = new duplicate-methods-test.DuplicateMethodsTestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index eb41e84cb72d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as duplicate-methods-test from 'duplicate-methods-test'; - -function main() { - const duplicateMethodsTestServiceClient = new duplicate-methods-test.DuplicateMethodsTestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index b5b59ab82822..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {DuplicateMethodsTestServiceClient} from 'duplicate-methods-test'; - -// check that the client class type name can be used -function doStuffWithDuplicateMethodsTestServiceClient(client: DuplicateMethodsTestServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const duplicateMethodsTestServiceClient = new DuplicateMethodsTestServiceClient(); - doStuffWithDuplicateMethodsTestServiceClient(duplicateMethodsTestServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts.baseline deleted file mode 100644 index ad48c9cffc7b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/esm/test/gapic_duplicate_methods_test_service_v1.ts.baseline +++ /dev/null @@ -1,977 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as duplicatemethodstestserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DuplicateMethodsTestServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.servicePath; - assert.strictEqual(servicePath, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - await client.initialize(); - assert(client.duplicateMethodsTestServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.duplicateMethodsTestServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.duplicate_methods_test.v1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - }); - - it('invokes echo with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('listLocations', () => { - it('invokes listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCall(expectedResponse); - const [response] = await client.listLocations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLocations( - request, - (err?: Error|null, result?: protos.google.cloud.location.ILocation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLocations(request), expectedError); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocationsStream without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLocationsStream with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json deleted file mode 100644 index 71c6fe0a2007..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "duplicate-methods-test", - "version": "0.1.0", - "description": "Duplicate_methods_test client for Node.js", - "repository": "googleapis/nodejs-duplicate-methods-test", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google duplicateMethodsTest", - "duplicateMethodsTest", - "duplicate methods test service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline deleted file mode 100644 index b91e79094ffa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.duplicate_methods_test.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/cloud/location/locations.proto"; - -option csharp_namespace = "Google.DuplicateMethodsTest.V1"; -option go_package = "google.golang.org/genproto/googleapis/duplicate_methods_test/v1;duplicate_methods_test"; -option java_multiple_files = true; -option java_outer_classname = "DuplicateMethodsTestProto"; -option java_package = "com.google.duplicate_methods_test.v1"; -option php_namespace = "Google\\DuplicateMethodsTest\\V1"; -option ruby_package = "Google::DuplicateMethodsTest::V1"; - -service DuplicateMethodsTestService { - option (google.api.default_host) = "duplicatemethodstest.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*}:getIamPolicy" - }; - } - - // Native ListLocations method that conflicts with the Locations mixin. - rpc ListLocations(google.cloud.location.ListLocationsRequest) returns (google.cloud.location.ListLocationsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*}/locations" - }; - } - - // Another native method to ensure the service is valid and has other methods. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1/echo" - body: "*" - }; - } -} - -message EchoRequest { - string content = 1; -} - -message EchoResponse { - string content = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline deleted file mode 100644 index 3741fd8a1799..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const content = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callEcho() { - // Construct request - const request = { - }; - - // Run request - const response = await duplicateMethodsTestClient.echo(request); - console.log(response); - } - - callEcho(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline deleted file mode 100644 index aeee64b61439..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource) { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await duplicateMethodsTestClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline deleted file mode 100644 index 4506a9a8664e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource that owns the locations collection, if applicable. - */ - // const name = 'abc123' - /** - * The standard list filter. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callListLocations() { - // Construct request - const request = { - }; - - // Run request - const iterable = duplicateMethodsTestClient.listLocationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLocations(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline deleted file mode 100644 index 5e881b6e29b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline +++ /dev/null @@ -1,151 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-duplicate-methods-test", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.duplicate_methods_test.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async", - "title": "DuplicateMethodsTestService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Native GetIamPolicy method that conflicts with the IAMPolicy mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async", - "title": "DuplicateMethodsTestService listLocations Sample", - "origin": "API_DEFINITION", - "description": " Native ListLocations method that conflicts with the Locations mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.list_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.location.ListLocationsResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async", - "title": "DuplicateMethodsTestService echo Sample", - "origin": "API_DEFINITION", - "description": " Another native method to ensure the service is valid and has other methods.", - "canonical": true, - "file": "duplicate_methods_test_service.echo.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.duplicate_methods_test.v1.EchoResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/webpack.config.cjs.baseline deleted file mode 100644 index 59e373662ce8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DuplicateMethodsTestService', - filename: './duplicate-methods-test-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.OwlBot.yaml.baseline deleted file mode 100644 index 5dac9f4a2490..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/duplicate_methods_test/google-duplicate_methods_test-nodejs - dest: /owl-bot-staging/google-duplicate_methods_test - -api-name: duplicate_methods_test \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.jsdoc.js.baseline deleted file mode 100644 index 9a7ab0b0fad9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'duplicate-methods-test', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/README.md.baseline deleted file mode 100644 index fa4497f8102b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Duplicate Methods Test Service API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/duplicate-methods-test.svg)](https://www.npmjs.org/package/duplicate-methods-test) - -Duplicate Methods Test Service API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Duplicate Methods Test Service API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/duplicate_methods_test/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Duplicate Methods Test Service API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install duplicate-methods-test -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install duplicate-methods-test@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=duplicatemethodstest.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-duplicate_methods_test diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json deleted file mode 100644 index 3f72914705f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "duplicate-methods-test", - "version": "0.1.0", - "description": "Duplicate_methods_test client for Node.js", - "repository": "googleapis/nodejs-duplicate-methods-test", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google duplicateMethodsTest", - "duplicateMethodsTest", - "duplicate methods test service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline deleted file mode 100644 index b91e79094ffa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.duplicate_methods_test.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/cloud/location/locations.proto"; - -option csharp_namespace = "Google.DuplicateMethodsTest.V1"; -option go_package = "google.golang.org/genproto/googleapis/duplicate_methods_test/v1;duplicate_methods_test"; -option java_multiple_files = true; -option java_outer_classname = "DuplicateMethodsTestProto"; -option java_package = "com.google.duplicate_methods_test.v1"; -option php_namespace = "Google\\DuplicateMethodsTest\\V1"; -option ruby_package = "Google::DuplicateMethodsTest::V1"; - -service DuplicateMethodsTestService { - option (google.api.default_host) = "duplicatemethodstest.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*}:getIamPolicy" - }; - } - - // Native ListLocations method that conflicts with the Locations mixin. - rpc ListLocations(google.cloud.location.ListLocationsRequest) returns (google.cloud.location.ListLocationsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*}/locations" - }; - } - - // Another native method to ensure the service is valid and has other methods. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1/echo" - body: "*" - }; - } -} - -message EchoRequest { - string content = 1; -} - -message EchoResponse { - string content = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline deleted file mode 100644 index 3741fd8a1799..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.echo.js.baseline +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const content = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callEcho() { - // Construct request - const request = { - }; - - // Run request - const response = await duplicateMethodsTestClient.echo(request); - console.log(response); - } - - callEcho(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline deleted file mode 100644 index aeee64b61439..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource) { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await duplicateMethodsTestClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline deleted file mode 100644 index 4506a9a8664e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/duplicate_methods_test_service.list_locations.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource that owns the locations collection, if applicable. - */ - // const name = 'abc123' - /** - * The standard list filter. - */ - // const filter = 'abc123' - /** - * The standard list page size. - */ - // const pageSize = 1234 - /** - * The standard list page token. - */ - // const pageToken = 'abc123' - - // Imports the Duplicate_methods_test library - const {DuplicateMethodsTestServiceClient} = require('duplicate-methods-test').v1; - - // Instantiates a client - const duplicateMethodsTestClient = new DuplicateMethodsTestServiceClient(); - - async function callListLocations() { - // Construct request - const request = { - }; - - // Run request - const iterable = duplicateMethodsTestClient.listLocationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLocations(); - // [END duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline deleted file mode 100644 index 5e881b6e29b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/samples/generated/v1/snippet_metadata_google.duplicate_methods_test.v1.json.baseline +++ /dev/null @@ -1,151 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-duplicate-methods-test", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.duplicate_methods_test.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async", - "title": "DuplicateMethodsTestService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Native GetIamPolicy method that conflicts with the IAMPolicy mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.GetIamPolicy", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async", - "title": "DuplicateMethodsTestService listLocations Sample", - "origin": "API_DEFINITION", - "description": " Native ListLocations method that conflicts with the Locations mixin.", - "canonical": true, - "file": "duplicate_methods_test_service.list_locations.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.location.ListLocationsResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "ListLocations", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.ListLocations", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - }, - { - "regionTag": "duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async", - "title": "DuplicateMethodsTestService echo Sample", - "origin": "API_DEFINITION", - "description": " Another native method to ensure the service is valid and has other methods.", - "canonical": true, - "file": "duplicate_methods_test_service.echo.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.duplicate_methods_test.v1.EchoResponse", - "client": { - "shortName": "DuplicateMethodsTestServiceClient", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestServiceClient" - }, - "method": { - "shortName": "Echo", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService.Echo", - "service": { - "shortName": "DuplicateMethodsTestService", - "fullName": "google.duplicate_methods_test.v1.DuplicateMethodsTestService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/index.ts.baseline deleted file mode 100644 index f49a9ce39e40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -type DuplicateMethodsTestServiceClient = v1.DuplicateMethodsTestServiceClient; -export {v1, DuplicateMethodsTestServiceClient}; -export default {v1, DuplicateMethodsTestServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client.ts.baseline deleted file mode 100644 index d50cf3be6a49..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client.ts.baseline +++ /dev/null @@ -1,899 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/duplicate_methods_test_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './duplicate_methods_test_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1 - */ -export class DuplicateMethodsTestServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('duplicate-methods-test'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - duplicateMethodsTestServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DuplicateMethodsTestServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 DuplicateMethodsTestServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DuplicateMethodsTestServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'duplicatemethodstest.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - 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 === 'object' && '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); - - // 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 = { - listLocations: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'locations') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.duplicate_methods_test.v1.DuplicateMethodsTestService', gapicConfig as gax.ClientConfig, - 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.duplicateMethodsTestServiceStub) { - return this.duplicateMethodsTestServiceStub; - } - - // Put together the "service stub" for - // google.duplicate_methods_test.v1.DuplicateMethodsTestService. - this.duplicateMethodsTestServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.duplicate_methods_test.v1.DuplicateMethodsTestService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.duplicate_methods_test.v1.DuplicateMethodsTestService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const duplicateMethodsTestServiceStubMethods = - ['getIamPolicy', 'listLocations', 'echo']; - for (const methodName of duplicateMethodsTestServiceStubMethods) { - const callPromise = this.duplicateMethodsTestServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.duplicateMethodsTestServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'duplicatemethodstest.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Native GetIamPolicy method that conflicts with the IAMPolicy mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.get_iam_policy.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getIamPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Another native method to ensure the service is valid and has other methods. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * @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 {@link protos.google.duplicate_methods_test.v1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/duplicate_methods_test_service.echo.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_Echo_async - */ - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.duplicate_methods_test.v1.IEchoRequest, - callback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.duplicate_methods_test.v1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.duplicate_methods_test.v1.IEchoResponse, - protos.google.duplicate_methods_test.v1.IEchoRequest|undefined, - {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Native ListLocations method that conflicts with the Locations mixin. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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 Array of {@link protos.google.cloud.location.Location|Location}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLocationsAsync()` - * 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. - */ - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request: protos.google.cloud.location.IListLocationsRequest, - callback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): void; - listLocations( - request?: protos.google.cloud.location.IListLocationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>, - callback?: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>): - Promise<[ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.location.IListLocationsRequest, - protos.google.cloud.location.IListLocationsResponse|null|undefined, - protos.google.cloud.location.ILocation>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLocations values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listLocations request %j', request); - return this.innerApiCalls - .listLocations(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.location.ILocation[], - protos.google.cloud.location.IListLocationsRequest|null, - protos.google.cloud.location.IListLocationsResponse - ]) => { - this._log.info('listLocations values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLocations`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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.cloud.location.Location|Location} 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 `listLocationsAsync()` - * 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. - */ - listLocationsStream( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations stream %j', request); - return this.descriptors.page.listLocations.createStream( - this.innerApiCalls.listLocations as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLocations`, 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.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @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.cloud.location.Location|Location}. 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 include:samples/generated/v1/duplicate_methods_test_service.list_locations.js - * region_tag:duplicatemethodstest_v1_generated_DuplicateMethodsTestService_ListLocations_async - */ - listLocationsAsync( - request?: protos.google.cloud.location.IListLocationsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listLocations']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLocations iterate %j', request); - return this.descriptors.page.listLocations.asyncIterate( - this.innerApiCalls['listLocations'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @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 {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.duplicateMethodsTestServiceStub && !this._terminated) { - return this.duplicateMethodsTestServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => {throw err}); - this.locationsClient.close().catch(err => {throw err}); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client_config.json.baseline deleted file mode 100644 index be7baac93862..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.duplicate_methods_test.v1.DuplicateMethodsTestService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListLocations": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_proto_list.json.baseline deleted file mode 100644 index d3ee7abc5dbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/duplicate_methods_test_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/duplicatemethodstest/v1/duplicate_methods_test_v1.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/index.ts.baseline deleted file mode 100644 index 37e108cedea7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {DuplicateMethodsTestServiceClient} from './duplicate_methods_test_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 8e82e79cd312..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const duplicate-methods-test = require('duplicate-methods-test'); - -function main() { - const duplicateMethodsTestServiceClient = new duplicate-methods-test.DuplicateMethodsTestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index b837e1bcff4f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {DuplicateMethodsTestServiceClient} from 'duplicate-methods-test'; - -// check that the client class type name can be used -function doStuffWithDuplicateMethodsTestServiceClient(client: DuplicateMethodsTestServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const duplicateMethodsTestServiceClient = new DuplicateMethodsTestServiceClient(); - doStuffWithDuplicateMethodsTestServiceClient(duplicateMethodsTestServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/test/gapic_duplicate_methods_test_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/test/gapic_duplicate_methods_test_service_v1.ts.baseline deleted file mode 100644 index e9f1676ac7cf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/test/gapic_duplicate_methods_test_service_v1.ts.baseline +++ /dev/null @@ -1,968 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as duplicatemethodstestserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DuplicateMethodsTestServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.servicePath; - assert.strictEqual(servicePath, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'duplicatemethodstest.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'duplicatemethodstest.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - await client.initialize(); - assert(client.duplicateMethodsTestServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.duplicateMethodsTestServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.duplicateMethodsTestServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.duplicate_methods_test.v1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echo with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - }); - - it('invokes echo with closed client', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.duplicate_methods_test.v1.EchoRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('listLocations', () => { - it('invokes listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCall(expectedResponse); - const [response] = await client.listLocations(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.innerApiCalls.listLocations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLocations( - request, - (err?: Error|null, result?: protos.google.cloud.location.ILocation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLocations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLocations(request), expectedError); - const actualRequest = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLocations as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLocationsStream without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLocationsStream with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLocationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.location.Location[] = []; - stream.on('data', (response: protos.google.cloud.location.Location) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLocations, request)); - assert( - (client.descriptors.page.listLocations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - generateSampleMessage(new protos.google.cloud.location.Location()), - ]; - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLocations with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.location.ListLocationsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.location.ListLocationsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new duplicatemethodstestserviceModule.v1.DuplicateMethodsTestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/webpack.config.js.baseline deleted file mode 100644 index 59e373662ce8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/duplicate_methods_test/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'DuplicateMethodsTestService', - filename: './duplicate-methods-test-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 29e8cfa84123..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/kms/google-cloud-kms-nodejs - dest: /owl-bot-staging/google-cloud-kms - -api-name: kms \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.jsdoc.cjs.baseline deleted file mode 100644 index bbc10bed01c8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'kms', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/README.md.baseline deleted file mode 100644 index 7f68cdc9cacc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Cloud Key Management Service (KMS) API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/kms.svg)](https://www.npmjs.org/package/kms) - -Cloud Key Management Service (KMS) API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Cloud Key Management Service (KMS) API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/kms/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Cloud Key Management Service (KMS) API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install kms -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install kms@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/index.ts.baseline deleted file mode 100644 index 8d2cd5910206..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const KeyManagementServiceClient = v1.KeyManagementServiceClient; -type KeyManagementServiceClient = v1.KeyManagementServiceClient; -export {v1, KeyManagementServiceClient}; -export default {v1, KeyManagementServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 9e6bc3bc748c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {KeyManagementServiceClient} from './key_management_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client.ts.baseline deleted file mode 100644 index 205e430c9fc7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client.ts.baseline +++ /dev/null @@ -1,3339 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as key_management_service_client_config from './key_management_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/key_management_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'key_management_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Google Cloud Key Management Service - * - * Manages cryptographic keys and operations using those keys. Implements a REST - * model with the following objects: - * - * * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} - * * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * - * If you are using manual gRPC libraries, see - * [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). - * @class - * @memberof v1 - */ -export class KeyManagementServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('kms'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - keyManagementServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KeyManagementServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 KeyManagementServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KeyManagementServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudkms.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // 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 = { - listKeyRings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keyRings'), - listCryptoKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys'), - listCryptoKeyVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeyVersions'), - listImportJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.v1.KeyManagementService', gapicConfig as gax.ClientConfig, - 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.keyManagementServiceStub) { - return this.keyManagementServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.v1.KeyManagementService. - this.keyManagementServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.KeyManagementService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.v1.KeyManagementService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const keyManagementServiceStubMethods = - ['listKeyRings', 'listCryptoKeys', 'listCryptoKeyVersions', 'listImportJobs', 'getKeyRing', 'getCryptoKey', 'getCryptoKeyVersion', 'getPublicKey', 'getImportJob', 'createKeyRing', 'createCryptoKey', 'createCryptoKeyVersion', 'importCryptoKeyVersion', 'createImportJob', 'updateCryptoKey', 'updateCryptoKeyVersion', 'encrypt', 'decrypt', 'asymmetricSign', 'asymmetricDecrypt', 'updateCryptoKeyPrimaryVersion', 'destroyCryptoKeyVersion', 'restoreCryptoKeyVersion']; - for (const methodName of keyManagementServiceStubMethods) { - const callPromise = this.keyManagementServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.keyManagementServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloudkms' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to get. - * @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 {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetKeyRing_async - */ - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getKeyRing request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getKeyRing response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getKeyRing(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]) => { - this._log.info('getKeyRing response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}, as well as its - * {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary} {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to get. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async - */ - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCryptoKey response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]) => { - this._log.info('getCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to get. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async - */ - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('getCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns the public key for the given {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN|ASYMMETRIC_SIGN} or - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT|ASYMMETRIC_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} public key to - * get. - * @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 {@link protos.google.cloud.kms.v1.PublicKey|PublicKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_public_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetPublicKey_async - */ - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getPublicKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getPublicKey response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getPublicKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]) => { - this._log.info('getPublicKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} to get. - * @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 {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetImportJob_async - */ - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getImportJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getImportJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getImportJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]) => { - this._log.info('getImportJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} in a given Project and Location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {string} request.keyRingId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.KeyRing} request.keyRing - * A {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async - */ - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createKeyRing request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createKeyRing response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createKeyRing(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]) => { - this._log.info('createKeyRing response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} within a {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm|CryptoKey.version_template.algorithm} - * are required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the KeyRing associated with the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * @param {string} request.cryptoKeyId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * A {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with initial field values. - * @param {boolean} request.skipInitialVersionCreation - * If set to true, the request will create a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} without any - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. You must manually call - * {@link protos.google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion|CreateCryptoKeyVersion} or - * {@link protos.google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion|ImportCryptoKeyVersion} - * before you can use this {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async - */ - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createCryptoKey response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]) => { - this._log.info('createCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * The server will assign the next sequential id. If unset, - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} associated with - * the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * A {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async - */ - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('createCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Imports a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} into an existing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} using the - * wrapped key material provided in the request. - * - * The version ID will be assigned the next sequential id within the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to - * be imported into. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} request.algorithm - * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|algorithm} of - * the key being imported. This does not need to match the - * {@link protos.google.cloud.kms.v1.CryptoKey.version_template|version_template} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} this - * version imports into. - * @param {string} request.importJob - * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} that was used to - * wrap this key material. - * @param {Buffer} request.rsaAesWrappedKey - * Wrapped key material produced with - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256|RSA_OAEP_3072_SHA1_AES_256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256|RSA_OAEP_4096_SHA1_AES_256}. - * - * This field contains the concatenation of two wrapped keys: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using RSAES-OAEP with SHA-1, - * MGF1 with SHA-1, and an empty label. - *
  2. - *
  3. The key to be imported, wrapped with the ephemeral AES-256 key - * using AES-KWP (RFC 5649). - *
  4. - *
- * - * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.import_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async - */ - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('importCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('importCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.importCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('importCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} within a {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.ImportJob.import_method|ImportJob.import_method} is required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} associated with the - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * @param {string} request.importJobId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.ImportJob} request.importJob - * Required. An {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateImportJob_async - */ - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createImportJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createImportJob response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createImportJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]) => { - this._log.info('createImportJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required list of fields to be updated in this request. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async - */ - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key.name': request.cryptoKey!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKey response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s metadata. - * - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} may be changed between - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED} and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED} using this - * method. See {@link protos.google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion|DestroyCryptoKeyVersion} and {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} to - * move between other states. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required list of fields to be updated in this request. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async - */ - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key_version.name': request.cryptoKeyVersion!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Encrypts data, so that it can only be recovered by a call to {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt}. - * The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} or {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * to use for encryption. - * - * If a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} is specified, the server will use its - * {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary version}. - * @param {Buffer} request.plaintext - * Required. The data to encrypt. Must be no larger than 64KiB. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the plaintext must be no larger - * than 64KiB. For {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - * @param {Buffer} request.additionalAuthenticatedData - * Optional data that, if specified, must also be provided during decryption - * through {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the AAD must be no larger than - * 64KiB. For {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - * @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 {@link protos.google.cloud.kms.v1.EncryptResponse|EncryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.encrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Encrypt_async - */ - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('encrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('encrypt response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.encrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]) => { - this._log.info('encrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Decrypts data that was protected by {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * must be {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to use for decryption. - * The server will choose the appropriate version. - * @param {Buffer} request.ciphertext - * Required. The encrypted data originally returned in - * {@link protos.google.cloud.kms.v1.EncryptResponse.ciphertext|EncryptResponse.ciphertext}. - * @param {Buffer} request.additionalAuthenticatedData - * Optional data that must match the data originally supplied in - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. - * @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 {@link protos.google.cloud.kms.v1.DecryptResponse|DecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Decrypt_async - */ - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('decrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('decrypt response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.decrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]) => { - this._log.info('decrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * ASYMMETRIC_SIGN, producing a signature that can be verified with the public - * key retrieved from {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for signing. - * @param {google.cloud.kms.v1.Digest} request.digest - * Required. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm}. - * @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 {@link protos.google.cloud.kms.v1.AsymmetricSignResponse|AsymmetricSignResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_sign.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async - */ - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('asymmetricSign request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('asymmetricSign response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.asymmetricSign(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]) => { - this._log.info('asymmetricSign response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Decrypts data that was encrypted with a public key retrieved from - * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey} corresponding to a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} ASYMMETRIC_DECRYPT. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * decryption. - * @param {Buffer} request.ciphertext - * Required. The data encrypted with the named {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s public - * key using OAEP. - * @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 {@link protos.google.cloud.kms.v1.AsymmetricDecryptResponse|AsymmetricDecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async - */ - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('asymmetricDecrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('asymmetricDecrypt response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.asymmetricDecrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]) => { - this._log.info('asymmetricDecrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the version of a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} that will be used in {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. - * - * Returns an error if called on an asymmetric key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to update. - * @param {string} request.cryptoKeyVersionId - * The id of the child {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use as primary. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_primary_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async - */ - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKeyPrimaryVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKeyPrimaryVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCryptoKeyPrimaryVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCryptoKeyPrimaryVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Schedule a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} for destruction. - * - * Upon calling this method, {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|CryptoKeyVersion.state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will be set to a time 24 - * hours in the future, at which point the {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} - * will be changed to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED}, and the key - * material will be irrevocably destroyed. - * - * Before the {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} is reached, - * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} may be called to reverse the process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to destroy. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.destroy_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async - */ - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('destroyCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('destroyCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.destroyCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('destroyCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Restore a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} - * state. - * - * Upon restoration of the CryptoKeyVersion, {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} - * will be set to {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED}, - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will be cleared. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to restore. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.restore_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async - */ - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('restoreCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restoreCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.restoreCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]) => { - this._log.info('restoreCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeyRingsAsync()` - * 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. - */ - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listKeyRings values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listKeyRings request %j', request); - return this.innerApiCalls - .listKeyRings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]) => { - this._log.info('listKeyRings values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listKeyRings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.KeyRing|KeyRing} 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 `listKeyRingsAsync()` - * 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. - */ - listKeyRingsStream( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listKeyRings stream %j', request); - return this.descriptors.page.listKeyRings.createStream( - this.innerApiCalls.listKeyRings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listKeyRings`, 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. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.KeyRing|KeyRing}. 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 include:samples/generated/v1/key_management_service.list_key_rings.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListKeyRings_async - */ - listKeyRingsAsync( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listKeyRings iterate %j', request); - return this.descriptors.page.listKeyRings.asyncIterate( - this.innerApiCalls['listKeyRings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * 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. - */ - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCryptoKeys values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listCryptoKeys request %j', request); - return this.innerApiCalls - .listCryptoKeys(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]) => { - this._log.info('listCryptoKeys values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCryptoKeys`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKey|CryptoKey} 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 `listCryptoKeysAsync()` - * 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. - */ - listCryptoKeysStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeys stream %j', request); - return this.descriptors.page.listCryptoKeys.createStream( - this.innerApiCalls.listCryptoKeys as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeys`, 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. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKey|CryptoKey}. 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 include:samples/generated/v1/key_management_service.list_crypto_keys.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async - */ - listCryptoKeysAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeys iterate %j', request); - return this.descriptors.page.listCryptoKeys.asyncIterate( - this.innerApiCalls['listCryptoKeys'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeyVersionsAsync()` - * 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. - */ - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCryptoKeyVersions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listCryptoKeyVersions request %j', request); - return this.innerApiCalls - .listCryptoKeyVersions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]) => { - this._log.info('listCryptoKeyVersions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCryptoKeyVersions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} 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 `listCryptoKeyVersionsAsync()` - * 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. - */ - listCryptoKeyVersionsStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeyVersions stream %j', request); - return this.descriptors.page.listCryptoKeyVersions.createStream( - this.innerApiCalls.listCryptoKeyVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeyVersions`, 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. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. 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 include:samples/generated/v1/key_management_service.list_crypto_key_versions.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async - */ - listCryptoKeyVersionsAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeyVersions iterate %j', request); - return this.descriptors.page.listCryptoKeyVersions.asyncIterate( - this.innerApiCalls['listCryptoKeyVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * 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. - */ - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listImportJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listImportJobs request %j', request); - return this.innerApiCalls - .listImportJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]) => { - this._log.info('listImportJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listImportJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.ImportJob|ImportJob} 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 `listImportJobsAsync()` - * 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. - */ - listImportJobsStream( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listImportJobs stream %j', request); - return this.descriptors.page.listImportJobs.createStream( - this.innerApiCalls.listImportJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listImportJobs`, 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. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.ImportJob|ImportJob}. 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 include:samples/generated/v1/key_management_service.list_import_jobs.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListImportJobs_async - */ - listImportJobsAsync( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listImportJobs iterate %j', request); - return this.descriptors.page.listImportJobs.asyncIterate( - this.innerApiCalls['listImportJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.keyManagementServiceStub && !this._terminated) { - return this.keyManagementServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => {throw err}); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client_config.json.baseline deleted file mode 100644 index f71290a313b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_client_config.json.baseline +++ /dev/null @@ -1,118 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.v1.KeyManagementService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListKeyRings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeys": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeyVersions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListImportJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetKeyRing": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPublicKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetImportJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateKeyRing": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateImportJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Encrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Decrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsymmetricSign": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsymmetricDecrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyPrimaryVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DestroyCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_proto_list.json.baseline deleted file mode 100644 index b7e20599adc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/src/v1/key_management_service_proto_list.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/kms/v1/resources.proto", - "../../protos/google/cloud/kms/v1/service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 23d692b452e9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const kms = require('kms'); - -function main() { - const keyManagementServiceClient = new kms.KeyManagementServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 471d47ca9875..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as kms from 'kms'; - -function main() { - const keyManagementServiceClient = new kms.KeyManagementServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 8c695e4b03b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {KeyManagementServiceClient} from 'kms'; - -// check that the client class type name can be used -function doStuffWithKeyManagementServiceClient(client: KeyManagementServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const keyManagementServiceClient = new KeyManagementServiceClient(); - doStuffWithKeyManagementServiceClient(keyManagementServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/test/gapic_key_management_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/test/gapic_key_management_service_v1.ts.baseline deleted file mode 100644 index a70096f09c23..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/esm/test/gapic_key_management_service_v1.ts.baseline +++ /dev/null @@ -1,3586 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as keymanagementserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.KeyManagementServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudkms.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath; - assert.strictEqual(servicePath, 'cloudkms.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = keymanagementserviceModule.v1.KeyManagementServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudkms.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new keymanagementserviceModule.v1.KeyManagementServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = keymanagementserviceModule.v1.KeyManagementServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - await client.initialize(); - assert(client.keyManagementServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.keyManagementServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getKeyRing', () => { - it('invokes getKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.getKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getKeyRing(request), expectedError); - }); - }); - - describe('getCryptoKey', () => { - it('invokes getCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCryptoKey(request), expectedError); - }); - }); - - describe('getCryptoKeyVersion', () => { - it('invokes getCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - }); - }); - - describe('getPublicKey', () => { - it('invokes getPublicKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.getPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPublicKey(request), expectedError); - }); - }); - - describe('getImportJob', () => { - it('invokes getImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.getImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getImportJob(request), expectedError); - }); - }); - - describe('createKeyRing', () => { - it('invokes createKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.createKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createKeyRing(request), expectedError); - }); - }); - - describe('createCryptoKey', () => { - it('invokes createCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createCryptoKey(request), expectedError); - }); - }); - - describe('createCryptoKeyVersion', () => { - it('invokes createCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - }); - }); - - describe('importCryptoKeyVersion', () => { - it('invokes importCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.importCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - }); - }); - - describe('createImportJob', () => { - it('invokes createImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.createImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createImportJob(request), expectedError); - }); - }); - - describe('updateCryptoKey', () => { - it('invokes updateCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKey(request), expectedError); - }); - }); - - describe('updateCryptoKeyVersion', () => { - it('invokes updateCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - }); - }); - - describe('encrypt', () => { - it('invokes encrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCall(expectedResponse); - const [response] = await client.encrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.encrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEncryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.encrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.encrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.encrypt(request), expectedError); - }); - }); - - describe('decrypt', () => { - it('invokes decrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCall(expectedResponse); - const [response] = await client.decrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.decrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.decrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.decrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.decrypt(request), expectedError); - }); - }); - - describe('asymmetricSign', () => { - it('invokes asymmetricSign without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricSign(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricSign( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricSignResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricSign = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricSign(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.asymmetricSign(request), expectedError); - }); - }); - - describe('asymmetricDecrypt', () => { - it('invokes asymmetricDecrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricDecrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricDecrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - }); - }); - - describe('updateCryptoKeyPrimaryVersion', () => { - it('invokes updateCryptoKeyPrimaryVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyPrimaryVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyPrimaryVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - }); - }); - - describe('destroyCryptoKeyVersion', () => { - it('invokes destroyCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.destroyCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.destroyCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - }); - }); - - describe('restoreCryptoKeyVersion', () => { - it('invokes restoreCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.restoreCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - }); - }); - - describe('listKeyRings', () => { - it('invokes listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCall(expectedResponse); - const [response] = await client.listKeyRings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKeyRings( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listKeyRings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKeyRings(request), expectedError); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRingsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listKeyRingsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - const iterable = client.listKeyRingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listKeyRingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeys', () => { - it('invokes listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeys( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeysStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeysStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - const iterable = client.listCryptoKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeyVersions', () => { - it('invokes listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeyVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeyVersions( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeyVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersionsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeyVersionsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - const iterable = client.listCryptoKeyVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeyVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listImportJobs', () => { - it('invokes listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listImportJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImportJobs( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImportJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listImportJobsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - const iterable = client.listImportJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImportJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json b/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json deleted file mode 100644 index afb55956344b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "kms", - "version": "0.1.0", - "description": "Kms client for Node.js", - "repository": "googleapis/nodejs-kms", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google kms", - "kms", - "key management service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/resources.proto.baseline deleted file mode 100644 index a608077a19d9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/resources.proto.baseline +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; -option java_multiple_files = true; -option java_outer_classname = "KmsResourcesProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. -message KeyRing { - // Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format - // `projects/*/locations/*/keyRings/*`. - string name = 1; - - // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created. - google.protobuf.Timestamp create_time = 2; -} - -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that can be used for cryptographic -// operations. -// -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of one or more [versions][google.cloud.kms.v1.CryptoKeyVersion], which -// represent the actual key material used in cryptographic operations. -message CryptoKey { - // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the cryptographic capabilities of a - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used for the operations allowed by - // its purpose. For more information, see - // [Key purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes). - enum CryptoKeyPurpose { - // Not specified. - CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - ENCRYPT_DECRYPT = 1; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_SIGN = 5; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_DECRYPT = 6; - } - - // Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string name = 1; - - // Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used - // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given - // in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. - // - // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. - // - // All keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] have a - // primary. For other keys, this field will be omitted. - CryptoKeyVersion primary = 2; - - // The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - CryptoKeyPurpose purpose = 3; - - // Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. - google.protobuf.Timestamp create_time = 5; - - // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically: - // - // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // 2. Mark the new version as primary. - // - // Key rotations performed manually via - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] - // do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] support - // automatic rotation. For other keys, this field must be omitted. - google.protobuf.Timestamp next_rotation_time = 7; - - // Controls the rate of automatic rotation. - oneof rotation_schedule { - // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service - // automatically rotates a key. Must be at least one day. - // - // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] support - // automatic rotation. For other keys, this field must be omitted. - google.protobuf.Duration rotation_period = 8; - } - - // A template describing settings for new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. - // The properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances created by either - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or - // auto-rotation are controlled by this template. - CryptoKeyVersionTemplate version_template = 11; - - // Labels with user-defined metadata. For more information, see - // [Labeling Keys](/kms/docs/labeling-keys). - map labels = 10; -} - -// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate] specifies the properties to use when creating -// a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually with -// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or -// automatically as a result of auto-rotation. -message CryptoKeyVersionTemplate { - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on - // this template. Immutable. Defaults to [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]. - ProtectionLevel protection_level = 1; - - // Required. [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] to use - // when creating a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this template. - // - // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both - // this field is omitted and [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 3; -} - -// Contains an HSM-generated attestation about a key operation. For more -// information, see [Verifying attestations] -// (https://cloud.google.com/kms/docs/attest-key). -message KeyOperationAttestation { - // Attestation formats provided by the HSM. - enum AttestationFormat { - // Not specified. - ATTESTATION_FORMAT_UNSPECIFIED = 0; - - // Cavium HSM attestation compressed with gzip. Note that this format is - // defined by Cavium and subject to change at any time. - CAVIUM_V1_COMPRESSED = 3; - - // Cavium HSM attestation V2 compressed with gzip. This is a new format - // introduced in Cavium's version 3.2-08. - CAVIUM_V2_COMPRESSED = 4; - } - - // Output only. The format of the attestation data. - AttestationFormat format = 4; - - // Output only. The attestation data provided by the HSM when the key - // operation was performed. - bytes content = 5; -} - -// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an individual cryptographic key, and the -// associated key material. -// -// An [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] version can be -// used for cryptographic operations. -// -// For security reasons, the raw cryptographic key material represented by a -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed or exported. It can only be used to -// encrypt, decrypt, or sign data when an authorized user or application invokes -// Cloud KMS. -message CryptoKeyVersion { - // The algorithm of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what - // parameters must be used for each cryptographic operation. - // - // The - // [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION] - // algorithm is usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - // - // Algorithms beginning with "RSA_SIGN_" are usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after "RSA_SIGN_" correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // For PSS, the salt length used is equal to the length of digest - // algorithm. For example, - // [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256] - // will use PSS with a salt length of 256 bits or 32 bytes. - // - // Algorithms beginning with "RSA_DECRYPT_" are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - // - // The fields in the name after "RSA_DECRYPT_" correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // Algorithms beginning with "EC_SIGN_" are usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after "EC_SIGN_" correspond to the following - // parameters: elliptic curve, digest algorithm. - // - // For more information, see [Key purposes and algorithms] - // (https://cloud.google.com/kms/docs/algorithms). - enum CryptoKeyVersionAlgorithm { - // Not specified. - CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0; - - // Creates symmetric encryption keys. - GOOGLE_SYMMETRIC_ENCRYPTION = 1; - - // RSASSA-PSS 2048 bit key with a SHA256 digest. - RSA_SIGN_PSS_2048_SHA256 = 2; - - // RSASSA-PSS 3072 bit key with a SHA256 digest. - RSA_SIGN_PSS_3072_SHA256 = 3; - - // RSASSA-PSS 4096 bit key with a SHA256 digest. - RSA_SIGN_PSS_4096_SHA256 = 4; - - // RSASSA-PSS 4096 bit key with a SHA512 digest. - RSA_SIGN_PSS_4096_SHA512 = 15; - - // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_2048_SHA256 = 5; - - // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_3072_SHA256 = 6; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_4096_SHA256 = 7; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. - RSA_SIGN_PKCS1_4096_SHA512 = 16; - - // RSAES-OAEP 2048 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_2048_SHA256 = 8; - - // RSAES-OAEP 3072 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_3072_SHA256 = 9; - - // RSAES-OAEP 4096 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_4096_SHA256 = 10; - - // RSAES-OAEP 4096 bit key with a SHA512 digest. - RSA_DECRYPT_OAEP_4096_SHA512 = 17; - - // ECDSA on the NIST P-256 curve with a SHA256 digest. - EC_SIGN_P256_SHA256 = 12; - - // ECDSA on the NIST P-384 curve with a SHA384 digest. - EC_SIGN_P384_SHA384 = 13; - } - - // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used. - enum CryptoKeyVersionState { - // Not specified. - CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; - - // This version is still being generated. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. - PENDING_GENERATION = 5; - - // This version may be used for cryptographic operations. - ENABLED = 1; - - // This version may not be used, but the key material is still available, - // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. - DISABLED = 2; - - // This version is destroyed, and the key material is no longer stored. - // A version may not leave this state once entered. - DESTROYED = 3; - - // This version is scheduled for destruction, and will be destroyed soon. - // Call - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. - DESTROY_SCHEDULED = 4; - - // This version is still being imported. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. - PENDING_IMPORT = 6; - - // This version was not imported successfully. It may not be used, enabled, - // disabled, or destroyed. The submitted key material has been discarded. - // Additional details can be found in - // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. - IMPORT_FAILED = 7; - } - - // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. Controls the level of detail returned - // for [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in - // [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions] and - // [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. - enum CryptoKeyVersionView { - // Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include - // the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. - CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0; - - // Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the - // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. - FULL = 1; - } - - // Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. - string name = 1; - - // The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - CryptoKeyVersionState state = 3; - - // Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] describing how crypto operations are - // performed with this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - ProtectionLevel protection_level = 7; - - // Output only. The [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] that this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] supports. - CryptoKeyVersionAlgorithm algorithm = 10; - - // Output only. Statement that was generated and signed by the HSM at key - // creation time. Use this statement to verify attributes of the key as stored - // on the HSM, independently of Google. Only provided for key versions with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level] [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8; - - // Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. - google.protobuf.Timestamp create_time = 4; - - // Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was - // generated. - google.protobuf.Timestamp generate_time = 11; - - // Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled - // for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. - google.protobuf.Timestamp destroy_time = 5; - - // Output only. The time this CryptoKeyVersion's key material was - // destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. - google.protobuf.Timestamp destroy_event_time = 6; - - // Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob] used to import this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if the underlying key material was - // imported. - string import_job = 14; - - // Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material - // was imported. - google.protobuf.Timestamp import_time = 15; - - // Output only. The root cause of an import failure. Only present if - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. - string import_failure_reason = 16; -} - -// The public key for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via -// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message PublicKey { - // The public key, encoded in PEM format. For more information, see the - // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for - // [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - - // The [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] associated - // with this key. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; -} - -// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how cryptographic operations are performed. -// For more information, see [Protection levels] -// (https://cloud.google.com/kms/docs/algorithms#protection_levels). -enum ProtectionLevel { - // Not specified. - PROTECTION_LEVEL_UNSPECIFIED = 0; - - // Crypto operations are performed in software. - SOFTWARE = 1; - - // Crypto operations are performed in a Hardware Security Module. - HSM = 2; -} - -// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create [CryptoKeys][google.cloud.kms.v1.CryptoKey] and -// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing key material, -// generated outside of Cloud KMS. -// -// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will generate a "wrapping key", -// which is a public/private key pair. You use the wrapping key to encrypt (also -// known as wrap) the pre-existing key material to protect it during the import -// process. The nature of the wrapping key depends on the choice of -// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the wrapping key generation -// is complete, the [state][google.cloud.kms.v1.ImportJob.state] will be set to -// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the [public_key][google.cloud.kms.v1.ImportJob.public_key] -// can be fetched. The fetched public key can then be used to wrap your -// pre-existing key material. -// -// Once the key material is wrapped, it can be imported into a new -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling -// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be imported with a single -// [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS uses the private key portion of the wrapping key to -// unwrap the key material. Only Cloud KMS has access to the private key. -// -// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is created. Once expired, Cloud KMS -// will no longer be able to import or unwrap any key material that was wrapped -// with the [ImportJob][google.cloud.kms.v1.ImportJob]'s public key. -// -// For more information, see -// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). -message ImportJob { - // The public key component of the wrapping key. For details of the type of - // key this public key corresponds to, see the [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod]. - message WrappingPublicKey { - // The public key, encoded in PEM format. For more information, see the [RFC - // 7468](https://tools.ietf.org/html/rfc7468) sections for [General - // Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - } - - // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the key wrapping method chosen for this - // [ImportJob][google.cloud.kms.v1.ImportJob]. - enum ImportMethod { - // Not specified. - IMPORT_METHOD_UNSPECIFIED = 0; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 3072 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_3072_SHA1_AES_256 = 1; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 4096 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_4096_SHA1_AES_256 = 2; - } - - // The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used. - enum ImportJobState { - // Not specified. - IMPORT_JOB_STATE_UNSPECIFIED = 0; - - // The wrapping key for this job is still being generated. It may not be - // used. Cloud KMS will automatically mark this job as - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as the wrapping key is generated. - PENDING_GENERATION = 1; - - // This job may be used in - // [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey] and - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // requests. - ACTIVE = 2; - - // This job can no longer be used and may not leave this state once entered. - EXPIRED = 3; - } - - // Output only. The resource name for this [ImportJob][google.cloud.kms.v1.ImportJob] in the format - // `projects/*/locations/*/keyRings/*/importJobs/*`. - string name = 1; - - // Required and immutable. The wrapping method to be used for incoming - // key material. - ImportMethod import_method = 2; - - // Required and immutable. The protection level of the [ImportJob][google.cloud.kms.v1.ImportJob]. This - // must match the - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] of the - // [version_template][google.cloud.kms.v1.CryptoKey.version_template] on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you - // attempt to import into. - ProtectionLevel protection_level = 9; - - // Output only. The time at which this [ImportJob][google.cloud.kms.v1.ImportJob] was created. - google.protobuf.Timestamp create_time = 3; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key material was generated. - google.protobuf.Timestamp generate_time = 4; - - // Output only. The time at which this [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for - // expiration and can no longer be used to import key material. - google.protobuf.Timestamp expire_time = 5; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob] expired. Only present if - // [state][google.cloud.kms.v1.ImportJob.state] is [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]. - google.protobuf.Timestamp expire_event_time = 10; - - // Output only. The current state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can - // be used. - ImportJobState state = 6; - - // Output only. The public key with which to wrap key material prior to - // import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]. - WrappingPublicKey public_key = 7; - - // Output only. Statement that was generated and signed by the key creator - // (for example, an HSM) at key creation time. Use this statement to verify - // attributes of the key as stored on the HSM, independently of Google. - // Only present if the chosen [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a protection - // level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8; -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/service.proto.baseline deleted file mode 100644 index bf14cdb19e17..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/protos/google/cloud/kms/v1/service.proto.baseline +++ /dev/null @@ -1,718 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/cloud/kms/v1/resources.proto"; -import "google/protobuf/field_mask.proto"; -import "google/api/client.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; -option java_multiple_files = true; -option java_outer_classname = "KmsProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// Google Cloud Key Management Service -// -// Manages cryptographic keys and operations using those keys. Implements a REST -// model with the following objects: -// -// * [KeyRing][google.cloud.kms.v1.KeyRing] -// * [CryptoKey][google.cloud.kms.v1.CryptoKey] -// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] -// -// If you are using manual gRPC libraries, see -// [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). -service KeyManagementService { - option (google.api.default_host) = "cloudkms.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudkms"; - - // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. - rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/keyRings" - }; - } - - // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - }; - } - - // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) returns (ListCryptoKeyVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - }; - } - - // Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. - rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - }; - } - - // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. - rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*}" - }; - } - - // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its - // [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - }; - } - - // Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - }; - } - - // Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" - }; - } - - // Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob]. - rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" - }; - } - - // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. - rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/keyRings" - body: "key_ring" - }; - } - - // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and - // [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] - // are required. - rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - body: "crypto_key" - }; - } - - // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // - // The server will assign the next sequential id. If unset, - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. - rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - body: "crypto_key_version" - }; - } - - // Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the - // wrapped key material provided in the request. - // - // The version ID will be assigned the next sequential id within the - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import" - body: "*" - }; - } - - // Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required. - rpc CreateImportJob(CreateImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - body: "import_job" - }; - } - - // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - body: "crypto_key" - }; - } - - // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. - // - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and - // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this - // method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to - // move between other states. - rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - body: "crypto_key_version" - }; - } - - // Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - // The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Encrypt(EncryptRequest) returns (EncryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" - body: "*" - }; - } - - // Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Decrypt(DecryptRequest) returns (DecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" - body: "*" - }; - } - - // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // ASYMMETRIC_SIGN, producing a signature that can be verified with the public - // key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - rpc AsymmetricSign(AsymmetricSignRequest) returns (AsymmetricSignResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign" - body: "*" - }; - } - - // Decrypts data that was encrypted with a public key retrieved from - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT. - rpc AsymmetricDecrypt(AsymmetricDecryptRequest) returns (AsymmetricDecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt" - body: "*" - }; - } - - // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. - // - // Returns an error if called on an asymmetric key. - rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" - body: "*" - }; - } - - // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. - // - // Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 - // hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] - // will be changed to - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key - // material will be irrevocably destroyed. - // - // Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process. - rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" - body: "*" - }; - } - - // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // state. - // - // Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] - // will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. - rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" - body: "*" - }; - } -} - -// Request message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. - string parent = 1; - - // Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the - // response. Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by - // including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. - string page_token = 3; - - // Optional. Only include resources that match the filter in the response. - string filter = 4; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 5; -} - -// Request message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format - // `projects/*/locations/*/keyRings/*`. - string parent = 1; - - // Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the - // response. Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by - // including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. - string page_token = 3; - - // The fields of the primary version to include in the response. - CryptoKeyVersion.CryptoKeyVersionView version_view = 4; - - // Optional. Only include resources that match the filter in the response. - string filter = 5; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 6; -} - -// Request message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string parent = 1; - - // Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to - // include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can - // subsequently be obtained by including the - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request. - // If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. - string page_token = 3; - - // The fields to include in the response. - CryptoKeyVersion.CryptoKeyVersionView view = 4; - - // Optional. Only include resources that match the filter in the response. - string filter = 5; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 6; -} - -// Request message for [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format - // `projects/*/locations/*/keyRings/*`. - string parent = 1; - - // Optional limit on the number of [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the - // response. Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be obtained by - // including the [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]. - string page_token = 3; - - // Optional. Only include resources that match the filter in the response. - string filter = 4; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 5; -} - -// Response message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsResponse { - // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. - repeated KeyRing key_rings = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysResponse { - // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - repeated CryptoKey crypto_keys = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsResponse { - // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - repeated CryptoKeyVersion crypto_key_versions = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of - // results. - string next_page_token = 2; - - // The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the - // query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsResponse { - // The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. - repeated ImportJob import_jobs = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that matched the query. - int32 total_size = 3; -} - -// Request message for [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. -message GetKeyRingRequest { - // The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. -message GetCryptoKeyRequest { - // The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. -message GetCryptoKeyVersionRequest { - // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message GetPublicKeyRequest { - // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to - // get. - string name = 1; -} - -// Request message for [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. -message GetImportJobRequest { - // The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get. - string name = 1; -} - -// Request message for [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. -message CreateKeyRingRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. - string parent = 1; - - // Required. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string key_ring_id = 2; - - // A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. - KeyRing key_ring = 3; -} - -// Request message for [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. -message CreateCryptoKeyRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the - // [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - string parent = 1; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string crypto_key_id = 2; - - // A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. - CryptoKey crypto_key = 3; - - // If set to true, the request will create a [CryptoKey][google.cloud.kms.v1.CryptoKey] without any - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must manually call - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or - // [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion] - // before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - bool skip_initial_version_creation = 5; -} - -// Request message for [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. -message CreateCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with - // the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - string parent = 1; - - // A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values. - CryptoKeyVersion crypto_key_version = 2; -} - -// Request message for [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -message ImportCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to - // be imported into. - string parent = 1; - - // Required. The [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] of - // the key being imported. This does not need to match the - // [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] this - // version imports into. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; - - // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] that was used to - // wrap this key material. - string import_job = 4; - - // Required. The incoming wrapped key material that is to be imported. - oneof wrapped_key_material { - // Wrapped key material produced with - // [RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] - // or - // [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]. - // - // This field contains the concatenation of two wrapped keys: - //
    - //
  1. An ephemeral AES-256 wrapping key wrapped with the - // [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP with SHA-1, - // MGF1 with SHA-1, and an empty label. - //
  2. - //
  3. The key to be imported, wrapped with the ephemeral AES-256 key - // using AES-KWP (RFC 5649). - //
  4. - //
- // - // This format is the same as the format produced by PKCS#11 mechanism - // CKM_RSA_AES_KEY_WRAP. - bytes rsa_aes_wrapped_key = 5; - } -} - -// Request message for [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. -message CreateImportJobRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the - // [ImportJobs][google.cloud.kms.v1.ImportJob]. - string parent = 1; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string import_job_id = 2; - - // Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values. - ImportJob import_job = 3; -} - -// Request message for [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. -message UpdateCryptoKeyRequest { - // [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. - CryptoKey crypto_key = 1; - - // Required list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. -message UpdateCryptoKeyVersionRequest { - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values. - CryptoKeyVersion crypto_key_version = 1; - - // Required list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // to use for encryption. - // - // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its - // [primary version][google.cloud.kms.v1.CryptoKey.primary]. - string name = 1; - - // Required. The data to encrypt. Must be no larger than 64KiB. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the plaintext must be no larger - // than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the - // plaintext and additional_authenticated_data fields must be no larger than - // 8KiB. - bytes plaintext = 2; - - // Optional data that, if specified, must also be provided during decryption - // through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the AAD must be no larger than - // 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the - // plaintext and additional_authenticated_data fields must be no larger than - // 8KiB. - bytes additional_authenticated_data = 3; -} - -// Request message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. - // The server will choose the appropriate version. - string name = 1; - - // Required. The encrypted data originally returned in - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. - bytes ciphertext = 2; - - // Optional data that must match the data originally supplied in - // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. - bytes additional_authenticated_data = 3; -} - -// Request message for [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignRequest { - // Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing. - string name = 1; - - // Required. The digest of the data to sign. The digest must be produced with - // the same digest algorithm as specified by the key version's - // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. - Digest digest = 3; -} - -// Request message for [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptRequest { - // Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // decryption. - string name = 1; - - // Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public - // key using OAEP. - bytes ciphertext = 3; -} - -// Response message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptResponse { - // The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. - bytes plaintext = 1; -} - -// Response message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptResponse { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption. - string name = 1; - - // The encrypted data. - bytes ciphertext = 2; -} - -// Response message for [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignResponse { - // The created signature. - bytes signature = 1; -} - -// Response message for [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptResponse { - // The decrypted data originally encrypted with the matching public key. - bytes plaintext = 1; -} - -// Request message for [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. -message UpdateCryptoKeyPrimaryVersionRequest { - // The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. - string name = 1; - - // The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. - string crypto_key_version_id = 2; -} - -// Request message for [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. -message DestroyCryptoKeyVersionRequest { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. - string name = 1; -} - -// Request message for [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. -message RestoreCryptoKeyVersionRequest { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. - string name = 1; -} - -// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest. -message Digest { - // Required. The message digest. - oneof digest { - // A message digest produced with the SHA-256 algorithm. - bytes sha256 = 1; - - // A message digest produced with the SHA-384 algorithm. - bytes sha384 = 2; - - // A message digest produced with the SHA-512 algorithm. - bytes sha512 = 3; - } -} - -// Cloud KMS metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. -message LocationMetadata { - // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this location. - bool hsm_available = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline deleted file mode 100644 index e9ce8596c408..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * decryption. - */ - // const name = 'abc123' - /** - * Required. The data encrypted with the named CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public - * key using OAEP. - */ - // const ciphertext = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricDecrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.asymmetricDecrypt(request); - console.log(response); - } - - callAsymmetricDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline deleted file mode 100644 index 6f5c3ea9aab7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for signing. - */ - // const name = 'abc123' - /** - * Required. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm. - */ - // const digest = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricSign() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.asymmetricSign(request); - console.log(response); - } - - callAsymmetricSign(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key.js.baseline deleted file mode 100644 index 26a179538126..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing associated with the - * CryptoKeys google.cloud.kms.v1.CryptoKey. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const cryptoKeyId = 'abc123' - /** - * A CryptoKey google.cloud.kms.v1.CryptoKey with initial field values. - */ - // const cryptoKey = {} - /** - * If set to true, the request will create a CryptoKey google.cloud.kms.v1.CryptoKey without any - * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must manually call - * CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion or - * ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion - * before you can use this CryptoKey google.cloud.kms.v1.CryptoKey. - */ - // const skipInitialVersionCreation = true - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createCryptoKey(request); - console.log(response); - } - - callCreateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline deleted file mode 100644 index 6629c95649ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey associated with - * the CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. - */ - // const parent = 'abc123' - /** - * A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with initial field values. - */ - // const cryptoKeyVersion = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createCryptoKeyVersion(request); - console.log(response); - } - - callCreateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_import_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_import_job.js.baseline deleted file mode 100644 index 2214d9238b4d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_import_job.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing google.cloud.kms.v1.KeyRing associated with the - * ImportJobs google.cloud.kms.v1.ImportJob. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const importJobId = 'abc123' - /** - * Required. An ImportJob google.cloud.kms.v1.ImportJob with initial field values. - */ - // const importJob = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateImportJob() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createImportJob(request); - console.log(response); - } - - callCreateImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_key_ring.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_key_ring.js.baseline deleted file mode 100644 index 9df5eab2da41..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.create_key_ring.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const keyRingId = 'abc123' - /** - * A KeyRing google.cloud.kms.v1.KeyRing with initial field values. - */ - // const keyRing = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateKeyRing() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createKeyRing(request); - console.log(response); - } - - callCreateKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.decrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.decrypt.js.baseline deleted file mode 100644 index f55bd25120ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.decrypt.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_Decrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to use for decryption. - * The server will choose the appropriate version. - */ - // const name = 'abc123' - /** - * Required. The encrypted data originally returned in - * EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext. - */ - // const ciphertext = Buffer.from('string') - /** - * Optional data that must match the data originally supplied in - * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. - */ - // const additionalAuthenticatedData = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDecrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.decrypt(request); - console.log(response); - } - - callDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Decrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline deleted file mode 100644 index aa0e43062cb2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to destroy. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDestroyCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.destroyCryptoKeyVersion(request); - console.log(response); - } - - callDestroyCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.encrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.encrypt.js.baseline deleted file mode 100644 index 92f065d345af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.encrypt.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_Encrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey or CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion - * to use for encryption. - * If a CryptoKey google.cloud.kms.v1.CryptoKey is specified, the server will use its - * primary version google.cloud.kms.v1.CryptoKey.primary. - */ - // const name = 'abc123' - /** - * Required. The data to encrypt. Must be no larger than 64KiB. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. For - * SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the plaintext must be no larger - * than 64KiB. For HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - */ - // const plaintext = Buffer.from('string') - /** - * Optional data that, if specified, must also be provided during decryption - * through DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. For - * SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the AAD must be no larger than - * 64KiB. For HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - */ - // const additionalAuthenticatedData = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callEncrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.encrypt(request); - console.log(response); - } - - callEncrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Encrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key.js.baseline deleted file mode 100644 index 57871b606322..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getCryptoKey(request); - console.log(response); - } - - callGetCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline deleted file mode 100644 index 1313d92cf639..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKeyVersion.name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getCryptoKeyVersion(request); - console.log(response); - } - - callGetCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_import_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_import_job.js.baseline deleted file mode 100644 index 50ac6d170ebe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_import_job.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.ImportJob.name of the ImportJob google.cloud.kms.v1.ImportJob to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetImportJob() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getImportJob(request); - console.log(response); - } - - callGetImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_GetImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_key_ring.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_key_ring.js.baseline deleted file mode 100644 index ce25f83bf221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_key_ring.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.KeyRing.name of the KeyRing google.cloud.kms.v1.KeyRing to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetKeyRing() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getKeyRing(request); - console.log(response); - } - - callGetKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_public_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_public_key.js.baseline deleted file mode 100644 index 52aeb7e8d72a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.get_public_key.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKeyVersion.name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion public key to - * get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetPublicKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getPublicKey(request); - console.log(response); - } - - callGetPublicKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline deleted file mode 100644 index 298f84bb082d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey to - * be imported into. - */ - // const parent = 'abc123' - /** - * Required. The algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm of - * the key being imported. This does not need to match the - * version_template google.cloud.kms.v1.CryptoKey.version_template of the CryptoKey google.cloud.kms.v1.CryptoKey this - * version imports into. - */ - // const algorithm = {} - /** - * Required. The name google.cloud.kms.v1.ImportJob.name of the ImportJob google.cloud.kms.v1.ImportJob that was used to - * wrap this key material. - */ - // const importJob = 'abc123' - /** - * Wrapped key material produced with - * RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 - * or - * RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256. - * This field contains the concatenation of two wrapped keys: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * public_key google.cloud.kms.v1.ImportJob.public_key using RSAES-OAEP with SHA-1, - * MGF1 with SHA-1, and an empty label. - *
  2. - *
  3. The key to be imported, wrapped with the ephemeral AES-256 key - * using AES-KWP (RFC 5649). - *
  4. - *
- * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - */ - // const rsaAesWrappedKey = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callImportCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.importCryptoKeyVersion(request); - console.log(response); - } - - callImportCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline deleted file mode 100644 index 86b3e0c30050..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion to - * include in the response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion can - * subsequently be obtained by including the - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token in a subsequent request. - * If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields to include in the response. - */ - // const view = {} - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeyVersions() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listCryptoKeyVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeyVersions(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline deleted file mode 100644 index 4d31b2d0f6b5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing to list, in the format - * `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of CryptoKeys google.cloud.kms.v1.CryptoKey to include in the - * response. Further CryptoKeys google.cloud.kms.v1.CryptoKey can subsequently be obtained by - * including the ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields of the primary version to include in the response. - */ - // const versionView = {} - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeys() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listCryptoKeysAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeys(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_import_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_import_jobs.js.baseline deleted file mode 100644 index d75def49aebc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_import_jobs.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing to list, in the format - * `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of ImportJobs google.cloud.kms.v1.ImportJob to include in the - * response. Further ImportJobs google.cloud.kms.v1.ImportJob can subsequently be obtained by - * including the ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListImportJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listImportJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListImportJobs(); - // [END cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_key_rings.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_key_rings.js.baseline deleted file mode 100644 index efe9d153c62e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.list_key_rings.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of KeyRings google.cloud.kms.v1.KeyRing to include in the - * response. Further KeyRings google.cloud.kms.v1.KeyRing can subsequently be obtained by - * including the ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListKeyRings() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listKeyRingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListKeyRings(); - // [END cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline deleted file mode 100644 index 468ea5f60a3d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to restore. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callRestoreCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.restoreCryptoKeyVersion(request); - console.log(response); - } - - callRestoreCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key.js.baseline deleted file mode 100644 index be4abdd1be80..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * CryptoKey google.cloud.kms.v1.CryptoKey with updated values. - */ - // const cryptoKey = {} - /** - * Required list of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKey(request); - console.log(response); - } - - callUpdateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline deleted file mode 100644 index 9420cbd5331d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to update. - */ - // const name = 'abc123' - /** - * The id of the child CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use as primary. - */ - // const cryptoKeyVersionId = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyPrimaryVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKeyPrimaryVersion(request); - console.log(response); - } - - callUpdateCryptoKeyPrimaryVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline deleted file mode 100644 index 9631b2017ba4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with updated values. - */ - // const cryptoKeyVersion = {} - /** - * Required list of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKeyVersion(request); - console.log(response); - } - - callUpdateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline deleted file mode 100644 index a44e558ebabb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline +++ /dev/null @@ -1,1087 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-kms", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.kms.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", - "title": "KeyManagementService listKeyRings Sample", - "origin": "API_DEFINITION", - "description": " Lists [KeyRings][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.list_key_rings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListKeyRingsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async", - "title": "KeyManagementService listCryptoKeys Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.list_crypto_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "version_view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeysResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async", - "title": "KeyManagementService listCryptoKeyVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.list_crypto_key_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeyVersionsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListImportJobs_async", - "title": "KeyManagementService listImportJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists [ImportJobs][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.list_import_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListImportJobsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetKeyRing_async", - "title": "KeyManagementService getKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.get_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async", - "title": "KeyManagementService getCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async", - "title": "KeyManagementService getCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetPublicKey_async", - "title": "KeyManagementService getPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].", - "canonical": true, - "file": "key_management_service.get_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.PublicKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetImportJob_async", - "title": "KeyManagementService getImportJob Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.get_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async", - "title": "KeyManagementService createKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.", - "canonical": true, - "file": "key_management_service.create_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "key_ring_id", - "type": "TYPE_STRING" - }, - { - "name": "key_ring", - "type": ".google.cloud.kms.v1.KeyRing" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async", - "title": "KeyManagementService createCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.", - "canonical": true, - "file": "key_management_service.create_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_id", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "skip_initial_version_creation", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async", - "title": "KeyManagementService createCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].", - "canonical": true, - "file": "key_management_service.create_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async", - "title": "KeyManagementService importCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the wrapped key material provided in the request. The version ID will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.import_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "algorithm", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm" - }, - { - "name": "import_job", - "type": "TYPE_STRING" - }, - { - "name": "rsa_aes_wrapped_key", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateImportJob_async", - "title": "KeyManagementService createImportJob Sample", - "origin": "API_DEFINITION", - "description": " Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.", - "canonical": true, - "file": "key_management_service.create_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "import_job_id", - "type": "TYPE_STRING" - }, - { - "name": "import_job", - "type": ".google.cloud.kms.v1.ImportJob" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async", - "title": "KeyManagementService updateCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.update_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "async": true, - "parameters": [ - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async", - "title": "KeyManagementService updateCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.", - "canonical": true, - "file": "key_management_service.update_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Encrypt_async", - "title": "KeyManagementService encrypt Sample", - "origin": "API_DEFINITION", - "description": " Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.encrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "plaintext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.EncryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Decrypt_async", - "title": "KeyManagementService decrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.DecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async", - "title": "KeyManagementService asymmetricSign Sample", - "origin": "API_DEFINITION", - "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].", - "canonical": true, - "file": "key_management_service.asymmetric_sign.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "digest", - "type": ".google.cloud.kms.v1.Digest" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricSignResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async", - "title": "KeyManagementService asymmetricDecrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.", - "canonical": true, - "file": "key_management_service.asymmetric_decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricDecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async", - "title": "KeyManagementService updateCryptoKeyPrimaryVersion Sample", - "origin": "API_DEFINITION", - "description": " Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. Returns an error if called on an asymmetric key.", - "canonical": true, - "file": "key_management_service.update_crypto_key_primary_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async", - "title": "KeyManagementService destroyCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed. Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.", - "canonical": true, - "file": "key_management_service.destroy_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async", - "title": "KeyManagementService restoreCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state. Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.", - "canonical": true, - "file": "key_management_service.restore_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/kms-esm/webpack.config.cjs.baseline deleted file mode 100644 index 5ecb7a0511d2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'KeyManagementService', - filename: './key-management-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.OwlBot.yaml.baseline deleted file mode 100644 index 29e8cfa84123..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/kms/google-cloud-kms-nodejs - dest: /owl-bot-staging/google-cloud-kms - -api-name: kms \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.jsdoc.js.baseline deleted file mode 100644 index 0ad05d7f5689..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'kms', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/kms/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/kms/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/kms/README.md.baseline deleted file mode 100644 index 7f68cdc9cacc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Cloud Key Management Service (KMS) API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/kms.svg)](https://www.npmjs.org/package/kms) - -Cloud Key Management Service (KMS) API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Cloud Key Management Service (KMS) API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/kms/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Cloud Key Management Service (KMS) API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install kms -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install kms@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-kms diff --git a/core/generator/gapic-generator-typescript/baselines/kms/package.json b/core/generator/gapic-generator-typescript/baselines/kms/package.json deleted file mode 100644 index 407ed881406f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "kms", - "version": "0.1.0", - "description": "Kms client for Node.js", - "repository": "googleapis/nodejs-kms", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google kms", - "kms", - "key management service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/resources.proto.baseline deleted file mode 100644 index a608077a19d9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/resources.proto.baseline +++ /dev/null @@ -1,533 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; -option java_multiple_files = true; -option java_outer_classname = "KmsResourcesProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// A [KeyRing][google.cloud.kms.v1.KeyRing] is a toplevel logical grouping of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. -message KeyRing { - // Output only. The resource name for the [KeyRing][google.cloud.kms.v1.KeyRing] in the format - // `projects/*/locations/*/keyRings/*`. - string name = 1; - - // Output only. The time at which this [KeyRing][google.cloud.kms.v1.KeyRing] was created. - google.protobuf.Timestamp create_time = 2; -} - -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] represents a logical key that can be used for cryptographic -// operations. -// -// A [CryptoKey][google.cloud.kms.v1.CryptoKey] is made up of one or more [versions][google.cloud.kms.v1.CryptoKeyVersion], which -// represent the actual key material used in cryptographic operations. -message CryptoKey { - // [CryptoKeyPurpose][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose] describes the cryptographic capabilities of a - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. A given key can only be used for the operations allowed by - // its purpose. For more information, see - // [Key purposes](https://cloud.google.com/kms/docs/algorithms#key_purposes). - enum CryptoKeyPurpose { - // Not specified. - CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - ENCRYPT_DECRYPT = 1; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_SIGN = 5; - - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_DECRYPT = 6; - } - - // Output only. The resource name for this [CryptoKey][google.cloud.kms.v1.CryptoKey] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string name = 1; - - // Output only. A copy of the "primary" [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] that will be used - // by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] when this [CryptoKey][google.cloud.kms.v1.CryptoKey] is given - // in [EncryptRequest.name][google.cloud.kms.v1.EncryptRequest.name]. - // - // The [CryptoKey][google.cloud.kms.v1.CryptoKey]'s primary version can be updated via - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. - // - // All keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] have a - // primary. For other keys, this field will be omitted. - CryptoKeyVersion primary = 2; - - // The immutable purpose of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - CryptoKeyPurpose purpose = 3; - - // Output only. The time at which this [CryptoKey][google.cloud.kms.v1.CryptoKey] was created. - google.protobuf.Timestamp create_time = 5; - - // At [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time], the Key Management Service will automatically: - // - // 1. Create a new version of this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // 2. Mark the new version as primary. - // - // Key rotations performed manually via - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] and - // [UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion] - // do not affect [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time]. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] support - // automatic rotation. For other keys, this field must be omitted. - google.protobuf.Timestamp next_rotation_time = 7; - - // Controls the rate of automatic rotation. - oneof rotation_schedule { - // [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] will be advanced by this period when the service - // automatically rotates a key. Must be at least one day. - // - // If [rotation_period][google.cloud.kms.v1.CryptoKey.rotation_period] is set, [next_rotation_time][google.cloud.kms.v1.CryptoKey.next_rotation_time] must also be set. - // - // Keys with [purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT] support - // automatic rotation. For other keys, this field must be omitted. - google.protobuf.Duration rotation_period = 8; - } - - // A template describing settings for new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances. - // The properties of new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] instances created by either - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or - // auto-rotation are controlled by this template. - CryptoKeyVersionTemplate version_template = 11; - - // Labels with user-defined metadata. For more information, see - // [Labeling Keys](/kms/docs/labeling-keys). - map labels = 10; -} - -// A [CryptoKeyVersionTemplate][google.cloud.kms.v1.CryptoKeyVersionTemplate] specifies the properties to use when creating -// a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], either manually with -// [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or -// automatically as a result of auto-rotation. -message CryptoKeyVersionTemplate { - // [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] to use when creating a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on - // this template. Immutable. Defaults to [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE]. - ProtectionLevel protection_level = 1; - - // Required. [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] to use - // when creating a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] based on this template. - // - // For backwards compatibility, GOOGLE_SYMMETRIC_ENCRYPTION is implied if both - // this field is omitted and [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] is - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 3; -} - -// Contains an HSM-generated attestation about a key operation. For more -// information, see [Verifying attestations] -// (https://cloud.google.com/kms/docs/attest-key). -message KeyOperationAttestation { - // Attestation formats provided by the HSM. - enum AttestationFormat { - // Not specified. - ATTESTATION_FORMAT_UNSPECIFIED = 0; - - // Cavium HSM attestation compressed with gzip. Note that this format is - // defined by Cavium and subject to change at any time. - CAVIUM_V1_COMPRESSED = 3; - - // Cavium HSM attestation V2 compressed with gzip. This is a new format - // introduced in Cavium's version 3.2-08. - CAVIUM_V2_COMPRESSED = 4; - } - - // Output only. The format of the attestation data. - AttestationFormat format = 4; - - // Output only. The attestation data provided by the HSM when the key - // operation was performed. - bytes content = 5; -} - -// A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] represents an individual cryptographic key, and the -// associated key material. -// -// An [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] version can be -// used for cryptographic operations. -// -// For security reasons, the raw cryptographic key material represented by a -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] can never be viewed or exported. It can only be used to -// encrypt, decrypt, or sign data when an authorized user or application invokes -// Cloud KMS. -message CryptoKeyVersion { - // The algorithm of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating what - // parameters must be used for each cryptographic operation. - // - // The - // [GOOGLE_SYMMETRIC_ENCRYPTION][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.GOOGLE_SYMMETRIC_ENCRYPTION] - // algorithm is usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - // - // Algorithms beginning with "RSA_SIGN_" are usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after "RSA_SIGN_" correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // For PSS, the salt length used is equal to the length of digest - // algorithm. For example, - // [RSA_SIGN_PSS_2048_SHA256][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm.RSA_SIGN_PSS_2048_SHA256] - // will use PSS with a salt length of 256 bits or 32 bytes. - // - // Algorithms beginning with "RSA_DECRYPT_" are usable with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - // - // The fields in the name after "RSA_DECRYPT_" correspond to the following - // parameters: padding algorithm, modulus bit length, and digest algorithm. - // - // Algorithms beginning with "EC_SIGN_" are usable with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN]. - // - // The fields in the name after "EC_SIGN_" correspond to the following - // parameters: elliptic curve, digest algorithm. - // - // For more information, see [Key purposes and algorithms] - // (https://cloud.google.com/kms/docs/algorithms). - enum CryptoKeyVersionAlgorithm { - // Not specified. - CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0; - - // Creates symmetric encryption keys. - GOOGLE_SYMMETRIC_ENCRYPTION = 1; - - // RSASSA-PSS 2048 bit key with a SHA256 digest. - RSA_SIGN_PSS_2048_SHA256 = 2; - - // RSASSA-PSS 3072 bit key with a SHA256 digest. - RSA_SIGN_PSS_3072_SHA256 = 3; - - // RSASSA-PSS 4096 bit key with a SHA256 digest. - RSA_SIGN_PSS_4096_SHA256 = 4; - - // RSASSA-PSS 4096 bit key with a SHA512 digest. - RSA_SIGN_PSS_4096_SHA512 = 15; - - // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_2048_SHA256 = 5; - - // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_3072_SHA256 = 6; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_4096_SHA256 = 7; - - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA512 digest. - RSA_SIGN_PKCS1_4096_SHA512 = 16; - - // RSAES-OAEP 2048 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_2048_SHA256 = 8; - - // RSAES-OAEP 3072 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_3072_SHA256 = 9; - - // RSAES-OAEP 4096 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_4096_SHA256 = 10; - - // RSAES-OAEP 4096 bit key with a SHA512 digest. - RSA_DECRYPT_OAEP_4096_SHA512 = 17; - - // ECDSA on the NIST P-256 curve with a SHA256 digest. - EC_SIGN_P256_SHA256 = 12; - - // ECDSA on the NIST P-384 curve with a SHA384 digest. - EC_SIGN_P384_SHA384 = 13; - } - - // The state of a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], indicating if it can be used. - enum CryptoKeyVersionState { - // Not specified. - CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0; - - // This version is still being generated. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. - PENDING_GENERATION = 5; - - // This version may be used for cryptographic operations. - ENABLED = 1; - - // This version may not be used, but the key material is still available, - // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. - DISABLED = 2; - - // This version is destroyed, and the key material is no longer stored. - // A version may not leave this state once entered. - DESTROYED = 3; - - // This version is scheduled for destruction, and will be destroyed soon. - // Call - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. - DESTROY_SCHEDULED = 4; - - // This version is still being imported. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. - PENDING_IMPORT = 6; - - // This version was not imported successfully. It may not be used, enabled, - // disabled, or destroyed. The submitted key material has been discarded. - // Additional details can be found in - // [CryptoKeyVersion.import_failure_reason][google.cloud.kms.v1.CryptoKeyVersion.import_failure_reason]. - IMPORT_FAILED = 7; - } - - // A view for [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]s. Controls the level of detail returned - // for [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] in - // [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions] and - // [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. - enum CryptoKeyVersionView { - // Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include - // the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. - CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0; - - // Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the - // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. - FULL = 1; - } - - // Output only. The resource name for this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*`. - string name = 1; - - // The current state of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - CryptoKeyVersionState state = 3; - - // Output only. The [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] describing how crypto operations are - // performed with this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - ProtectionLevel protection_level = 7; - - // Output only. The [CryptoKeyVersionAlgorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] that this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] supports. - CryptoKeyVersionAlgorithm algorithm = 10; - - // Output only. Statement that was generated and signed by the HSM at key - // creation time. Use this statement to verify attributes of the key as stored - // on the HSM, independently of Google. Only provided for key versions with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersion.protection_level] [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8; - - // Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] was created. - google.protobuf.Timestamp create_time = 4; - - // Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material was - // generated. - google.protobuf.Timestamp generate_time = 11; - - // Output only. The time this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material is scheduled - // for destruction. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED]. - google.protobuf.Timestamp destroy_time = 5; - - // Output only. The time this CryptoKeyVersion's key material was - // destroyed. Only present if [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED]. - google.protobuf.Timestamp destroy_event_time = 6; - - // Output only. The name of the [ImportJob][google.cloud.kms.v1.ImportJob] used to import this - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Only present if the underlying key material was - // imported. - string import_job = 14; - - // Output only. The time at which this [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s key material - // was imported. - google.protobuf.Timestamp import_time = 15; - - // Output only. The root cause of an import failure. Only present if - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] is - // [IMPORT_FAILED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED]. - string import_failure_reason = 16; -} - -// The public key for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Obtained via -// [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message PublicKey { - // The public key, encoded in PEM format. For more information, see the - // [RFC 7468](https://tools.ietf.org/html/rfc7468) sections for - // [General Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - - // The [Algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] associated - // with this key. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; -} - -// [ProtectionLevel][google.cloud.kms.v1.ProtectionLevel] specifies how cryptographic operations are performed. -// For more information, see [Protection levels] -// (https://cloud.google.com/kms/docs/algorithms#protection_levels). -enum ProtectionLevel { - // Not specified. - PROTECTION_LEVEL_UNSPECIFIED = 0; - - // Crypto operations are performed in software. - SOFTWARE = 1; - - // Crypto operations are performed in a Hardware Security Module. - HSM = 2; -} - -// An [ImportJob][google.cloud.kms.v1.ImportJob] can be used to create [CryptoKeys][google.cloud.kms.v1.CryptoKey] and -// [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] using pre-existing key material, -// generated outside of Cloud KMS. -// -// When an [ImportJob][google.cloud.kms.v1.ImportJob] is created, Cloud KMS will generate a "wrapping key", -// which is a public/private key pair. You use the wrapping key to encrypt (also -// known as wrap) the pre-existing key material to protect it during the import -// process. The nature of the wrapping key depends on the choice of -// [import_method][google.cloud.kms.v1.ImportJob.import_method]. When the wrapping key generation -// is complete, the [state][google.cloud.kms.v1.ImportJob.state] will be set to -// [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] and the [public_key][google.cloud.kms.v1.ImportJob.public_key] -// can be fetched. The fetched public key can then be used to wrap your -// pre-existing key material. -// -// Once the key material is wrapped, it can be imported into a new -// [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] by calling -// [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -// Multiple [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can be imported with a single -// [ImportJob][google.cloud.kms.v1.ImportJob]. Cloud KMS uses the private key portion of the wrapping key to -// unwrap the key material. Only Cloud KMS has access to the private key. -// -// An [ImportJob][google.cloud.kms.v1.ImportJob] expires 3 days after it is created. Once expired, Cloud KMS -// will no longer be able to import or unwrap any key material that was wrapped -// with the [ImportJob][google.cloud.kms.v1.ImportJob]'s public key. -// -// For more information, see -// [Importing a key](https://cloud.google.com/kms/docs/importing-a-key). -message ImportJob { - // The public key component of the wrapping key. For details of the type of - // key this public key corresponds to, see the [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod]. - message WrappingPublicKey { - // The public key, encoded in PEM format. For more information, see the [RFC - // 7468](https://tools.ietf.org/html/rfc7468) sections for [General - // Considerations](https://tools.ietf.org/html/rfc7468#section-2) and - // [Textual Encoding of Subject Public Key Info] - // (https://tools.ietf.org/html/rfc7468#section-13). - string pem = 1; - } - - // [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] describes the key wrapping method chosen for this - // [ImportJob][google.cloud.kms.v1.ImportJob]. - enum ImportMethod { - // Not specified. - IMPORT_METHOD_UNSPECIFIED = 0; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 3072 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_3072_SHA1_AES_256 = 1; - - // This ImportMethod represents the CKM_RSA_AES_KEY_WRAP key wrapping - // scheme defined in the PKCS #11 standard. In summary, this involves - // wrapping the raw key with an ephemeral AES key, and wrapping the - // ephemeral AES key with a 4096 bit RSA key. For more details, see - // [RSA AES key wrap - // mechanism](http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/cos01/pkcs11-curr-v2.40-cos01.html#_Toc408226908). - RSA_OAEP_4096_SHA1_AES_256 = 2; - } - - // The state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can be used. - enum ImportJobState { - // Not specified. - IMPORT_JOB_STATE_UNSPECIFIED = 0; - - // The wrapping key for this job is still being generated. It may not be - // used. Cloud KMS will automatically mark this job as - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE] as soon as the wrapping key is generated. - PENDING_GENERATION = 1; - - // This job may be used in - // [CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey] and - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] - // requests. - ACTIVE = 2; - - // This job can no longer be used and may not leave this state once entered. - EXPIRED = 3; - } - - // Output only. The resource name for this [ImportJob][google.cloud.kms.v1.ImportJob] in the format - // `projects/*/locations/*/keyRings/*/importJobs/*`. - string name = 1; - - // Required and immutable. The wrapping method to be used for incoming - // key material. - ImportMethod import_method = 2; - - // Required and immutable. The protection level of the [ImportJob][google.cloud.kms.v1.ImportJob]. This - // must match the - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] of the - // [version_template][google.cloud.kms.v1.CryptoKey.version_template] on the [CryptoKey][google.cloud.kms.v1.CryptoKey] you - // attempt to import into. - ProtectionLevel protection_level = 9; - - // Output only. The time at which this [ImportJob][google.cloud.kms.v1.ImportJob] was created. - google.protobuf.Timestamp create_time = 3; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob]'s key material was generated. - google.protobuf.Timestamp generate_time = 4; - - // Output only. The time at which this [ImportJob][google.cloud.kms.v1.ImportJob] is scheduled for - // expiration and can no longer be used to import key material. - google.protobuf.Timestamp expire_time = 5; - - // Output only. The time this [ImportJob][google.cloud.kms.v1.ImportJob] expired. Only present if - // [state][google.cloud.kms.v1.ImportJob.state] is [EXPIRED][google.cloud.kms.v1.ImportJob.ImportJobState.EXPIRED]. - google.protobuf.Timestamp expire_event_time = 10; - - // Output only. The current state of the [ImportJob][google.cloud.kms.v1.ImportJob], indicating if it can - // be used. - ImportJobState state = 6; - - // Output only. The public key with which to wrap key material prior to - // import. Only returned if [state][google.cloud.kms.v1.ImportJob.state] is - // [ACTIVE][google.cloud.kms.v1.ImportJob.ImportJobState.ACTIVE]. - WrappingPublicKey public_key = 7; - - // Output only. Statement that was generated and signed by the key creator - // (for example, an HSM) at key creation time. Use this statement to verify - // attributes of the key as stored on the HSM, independently of Google. - // Only present if the chosen [ImportMethod][google.cloud.kms.v1.ImportJob.ImportMethod] is one with a protection - // level of [HSM][google.cloud.kms.v1.ProtectionLevel.HSM]. - KeyOperationAttestation attestation = 8; -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/service.proto.baseline deleted file mode 100644 index bf14cdb19e17..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/protos/google/cloud/kms/v1/service.proto.baseline +++ /dev/null @@ -1,718 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.kms.v1; - -import "google/api/annotations.proto"; -import "google/cloud/kms/v1/resources.proto"; -import "google/protobuf/field_mask.proto"; -import "google/api/client.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Kms.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/kms/v1;kms"; -option java_multiple_files = true; -option java_outer_classname = "KmsProto"; -option java_package = "com.google.cloud.kms.v1"; -option php_namespace = "Google\\Cloud\\Kms\\V1"; - -// Google Cloud Key Management Service -// -// Manages cryptographic keys and operations using those keys. Implements a REST -// model with the following objects: -// -// * [KeyRing][google.cloud.kms.v1.KeyRing] -// * [CryptoKey][google.cloud.kms.v1.CryptoKey] -// * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] -// -// If you are using manual gRPC libraries, see -// [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). -service KeyManagementService { - option (google.api.default_host) = "cloudkms.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudkms"; - - // Lists [KeyRings][google.cloud.kms.v1.KeyRing]. - rpc ListKeyRings(ListKeyRingsRequest) returns (ListKeyRingsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/keyRings" - }; - } - - // Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - rpc ListCryptoKeys(ListCryptoKeysRequest) returns (ListCryptoKeysResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - }; - } - - // Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - rpc ListCryptoKeyVersions(ListCryptoKeyVersionsRequest) returns (ListCryptoKeyVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - }; - } - - // Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. - rpc ListImportJobs(ListImportJobsRequest) returns (ListImportJobsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - }; - } - - // Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing]. - rpc GetKeyRing(GetKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*}" - }; - } - - // Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its - // [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKey(GetCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - }; - } - - // Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. - rpc GetCryptoKeyVersion(GetCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - }; - } - - // Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or - // [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT]. - rpc GetPublicKey(GetPublicKeyRequest) returns (PublicKey) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}/publicKey" - }; - } - - // Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob]. - rpc GetImportJob(GetImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/keyRings/*/importJobs/*}" - }; - } - - // Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. - rpc CreateKeyRing(CreateKeyRingRequest) returns (KeyRing) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/keyRings" - body: "key_ring" - }; - } - - // Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and - // [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] - // are required. - rpc CreateCryptoKey(CreateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/cryptoKeys" - body: "crypto_key" - }; - } - - // Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. - // - // The server will assign the next sequential id. If unset, - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED]. - rpc CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions" - body: "crypto_key_version" - }; - } - - // Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the - // wrapped key material provided in the request. - // - // The version ID will be assigned the next sequential id within the - // [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*/cryptoKeys/*}/cryptoKeyVersions:import" - body: "*" - }; - } - - // Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. - // - // [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required. - rpc CreateImportJob(CreateImportJobRequest) returns (ImportJob) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/keyRings/*}/importJobs" - body: "import_job" - }; - } - - // Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. - rpc UpdateCryptoKey(UpdateCryptoKeyRequest) returns (CryptoKey) { - option (google.api.http) = { - patch: "/v1/{crypto_key.name=projects/*/locations/*/keyRings/*/cryptoKeys/*}" - body: "crypto_key" - }; - } - - // Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. - // - // [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between - // [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and - // [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this - // method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to - // move between other states. - rpc UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - patch: "/v1/{crypto_key_version.name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}" - body: "crypto_key_version" - }; - } - - // Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - // The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - // [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Encrypt(EncryptRequest) returns (EncryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/**}:encrypt" - body: "*" - }; - } - - // Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - rpc Decrypt(DecryptRequest) returns (DecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:decrypt" - body: "*" - }; - } - - // Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] - // ASYMMETRIC_SIGN, producing a signature that can be verified with the public - // key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - rpc AsymmetricSign(AsymmetricSignRequest) returns (AsymmetricSignResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricSign" - body: "*" - }; - } - - // Decrypts data that was encrypted with a public key retrieved from - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with - // [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT. - rpc AsymmetricDecrypt(AsymmetricDecryptRequest) returns (AsymmetricDecryptResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:asymmetricDecrypt" - body: "*" - }; - } - - // Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. - // - // Returns an error if called on an asymmetric key. - rpc UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest) returns (CryptoKey) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*}:updatePrimaryVersion" - body: "*" - }; - } - - // Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. - // - // Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 - // hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] - // will be changed to - // [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key - // material will be irrevocably destroyed. - // - // Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process. - rpc DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:destroy" - body: "*" - }; - } - - // Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the - // [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] - // state. - // - // Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] - // will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], - // and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared. - rpc RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest) returns (CryptoKeyVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/keyRings/*/cryptoKeys/*/cryptoKeyVersions/*}:restore" - body: "*" - }; - } -} - -// Request message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. - string parent = 1; - - // Optional limit on the number of [KeyRings][google.cloud.kms.v1.KeyRing] to include in the - // response. Further [KeyRings][google.cloud.kms.v1.KeyRing] can subsequently be obtained by - // including the [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListKeyRingsResponse.next_page_token][google.cloud.kms.v1.ListKeyRingsResponse.next_page_token]. - string page_token = 3; - - // Optional. Only include resources that match the filter in the response. - string filter = 4; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 5; -} - -// Request message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format - // `projects/*/locations/*/keyRings/*`. - string parent = 1; - - // Optional limit on the number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] to include in the - // response. Further [CryptoKeys][google.cloud.kms.v1.CryptoKey] can subsequently be obtained by - // including the [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListCryptoKeysResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token]. - string page_token = 3; - - // The fields of the primary version to include in the response. - CryptoKeyVersion.CryptoKeyVersionView version_view = 4; - - // Optional. Only include resources that match the filter in the response. - string filter = 5; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 6; -} - -// Request message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format - // `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string parent = 1; - - // Optional limit on the number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] to - // include in the response. Further [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] can - // subsequently be obtained by including the - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token] in a subsequent request. - // If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListCryptoKeyVersionsResponse.next_page_token][google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token]. - string page_token = 3; - - // The fields to include in the response. - CryptoKeyVersion.CryptoKeyVersionView view = 4; - - // Optional. Only include resources that match the filter in the response. - string filter = 5; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 6; -} - -// Request message for [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsRequest { - // Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format - // `projects/*/locations/*/keyRings/*`. - string parent = 1; - - // Optional limit on the number of [ImportJobs][google.cloud.kms.v1.ImportJob] to include in the - // response. Further [ImportJobs][google.cloud.kms.v1.ImportJob] can subsequently be obtained by - // including the [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token] in a subsequent - // request. If unspecified, the server will pick an appropriate default. - int32 page_size = 2; - - // Optional pagination token, returned earlier via - // [ListImportJobsResponse.next_page_token][google.cloud.kms.v1.ListImportJobsResponse.next_page_token]. - string page_token = 3; - - // Optional. Only include resources that match the filter in the response. - string filter = 4; - - // Optional. Specify how the results should be sorted. If not specified, the - // results will be sorted in the default order. - string order_by = 5; -} - -// Response message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. -message ListKeyRingsResponse { - // The list of [KeyRings][google.cloud.kms.v1.KeyRing]. - repeated KeyRing key_rings = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListKeyRingsRequest.page_token][google.cloud.kms.v1.ListKeyRingsRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [KeyRings][google.cloud.kms.v1.KeyRing] that matched the query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. -message ListCryptoKeysResponse { - // The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - repeated CryptoKey crypto_keys = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeysRequest.page_token][google.cloud.kms.v1.ListCryptoKeysRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [CryptoKeys][google.cloud.kms.v1.CryptoKey] that matched the query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. -message ListCryptoKeyVersionsResponse { - // The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - repeated CryptoKeyVersion crypto_key_versions = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListCryptoKeyVersionsRequest.page_token][google.cloud.kms.v1.ListCryptoKeyVersionsRequest.page_token] to retrieve the next page of - // results. - string next_page_token = 2; - - // The total number of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion] that matched the - // query. - int32 total_size = 3; -} - -// Response message for [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. -message ListImportJobsResponse { - // The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. - repeated ImportJob import_jobs = 1; - - // A token to retrieve next page of results. Pass this value in - // [ListImportJobsRequest.page_token][google.cloud.kms.v1.ListImportJobsRequest.page_token] to retrieve the next page of results. - string next_page_token = 2; - - // The total number of [ImportJobs][google.cloud.kms.v1.ImportJob] that matched the query. - int32 total_size = 3; -} - -// Request message for [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. -message GetKeyRingRequest { - // The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. -message GetCryptoKeyRequest { - // The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. -message GetCryptoKeyVersionRequest { - // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get. - string name = 1; -} - -// Request message for [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. -message GetPublicKeyRequest { - // The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to - // get. - string name = 1; -} - -// Request message for [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. -message GetImportJobRequest { - // The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get. - string name = 1; -} - -// Request message for [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. -message CreateKeyRingRequest { - // Required. The resource name of the location associated with the - // [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/*/locations/*`. - string parent = 1; - - // Required. It must be unique within a location and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string key_ring_id = 2; - - // A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. - KeyRing key_ring = 3; -} - -// Request message for [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. -message CreateCryptoKeyRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the - // [CryptoKeys][google.cloud.kms.v1.CryptoKey]. - string parent = 1; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string crypto_key_id = 2; - - // A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values. - CryptoKey crypto_key = 3; - - // If set to true, the request will create a [CryptoKey][google.cloud.kms.v1.CryptoKey] without any - // [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. You must manually call - // [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or - // [ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion] - // before you can use this [CryptoKey][google.cloud.kms.v1.CryptoKey]. - bool skip_initial_version_creation = 5; -} - -// Request message for [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. -message CreateCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] associated with - // the [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. - string parent = 1; - - // A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values. - CryptoKeyVersion crypto_key_version = 2; -} - -// Request message for [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. -message ImportCryptoKeyVersionRequest { - // Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to - // be imported into. - string parent = 1; - - // Required. The [algorithm][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm] of - // the key being imported. This does not need to match the - // [version_template][google.cloud.kms.v1.CryptoKey.version_template] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] this - // version imports into. - CryptoKeyVersion.CryptoKeyVersionAlgorithm algorithm = 2; - - // Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] that was used to - // wrap this key material. - string import_job = 4; - - // Required. The incoming wrapped key material that is to be imported. - oneof wrapped_key_material { - // Wrapped key material produced with - // [RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] - // or - // [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]. - // - // This field contains the concatenation of two wrapped keys: - //
    - //
  1. An ephemeral AES-256 wrapping key wrapped with the - // [public_key][google.cloud.kms.v1.ImportJob.public_key] using RSAES-OAEP with SHA-1, - // MGF1 with SHA-1, and an empty label. - //
  2. - //
  3. The key to be imported, wrapped with the ephemeral AES-256 key - // using AES-KWP (RFC 5649). - //
  4. - //
- // - // This format is the same as the format produced by PKCS#11 mechanism - // CKM_RSA_AES_KEY_WRAP. - bytes rsa_aes_wrapped_key = 5; - } -} - -// Request message for [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. -message CreateImportJobRequest { - // Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] associated with the - // [ImportJobs][google.cloud.kms.v1.ImportJob]. - string parent = 1; - - // Required. It must be unique within a KeyRing and match the regular - // expression `[a-zA-Z0-9_-]{1,63}` - string import_job_id = 2; - - // Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values. - ImportJob import_job = 3; -} - -// Request message for [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. -message UpdateCryptoKeyRequest { - // [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values. - CryptoKey crypto_key = 1; - - // Required list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. -message UpdateCryptoKeyVersionRequest { - // [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values. - CryptoKeyVersion crypto_key_version = 1; - - // Required list of fields to be updated in this request. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] - // to use for encryption. - // - // If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its - // [primary version][google.cloud.kms.v1.CryptoKey.primary]. - string name = 1; - - // Required. The data to encrypt. Must be no larger than 64KiB. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the plaintext must be no larger - // than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the - // plaintext and additional_authenticated_data fields must be no larger than - // 8KiB. - bytes plaintext = 2; - - // Optional data that, if specified, must also be provided during decryption - // through [DecryptRequest.additional_authenticated_data][google.cloud.kms.v1.DecryptRequest.additional_authenticated_data]. - // - // The maximum size depends on the key version's - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - // [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the AAD must be no larger than - // 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the - // plaintext and additional_authenticated_data fields must be no larger than - // 8KiB. - bytes additional_authenticated_data = 3; -} - -// Request message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptRequest { - // Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. - // The server will choose the appropriate version. - string name = 1; - - // Required. The encrypted data originally returned in - // [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext]. - bytes ciphertext = 2; - - // Optional data that must match the data originally supplied in - // [EncryptRequest.additional_authenticated_data][google.cloud.kms.v1.EncryptRequest.additional_authenticated_data]. - bytes additional_authenticated_data = 3; -} - -// Request message for [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignRequest { - // Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing. - string name = 1; - - // Required. The digest of the data to sign. The digest must be produced with - // the same digest algorithm as specified by the key version's - // [algorithm][google.cloud.kms.v1.CryptoKeyVersion.algorithm]. - Digest digest = 3; -} - -// Request message for [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptRequest { - // Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for - // decryption. - string name = 1; - - // Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public - // key using OAEP. - bytes ciphertext = 3; -} - -// Response message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. -message DecryptResponse { - // The decrypted data originally supplied in [EncryptRequest.plaintext][google.cloud.kms.v1.EncryptRequest.plaintext]. - bytes plaintext = 1; -} - -// Response message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. -message EncryptResponse { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] used in encryption. - string name = 1; - - // The encrypted data. - bytes ciphertext = 2; -} - -// Response message for [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. -message AsymmetricSignResponse { - // The created signature. - bytes signature = 1; -} - -// Response message for [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. -message AsymmetricDecryptResponse { - // The decrypted data originally encrypted with the matching public key. - bytes plaintext = 1; -} - -// Request message for [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. -message UpdateCryptoKeyPrimaryVersionRequest { - // The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update. - string name = 1; - - // The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary. - string crypto_key_version_id = 2; -} - -// Request message for [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. -message DestroyCryptoKeyVersionRequest { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy. - string name = 1; -} - -// Request message for [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. -message RestoreCryptoKeyVersionRequest { - // The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore. - string name = 1; -} - -// A [Digest][google.cloud.kms.v1.Digest] holds a cryptographic message digest. -message Digest { - // Required. The message digest. - oneof digest { - // A message digest produced with the SHA-256 algorithm. - bytes sha256 = 1; - - // A message digest produced with the SHA-384 algorithm. - bytes sha384 = 2; - - // A message digest produced with the SHA-512 algorithm. - bytes sha512 = 3; - } -} - -// Cloud KMS metadata for the given [google.cloud.location.Location][google.cloud.location.Location]. -message LocationMetadata { - // Indicates whether [CryptoKeys][google.cloud.kms.v1.CryptoKey] with - // [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level] - // [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] can be created in this location. - bool hsm_available = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline deleted file mode 100644 index e9ce8596c408..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_decrypt.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for - * decryption. - */ - // const name = 'abc123' - /** - * Required. The data encrypted with the named CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public - * key using OAEP. - */ - // const ciphertext = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricDecrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.asymmetricDecrypt(request); - console.log(response); - } - - callAsymmetricDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline deleted file mode 100644 index 6f5c3ea9aab7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.asymmetric_sign.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use for signing. - */ - // const name = 'abc123' - /** - * Required. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm. - */ - // const digest = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callAsymmetricSign() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.asymmetricSign(request); - console.log(response); - } - - callAsymmetricSign(); - // [END cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key.js.baseline deleted file mode 100644 index 26a179538126..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing associated with the - * CryptoKeys google.cloud.kms.v1.CryptoKey. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const cryptoKeyId = 'abc123' - /** - * A CryptoKey google.cloud.kms.v1.CryptoKey with initial field values. - */ - // const cryptoKey = {} - /** - * If set to true, the request will create a CryptoKey google.cloud.kms.v1.CryptoKey without any - * CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must manually call - * CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion or - * ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion - * before you can use this CryptoKey google.cloud.kms.v1.CryptoKey. - */ - // const skipInitialVersionCreation = true - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createCryptoKey(request); - console.log(response); - } - - callCreateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline deleted file mode 100644 index 6629c95649ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_crypto_key_version.js.baseline +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey associated with - * the CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. - */ - // const parent = 'abc123' - /** - * A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with initial field values. - */ - // const cryptoKeyVersion = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createCryptoKeyVersion(request); - console.log(response); - } - - callCreateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_import_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_import_job.js.baseline deleted file mode 100644 index 2214d9238b4d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_import_job.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.KeyRing.name of the KeyRing google.cloud.kms.v1.KeyRing associated with the - * ImportJobs google.cloud.kms.v1.ImportJob. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const importJobId = 'abc123' - /** - * Required. An ImportJob google.cloud.kms.v1.ImportJob with initial field values. - */ - // const importJob = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateImportJob() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createImportJob(request); - console.log(response); - } - - callCreateImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_CreateImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_key_ring.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_key_ring.js.baseline deleted file mode 100644 index 9df5eab2da41..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.create_key_ring.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - */ - // const keyRingId = 'abc123' - /** - * A KeyRing google.cloud.kms.v1.KeyRing with initial field values. - */ - // const keyRing = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callCreateKeyRing() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.createKeyRing(request); - console.log(response); - } - - callCreateKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.decrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.decrypt.js.baseline deleted file mode 100644 index f55bd25120ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.decrypt.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_Decrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to use for decryption. - * The server will choose the appropriate version. - */ - // const name = 'abc123' - /** - * Required. The encrypted data originally returned in - * EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext. - */ - // const ciphertext = Buffer.from('string') - /** - * Optional data that must match the data originally supplied in - * EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data. - */ - // const additionalAuthenticatedData = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDecrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.decrypt(request); - console.log(response); - } - - callDecrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Decrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline deleted file mode 100644 index aa0e43062cb2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.destroy_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to destroy. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callDestroyCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.destroyCryptoKeyVersion(request); - console.log(response); - } - - callDestroyCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.encrypt.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.encrypt.js.baseline deleted file mode 100644 index 92f065d345af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.encrypt.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_Encrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey or CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion - * to use for encryption. - * If a CryptoKey google.cloud.kms.v1.CryptoKey is specified, the server will use its - * primary version google.cloud.kms.v1.CryptoKey.primary. - */ - // const name = 'abc123' - /** - * Required. The data to encrypt. Must be no larger than 64KiB. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. For - * SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the plaintext must be no larger - * than 64KiB. For HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - */ - // const plaintext = Buffer.from('string') - /** - * Optional data that, if specified, must also be provided during decryption - * through DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data. - * The maximum size depends on the key version's - * protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level. For - * SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE keys, the AAD must be no larger than - * 64KiB. For HSM google.cloud.kms.v1.ProtectionLevel.HSM keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - */ - // const additionalAuthenticatedData = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callEncrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.encrypt(request); - console.log(response); - } - - callEncrypt(); - // [END cloudkms_v1_generated_KeyManagementService_Encrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key.js.baseline deleted file mode 100644 index 57871b606322..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getCryptoKey(request); - console.log(response); - } - - callGetCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline deleted file mode 100644 index 1313d92cf639..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKeyVersion.name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getCryptoKeyVersion(request); - console.log(response); - } - - callGetCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_import_job.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_import_job.js.baseline deleted file mode 100644 index 50ac6d170ebe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_import_job.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetImportJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.ImportJob.name of the ImportJob google.cloud.kms.v1.ImportJob to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetImportJob() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getImportJob(request); - console.log(response); - } - - callGetImportJob(); - // [END cloudkms_v1_generated_KeyManagementService_GetImportJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_key_ring.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_key_ring.js.baseline deleted file mode 100644 index ce25f83bf221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_key_ring.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.KeyRing.name of the KeyRing google.cloud.kms.v1.KeyRing to get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetKeyRing() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getKeyRing(request); - console.log(response); - } - - callGetKeyRing(); - // [END cloudkms_v1_generated_KeyManagementService_GetKeyRing_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_public_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_public_key.js.baseline deleted file mode 100644 index 52aeb7e8d72a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.get_public_key.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The name google.cloud.kms.v1.CryptoKeyVersion.name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion public key to - * get. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callGetPublicKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.getPublicKey(request); - console.log(response); - } - - callGetPublicKey(); - // [END cloudkms_v1_generated_KeyManagementService_GetPublicKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline deleted file mode 100644 index 298f84bb082d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.import_crypto_key_version.js.baseline +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name google.cloud.kms.v1.CryptoKey.name of the CryptoKey google.cloud.kms.v1.CryptoKey to - * be imported into. - */ - // const parent = 'abc123' - /** - * Required. The algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm of - * the key being imported. This does not need to match the - * version_template google.cloud.kms.v1.CryptoKey.version_template of the CryptoKey google.cloud.kms.v1.CryptoKey this - * version imports into. - */ - // const algorithm = {} - /** - * Required. The name google.cloud.kms.v1.ImportJob.name of the ImportJob google.cloud.kms.v1.ImportJob that was used to - * wrap this key material. - */ - // const importJob = 'abc123' - /** - * Wrapped key material produced with - * RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 - * or - * RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256. - * This field contains the concatenation of two wrapped keys: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * public_key google.cloud.kms.v1.ImportJob.public_key using RSAES-OAEP with SHA-1, - * MGF1 with SHA-1, and an empty label. - *
  2. - *
  3. The key to be imported, wrapped with the ephemeral AES-256 key - * using AES-KWP (RFC 5649). - *
  4. - *
- * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - */ - // const rsaAesWrappedKey = Buffer.from('string') - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callImportCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.importCryptoKeyVersion(request); - console.log(response); - } - - callImportCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline deleted file mode 100644 index 86b3e0c30050..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_key_versions.js.baseline +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion to - * include in the response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion can - * subsequently be obtained by including the - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token in a subsequent request. - * If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields to include in the response. - */ - // const view = {} - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeyVersions() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listCryptoKeyVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeyVersions(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline deleted file mode 100644 index 4d31b2d0f6b5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_crypto_keys.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing to list, in the format - * `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of CryptoKeys google.cloud.kms.v1.CryptoKey to include in the - * response. Further CryptoKeys google.cloud.kms.v1.CryptoKey can subsequently be obtained by - * including the ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * The fields of the primary version to include in the response. - */ - // const versionView = {} - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListCryptoKeys() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listCryptoKeysAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCryptoKeys(); - // [END cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_import_jobs.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_import_jobs.js.baseline deleted file mode 100644 index d75def49aebc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_import_jobs.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the KeyRing google.cloud.kms.v1.KeyRing to list, in the format - * `projects/* /locations/* /keyRings/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of ImportJobs google.cloud.kms.v1.ImportJob to include in the - * response. Further ImportJobs google.cloud.kms.v1.ImportJob can subsequently be obtained by - * including the ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListImportJobs() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listImportJobsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListImportJobs(); - // [END cloudkms_v1_generated_KeyManagementService_ListImportJobs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_key_rings.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_key_rings.js.baseline deleted file mode 100644 index efe9d153c62e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.list_key_rings.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the location associated with the - * KeyRings google.cloud.kms.v1.KeyRing, in the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * Optional limit on the number of KeyRings google.cloud.kms.v1.KeyRing to include in the - * response. Further KeyRings google.cloud.kms.v1.KeyRing can subsequently be obtained by - * including the ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token in a subsequent - * request. If unspecified, the server will pick an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional pagination token, returned earlier via - * ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Only include resources that match the filter in the response. - */ - // const filter = 'abc123' - /** - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - */ - // const orderBy = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callListKeyRings() { - // Construct request - const request = { - }; - - // Run request - const iterable = kmsClient.listKeyRingsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListKeyRings(); - // [END cloudkms_v1_generated_KeyManagementService_ListKeyRings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline deleted file mode 100644 index 468ea5f60a3d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.restore_crypto_key_version.js.baseline +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to restore. - */ - // const name = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callRestoreCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.restoreCryptoKeyVersion(request); - console.log(response); - } - - callRestoreCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key.js.baseline deleted file mode 100644 index be4abdd1be80..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * CryptoKey google.cloud.kms.v1.CryptoKey with updated values. - */ - // const cryptoKey = {} - /** - * Required list of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKey() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKey(request); - console.log(response); - } - - callUpdateCryptoKey(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline deleted file mode 100644 index 9420cbd5331d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_primary_version.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The resource name of the CryptoKey google.cloud.kms.v1.CryptoKey to update. - */ - // const name = 'abc123' - /** - * The id of the child CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion to use as primary. - */ - // const cryptoKeyVersionId = 'abc123' - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyPrimaryVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKeyPrimaryVersion(request); - console.log(response); - } - - callUpdateCryptoKeyPrimaryVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline deleted file mode 100644 index 9631b2017ba4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/key_management_service.update_crypto_key_version.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion with updated values. - */ - // const cryptoKeyVersion = {} - /** - * Required list of fields to be updated in this request. - */ - // const updateMask = {} - - // Imports the Kms library - const {KeyManagementServiceClient} = require('kms').v1; - - // Instantiates a client - const kmsClient = new KeyManagementServiceClient(); - - async function callUpdateCryptoKeyVersion() { - // Construct request - const request = { - }; - - // Run request - const response = await kmsClient.updateCryptoKeyVersion(request); - console.log(response); - } - - callUpdateCryptoKeyVersion(); - // [END cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline deleted file mode 100644 index a44e558ebabb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/samples/generated/v1/snippet_metadata_google.cloud.kms.v1.json.baseline +++ /dev/null @@ -1,1087 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-kms", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.kms.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListKeyRings_async", - "title": "KeyManagementService listKeyRings Sample", - "origin": "API_DEFINITION", - "description": " Lists [KeyRings][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.list_key_rings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListKeyRingsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListKeyRings", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListKeyRings", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async", - "title": "KeyManagementService listCryptoKeys Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.list_crypto_keys.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "version_view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeysResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeys", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeys", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async", - "title": "KeyManagementService listCryptoKeyVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.list_crypto_key_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListCryptoKeyVersionsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListCryptoKeyVersions", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ListImportJobs_async", - "title": "KeyManagementService listImportJobs Sample", - "origin": "API_DEFINITION", - "description": " Lists [ImportJobs][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.list_import_jobs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ListImportJobsResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ListImportJobs", - "fullName": "google.cloud.kms.v1.KeyManagementService.ListImportJobs", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetKeyRing_async", - "title": "KeyManagementService getKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].", - "canonical": true, - "file": "key_management_service.get_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async", - "title": "KeyManagementService getCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async", - "title": "KeyManagementService getCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].", - "canonical": true, - "file": "key_management_service.get_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetPublicKey_async", - "title": "KeyManagementService getPublicKey Sample", - "origin": "API_DEFINITION", - "description": " Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].", - "canonical": true, - "file": "key_management_service.get_public_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.PublicKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetPublicKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetPublicKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_GetImportJob_async", - "title": "KeyManagementService getImportJob Sample", - "origin": "API_DEFINITION", - "description": " Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].", - "canonical": true, - "file": "key_management_service.get_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "GetImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.GetImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async", - "title": "KeyManagementService createKeyRing Sample", - "origin": "API_DEFINITION", - "description": " Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.", - "canonical": true, - "file": "key_management_service.create_key_ring.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "key_ring_id", - "type": "TYPE_STRING" - }, - { - "name": "key_ring", - "type": ".google.cloud.kms.v1.KeyRing" - } - ], - "resultType": ".google.cloud.kms.v1.KeyRing", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateKeyRing", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateKeyRing", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async", - "title": "KeyManagementService createCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.", - "canonical": true, - "file": "key_management_service.create_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_id", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "skip_initial_version_creation", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async", - "title": "KeyManagementService createCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey]. The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].", - "canonical": true, - "file": "key_management_service.create_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async", - "title": "KeyManagementService importCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the wrapped key material provided in the request. The version ID will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.import_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 84, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "algorithm", - "type": ".google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm" - }, - { - "name": "import_job", - "type": "TYPE_STRING" - }, - { - "name": "rsa_aes_wrapped_key", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "ImportCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_CreateImportJob_async", - "title": "KeyManagementService createImportJob Sample", - "origin": "API_DEFINITION", - "description": " Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing]. [ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.", - "canonical": true, - "file": "key_management_service.create_import_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "import_job_id", - "type": "TYPE_STRING" - }, - { - "name": "import_job", - "type": ".google.cloud.kms.v1.ImportJob" - } - ], - "resultType": ".google.cloud.kms.v1.ImportJob", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "CreateImportJob", - "fullName": "google.cloud.kms.v1.KeyManagementService.CreateImportJob", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async", - "title": "KeyManagementService updateCryptoKey Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].", - "canonical": true, - "file": "key_management_service.update_crypto_key.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "async": true, - "parameters": [ - { - "name": "crypto_key", - "type": ".google.cloud.kms.v1.CryptoKey" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKey", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async", - "title": "KeyManagementService updateCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata. [state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.", - "canonical": true, - "file": "key_management_service.update_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "crypto_key_version", - "type": ".google.cloud.kms.v1.CryptoKeyVersion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Encrypt_async", - "title": "KeyManagementService encrypt Sample", - "origin": "API_DEFINITION", - "description": " Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.encrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "plaintext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.EncryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Encrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Encrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_Decrypt_async", - "title": "KeyManagementService decrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].", - "canonical": true, - "file": "key_management_service.decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - }, - { - "name": "additional_authenticated_data", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.DecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "Decrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.Decrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async", - "title": "KeyManagementService asymmetricSign Sample", - "origin": "API_DEFINITION", - "description": " Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].", - "canonical": true, - "file": "key_management_service.asymmetric_sign.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "digest", - "type": ".google.cloud.kms.v1.Digest" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricSignResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricSign", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricSign", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async", - "title": "KeyManagementService asymmetricDecrypt Sample", - "origin": "API_DEFINITION", - "description": " Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.", - "canonical": true, - "file": "key_management_service.asymmetric_decrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "ciphertext", - "type": "TYPE_BYTES" - } - ], - "resultType": ".google.cloud.kms.v1.AsymmetricDecryptResponse", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "AsymmetricDecrypt", - "fullName": "google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async", - "title": "KeyManagementService updateCryptoKeyPrimaryVersion Sample", - "origin": "API_DEFINITION", - "description": " Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. Returns an error if called on an asymmetric key.", - "canonical": true, - "file": "key_management_service.update_crypto_key_primary_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "crypto_key_version_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKey", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "UpdateCryptoKeyPrimaryVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async", - "title": "KeyManagementService destroyCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction. Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed. Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.", - "canonical": true, - "file": "key_management_service.destroy_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "DestroyCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - }, - { - "regionTag": "cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async", - "title": "KeyManagementService restoreCryptoKeyVersion Sample", - "origin": "API_DEFINITION", - "description": " Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state. Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.", - "canonical": true, - "file": "key_management_service.restore_crypto_key_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.kms.v1.CryptoKeyVersion", - "client": { - "shortName": "KeyManagementServiceClient", - "fullName": "google.cloud.kms.v1.KeyManagementServiceClient" - }, - "method": { - "shortName": "RestoreCryptoKeyVersion", - "fullName": "google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion", - "service": { - "shortName": "KeyManagementService", - "fullName": "google.cloud.kms.v1.KeyManagementService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/src/index.ts.baseline deleted file mode 100644 index 8b85dab08172..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const KeyManagementServiceClient = v1.KeyManagementServiceClient; -type KeyManagementServiceClient = v1.KeyManagementServiceClient; -export {v1, KeyManagementServiceClient}; -export default {v1, KeyManagementServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/src/v1/index.ts.baseline deleted file mode 100644 index 5238b41c0fc5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {KeyManagementServiceClient} from './key_management_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client.ts.baseline deleted file mode 100644 index 5ab7909bf3b5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client.ts.baseline +++ /dev/null @@ -1,3338 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, IamClient, IamProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/key_management_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './key_management_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Google Cloud Key Management Service - * - * Manages cryptographic keys and operations using those keys. Implements a REST - * model with the following objects: - * - * * {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} - * * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} - * * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * - * If you are using manual gRPC libraries, see - * [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). - * @class - * @memberof v1 - */ -export class KeyManagementServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('kms'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - keyManagementServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of KeyManagementServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 KeyManagementServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof KeyManagementServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudkms.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // 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 = { - listKeyRings: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keyRings'), - listCryptoKeys: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeys'), - listCryptoKeyVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'cryptoKeyVersions'), - listImportJobs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'importJobs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.kms.v1.KeyManagementService', gapicConfig as gax.ClientConfig, - 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.keyManagementServiceStub) { - return this.keyManagementServiceStub; - } - - // Put together the "service stub" for - // google.cloud.kms.v1.KeyManagementService. - this.keyManagementServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.kms.v1.KeyManagementService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.kms.v1.KeyManagementService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const keyManagementServiceStubMethods = - ['listKeyRings', 'listCryptoKeys', 'listCryptoKeyVersions', 'listImportJobs', 'getKeyRing', 'getCryptoKey', 'getCryptoKeyVersion', 'getPublicKey', 'getImportJob', 'createKeyRing', 'createCryptoKey', 'createCryptoKeyVersion', 'importCryptoKeyVersion', 'createImportJob', 'updateCryptoKey', 'updateCryptoKeyVersion', 'encrypt', 'decrypt', 'asymmetricSign', 'asymmetricDecrypt', 'updateCryptoKeyPrimaryVersion', 'destroyCryptoKeyVersion', 'restoreCryptoKeyVersion']; - for (const methodName of keyManagementServiceStubMethods) { - const callPromise = this.keyManagementServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.keyManagementServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudkms.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloudkms' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to get. - * @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 {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetKeyRing_async - */ - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request: protos.google.cloud.kms.v1.IGetKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): void; - getKeyRing( - request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getKeyRing request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getKeyRing response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getKeyRing(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.IGetKeyRingRequest|undefined, - {}|undefined - ]) => { - this._log.info('getKeyRing response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}, as well as its - * {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary} {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to get. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKey_async - */ - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKey( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCryptoKey response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IGetCryptoKeyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to get. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetCryptoKeyVersion_async - */ - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - getCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns the public key for the given {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. The - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN|ASYMMETRIC_SIGN} or - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT|ASYMMETRIC_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} public key to - * get. - * @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 {@link protos.google.cloud.kms.v1.PublicKey|PublicKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_public_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetPublicKey_async - */ - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): void; - getPublicKey( - request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getPublicKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getPublicKey response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getPublicKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IPublicKey, - protos.google.cloud.kms.v1.IGetPublicKeyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getPublicKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns metadata for a given {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} to get. - * @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 {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.get_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_GetImportJob_async - */ - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request: protos.google.cloud.kms.v1.IGetImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): void; - getImportJob( - request?: protos.google.cloud.kms.v1.IGetImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getImportJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getImportJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getImportJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.IGetImportJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('getImportJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} in a given Project and Location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {string} request.keyRingId - * Required. It must be unique within a location and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.KeyRing} request.keyRing - * A {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_key_ring.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateKeyRing_async - */ - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - callback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): void; - createKeyRing( - request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createKeyRing request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createKeyRing response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createKeyRing(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IKeyRing, - protos.google.cloud.kms.v1.ICreateKeyRingRequest|undefined, - {}|undefined - ]) => { - this._log.info('createKeyRing response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} within a {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm|CryptoKey.version_template.algorithm} - * are required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the KeyRing associated with the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * @param {string} request.cryptoKeyId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * A {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with initial field values. - * @param {boolean} request.skipInitialVersionCreation - * If set to true, the request will create a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} without any - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. You must manually call - * {@link protos.google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion|CreateCryptoKeyVersion} or - * {@link protos.google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion|ImportCryptoKeyVersion} - * before you can use this {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKey_async - */ - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKey( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createCryptoKey response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.ICreateCryptoKeyRequest|undefined, - {}|undefined - ]) => { - this._log.info('createCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * The server will assign the next sequential id. If unset, - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} associated with - * the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * A {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateCryptoKeyVersion_async - */ - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - createCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Imports a new {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} into an existing {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} using the - * wrapped key material provided in the request. - * - * The version ID will be assigned the next sequential id within the - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.CryptoKey.name|name} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to - * be imported into. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm} request.algorithm - * Required. The {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm|algorithm} of - * the key being imported. This does not need to match the - * {@link protos.google.cloud.kms.v1.CryptoKey.version_template|version_template} of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} this - * version imports into. - * @param {string} request.importJob - * Required. The {@link protos.google.cloud.kms.v1.ImportJob.name|name} of the {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} that was used to - * wrap this key material. - * @param {Buffer} request.rsaAesWrappedKey - * Wrapped key material produced with - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256|RSA_OAEP_3072_SHA1_AES_256} - * or - * {@link protos.google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256|RSA_OAEP_4096_SHA1_AES_256}. - * - * This field contains the concatenation of two wrapped keys: - *
    - *
  1. An ephemeral AES-256 wrapping key wrapped with the - * {@link protos.google.cloud.kms.v1.ImportJob.public_key|public_key} using RSAES-OAEP with SHA-1, - * MGF1 with SHA-1, and an empty label. - *
  2. - *
  3. The key to be imported, wrapped with the ephemeral AES-256 key - * using AES-KWP (RFC 5649). - *
  4. - *
- * - * This format is the same as the format produced by PKCS#11 mechanism - * CKM_RSA_AES_KEY_WRAP. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.import_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ImportCryptoKeyVersion_async - */ - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - importCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('importCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('importCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.importCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('importCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a new {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} within a {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * - * {@link protos.google.cloud.kms.v1.ImportJob.import_method|ImportJob.import_method} is required. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The {@link protos.google.cloud.kms.v1.KeyRing.name|name} of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} associated with the - * {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * @param {string} request.importJobId - * Required. It must be unique within a KeyRing and match the regular - * expression `[a-zA-Z0-9_-]{1,63}` - * @param {google.cloud.kms.v1.ImportJob} request.importJob - * Required. An {@link protos.google.cloud.kms.v1.ImportJob|ImportJob} with initial field values. - * @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 {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.create_import_job.js - * region_tag:cloudkms_v1_generated_KeyManagementService_CreateImportJob_async - */ - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request: protos.google.cloud.kms.v1.ICreateImportJobRequest, - callback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): void; - createImportJob( - request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createImportJob request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createImportJob response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createImportJob(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IImportJob, - protos.google.cloud.kms.v1.ICreateImportJobRequest|undefined, - {}|undefined - ]) => { - this._log.info('createImportJob response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKey} request.cryptoKey - * {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required list of fields to be updated in this request. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKey_async - */ - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKey( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key.name': request.cryptoKey!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKey request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKey response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCryptoKey(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCryptoKey response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s metadata. - * - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} may be changed between - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED|ENABLED} and - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED} using this - * method. See {@link protos.google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion|DestroyCryptoKeyVersion} and {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} to - * move between other states. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.kms.v1.CryptoKeyVersion} request.cryptoKeyVersion - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with updated values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required list of fields to be updated in this request. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyVersion_async - */ - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'crypto_key_version.name': request.cryptoKeyVersion!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Encrypts data, so that it can only be recovered by a call to {@link protos.google.cloud.kms.v1.KeyManagementService.Decrypt|Decrypt}. - * The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} must be - * {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} or {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} - * to use for encryption. - * - * If a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} is specified, the server will use its - * {@link protos.google.cloud.kms.v1.CryptoKey.primary|primary version}. - * @param {Buffer} request.plaintext - * Required. The data to encrypt. Must be no larger than 64KiB. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the plaintext must be no larger - * than 64KiB. For {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - * @param {Buffer} request.additionalAuthenticatedData - * Optional data that, if specified, must also be provided during decryption - * through {@link protos.google.cloud.kms.v1.DecryptRequest.additional_authenticated_data|DecryptRequest.additional_authenticated_data}. - * - * The maximum size depends on the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level|protection_level}. For - * {@link protos.google.cloud.kms.v1.ProtectionLevel.SOFTWARE|SOFTWARE} keys, the AAD must be no larger than - * 64KiB. For {@link protos.google.cloud.kms.v1.ProtectionLevel.HSM|HSM} keys, the combined length of the - * plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - * @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 {@link protos.google.cloud.kms.v1.EncryptResponse|EncryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.encrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Encrypt_async - */ - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request: protos.google.cloud.kms.v1.IEncryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): void; - encrypt( - request?: protos.google.cloud.kms.v1.IEncryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('encrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('encrypt response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.encrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IEncryptResponse, - protos.google.cloud.kms.v1.IEncryptRequest|undefined, - {}|undefined - ]) => { - this._log.info('encrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Decrypts data that was protected by {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. The {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * must be {@link protos.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT|ENCRYPT_DECRYPT}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to use for decryption. - * The server will choose the appropriate version. - * @param {Buffer} request.ciphertext - * Required. The encrypted data originally returned in - * {@link protos.google.cloud.kms.v1.EncryptResponse.ciphertext|EncryptResponse.ciphertext}. - * @param {Buffer} request.additionalAuthenticatedData - * Optional data that must match the data originally supplied in - * {@link protos.google.cloud.kms.v1.EncryptRequest.additional_authenticated_data|EncryptRequest.additional_authenticated_data}. - * @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 {@link protos.google.cloud.kms.v1.DecryptResponse|DecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_Decrypt_async - */ - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request: protos.google.cloud.kms.v1.IDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): void; - decrypt( - request?: protos.google.cloud.kms.v1.IDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('decrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('decrypt response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.decrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IDecryptResponse, - protos.google.cloud.kms.v1.IDecryptRequest|undefined, - {}|undefined - ]) => { - this._log.info('decrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Signs data using a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} - * ASYMMETRIC_SIGN, producing a signature that can be verified with the public - * key retrieved from {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for signing. - * @param {google.cloud.kms.v1.Digest} request.digest - * Required. The digest of the data to sign. The digest must be produced with - * the same digest algorithm as specified by the key version's - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.algorithm|algorithm}. - * @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 {@link protos.google.cloud.kms.v1.AsymmetricSignResponse|AsymmetricSignResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_sign.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricSign_async - */ - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): void; - asymmetricSign( - request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('asymmetricSign request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('asymmetricSign response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.asymmetricSign(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IAsymmetricSignResponse, - protos.google.cloud.kms.v1.IAsymmetricSignRequest|undefined, - {}|undefined - ]) => { - this._log.info('asymmetricSign response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Decrypts data that was encrypted with a public key retrieved from - * {@link protos.google.cloud.kms.v1.KeyManagementService.GetPublicKey|GetPublicKey} corresponding to a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} with - * {@link protos.google.cloud.kms.v1.CryptoKey.purpose|CryptoKey.purpose} ASYMMETRIC_DECRYPT. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use for - * decryption. - * @param {Buffer} request.ciphertext - * Required. The data encrypted with the named {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}'s public - * key using OAEP. - * @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 {@link protos.google.cloud.kms.v1.AsymmetricDecryptResponse|AsymmetricDecryptResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.asymmetric_decrypt.js - * region_tag:cloudkms_v1_generated_KeyManagementService_AsymmetricDecrypt_async - */ - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - callback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): void; - asymmetricDecrypt( - request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('asymmetricDecrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('asymmetricDecrypt response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.asymmetricDecrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, - protos.google.cloud.kms.v1.IAsymmetricDecryptRequest|undefined, - {}|undefined - ]) => { - this._log.info('asymmetricDecrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the version of a {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} that will be used in {@link protos.google.cloud.kms.v1.KeyManagementService.Encrypt|Encrypt}. - * - * Returns an error if called on an asymmetric key. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to update. - * @param {string} request.cryptoKeyVersionId - * The id of the child {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to use as primary. - * @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 {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.update_crypto_key_primary_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_UpdateCryptoKeyPrimaryVersion_async - */ - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): void; - updateCryptoKeyPrimaryVersion( - request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCryptoKeyPrimaryVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCryptoKeyPrimaryVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCryptoKeyPrimaryVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKey, - protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCryptoKeyPrimaryVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Schedule a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} for destruction. - * - * Upon calling this method, {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|CryptoKeyVersion.state} will be set to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will be set to a time 24 - * hours in the future, at which point the {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} - * will be changed to - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED|DESTROYED}, and the key - * material will be irrevocably destroyed. - * - * Before the {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} is reached, - * {@link protos.google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion|RestoreCryptoKeyVersion} may be called to reverse the process. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to destroy. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.destroy_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_DestroyCryptoKeyVersion_async - */ - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - destroyCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('destroyCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('destroyCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.destroyCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('destroyCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Restore a {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} in the - * {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED|DESTROY_SCHEDULED} - * state. - * - * Upon restoration of the CryptoKeyVersion, {@link protos.google.cloud.kms.v1.CryptoKeyVersion.state|state} - * will be set to {@link protos.google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED|DISABLED}, - * and {@link protos.google.cloud.kms.v1.CryptoKeyVersion.destroy_time|destroy_time} will be cleared. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} to restore. - * @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 {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/key_management_service.restore_crypto_key_version.js - * region_tag:cloudkms_v1_generated_KeyManagementService_RestoreCryptoKeyVersion_async - */ - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - callback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): void; - restoreCryptoKeyVersion( - request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('restoreCryptoKeyVersion request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restoreCryptoKeyVersion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.restoreCryptoKeyVersion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion, - protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest|undefined, - {}|undefined - ]) => { - this._log.info('restoreCryptoKeyVersion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.KeyRing|KeyRing}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listKeyRingsAsync()` - * 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. - */ - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request: protos.google.cloud.kms.v1.IListKeyRingsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): void; - listKeyRings( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>): - Promise<[ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListKeyRingsRequest, - protos.google.cloud.kms.v1.IListKeyRingsResponse|null|undefined, - protos.google.cloud.kms.v1.IKeyRing>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listKeyRings values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listKeyRings request %j', request); - return this.innerApiCalls - .listKeyRings(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.IKeyRing[], - protos.google.cloud.kms.v1.IListKeyRingsRequest|null, - protos.google.cloud.kms.v1.IListKeyRingsResponse - ]) => { - this._log.info('listKeyRings values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listKeyRings`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.KeyRing|KeyRing} 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 `listKeyRingsAsync()` - * 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. - */ - listKeyRingsStream( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listKeyRings stream %j', request); - return this.descriptors.page.listKeyRings.createStream( - this.innerApiCalls.listKeyRings as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listKeyRings`, 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. The resource name of the location associated with the - * {@link protos.google.cloud.kms.v1.KeyRing|KeyRings}, in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} to include in the - * response. Further {@link protos.google.cloud.kms.v1.KeyRing|KeyRings} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListKeyRingsResponse.next_page_token|ListKeyRingsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.KeyRing|KeyRing}. 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 include:samples/generated/v1/key_management_service.list_key_rings.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListKeyRings_async - */ - listKeyRingsAsync( - request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listKeyRings']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listKeyRings iterate %j', request); - return this.descriptors.page.listKeyRings.asyncIterate( - this.innerApiCalls['listKeyRings'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeysAsync()` - * 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. - */ - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): void; - listCryptoKeys( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeysRequest, - protos.google.cloud.kms.v1.IListCryptoKeysResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKey>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCryptoKeys values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listCryptoKeys request %j', request); - return this.innerApiCalls - .listCryptoKeys(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.ICryptoKey[], - protos.google.cloud.kms.v1.IListCryptoKeysRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeysResponse - ]) => { - this._log.info('listCryptoKeys values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCryptoKeys`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKey|CryptoKey} 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 `listCryptoKeysAsync()` - * 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. - */ - listCryptoKeysStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeys stream %j', request); - return this.descriptors.page.listCryptoKeys.createStream( - this.innerApiCalls.listCryptoKeys as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeys`, 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. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} to include in the - * response. Further {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKeys} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token|ListCryptoKeysResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.versionView - * The fields of the primary version to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKey|CryptoKey}. 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 include:samples/generated/v1/key_management_service.list_crypto_keys.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeys_async - */ - listCryptoKeysAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeys']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeys iterate %j', request); - return this.descriptors.page.listCryptoKeys.asyncIterate( - this.innerApiCalls['listCryptoKeys'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCryptoKeyVersionsAsync()` - * 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. - */ - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): void; - listCryptoKeyVersions( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>): - Promise<[ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse|null|undefined, - protos.google.cloud.kms.v1.ICryptoKeyVersion>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCryptoKeyVersions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listCryptoKeyVersions request %j', request); - return this.innerApiCalls - .listCryptoKeyVersions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.ICryptoKeyVersion[], - protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest|null, - protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse - ]) => { - this._log.info('listCryptoKeyVersions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCryptoKeyVersions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion} 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 `listCryptoKeyVersionsAsync()` - * 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. - */ - listCryptoKeyVersionsStream( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeyVersions stream %j', request); - return this.descriptors.page.listCryptoKeyVersions.createStream( - this.innerApiCalls.listCryptoKeyVersions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCryptoKeyVersions`, 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. The resource name of the {@link protos.google.cloud.kms.v1.CryptoKey|CryptoKey} to list, in the format - * `projects/* /locations/* /keyRings/* /cryptoKeys/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} to - * include in the response. Further {@link protos.google.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersions} can - * subsequently be obtained by including the - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token} in a subsequent request. - * If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token|ListCryptoKeyVersionsResponse.next_page_token}. - * @param {google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionView} request.view - * The fields to include in the response. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.CryptoKeyVersion|CryptoKeyVersion}. 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 include:samples/generated/v1/key_management_service.list_crypto_key_versions.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListCryptoKeyVersions_async - */ - listCryptoKeyVersionsAsync( - request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCryptoKeyVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCryptoKeyVersions iterate %j', request); - return this.descriptors.page.listCryptoKeyVersions.asyncIterate( - this.innerApiCalls['listCryptoKeyVersions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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 Array of {@link protos.google.cloud.kms.v1.ImportJob|ImportJob}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listImportJobsAsync()` - * 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. - */ - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request: protos.google.cloud.kms.v1.IListImportJobsRequest, - callback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): void; - listImportJobs( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>, - callback?: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>): - Promise<[ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.kms.v1.IListImportJobsRequest, - protos.google.cloud.kms.v1.IListImportJobsResponse|null|undefined, - protos.google.cloud.kms.v1.IImportJob>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listImportJobs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listImportJobs request %j', request); - return this.innerApiCalls - .listImportJobs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.kms.v1.IImportJob[], - protos.google.cloud.kms.v1.IListImportJobsRequest|null, - protos.google.cloud.kms.v1.IListImportJobsResponse - ]) => { - this._log.info('listImportJobs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listImportJobs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.ImportJob|ImportJob} 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 `listImportJobsAsync()` - * 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. - */ - listImportJobsStream( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listImportJobs stream %j', request); - return this.descriptors.page.listImportJobs.createStream( - this.innerApiCalls.listImportJobs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listImportJobs`, 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. The resource name of the {@link protos.google.cloud.kms.v1.KeyRing|KeyRing} to list, in the format - * `projects/* /locations/* /keyRings/*`. - * @param {number} request.pageSize - * Optional limit on the number of {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} to include in the - * response. Further {@link protos.google.cloud.kms.v1.ImportJob|ImportJobs} can subsequently be obtained by - * including the {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token} in a subsequent - * request. If unspecified, the server will pick an appropriate default. - * @param {string} request.pageToken - * Optional pagination token, returned earlier via - * {@link protos.google.cloud.kms.v1.ListImportJobsResponse.next_page_token|ListImportJobsResponse.next_page_token}. - * @param {string} request.filter - * Optional. Only include resources that match the filter in the response. - * @param {string} request.orderBy - * Optional. Specify how the results should be sorted. If not specified, the - * results will be sorted in the default order. - * @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.cloud.kms.v1.ImportJob|ImportJob}. 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 include:samples/generated/v1/key_management_service.list_import_jobs.js - * region_tag:cloudkms_v1_generated_KeyManagementService_ListImportJobs_async - */ - listImportJobsAsync( - request?: protos.google.cloud.kms.v1.IListImportJobsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listImportJobs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listImportJobs iterate %j', request); - return this.descriptors.page.listImportJobs.asyncIterate( - this.innerApiCalls['listImportJobs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.Policy]> { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see {@link https://cloud.google.com/iam/docs/overview#permissions | IAM Overview }. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]> { - return this.iamClient.testIamPermissions(request, options, callback); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.keyManagementServiceStub && !this._terminated) { - return this.keyManagementServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.iamClient.close().catch(err => {throw err}); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client_config.json.baseline deleted file mode 100644 index f71290a313b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_client_config.json.baseline +++ /dev/null @@ -1,118 +0,0 @@ -{ - "interfaces": { - "google.cloud.kms.v1.KeyManagementService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListKeyRings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeys": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListCryptoKeyVersions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListImportJobs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetKeyRing": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPublicKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetImportJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateKeyRing": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateImportJob": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKey": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Encrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Decrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsymmetricSign": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AsymmetricDecrypt": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCryptoKeyPrimaryVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DestroyCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreCryptoKeyVersion": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_proto_list.json.baseline deleted file mode 100644 index b7e20599adc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/src/v1/key_management_service_proto_list.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/kms/v1/resources.proto", - "../../protos/google/cloud/kms/v1/service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 87a29ad6830b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const kms = require('kms'); - -function main() { - const keyManagementServiceClient = new kms.KeyManagementServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index b3732005b505..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {KeyManagementServiceClient} from 'kms'; - -// check that the client class type name can be used -function doStuffWithKeyManagementServiceClient(client: KeyManagementServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const keyManagementServiceClient = new KeyManagementServiceClient(); - doStuffWithKeyManagementServiceClient(keyManagementServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/test/gapic_key_management_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/kms/test/gapic_key_management_service_v1.ts.baseline deleted file mode 100644 index b0382f4b2d22..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/test/gapic_key_management_service_v1.ts.baseline +++ /dev/null @@ -1,3577 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as keymanagementserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, IamProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.KeyManagementServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudkms.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = keymanagementserviceModule.v1.KeyManagementServiceClient.servicePath; - assert.strictEqual(servicePath, 'cloudkms.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = keymanagementserviceModule.v1.KeyManagementServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudkms.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudkms.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new keymanagementserviceModule.v1.KeyManagementServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = keymanagementserviceModule.v1.KeyManagementServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - await client.initialize(); - assert(client.keyManagementServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.keyManagementServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.keyManagementServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getKeyRing', () => { - it('invokes getKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.getKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.getKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetKeyRingRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getKeyRing(request), expectedError); - }); - }); - - describe('getCryptoKey', () => { - it('invokes getCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.getCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCryptoKey(request), expectedError); - }); - }); - - describe('getCryptoKeyVersion', () => { - it('invokes getCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCryptoKeyVersion(request), expectedError); - }); - }); - - describe('getPublicKey', () => { - it('invokes getPublicKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCall(expectedResponse); - const [response] = await client.getPublicKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.PublicKey() - ); - client.innerApiCalls.getPublicKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPublicKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IPublicKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPublicKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPublicKey(request), expectedError); - const actualRequest = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPublicKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPublicKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetPublicKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetPublicKeyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getPublicKey(request), expectedError); - }); - }); - - describe('getImportJob', () => { - it('invokes getImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.getImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.getImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.GetImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.GetImportJobRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getImportJob(request), expectedError); - }); - }); - - describe('createKeyRing', () => { - it('invokes createKeyRing without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCall(expectedResponse); - const [response] = await client.createKeyRing(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.KeyRing() - ); - client.innerApiCalls.createKeyRing = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createKeyRing( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createKeyRing = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createKeyRing(request), expectedError); - const actualRequest = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createKeyRing as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createKeyRing with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateKeyRingRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateKeyRingRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createKeyRing(request), expectedError); - }); - }); - - describe('createCryptoKey', () => { - it('invokes createCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.createCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createCryptoKey(request), expectedError); - }); - }); - - describe('createCryptoKeyVersion', () => { - it('invokes createCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.createCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createCryptoKeyVersion(request), expectedError); - }); - }); - - describe('importCryptoKeyVersion', () => { - it('invokes importCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.importCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ImportCryptoKeyVersionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.importCryptoKeyVersion(request), expectedError); - }); - }); - - describe('createImportJob', () => { - it('invokes createImportJob without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCall(expectedResponse); - const [response] = await client.createImportJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.ImportJob() - ); - client.innerApiCalls.createImportJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createImportJob( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createImportJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createImportJob(request), expectedError); - const actualRequest = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createImportJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createImportJob with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.CreateImportJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.CreateImportJobRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createImportJob(request), expectedError); - }); - }); - - describe('updateCryptoKey', () => { - it('invokes updateCryptoKey without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKey(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKey = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKey( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKey = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKey(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKey as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKey with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyRequest() - ); - request.cryptoKey ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyRequest', ['cryptoKey', 'name']); - request.cryptoKey.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKey(request), expectedError); - }); - }); - - describe('updateCryptoKeyVersion', () => { - it('invokes updateCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedHeaderRequestParams = `crypto_key_version.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest() - ); - request.cryptoKeyVersion ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest', ['cryptoKeyVersion', 'name']); - request.cryptoKeyVersion.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKeyVersion(request), expectedError); - }); - }); - - describe('encrypt', () => { - it('invokes encrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCall(expectedResponse); - const [response] = await client.encrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptResponse() - ); - client.innerApiCalls.encrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.encrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IEncryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.encrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.encrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.encrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes encrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.EncryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.EncryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.encrypt(request), expectedError); - }); - }); - - describe('decrypt', () => { - it('invokes decrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCall(expectedResponse); - const [response] = await client.decrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptResponse() - ); - client.innerApiCalls.decrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.decrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.decrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.decrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.decrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes decrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.decrypt(request), expectedError); - }); - }); - - describe('asymmetricSign', () => { - it('invokes asymmetricSign without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricSign(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignResponse() - ); - client.innerApiCalls.asymmetricSign = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricSign( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricSignResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricSign = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricSign(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricSign as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricSign with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricSignRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricSignRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.asymmetricSign(request), expectedError); - }); - }); - - describe('asymmetricDecrypt', () => { - it('invokes asymmetricDecrypt without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(expectedResponse); - const [response] = await client.asymmetricDecrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptResponse() - ); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.asymmetricDecrypt( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IAsymmetricDecryptResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.asymmetricDecrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.asymmetricDecrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes asymmetricDecrypt with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.AsymmetricDecryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.AsymmetricDecryptRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.asymmetricDecrypt(request), expectedError); - }); - }); - - describe('updateCryptoKeyPrimaryVersion', () => { - it('invokes updateCryptoKeyPrimaryVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(expectedResponse); - const [response] = await client.updateCryptoKeyPrimaryVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKey() - ); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCryptoKeyPrimaryVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCryptoKeyPrimaryVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCryptoKeyPrimaryVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCryptoKeyPrimaryVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCryptoKeyPrimaryVersion(request), expectedError); - }); - }); - - describe('destroyCryptoKeyVersion', () => { - it('invokes destroyCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.destroyCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.destroyCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.destroyCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.destroyCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes destroyCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.destroyCryptoKeyVersion(request), expectedError); - }); - }); - - describe('restoreCryptoKeyVersion', () => { - it('invokes restoreCryptoKeyVersion without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(expectedResponse); - const [response] = await client.restoreCryptoKeyVersion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.kms.v1.CryptoKeyVersion() - ); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreCryptoKeyVersion( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreCryptoKeyVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreCryptoKeyVersion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreCryptoKeyVersion with closed client', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restoreCryptoKeyVersion(request), expectedError); - }); - }); - - describe('listKeyRings', () => { - it('invokes listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCall(expectedResponse); - const [response] = await client.listKeyRings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.innerApiCalls.listKeyRings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listKeyRings( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IKeyRing[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listKeyRings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listKeyRings(request), expectedError); - const actualRequest = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listKeyRings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listKeyRingsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listKeyRingsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listKeyRingsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.KeyRing[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.KeyRing) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listKeyRings, request)); - assert( - (client.descriptors.page.listKeyRings.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - generateSampleMessage(new protos.google.cloud.kms.v1.KeyRing()), - ]; - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - const iterable = client.listKeyRingsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listKeyRings with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListKeyRingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListKeyRingsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listKeyRings.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listKeyRingsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IKeyRing[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listKeyRings.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeys', () => { - it('invokes listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeys(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.innerApiCalls.listCryptoKeys = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeys( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKey[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeys = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeys(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeys as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeysStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeysStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeysStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKey[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKey) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeys, request)); - assert( - (client.descriptors.page.listCryptoKeys.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKey()), - ]; - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - const iterable = client.listCryptoKeysAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeys with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeysRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeysRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeys.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeysAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKey[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeys.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listCryptoKeyVersions', () => { - it('invokes listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listCryptoKeyVersions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCryptoKeyVersions( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.ICryptoKeyVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCryptoKeyVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCryptoKeyVersions(request), expectedError); - const actualRequest = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCryptoKeyVersions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCryptoKeyVersionsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCryptoKeyVersionsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCryptoKeyVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.CryptoKeyVersion[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.CryptoKeyVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCryptoKeyVersions, request)); - assert( - (client.descriptors.page.listCryptoKeyVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - generateSampleMessage(new protos.google.cloud.kms.v1.CryptoKeyVersion()), - ]; - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - const iterable = client.listCryptoKeyVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCryptoKeyVersions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListCryptoKeyVersionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListCryptoKeyVersionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCryptoKeyVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCryptoKeyVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.ICryptoKeyVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCryptoKeyVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listImportJobs', () => { - it('invokes listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCall(expectedResponse); - const [response] = await client.listImportJobs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.innerApiCalls.listImportJobs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listImportJobs( - request, - (err?: Error|null, result?: protos.google.cloud.kms.v1.IImportJob[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listImportJobs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listImportJobs(request), expectedError); - const actualRequest = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listImportJobs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listImportJobsStream without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listImportJobsStream with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listImportJobsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.kms.v1.ImportJob[] = []; - stream.on('data', (response: protos.google.cloud.kms.v1.ImportJob) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listImportJobs, request)); - assert( - (client.descriptors.page.listImportJobs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - generateSampleMessage(new protos.google.cloud.kms.v1.ImportJob()), - ]; - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - const iterable = client.listImportJobsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listImportJobs with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.kms.v1.ListImportJobsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.kms.v1.ListImportJobsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listImportJobs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listImportJobsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.kms.v1.IImportJob[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listImportJobs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new keymanagementserviceModule.v1.KeyManagementServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/kms/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/kms/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/kms/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/kms/webpack.config.js.baseline deleted file mode 100644 index 5ecb7a0511d2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/kms/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'KeyManagementService', - filename: './key-management-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 7f3806ae0318..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/logging/google-logging-nodejs - dest: /owl-bot-staging/google-logging - -api-name: logging \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.jsdoc.cjs.baseline deleted file mode 100644 index e9e33dd6fef7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'logging', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/README.md.baseline deleted file mode 100644 index 00c4032835df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Logging: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/logging.svg)](https://www.npmjs.org/package/logging) - -Logging client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Logging Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/logging/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Logging API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install logging -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install logging@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=logging.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/index.ts.baseline deleted file mode 100644 index 5d29d89a98e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2/index.js'; -const ConfigServiceV2Client = v2.ConfigServiceV2Client; -type ConfigServiceV2Client = v2.ConfigServiceV2Client; -const LoggingServiceV2Client = v2.LoggingServiceV2Client; -type LoggingServiceV2Client = v2.LoggingServiceV2Client; -const MetricsServiceV2Client = v2.MetricsServiceV2Client; -type MetricsServiceV2Client = v2.MetricsServiceV2Client; -export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client.ts.baseline deleted file mode 100644 index b93456194098..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client.ts.baseline +++ /dev/null @@ -1,5010 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as config_service_v2_client_config from './config_service_v2_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/config_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'config_service_v2_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for configuring sinks used to route log entries. - * @class - * @memberof v2 - */ -export class ConfigServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - configServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConfigServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ConfigServiceV2Client({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConfigServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listBuckets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), - listViews: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), - listSinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), - listExclusions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const copyLogEntriesResponse = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; - const copyLogEntriesMetadata = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - copyLogEntries: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), - copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, - 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.configServiceV2Stub) { - return this.configServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.ConfigServiceV2. - this.configServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.ConfigServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const configServiceV2StubMethods = - ['listBuckets', 'getBucket', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; - for (const methodName of configServiceV2StubMethods) { - const callPromise = this.configServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.configServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async - */ - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBucket response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]) => { - this._log.info('getBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a log bucket that can be used to store log entries. After a bucket - * has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - * to 100 characters and can include only letters, digits, underscores, - * hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be compliant - * with any Location Restriction Org Policy. The name field in the bucket is - * ignored. - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async - */ - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBucket response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]) => { - this._log.info('createBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a log bucket. This method replaces the following fields in the - * existing bucket with values from the new bucket: `retention_period` - * - * If the retention period is decreased and the bucket is locked, - * `FAILED_PRECONDITION` will be returned. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an update. A - * bucket field will be overwritten if, and only if, it is in the update mask. - * `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async - */ - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBucket response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]) => { - this._log.info('updateBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a log bucket. - * - * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - * After 7 days, the bucket will be purged and all log entries in the bucket - * will be permanently deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async - */ - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBucket request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBucket response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Undeletes a log bucket. A bucket that has been deleted can be undeleted - * within the grace period of 7 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to undelete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async - */ - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('undeleteBucket request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('undeleteBucket response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.undeleteBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]) => { - this._log.info('undeleteBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a view on a log bucket.. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async - */ - getView( - request?: protos.google.logging.v2.IGetViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>; - getView( - request: protos.google.logging.v2.IGetViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request: protos.google.logging.v2.IGetViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request?: protos.google.logging.v2.IGetViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getView response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]) => { - this._log.info('getView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a view over log entries in a log bucket. A bucket may contain a - * maximum of 30 views. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket in which to create the view - * - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {string} request.viewId - * Required. The id to use for this view. - * @param {google.logging.v2.LogView} request.view - * Required. The new view. - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async - */ - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createView response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]) => { - this._log.info('createView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a view on a log bucket. This method replaces the following fields - * in the existing view with values from the new view: `filter`. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can update the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to update - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {google.logging.v2.LogView} request.view - * Required. The updated view. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async - */ - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateView response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]) => { - this._log.info('updateView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a view on a log bucket. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can delete the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to delete: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async - */ - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteView request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteView response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The resource name of the sink: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async - */ - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSink response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]) => { - this._log.info('getSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a sink that exports specified log entries to a destination. The - * export of newly-ingested log entries begins immediately, unless the sink's - * `writer_identity` is not permitted to write to the destination. A sink can - * export log entries only from the resource owning the sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the sink: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in {@link protos.google.logging.v2.LogSink|LogSink}. - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async - */ - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSink response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]) => { - this._log.info('createSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a sink. This method replaces the following fields in the existing - * sink with values from the new sink: `destination`, and `filter`. - * - * The updated sink might also have a new `writer_identity`; see the - * `unique_writer_identity` field. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to update, including the parent - * resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The updated sink, whose name is the same identifier that appears as part - * of `sink_name`. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * - * `destination,filter,includeChildren` - * - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async - */ - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSink response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]) => { - this._log.info('updateSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a sink. If the sink has a unique `writer_identity`, then that - * service account is also deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to delete, including the parent - * resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async - */ - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSink request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSink response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the description of an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async - */ - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getExclusion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]) => { - this._log.info('getExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new exclusion in the _Default sink in a specified parent - * resource. Only log entries belonging to that resource can be excluded. You - * can have up to 10 exclusions in a resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource in which to create the exclusion: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-logging-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async - */ - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createExclusion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]) => { - this._log.info('createExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Changes one or more properties of an existing exclusion in the _Default - * sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the exclusion to update: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. New values for the existing exclusion. Only the fields specified in - * `update_mask` are relevant. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A non-empty list of fields to change in the existing exclusion. New values - * for the fields are taken from the corresponding fields in the - * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. Fields not mentioned in - * `update_mask` are not changed and are ignored in the request. - * - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async - */ - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateExclusion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]) => { - this._log.info('updateExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion to delete: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async - */ - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteExclusion response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the Logging CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve CMEK settings. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * @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 {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async - */ - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCmekSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCmekSettings response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getCmekSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]) => { - this._log.info('getCmekSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the Log Router CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the CMEK settings to update. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.CmekSettings} request.cmekSettings - * Required. The CMEK settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @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 {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async - */ - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCmekSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCmekSettings response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCmekSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCmekSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve settings. - * - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * @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 {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async - */ - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSettings response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]) => { - this._log.info('getSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. 4) `location_id` is not supported by - * Logging. 5) `location_id` violate OrgPolicy. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the settings to update. - * - * "organizations/[ORGANIZATION_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.Settings} request.settings - * Required. The settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @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 {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async - */ - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSettings response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]) => { - this._log.info('updateSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Copies a set of log entries from a log bucket to a Cloud Storage bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Log bucket from which to copy log entries. - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - * @param {string} [request.filter] - * Optional. A filter specifying which log entries to copy. The filter must be no more - * than 20k characters. An empty filter matches all log entries. - * @param {string} request.destination - * Required. Destination to which to copy log 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('copyLogEntries response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('copyLogEntries request %j', request); - return this.innerApiCalls.copyLogEntries(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('copyLogEntries response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `copyLogEntries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - async checkCopyLogEntriesProgress(name: string): Promise>{ - this._log.info('copyLogEntries long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists log buckets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * 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. - */ - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>, - callback?: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBuckets values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listBuckets request %j', request); - return this.innerApiCalls - .listBuckets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]) => { - this._log.info('listBuckets values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBuckets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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.logging.v2.LogBucket|LogBucket} 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 `listBucketsAsync()` - * 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. - */ - listBucketsStream( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBuckets stream %j', request); - return this.descriptors.page.listBuckets.createStream( - this.innerApiCalls.listBuckets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuckets`, 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. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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.logging.v2.LogBucket|LogBucket}. 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 include:samples/generated/v2/config_service_v2.list_buckets.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async - */ - listBucketsAsync( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBuckets iterate %j', request); - return this.descriptors.page.listBuckets.asyncIterate( - this.innerApiCalls['listBuckets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists views on a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogView|LogView}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * 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. - */ - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>, - callback?: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listViews values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listViews request %j', request); - return this.innerApiCalls - .listViews(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]) => { - this._log.info('listViews values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listViews`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogView|LogView} 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 `listViewsAsync()` - * 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. - */ - listViewsStream( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listViews stream %j', request); - return this.descriptors.page.listViews.createStream( - this.innerApiCalls.listViews as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listViews`, 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. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogView|LogView}. 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 include:samples/generated/v2/config_service_v2.list_views.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async - */ - listViewsAsync( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listViews iterate %j', request); - return this.descriptors.page.listViews.asyncIterate( - this.innerApiCalls['listViews'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists sinks. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogSink|LogSink}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * 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. - */ - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSinks values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listSinks request %j', request); - return this.innerApiCalls - .listSinks(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]) => { - this._log.info('listSinks values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSinks`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogSink|LogSink} 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 `listSinksAsync()` - * 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. - */ - listSinksStream( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSinks stream %j', request); - return this.descriptors.page.listSinks.createStream( - this.innerApiCalls.listSinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSinks`, 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. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogSink|LogSink}. 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 include:samples/generated/v2/config_service_v2.list_sinks.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async - */ - listSinksAsync( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSinks iterate %j', request); - return this.descriptors.page.listSinks.asyncIterate( - this.innerApiCalls['listSinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the exclusions on the _Default sink in a parent resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * 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. - */ - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>, - callback?: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listExclusions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listExclusions request %j', request); - return this.innerApiCalls - .listExclusions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]) => { - this._log.info('listExclusions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listExclusions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogExclusion|LogExclusion} 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 `listExclusionsAsync()` - * 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. - */ - listExclusionsStream( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listExclusions stream %j', request); - return this.descriptors.page.listExclusions.createStream( - this.innerApiCalls.listExclusions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExclusions`, 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. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogExclusion|LogExclusion}. 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 include:samples/generated/v2/config_service_v2.list_exclusions.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async - */ - listExclusionsAsync( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listExclusions iterate %j', request); - return this.descriptors.page.listExclusions.asyncIterate( - this.innerApiCalls['listExclusions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.configServiceV2Stub && !this._terminated) { - return this.configServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client_config.json.baseline deleted file mode 100644 index 5ae5608c2c43..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_client_config.json.baseline +++ /dev/null @@ -1,145 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.ConfigServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListBuckets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListViews": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSinks": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateSink": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListExclusions": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CopyLogEntries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/config_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/index.ts.baseline deleted file mode 100644 index 4dd29130988d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/index.ts.baseline +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2026 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. ** - -export {ConfigServiceV2Client} from './config_service_v2_client.js'; -export {LoggingServiceV2Client} from './logging_service_v2_client.js'; -export {MetricsServiceV2Client} from './metrics_service_v2_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client.ts.baseline deleted file mode 100644 index 5da76945a799..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client.ts.baseline +++ /dev/null @@ -1,2648 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as logging_service_v2_client_config from './logging_service_v2_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/logging_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'logging_service_v2_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for ingesting and querying logs. - * @class - * @memberof v2 - */ -export class LoggingServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - loggingServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LoggingServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 LoggingServiceV2Client({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LoggingServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listLogEntries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listLogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // Some methods on this API support automatically batching - // requests; denote this. - - this.descriptors.batching = { - writeLogEntries: new this._gaxModule.BundleDescriptor( - 'entries', - ['log_name','resource','labels'], - null, - this._gaxModule.GrpcClient.createByteLengthFunction( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, - 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.loggingServiceV2Stub) { - return this.loggingServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.LoggingServiceV2. - this.loggingServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.LoggingServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const loggingServiceV2StubMethods = - ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; - for (const methodName of loggingServiceV2StubMethods) { - const callPromise = this.loggingServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.batching?.[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.loggingServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Deletes all the log entries in a log for the _Default Log Bucket. The log - * reappears if it receives new entries. Log entries written shortly before - * the delete operation might not be deleted. Entries received after the - * delete operation with a timestamp before the operation will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.logName - * Required. The resource name of the log to delete: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * - * For more information about log names, see - * {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.delete_log.js - * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async - */ - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'log_name': request.logName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteLog request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteLog response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteLog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteLog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Writes log entries to Logging. This API method is the - * only way to send log entries to Logging. This method - * is used, directly or indirectly, by the Logging agent - * (fluentd) and all logging libraries configured to use Logging. - * A single request may contain log entries for a maximum of 1000 - * different resources (projects, organizations, billing accounts or - * folders) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.logName] - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example: - * - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - * @param {google.api.MonitoredResource} [request.resource] - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} [request.labels] - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} request.entries - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * {@link protos.google.logging.v2.LogEntry|LogEntry} type. - * - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * - * Log entries with timestamps that are more than the - * [logs retention period](https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be [exported - * with - * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * - * To improve throughput and to avoid exceeding the - * [quota limit](https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - * @param {boolean} [request.partialSuccess] - * Optional. Whether valid entries should be written even if some other - * entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - * entry is not written, then the response status is the error associated - * with one of the failed entries and the response includes error details - * keyed by the entries' zero-based index in the `entries.write` method. - * @param {boolean} [request.dryRun] - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - * @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 {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async - */ - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('writeLogEntries request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('writeLogEntries response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.writeLogEntries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]) => { - this._log.info('writeLogEntries response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Streaming read of log entries as they are ingested. Until the stream is - * terminated, it will continue reading logs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and - * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async - */ - tailLogEntries( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('tailLogEntries stream %j', options); - return this.innerApiCalls.tailLogEntries(null, options); - } - - /** - * Lists log entries. Use this method to retrieve log entries that originated - * from a project/folder/organization/billing account. For ways to export log - * entries, see [Exporting - * Logs](https://cloud.google.com/logging/docs/export). - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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 Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * 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. - */ - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogEntries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listLogEntries request %j', request); - return this.innerApiCalls - .listLogEntries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]) => { - this._log.info('listLogEntries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogEntries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.logging.v2.LogEntry|LogEntry} 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 `listLogEntriesAsync()` - * 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. - */ - listLogEntriesStream( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogEntries stream %j', request); - return this.descriptors.page.listLogEntries.createStream( - this.innerApiCalls.listLogEntries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogEntries`, 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.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.logging.v2.LogEntry|LogEntry}. 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 include:samples/generated/v2/logging_service_v2.list_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async - */ - listLogEntriesAsync( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogEntries iterate %j', request); - return this.descriptors.page.listLogEntries.asyncIterate( - this.innerApiCalls['listLogEntries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the descriptors for monitored resource types used by Logging. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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 Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMonitoredResourceDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listMonitoredResourceDescriptors request %j', request); - return this.innerApiCalls - .listMonitoredResourceDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]) => { - this._log.info('listMonitoredResourceDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} 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 `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors stream %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, 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 {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. 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 include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors iterate %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the logs in projects, organizations, folders, or billing accounts. - * Only logs that have entries are listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_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 Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * 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. - */ - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listLogs request %j', request); - return this.innerApiCalls - .listLogs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]) => { - this._log.info('listLogs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @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 string 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 `listLogsAsync()` - * 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. - */ - listLogsStream( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogs stream %j', request); - return this.descriptors.page.listLogs.createStream( - this.innerApiCalls.listLogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogs`, 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. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @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 - * string. 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 include:samples/generated/v2/logging_service_v2.list_logs.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async - */ - listLogsAsync( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogs iterate %j', request); - return this.descriptors.page.listLogs.asyncIterate( - this.innerApiCalls['listLogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.loggingServiceV2Stub && !this._terminated) { - return this.loggingServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client_config.json.baseline deleted file mode 100644 index 342e96e9b3e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_client_config.json.baseline +++ /dev/null @@ -1,67 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.LoggingServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "DeleteLog": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "WriteLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default", - "bundling": { - "element_count_threshold": 1000, - "request_byte_threshold": 1048576, - "delay_threshold_millis": 50, - "element_count_limit": 1000000 - } - }, - "ListLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListMonitoredResourceDescriptors": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListLogs": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "TailLogEntries": { - "timeout_millis": 3600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/logging_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client.ts.baseline deleted file mode 100644 index b0fe3de47730..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client.ts.baseline +++ /dev/null @@ -1,2190 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as metrics_service_v2_client_config from './metrics_service_v2_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/metrics_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'metrics_service_v2_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for configuring logs-based metrics. - * @class - * @memberof v2 - */ -export class MetricsServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricsServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricsServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 MetricsServiceV2Client({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricsServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listLogMetrics: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, - 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.metricsServiceV2Stub) { - return this.metricsServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.MetricsServiceV2. - this.metricsServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.MetricsServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const metricsServiceV2StubMethods = - ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; - for (const methodName of metricsServiceV2StubMethods) { - const callPromise = this.metricsServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.metricsServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the desired metric: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async - */ - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLogMetric response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]) => { - this._log.info('getLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project in which to create the metric: - * - * "projects/[PROJECT_ID]" - * - * The new metric must be provided in the request. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - * @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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async - */ - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createLogMetric response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]) => { - this._log.info('createLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates or updates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to update: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The updated metric. - * @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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async - */ - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateLogMetric response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]) => { - this._log.info('updateLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to delete: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async - */ - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteLogMetric response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists logs-based metrics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * 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. - */ - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogMetrics values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listLogMetrics request %j', request); - return this.innerApiCalls - .listLogMetrics(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]) => { - this._log.info('listLogMetrics values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogMetrics`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogMetric|LogMetric} 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 `listLogMetricsAsync()` - * 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. - */ - listLogMetricsStream( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogMetrics stream %j', request); - return this.descriptors.page.listLogMetrics.createStream( - this.innerApiCalls.listLogMetrics as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogMetrics`, 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. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogMetric|LogMetric}. 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 include:samples/generated/v2/metrics_service_v2.list_log_metrics.js - * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async - */ - listLogMetricsAsync( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogMetrics iterate %j', request); - return this.descriptors.page.listLogMetrics.asyncIterate( - this.innerApiCalls['listLogMetrics'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.metricsServiceV2Stub && !this._terminated) { - return this.metricsServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client_config.json.baseline deleted file mode 100644 index 014688ab775a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_client_config.json.baseline +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.MetricsServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListLogMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/src/v2/metrics_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 679906fceb22..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const logging = require('logging'); - -function main() { - const configServiceV2Client = new logging.ConfigServiceV2Client(); - const loggingServiceV2Client = new logging.LoggingServiceV2Client(); - const metricsServiceV2Client = new logging.MetricsServiceV2Client(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 487c17f61940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as logging from 'logging'; - -function main() { - const configServiceV2Client = new logging.ConfigServiceV2Client(); - const loggingServiceV2Client = new logging.LoggingServiceV2Client(); - const metricsServiceV2Client = new logging.MetricsServiceV2Client(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 51f52bae60f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,45 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from 'logging'; - -// check that the client class type name can be used -function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { - client.close(); -} -function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { - client.close(); -} -function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const configServiceV2Client = new ConfigServiceV2Client(); - doStuffWithConfigServiceV2Client(configServiceV2Client); - // check that the client instance can be created - const loggingServiceV2Client = new LoggingServiceV2Client(); - doStuffWithLoggingServiceV2Client(loggingServiceV2Client); - // check that the client instance can be created - const metricsServiceV2Client = new MetricsServiceV2Client(); - doStuffWithMetricsServiceV2Client(metricsServiceV2Client); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_config_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_config_service_v2_v2.ts.baseline deleted file mode 100644 index b8ce1e24b5ea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_config_service_v2_v2.ts.baseline +++ /dev/null @@ -1,4853 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as configservicev2Module from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConfigServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new configservicev2Module.v2.ConfigServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = configservicev2Module.v2.ConfigServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - await client.initialize(); - assert(client.configServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.configServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getBucket', () => { - it('invokes getBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); - const [response] = await client.getBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBucket(request), expectedError); - }); - }); - - describe('createBucket', () => { - it('invokes createBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); - const [response] = await client.createBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBucket(request), expectedError); - }); - }); - - describe('updateBucket', () => { - it('invokes updateBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); - const [response] = await client.updateBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBucket(request), expectedError); - }); - }); - - describe('deleteBucket', () => { - it('invokes deleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBucket(request), expectedError); - }); - }); - - describe('undeleteBucket', () => { - it('invokes undeleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.undeleteBucket(request), expectedError); - }); - }); - - describe('getView', () => { - it('invokes getView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCall(expectedResponse); - const [response] = await client.getView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getView(request), expectedError); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getView(request), expectedError); - }); - }); - - describe('createView', () => { - it('invokes createView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCall(expectedResponse); - const [response] = await client.createView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createView(request), expectedError); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createView(request), expectedError); - }); - }); - - describe('updateView', () => { - it('invokes updateView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); - const [response] = await client.updateView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateView(request), expectedError); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateView(request), expectedError); - }); - }); - - describe('deleteView', () => { - it('invokes deleteView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); - const [response] = await client.deleteView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteView( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteView(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteView(request), expectedError); - }); - }); - - describe('getSink', () => { - it('invokes getSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); - const [response] = await client.getSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSink(request), expectedError); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSink(request), expectedError); - }); - }); - - describe('createSink', () => { - it('invokes createSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); - const [response] = await client.createSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSink(request), expectedError); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSink(request), expectedError); - }); - }); - - describe('updateSink', () => { - it('invokes updateSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); - const [response] = await client.updateSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSink(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSink(request), expectedError); - }); - }); - - describe('deleteSink', () => { - it('invokes deleteSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSink(request), expectedError); - }); - }); - - describe('getExclusion', () => { - it('invokes getExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.getExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExclusion(request), expectedError); - }); - }); - - describe('createExclusion', () => { - it('invokes createExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.createExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createExclusion(request), expectedError); - }); - }); - - describe('updateExclusion', () => { - it('invokes updateExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.updateExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateExclusion(request), expectedError); - }); - }); - - describe('deleteExclusion', () => { - it('invokes deleteExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExclusion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteExclusion(request), expectedError); - }); - }); - - describe('getCmekSettings', () => { - it('invokes getCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCmekSettings(request), expectedError); - }); - }); - - describe('updateCmekSettings', () => { - it('invokes updateCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCmekSettings(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSettings(request), expectedError); - }); - }); - - describe('copyLogEntries', () => { - it('invokes copyLogEntries without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); - const [operation] = await client.copyLogEntries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.copyLogEntries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.copyLogEntries(request), expectedError); - }); - - it('invokes copyLogEntries with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.copyLogEntries(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkCopyLogEntriesProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCopyLogEntriesProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuckets', () => { - it('invokes listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); - const [response] = await client.listBuckets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuckets( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuckets(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBucketsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBucketsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogBucket[] = []; - const iterable = client.listBucketsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBucketsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogBucket[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listViews', () => { - it('invokes listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); - const [response] = await client.listViews(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listViews( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listViews(request), expectedError); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViewsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listViewsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogView[] = []; - const iterable = client.listViewsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listViewsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogView[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSinks', () => { - it('invokes listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); - const [response] = await client.listSinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogSink[] = []; - const iterable = client.listSinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogSink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listExclusions', () => { - it('invokes listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); - const [response] = await client.listExclusions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExclusions( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExclusions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusionsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExclusionsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogExclusion[] = []; - const iterable = client.listExclusionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExclusionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogExclusion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_logging_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_logging_service_v2_v2.ts.baseline deleted file mode 100644 index 2efb4ccb6716..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_logging_service_v2_v2.ts.baseline +++ /dev/null @@ -1,2272 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as loggingservicev2Module from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.LoggingServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new loggingservicev2Module.v2.LoggingServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - await client.initialize(); - assert(client.loggingServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.loggingServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('deleteLog', () => { - it('invokes deleteLog without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLog( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLog(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteLog(request), expectedError); - }); - }); - - describe('writeLogEntries', () => { - it('invokes writeLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.writeLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - - it('invokes writeLogEntries with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - }); - - describe('tailLogEntries', () => { - it('invokes tailLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesResponse() - ); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes tailLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('listLogEntries', () => { - it('invokes listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.listLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogEntries(request), expectedError); - }); - - it('invokes listLogEntriesStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('invokes listLogEntriesStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('uses async iteration with listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogEntry[] = []; - const iterable = client.listLogEntriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogEntriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listLogs', () => { - it('invokes listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); - const [response] = await client.listLogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogs( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.listLogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_metrics_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_metrics_service_v2_v2.ts.baseline deleted file mode 100644 index c03485d10852..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/esm/test/gapic_metrics_service_v2_v2.ts.baseline +++ /dev/null @@ -1,2114 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricsservicev2Module from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.MetricsServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new metricsservicev2Module.v2.MetricsServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - await client.initialize(); - assert(client.metricsServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.metricsServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getLogMetric', () => { - it('invokes getLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.getLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLogMetric(request), expectedError); - }); - }); - - describe('createLogMetric', () => { - it('invokes createLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.createLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createLogMetric(request), expectedError); - }); - }); - - describe('updateLogMetric', () => { - it('invokes updateLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.updateLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateLogMetric(request), expectedError); - }); - }); - - describe('deleteLogMetric', () => { - it('invokes deleteLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLogMetric( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteLogMetric(request), expectedError); - }); - }); - - describe('listLogMetrics', () => { - it('invokes listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); - const [response] = await client.listLogMetrics(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogMetrics( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetricsStream without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogMetricsStream with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogMetric[] = []; - const iterable = client.listLogMetricsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogMetricsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogMetric[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json b/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json deleted file mode 100644 index 51e69ba5b936..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json +++ /dev/null @@ -1,107 +0,0 @@ -{ - "name": "logging", - "version": "0.1.0", - "description": "Logging client for Node.js", - "repository": "googleapis/nodejs-logging", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google logging", - "logging", - "config service v2", - "logging service v2", - "metrics service v2" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/http_request.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/http_request.proto.baseline deleted file mode 100644 index b878d60dce43..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/http_request.proto.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.type; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "HttpRequestProto"; -option java_package = "com.google.logging.type"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// A common proto for logging HTTP requests. Only contains semantics -// defined by the HTTP specification. Product-specific logging -// information MUST be defined in a separate message. -message HttpRequest { - // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - string request_method = 1; - - // The scheme (http, https), the host name, the path and the query - // portion of the URL that was requested. - // Example: `"http://example.com/some/info?color=red"`. - string request_url = 2; - - // The size of the HTTP request message in bytes, including the request - // headers and the request body. - int64 request_size = 3; - - // The response code indicating the status of response. - // Examples: 200, 404. - int32 status = 4; - - // The size of the HTTP response message sent back to the client, in bytes, - // including the response headers and the response body. - int64 response_size = 5; - - // The user agent sent by the client. Example: - // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - // CLR 1.0.3705)"`. - string user_agent = 6; - - // The IP address (IPv4 or IPv6) of the client that issued the HTTP - // request. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string remote_ip = 7; - - // The IP address (IPv4 or IPv6) of the origin server that the request was - // sent to. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string server_ip = 13; - - // The referer URL of the request, as defined in - // [HTTP/1.1 Header Field - // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - string referer = 8; - - // The request processing latency on the server, from the time the request was - // received until the response was sent. - google.protobuf.Duration latency = 14; - - // Whether or not a cache lookup was attempted. - bool cache_lookup = 11; - - // Whether or not an entity was served from cache - // (with or without validation). - bool cache_hit = 9; - - // Whether or not the response was validated with the origin server before - // being served from cache. This field is only meaningful if `cache_hit` is - // True. - bool cache_validated_with_origin_server = 10; - - // The number of HTTP response bytes inserted into cache. Set only when a - // cache fill was attempted. - int64 cache_fill_bytes = 12; - - // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - string protocol = 15; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/log_severity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/log_severity.proto.baseline deleted file mode 100644 index bed71935f948..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/type/log_severity.proto.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.type; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "LogSeverityProto"; -option java_package = "com.google.logging.type"; -option objc_class_prefix = "GLOG"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// The severity of the event described in a log entry, expressed as one of the -// standard severity levels listed below. For your reference, the levels are -// assigned the listed numeric values. The effect of using numeric values other -// than those listed is undefined. -// -// You can filter for log entries by severity. For example, the following -// filter expression will match log entries with severities `INFO`, `NOTICE`, -// and `WARNING`: -// -// severity > DEBUG AND severity <= WARNING -// -// If you are writing log entries, you should map other severity encodings to -// one of these standard levels. For example, you might map all of Java's FINE, -// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the -// original severity level in the log entry payload if you wish. -enum LogSeverity { - // (0) The log entry has no assigned severity level. - DEFAULT = 0; - - // (100) Debug or trace information. - DEBUG = 100; - - // (200) Routine information, such as ongoing status or performance. - INFO = 200; - - // (300) Normal but significant events, such as start up, shut down, or - // a configuration change. - NOTICE = 300; - - // (400) Warning events might cause problems. - WARNING = 400; - - // (500) Error events are likely to cause problems. - ERROR = 500; - - // (600) Critical events cause more severe problems or outages. - CRITICAL = 600; - - // (700) A person must take an action immediately. - ALERT = 700; - - // (800) One or more systems are unusable. - EMERGENCY = 800; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/log_entry.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/log_entry.proto.baseline deleted file mode 100644 index 99712936989e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/log_entry.proto.baseline +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/type/http_request.proto"; -import "google/logging/type/log_severity.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// An individual entry in a log. -message LogEntry { - option (google.api.resource) = { - type: "logging.googleapis.com/Log" - pattern: "projects/{project}/logs/{log}" - pattern: "organizations/{organization}/logs/{log}" - pattern: "folders/{folder}/logs/{log}" - pattern: "billingAccounts/{billing_account}/logs/{log}" - name_field: "log_name" - }; - - // Required. The resource name of the log to which this log entry belongs: - // - // "projects/[PROJECT_ID]/logs/[LOG_ID]" - // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - // "folders/[FOLDER_ID]/logs/[LOG_ID]" - // - // A project number may be used in place of PROJECT_ID. The project number is - // translated to its corresponding PROJECT_ID internally and the `log_name` - // field will contain PROJECT_ID in queries and exports. - // - // `[LOG_ID]` must be URL-encoded within `log_name`. Example: - // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - // - // `[LOG_ID]` must be less than 512 characters long and can only include the - // following characters: upper and lower case alphanumeric characters, - // forward-slash, underscore, hyphen, and period. - // - // For backward compatibility, if `log_name` begins with a forward-slash, such - // as `/projects/...`, then the log entry is ingested as usual, but the - // forward-slash is removed. Listing the log entry will not show the leading - // slash and filtering for a log name with a leading slash will never return - // any results. - string log_name = 12 [(google.api.field_behavior) = REQUIRED]; - - // Required. The monitored resource that produced this log entry. - // - // Example: a log entry that reports a database error would be associated with - // the monitored resource designating the particular database that reported - // the error. - google.api.MonitoredResource resource = 8 [(google.api.field_behavior) = REQUIRED]; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer. Some Google - // Cloud Platform services use this field for their log entry payloads. - // - // The following protocol buffer types are supported; user-defined types - // are not supported: - // - // "type.googleapis.com/google.cloud.audit.AuditLog" - // "type.googleapis.com/google.appengine.logging.v1.RequestLog" - google.protobuf.Any proto_payload = 2; - - // The log entry payload, represented as a Unicode string (UTF-8). - string text_payload = 3; - - // The log entry payload, represented as a structure that is - // expressed as a JSON object. - google.protobuf.Struct json_payload = 6; - } - - // Optional. The time the event described by the log entry occurred. This time is used - // to compute the log entry's age and to enforce the logs retention period. - // If this field is omitted in a new log entry, then Logging assigns it the - // current time. Timestamps have nanosecond accuracy, but trailing zeros in - // the fractional seconds might be omitted when the timestamp is displayed. - // - // Incoming log entries must have timestamps that don't exceed the - // [logs retention - // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in - // the past, and that don't exceed 24 hours in the future. Log entries outside - // those time boundaries aren't ingested by Logging. - google.protobuf.Timestamp timestamp = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time the log entry was received by Logging. - google.protobuf.Timestamp receive_timestamp = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique identifier for the log entry. If you provide a value, then - // Logging considers other log entries in the same project, with the same - // `timestamp`, and with the same `insert_id` to be duplicates which are - // removed in a single query result. However, there are no guarantees of - // de-duplication in the export of logs. - // - // If the `insert_id` is omitted when writing a log entry, the Logging API - // assigns its own unique identifier in this field. - // - // In queries, the `insert_id` is also used to order log entries that have - // the same `log_name` and `timestamp` values. - string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about the HTTP request associated with this log entry, if - // applicable. - google.logging.type.HttpRequest http_request = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map of key, value pairs that provides additional information about the - // log entry. The labels can be user-defined or system-defined. - // - // User-defined labels are arbitrary key, value pairs that you can use to - // classify logs. - // - // System-defined labels are defined by GCP services for platform logs. - // They have two components - a service namespace component and the - // attribute name. For example: `compute.googleapis.com/resource_name`. - // - // Cloud Logging truncates label keys that exceed 512 B and label - // values that exceed 64 KB upon their associated log entry being - // written. The truncation is indicated by an ellipsis at the - // end of the character string. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about an operation associated with the log entry, if - // applicable. - LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Resource name of the trace associated with the log entry, if any. If it - // contains a relative resource name, the name is assumed to be relative to - // `//tracing.googleapis.com`. Example: - // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` - string trace = 22 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The span ID within the trace associated with the log entry. - // - // For Trace spans, this is the same format that the Trace API v2 uses: a - // 16-character hexadecimal encoding of an 8-byte array, such as - // `000000000000004a`. - string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sampling decision of the trace associated with the log entry. - // - // True means that the trace resource name in the `trace` field was sampled - // for storage in a trace backend. False means that the trace was not sampled - // for storage when this log entry was written, or the sampling decision was - // unknown at the time. A non-sampled `trace` value is still useful as a - // request correlation identifier. The default is False. - bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Source code location information associated with the log entry, if any. - LogEntrySourceLocation source_location = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information indicating this LogEntry is part of a sequence of multiple log - // entries split from a single LogEntry. - LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information about a potentially long-running operation with which -// a log entry is associated. -message LogEntryOperation { - // Optional. An arbitrary operation identifier. Log entries with the same - // identifier are assumed to be part of the same operation. - string id = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An arbitrary producer identifier. The combination of `id` and - // `producer` must be globally unique. Examples for `producer`: - // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. - string producer = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the first log entry in the operation. - bool first = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the last log entry in the operation. - bool last = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information about the source code location that produced the log -// entry. -message LogEntrySourceLocation { - // Optional. Source file name. Depending on the runtime environment, this - // might be a simple name or a fully-qualified name. - string file = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Line within the source file. 1-based; 0 indicates no line number - // available. - int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Human-readable name of the function or method being invoked, with - // optional context such as the class or package name. This information may be - // used in contexts such as the logs viewer, where a file and line number are - // less meaningful. The format can vary by language. For example: - // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` - // (Python). - string function = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information used to correlate multiple log entries. Used when a -// single LogEntry would exceed the Google Cloud Logging size limit and is -// split across multiple log entries. -message LogSplit { - // A globally unique identifier for all log entries in a sequence of split log - // entries. All log entries with the same |LogSplit.uid| are assumed to be - // part of the same sequence of split log entries. - string uid = 1; - - // The index of this LogEntry in the sequence of split log entries. Log - // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log - // entries. - int32 index = 2; - - // The total number of log entries that the original LogEntry was split into. - int32 total_splits = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging.proto.baseline deleted file mode 100644 index b7f4f189d2ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging.proto.baseline +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/v2/log_entry.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// Service for ingesting and querying logs. -service LoggingServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read," - "https://www.googleapis.com/auth/logging.write"; - - // Deletes all the log entries in a log for the _Default Log Bucket. The log - // reappears if it receives new entries. Log entries written shortly before - // the delete operation might not be deleted. Entries received after the - // delete operation with a timestamp before the operation will be deleted. - rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{log_name=projects/*/logs/*}" - additional_bindings { - delete: "/v2/{log_name=*/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=organizations/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=folders/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=billingAccounts/*/logs/*}" - } - }; - option (google.api.method_signature) = "log_name"; - } - - // Writes log entries to Logging. This API method is the - // only way to send log entries to Logging. This method - // is used, directly or indirectly, by the Logging agent - // (fluentd) and all logging libraries configured to use Logging. - // A single request may contain log entries for a maximum of 1000 - // different resources (projects, organizations, billing accounts or - // folders) - rpc WriteLogEntries(WriteLogEntriesRequest) returns (WriteLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:write" - body: "*" - }; - option (google.api.method_signature) = "log_name,resource,labels,entries"; - } - - // Lists log entries. Use this method to retrieve log entries that originated - // from a project/folder/organization/billing account. For ways to export log - // entries, see [Exporting - // Logs](https://cloud.google.com/logging/docs/export). - rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:list" - body: "*" - }; - option (google.api.method_signature) = "resource_names,filter,order_by"; - } - - // Lists the descriptors for monitored resource types used by Logging. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v2/monitoredResourceDescriptors" - }; - } - - // Lists the logs in projects, organizations, folders, or billing accounts. - // Only logs that have entries are listed. - rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/logs" - additional_bindings { - get: "/v2/{parent=projects/*}/logs" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/logs" - } - additional_bindings { - get: "/v2/{parent=folders/*}/logs" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/logs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Streaming read of log entries as they are ingested. Until the stream is - // terminated, it will continue reading logs. - rpc TailLogEntries(stream TailLogEntriesRequest) returns (stream TailLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:tail" - body: "*" - }; - } -} - -// The parameters to DeleteLog. -message DeleteLogRequest { - // Required. The resource name of the log to delete: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example, - // `"projects/my-project-id/logs/syslog"`, - // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - // - // For more information about log names, see - // [LogEntry][google.logging.v2.LogEntry]. - string log_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/Log" - } - ]; -} - -// The parameters to WriteLogEntries. -message WriteLogEntriesRequest { - // Optional. A default log resource name that is assigned to all log entries - // in `entries` that do not specify a value for `log_name`: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example: - // - // "projects/my-project-id/logs/syslog" - // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - // - // The permission `logging.logEntries.create` is needed on each project, - // organization, billing account, or folder that is receiving new log - // entries, whether the resource is specified in `logName` or in an - // individual log entry. - string log_name = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "logging.googleapis.com/Log" - } - ]; - - // Optional. A default monitored resource object that is assigned to all log - // entries in `entries` that do not specify a value for `resource`. Example: - // - // { "type": "gce_instance", - // "labels": { - // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - // - // See [LogEntry][google.logging.v2.LogEntry]. - google.api.MonitoredResource resource = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Default labels that are added to the `labels` field of all log - // entries in `entries`. If a log entry already has a label with the same key - // as a label in this parameter, then the log entry's label is not changed. - // See [LogEntry][google.logging.v2.LogEntry]. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The log entries to send to Logging. The order of log - // entries in this list does not matter. Values supplied in this method's - // `log_name`, `resource`, and `labels` fields are copied into those log - // entries in this list that do not include values for their corresponding - // fields. For more information, see the - // [LogEntry][google.logging.v2.LogEntry] type. - // - // If the `timestamp` or `insert_id` fields are missing in log entries, then - // this method supplies the current time or a unique identifier, respectively. - // The supplied values are chosen so that, among the log entries that did not - // supply their own values, the entries earlier in the list will sort before - // the entries later in the list. See the `entries.list` method. - // - // Log entries with timestamps that are more than the - // [logs retention period](https://cloud.google.com/logging/quotas) in - // the past or more than 24 hours in the future will not be available when - // calling `entries.list`. However, those log entries can still be [exported - // with - // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - // - // To improve throughput and to avoid exceeding the - // [quota limit](https://cloud.google.com/logging/quotas) for calls to - // `entries.write`, you should try to include several log entries in this - // list, rather than calling this method for each individual log entry. - repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether valid entries should be written even if some other - // entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - // entry is not written, then the response status is the error associated - // with one of the failed entries and the response includes error details - // keyed by the entries' zero-based index in the `entries.write` method. - bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the request should expect normal response, but the - // entries won't be persisted nor exported. Useful for checking whether the - // logging API endpoints are working properly before sending valuable data. - bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from WriteLogEntries. -message WriteLogEntriesResponse { - -} - -// Error details for WriteLogEntries with partial success. -message WriteLogEntriesPartialErrors { - // When `WriteLogEntriesRequest.partial_success` is true, records the error - // status for entries that were not written due to a permanent error, keyed - // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. - // - // Failed requests for which no entries are written will not include - // per-entry errors. - map log_entry_errors = 1; -} - -// The parameters to `ListLogEntries`. -message ListLogEntriesRequest { - // Required. Names of one or more parent resources from which to - // retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // Projects listed in the `project_ids` field are added to this list. - repeated string resource_names = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. A filter that chooses which log entries to return. See [Advanced - // Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - // Only log entries that match the filter are returned. An empty filter - // matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of the filter is - // 20000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. How the results should be sorted. Presently, the only permitted - // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - // option returns entries in order of increasing values of - // `LogEntry.timestamp` (oldest first), and the second option returns entries - // in order of decreasing timestamps (newest first). Entries with equal - // timestamps are returned in order of their `insert_id` values. - string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. Default is 50. - // If the value is negative or exceeds 1000, the request is rejected. The - // presence of `next_page_token` in the response indicates that more results - // might be available. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `page_token` must be the value of - // `next_page_token` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListLogEntries`. -message ListLogEntriesResponse { - // A list of log entries. If `entries` is empty, `nextPageToken` may still be - // returned, indicating that more entries may exist. See `nextPageToken` for - // more information. - repeated LogEntry entries = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - // - // If a value for `next_page_token` appears and the `entries` field is empty, - // it means that the search found no log entries so far but it did not have - // time to search all the possible log entries. Retry the method with this - // value for `page_token` to continue the search. Alternatively, consider - // speeding up the search by changing your filter to specify a single log name - // or resource type, or to narrow the time range of the search. - string next_page_token = 2; -} - -// The parameters to ListMonitoredResourceDescriptors -message ListMonitoredResourceDescriptorsRequest { - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListMonitoredResourceDescriptors. -message ListMonitoredResourceDescriptorsResponse { - // A list of resource descriptors. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to ListLogs. -message ListLogsRequest { - // Required. The resource name that owns the logs: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource name that owns the logs: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // To support legacy queries, it could also be: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - repeated string resource_names = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; -} - -// Result returned from ListLogs. -message ListLogsResponse { - // A list of log names. For example, - // `"projects/my-project/logs/syslog"` or - // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - repeated string log_names = 3; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `TailLogEntries`. -message TailLogEntriesRequest { - // Required. Name of a parent resource from which to retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A filter that chooses which log entries to return. See [Advanced - // Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - // Only log entries that match the filter are returned. An empty filter - // matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not in `resource_names` will cause - // the filter to return no results. The maximum length of the filter is 20000 - // characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The amount of time to buffer log entries at the server before - // being returned to prevent out of order results due to late arriving log - // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - // milliseconds. - google.protobuf.Duration buffer_window = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `TailLogEntries`. -message TailLogEntriesResponse { - // Information about entries that were omitted from the session. - message SuppressionInfo { - // An indicator of why entries were omitted. - enum Reason { - // Unexpected default. - REASON_UNSPECIFIED = 0; - - // Indicates suppression occurred due to relevant entries being - // received in excess of rate limits. For quotas and limits, see - // [Logging API quotas and - // limits](https://cloud.google.com/logging/quotas#api-limits). - RATE_LIMIT = 1; - - // Indicates suppression occurred due to the client not consuming - // responses quickly enough. - NOT_CONSUMED = 2; - } - - // The reason that entries were omitted from the session. - Reason reason = 1; - - // A lower bound on the count of entries omitted due to `reason`. - int32 suppressed_count = 2; - } - - // A list of log entries. Each response in the stream will order entries with - // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed - // between separate responses. - repeated LogEntry entries = 1; - - // If entries that otherwise would have been included in the session were not - // sent back to the client, counts of relevant entries omitted from the - // session with the reason that they were not included. There will be at most - // one of each reason per response. The counts represent the number of - // suppressed entries since the last streamed response. - repeated SuppressionInfo suppression_info = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging_config.proto.baseline deleted file mode 100644 index ef0024063d7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/protos/google/logging/v2/logging_config.proto.baseline +++ /dev/null @@ -1,1957 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LoggingConfigProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/OrganizationLocation" - pattern: "organizations/{organization}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/FolderLocation" - pattern: "folders/{folder}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/BillingAccountLocation" - pattern: "billingAccounts/{billing_account}/locations/{location}" -}; - -// Service for configuring sinks used to route log entries. -service ConfigServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read"; - - // Lists log buckets. - rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*}/buckets" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a log bucket. - rpc GetBucket(GetBucketRequest) returns (LogBucket) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/buckets/*}" - } - }; - } - - // Creates a log bucket that can be used to store log entries. After a bucket - // has been created, the bucket's location cannot be changed. - rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - body: "bucket" - } - }; - } - - // Updates a log bucket. This method replaces the following fields in the - // existing bucket with values from the new bucket: `retention_period` - // - // If the retention period is decreased and the bucket is locked, - // `FAILED_PRECONDITION` will be returned. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*}" - body: "bucket" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - body: "bucket" - } - }; - } - - // Deletes a log bucket. - // - // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - // After 7 days, the bucket will be purged and all log entries in the bucket - // will be permanently deleted. - rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Undeletes a log bucket. A bucket that has been deleted can be undeleted - // within the grace period of 7 days. - rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" - body: "*" - } - }; - } - - // Lists views on a log bucket. - rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/views" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a view on a log bucket.. - rpc GetView(GetViewRequest) returns (LogView) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/buckets/*/views/*}" - } - }; - } - - // Creates a view over log entries in a log bucket. A bucket may contain a - // maximum of 30 views. - rpc CreateView(CreateViewRequest) returns (LogView) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/views" - body: "view" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - body: "view" - } - }; - } - - // Updates a view on a log bucket. This method replaces the following fields - // in the existing view with values from the new view: `filter`. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can update the view. If this occurs, please try again in a - // few minutes. - rpc UpdateView(UpdateViewRequest) returns (LogView) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - body: "view" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - body: "view" - } - }; - } - - // Deletes a view on a log bucket. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can delete the view. If this occurs, please try again in a - // few minutes. - rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Lists sinks. - rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/sinks" - additional_bindings { - get: "/v2/{parent=projects/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=folders/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/sinks" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a sink. - rpc GetSink(GetSinkRequest) returns (LogSink) { - option (google.api.http) = { - get: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { - get: "/v2/{sink_name=projects/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=organizations/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=folders/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Creates a sink that exports specified log entries to a destination. The - // export of newly-ingested log entries begins immediately, unless the sink's - // `writer_identity` is not permitted to write to the destination. A sink can - // export log entries only from the resource owning the sink. - rpc CreateSink(CreateSinkRequest) returns (LogSink) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/sinks" - body: "sink" - additional_bindings { - post: "/v2/{parent=projects/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=folders/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/sinks" - body: "sink" - } - }; - option (google.api.method_signature) = "parent,sink"; - } - - // Updates a sink. This method replaces the following fields in the existing - // sink with values from the new sink: `destination`, and `filter`. - // - // The updated sink might also have a new `writer_identity`; see the - // `unique_writer_identity` field. - rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { - option (google.api.http) = { - put: "/v2/{sink_name=*/*/sinks/*}" - body: "sink" - additional_bindings { - put: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - }; - option (google.api.method_signature) = "sink_name,sink,update_mask"; - option (google.api.method_signature) = "sink_name,sink"; - } - - // Deletes a sink. If the sink has a unique `writer_identity`, then that - // service account is also deleted. - rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { - delete: "/v2/{sink_name=projects/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=organizations/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=folders/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Lists all the exclusions on the _Default sink in a parent resource. - rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/exclusions" - additional_bindings { - get: "/v2/{parent=projects/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=folders/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/exclusions" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the description of an exclusion in the _Default sink. - rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - get: "/v2/{name=*/*/exclusions/*}" - additional_bindings { - get: "/v2/{name=projects/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new exclusion in the _Default sink in a specified parent - // resource. Only log entries belonging to that resource can be excluded. You - // can have up to 10 exclusions in a resource. - rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/exclusions" - body: "exclusion" - additional_bindings { - post: "/v2/{parent=projects/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=folders/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/exclusions" - body: "exclusion" - } - }; - option (google.api.method_signature) = "parent,exclusion"; - } - - // Changes one or more properties of an existing exclusion in the _Default - // sink. - rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - patch: "/v2/{name=*/*/exclusions/*}" - body: "exclusion" - additional_bindings { - patch: "/v2/{name=projects/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=organizations/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=folders/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/exclusions/*}" - body: "exclusion" - } - }; - option (google.api.method_signature) = "name,exclusion,update_mask"; - } - - // Deletes an exclusion in the _Default sink. - rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/exclusions/*}" - additional_bindings { - delete: "/v2/{name=projects/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the Logging CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can be configured for Google Cloud projects, - // folders, organizations and billing accounts. Once configured for an - // organization, it applies to all projects and folders in the Google Cloud - // organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/cmekSettings" - additional_bindings { - get: "/v2/{name=projects/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=organizations/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=folders/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*}/cmekSettings" - } - }; - } - - // Updates the Log Router CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can currently only be configured for Google - // Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/cmekSettings" - body: "cmek_settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/cmekSettings" - body: "cmek_settings" - } - }; - } - - // Gets the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can be get for Google Cloud projects, - // folders, organizations and billing accounts. Currently it can only be - // configured for organizations. Once configured for an organization, it - // applies to all projects and folders in the Google Cloud organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/settings" - additional_bindings { - get: "/v2/{name=projects/*}/settings" - } - additional_bindings { - get: "/v2/{name=organizations/*}/settings" - } - additional_bindings { - get: "/v2/{name=folders/*}/settings" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*}/settings" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can currently only be configured for - // Google Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. 4) `location_id` is not supported by - // Logging. 5) `location_id` violate OrgPolicy. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/settings" - body: "settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/settings" - body: "settings" - } - additional_bindings { - patch: "/v2/{name=folders/*}/settings" - body: "settings" - } - }; - option (google.api.method_signature) = "settings,update_mask"; - } - - // Copies a set of log entries from a log bucket to a Cloud Storage bucket. - rpc CopyLogEntries(CopyLogEntriesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/entries:copy" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "CopyLogEntriesResponse" - metadata_type: "CopyLogEntriesMetadata" - }; - } -} - -// Describes a repository in which log entries are stored. -message LogBucket { - option (google.api.resource) = { - type: "logging.googleapis.com/LogBucket" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" - }; - - // Output only. The resource name of the bucket. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // For a list of supported locations, see [Supported - // Regions](https://cloud.google.com/logging/docs/region-support) - // - // For the location of `global` it is unspecified where log entries are - // actually stored. - // - // After a bucket has been created, the location cannot be changed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describes this bucket. - string description = 3; - - // Output only. The creation timestamp of the bucket. This is not set for any of the - // default buckets. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the bucket. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Logs will be retained by default for this amount of time, after which they - // will automatically be deleted. The minimum retention period is 1 day. If - // this value is set to zero at bucket creation time, the default time of 30 - // days will be used. - int32 retention_days = 11; - - // Whether the bucket is locked. - // - // The retention period on a locked bucket cannot be changed. Locked buckets - // may only be deleted if they are empty. - bool locked = 9; - - // Output only. The bucket lifecycle state. - LifecycleState lifecycle_state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Log entry field paths that are denied access in this bucket. - // - // The following fields and their children are eligible: `textPayload`, - // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. - // - // Restricting a repeated field will restrict all values. Adding a parent will - // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) - repeated string restricted_fields = 15; - - // The CMEK settings of the log bucket. If present, new log entries written to - // this log bucket are encrypted using the CMEK key provided in this - // configuration. If a log bucket has CMEK settings, the CMEK settings cannot - // be disabled later by updating the log bucket. Changing the KMS key is - // allowed. - CmekSettings cmek_settings = 19; -} - -// Describes a view over log entries in a bucket. -message LogView { - option (google.api.resource) = { - type: "logging.googleapis.com/LogView" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" - }; - - // The resource name of the view. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` - string name = 1; - - // Describes this view. - string description = 3; - - // Output only. The creation timestamp of the view. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the view. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Filter that restricts which log entries in a bucket are visible in this - // view. - // - // Filters are restricted to be a logical AND of ==/!= of any of the - // following: - // - // - originating project/folder/organization/billing account. - // - resource type - // - log id - // - // For example: - // - // SOURCE("projects/myproject") AND resource.type = "gce_instance" - // AND LOG_ID("stdout") - string filter = 7; -} - -// Describes a sink used to export log entries to one of the following -// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a -// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log -// entries are exported. The sink must be created within a project, -// organization, billing account, or folder. -message LogSink { - option (google.api.resource) = { - type: "logging.googleapis.com/LogSink" - pattern: "projects/{project}/sinks/{sink}" - pattern: "organizations/{organization}/sinks/{sink}" - pattern: "folders/{folder}/sinks/{sink}" - pattern: "billingAccounts/{billing_account}/sinks/{sink}" - }; - - // Deprecated. This is unused. - enum VersionFormat { - // An unspecified format version that will default to V2. - VERSION_FORMAT_UNSPECIFIED = 0; - - // `LogEntry` version 2 format. - V2 = 1; - - // `LogEntry` version 1 format. - V1 = 2; - } - - // Required. The client-assigned sink identifier, unique within the project. - // - // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited - // to 100 characters and can include only the following characters: upper and - // lower-case alphanumeric characters, underscores, hyphens, and periods. - // First character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The export destination: - // - // "storage.googleapis.com/[GCS_BUCKET]" - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" - // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - // - // The sink's `writer_identity`, set when the sink is created, must have - // permission to write to the destination or else the log entries are not - // exported. For more information, see - // [Exporting Logs with - // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - string destination = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "*" - } - ]; - - // Optional. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The - // only exported log entries are those that are in the resource owning the - // sink and that match the filter. - // - // For example: - // - // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A description of this sink. - // - // The maximum length of the description is 8000 characters. - string description = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, then this sink is disabled and it does not export any log - // entries. - bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Log entries that match any of these exclusion filters will not be exported. - // - // If a log entry is matched by both `filter` and one of `exclusion_filters` - // it will not be exported. - repeated LogExclusion exclusions = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Deprecated. This field is unused. - VersionFormat output_version_format = 6 [deprecated = true]; - - // Output only. An IAM identity—a service account or group—under which Cloud - // Logging writes the exported log entries to the sink's destination. This - // field is set by - // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and - // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the - // value of `unique_writer_identity` in those methods. - // - // Until you grant this identity write-access to the destination, log entry - // exports from this sink will fail. For more information, see [Granting - // Access for a - // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). - // Consult the destination service's documentation to determine the - // appropriate IAM roles to assign to the identity. - // - // Sinks that have a destination that is a log bucket in the same project as - // the sink do not have a writer_identity and no additional permissions are - // required. - string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This field applies only to sinks owned by organizations and folders. If the - // field is false, the default, only the logs owned by the sink's parent - // resource are available for export. If the field is true, then log entries - // from all the projects, folders, and billing accounts contained in the - // sink's parent resource are also available for export. Whether a particular - // log entry from the children is exported depends on the sink's filter - // expression. - // - // For example, if this field is true, then the filter - // `resource.type=gce_instance` would export all Compute Engine VM instance - // log entries from all projects in the sink's parent. - // - // To only export entries from certain child projects, filter on the project - // part of the log name: - // - // logName:("projects/test-project1/" OR "projects/test-project2/") AND - // resource.type=gce_instance - bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Destination dependent options. - oneof options { - // Optional. Options that affect sinks exporting data to BigQuery. - BigQueryOptions bigquery_options = 12 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The creation timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Options that change functionality of a sink exporting data to BigQuery. -message BigQueryOptions { - // Optional. Whether to use [BigQuery's partition - // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By - // default, Cloud Logging creates dated tables based on the log entries' - // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix - // is no longer present and [special query - // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) - // has to be used instead. In both cases, tables are sharded based on UTC - // timezone. - bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. True if new timestamp column based partitioning is in use, false if legacy - // ingestion-time partitioning is in use. - // - // All new sinks will have this field set true and will use timestamp column - // based partitioning. If use_partitioned_tables is false, this value has no - // meaning and will be false. Legacy sinks using partitioned tables will have - // this field set to false. - bool uses_timestamp_column_partitioning = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The parameters to `ListBuckets`. -message ListBucketsRequest { - // Required. The parent resource whose buckets are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - // - // Note: The locations portion of the resource must be specified, but - // supplying the character `-` in place of [LOCATION_ID] will return all - // buckets. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the preceding call - // to this method. `pageToken` must be the value of `nextPageToken` from the - // previous response. The values of other method parameters should be - // identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. Non-positive - // values are ignored. The presence of `nextPageToken` in the response - // indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListBuckets. -message ListBucketsResponse { - // A list of buckets. - repeated LogBucket buckets = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateBucket`. -message CreateBucketRequest { - // Required. The resource in which to create the log bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // - // For example: - // - // `"projects/my-project/locations/global"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - // to 100 characters and can include only letters, digits, underscores, - // hyphens, and periods. - string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new bucket. The region specified in the new bucket must be compliant - // with any Location Restriction Org Policy. The name field in the bucket is - // ignored. - LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateBucket`. -message UpdateBucketRequest { - // Required. The full resource name of the bucket to update. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. The updated bucket. - LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask that specifies the fields in `bucket` that need an update. A - // bucket field will be overwritten if, and only if, it is in the update mask. - // `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see: - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=retention_days` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `GetBucket`. -message GetBucketRequest { - // Required. The resource name of the bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `DeleteBucket`. -message DeleteBucketRequest { - // Required. The full resource name of the bucket to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `UndeleteBucket`. -message UndeleteBucketRequest { - // Required. The full resource name of the bucket to undelete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `ListViews`. -message ListViewsRequest { - // Required. The bucket whose views are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If present, then retrieve the next batch of results from the preceding call - // to this method. `pageToken` must be the value of `nextPageToken` from the - // previous response. The values of other method parameters should be - // identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListViews. -message ListViewsResponse { - // A list of views. - repeated LogView views = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateView`. -message CreateViewRequest { - // Required. The bucket in which to create the view - // - // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The id to use for this view. - string view_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new view. - LogView view = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateView`. -message UpdateViewRequest { - // Required. The full resource name of the view to update - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The updated view. - LogView view = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that specifies the fields in `view` that need - // an update. A field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `GetView`. -message GetViewRequest { - // Required. The resource name of the policy: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogView" - } - ]; -} - -// The parameters to `DeleteView`. -message DeleteViewRequest { - // Required. The full resource name of the view to delete: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogView" - } - ]; -} - -// The parameters to `ListSinks`. -message ListSinksRequest { - // Required. The parent resource whose sinks are to be listed: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListSinks`. -message ListSinksResponse { - // A list of sinks. - repeated LogSink sinks = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `GetSink`. -message GetSinkRequest { - // Required. The resource name of the sink: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; -} - -// The parameters to `CreateSink`. -message CreateSinkRequest { - // Required. The resource in which to create the sink: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - // - // For examples: - // - // `"projects/my-project"` - // `"organizations/123456789"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The new sink, whose `name` parameter is a sink identifier that - // is not already in use. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines the kind of IAM identity returned as `writer_identity` - // in the new sink. If this value is omitted or set to false, and if the - // sink's parent is a project, then the value returned as `writer_identity` is - // the same group or service account used by Cloud Logging before the addition - // of writer identities to this API. The sink's destination must be in the - // same project as the sink itself. - // - // If this field is set to true, or if the sink is owned by a non-project - // resource such as an organization, then the value of `writer_identity` will - // be a unique service account used only for exports from the new sink. For - // more information, see `writer_identity` in [LogSink][google.logging.v2.LogSink]. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `UpdateSink`. -message UpdateSinkRequest { - // Required. The full resource name of the sink to update, including the parent - // resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The updated sink, whose name is the same identifier that appears as part - // of `sink_name`. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] - // for a description of this field. When updating a sink, the effect of this - // field on the value of `writer_identity` in the updated sink depends on both - // the old and new values of this field: - // - // + If the old and new values of this field are both false or both true, - // then there is no change to the sink's `writer_identity`. - // + If the old value is false and the new value is true, then - // `writer_identity` is changed to a unique service account. - // + It is an error if the old value is true and the new value is - // set to false or defaulted to false. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field mask that specifies the fields in `sink` that need - // an update. A sink field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // An empty `updateMask` is temporarily treated as using the following mask - // for backwards compatibility purposes: - // - // `destination,filter,includeChildren` - // - // At some point in the future, behavior will be removed and specifying an - // empty `updateMask` will be an error. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `DeleteSink`. -message DeleteSinkRequest { - // Required. The full resource name of the sink to delete, including the parent - // resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; -} - -// Specifies a set of log entries that are filtered out by a sink. If -// your Google Cloud resource receives a large volume of log entries, you can -// use exclusions to reduce your chargeable logs. Note that exclusions on -// organization-level and folder-level sinks don't apply to child resources. -// Note also that you cannot modify the _Required sink or exclude logs from it. -message LogExclusion { - option (google.api.resource) = { - type: "logging.googleapis.com/LogExclusion" - pattern: "projects/{project}/exclusions/{exclusion}" - pattern: "organizations/{organization}/exclusions/{exclusion}" - pattern: "folders/{folder}/exclusions/{exclusion}" - pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" - }; - - // Required. A client-assigned identifier, such as `"load-balancer-exclusion"`. - // Identifiers are limited to 100 characters and can include only letters, - // digits, underscores, hyphens, and periods. First character has to be - // alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A description of this exclusion. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that - // matches the log entries to be excluded. By using the [sample - // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), - // you can exclude less than 100% of the matching log entries. - // - // For example, the following query matches 99% of low-severity log entries - // from Google Cloud Storage buckets: - // - // `resource.type=gcs_bucket severity=ERROR" - // - // The maximum length of the filter is 20000 characters. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If set to True, then this metric is disabled and it does not - // generate any points. - bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The metric descriptor associated with the logs-based metric. - // If unspecified, it uses a default metric descriptor with a DELTA metric - // kind, INT64 value type, with no labels and a unit of "1". Such a metric - // counts the number of log entries matching the `filter` expression. - // - // The `name`, `type`, and `description` fields in the `metric_descriptor` - // are output only, and is constructed using the `name` and `description` - // field in the LogMetric. - // - // To create a logs-based metric that records a distribution of log values, a - // DELTA metric kind with a DISTRIBUTION value type must be used along with - // a `value_extractor` expression in the LogMetric. - // - // Each label in the metric descriptor must have a matching label - // name as the key and an extractor expression as the value in the - // `label_extractors` map. - // - // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot - // be updated once initially configured. New labels can be added in the - // `metric_descriptor`, but existing labels cannot be modified except for - // their description. - google.api.MetricDescriptor metric_descriptor = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A `value_extractor` is required when using a distribution - // logs-based metric to extract the values to record from a log entry. - // Two functions are supported for value extraction: `EXTRACT(field)` or - // `REGEXP_EXTRACT(field, regex)`. The argument are: - // 1. field: The name of the log entry field from which the value is to be - // extracted. - // 2. regex: A regular expression using the Google RE2 syntax - // (https://github.com/google/re2/wiki/Syntax) with a single capture - // group to extract data from the specified log entry field. The value - // of the field is converted to a string before applying the regex. - // It is an error to specify a regex that does not include exactly one - // capture group. - // - // The result of the extraction must be convertible to a double type, as the - // distribution always records double values. If either the extraction or - // the conversion to double fails, then those values are not recorded in the - // distribution. - // - // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` - string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map from a label key string to an extractor expression which is - // used to extract data from a log entry field and assign as the label value. - // Each label key specified in the LabelDescriptor must have an associated - // extractor expression in this map. The syntax of the extractor expression - // is the same as for the `value_extractor` field. - // - // The extracted value is converted to the type defined in the label - // descriptor. If the either the extraction or the type conversion fails, - // the label will have a default value. The default value for a string - // label is an empty string, for an integer label its 0, and for a boolean - // label its `false`. - // - // Note that there are upper bounds on the maximum number of labels and the - // number of active time series that are allowed in a project. - map label_extractors = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `bucket_options` are required when the logs-based metric is - // using a DISTRIBUTION value type and it describes the bucket boundaries - // used to create a histogram of the extracted values. - google.api.Distribution.BucketOptions bucket_options = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The creation timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp update_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Deprecated. The API version that created or updated this metric. - // The v2 format is used by default and cannot be changed. - ApiVersion version = 4 [deprecated = true]; -} - -// The parameters to ListLogMetrics. -message ListLogMetricsRequest { - // Required. The name of the project containing the metrics: - // - // "projects/[PROJECT_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogMetrics. -message ListLogMetricsResponse { - // A list of logs-based metrics. - repeated LogMetric metrics = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLogMetric. -message GetLogMetricRequest { - // Required. The resource name of the desired metric: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} - -// The parameters to CreateLogMetric. -message CreateLogMetricRequest { - // Required. The resource name of the project in which to create the metric: - // - // "projects/[PROJECT_ID]" - // - // The new metric must be provided in the request. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The new logs-based metric, which must not have an identifier that - // already exists. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to UpdateLogMetric. -message UpdateLogMetricRequest { - // Required. The resource name of the metric to update: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - // - // The updated metric must be provided in the request and it's - // `name` field must be the same as `[METRIC_ID]` If the metric - // does not exist in `[PROJECT_ID]`, then a new metric is created. - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The updated metric. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLogMetric. -message DeleteLogMetricRequest { - // Required. The resource name of the metric to delete: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline deleted file mode 100644 index 1c3061e72b2e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, destination) { - // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Log bucket from which to copy log entries. - * For example: - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - */ - // const name = 'abc123' - /** - * Optional. A filter specifying which log entries to copy. The filter must be no more - * than 20k characters. An empty filter matches all log entries. - */ - // const filter = 'abc123' - /** - * Required. Destination to which to copy log entries. - */ - // const destination = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCopyLogEntries() { - // Construct request - const request = { - name, - destination, - }; - - // Run request - const [operation] = await loggingClient.copyLogEntries(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCopyLogEntries(); - // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_bucket.js.baseline deleted file mode 100644 index 771360131be9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_bucket.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - * to 100 characters and can include only letters, digits, underscores, - * hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be compliant - * with any Location Restriction Org Policy. The name field in the bucket is - * ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucket() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const response = await loggingClient.createBucket(request); - console.log(response); - } - - callCreateBucket(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_exclusion.js.baseline deleted file mode 100644 index 152d2bf9ddd3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_exclusion.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, exclusion) { - // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource in which to create the exclusion: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-logging-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - */ - // const exclusion = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateExclusion() { - // Construct request - const request = { - parent, - exclusion, - }; - - // Run request - const response = await loggingClient.createExclusion(request); - console.log(response); - } - - callCreateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_sink.js.baseline deleted file mode 100644 index 93646b5b4e91..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_sink.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, sink) { - // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the sink: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - */ - // const sink = {} - /** - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in LogSink google.logging.v2.LogSink. - */ - // const uniqueWriterIdentity = true - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateSink() { - // Construct request - const request = { - parent, - sink, - }; - - // Run request - const response = await loggingClient.createSink(request); - console.log(response); - } - - callCreateSink(); - // [END logging_v2_generated_ConfigServiceV2_CreateSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_view.js.baseline deleted file mode 100644 index b47aabe3b6a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.create_view.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, viewId, view) { - // [START logging_v2_generated_ConfigServiceV2_CreateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket in which to create the view - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const parent = 'abc123' - /** - * Required. The id to use for this view. - */ - // const viewId = 'abc123' - /** - * Required. The new view. - */ - // const view = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateView() { - // Construct request - const request = { - parent, - viewId, - view, - }; - - // Run request - const response = await loggingClient.createView(request); - console.log(response); - } - - callCreateView(); - // [END logging_v2_generated_ConfigServiceV2_CreateView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_bucket.js.baseline deleted file mode 100644 index dd6676b03c50..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteBucket(request); - console.log(response); - } - - callDeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline deleted file mode 100644 index 3d0dc8ac2329..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion to delete: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteExclusion(request); - console.log(response); - } - - callDeleteExclusion(); - // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_sink.js.baseline deleted file mode 100644 index af2c37cc2524..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_sink.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to delete, including the parent - * resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.deleteSink(request); - console.log(response); - } - - callDeleteSink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_view.js.baseline deleted file mode 100644 index 8c7267a5f835..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.delete_view.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to delete: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteView(request); - console.log(response); - } - - callDeleteView(); - // [END logging_v2_generated_ConfigServiceV2_DeleteView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_bucket.js.baseline deleted file mode 100644 index c540b330f073..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getBucket(request); - console.log(response); - } - - callGetBucket(); - // [END logging_v2_generated_ConfigServiceV2_GetBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline deleted file mode 100644 index 12c51710399e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve CMEK settings. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetCmekSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getCmekSettings(request); - console.log(response); - } - - callGetCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_exclusion.js.baseline deleted file mode 100644 index f2c49bf6088f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_exclusion.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getExclusion(request); - console.log(response); - } - - callGetExclusion(); - // [END logging_v2_generated_ConfigServiceV2_GetExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_settings.js.baseline deleted file mode 100644 index 30ef52b74775..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_settings.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve settings. - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_sink.js.baseline deleted file mode 100644 index 9b597a4b8aae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_sink.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_GetSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the sink: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.getSink(request); - console.log(response); - } - - callGetSink(); - // [END logging_v2_generated_ConfigServiceV2_GetSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_view.js.baseline deleted file mode 100644 index 708cf1c403e1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.get_view.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the policy: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getView(request); - console.log(response); - } - - callGetView(); - // [END logging_v2_generated_ConfigServiceV2_GetView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_buckets.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_buckets.js.baseline deleted file mode 100644 index 5dc536acb875..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_buckets.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose buckets are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of LOCATION_ID will return all - * buckets. - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListBuckets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listBucketsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuckets(); - // [END logging_v2_generated_ConfigServiceV2_ListBuckets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_exclusions.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_exclusions.js.baseline deleted file mode 100644 index 4dadbf094736..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_exclusions.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose exclusions are to be listed. - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListExclusions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listExclusionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExclusions(); - // [END logging_v2_generated_ConfigServiceV2_ListExclusions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_sinks.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_sinks.js.baseline deleted file mode 100644 index bbdd5697a6a2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_sinks.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose sinks are to be listed: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListSinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listSinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSinks(); - // [END logging_v2_generated_ConfigServiceV2_ListSinks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_views.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_views.js.baseline deleted file mode 100644 index 0c7779a881aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.list_views.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListViews_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket whose views are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListViews() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listViewsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListViews(); - // [END logging_v2_generated_ConfigServiceV2_ListViews_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline deleted file mode 100644 index 6f4c111057b9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to undelete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUndeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.undeleteBucket(request); - console.log(response); - } - - callUndeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_bucket.js.baseline deleted file mode 100644 index 274220ab8257..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_bucket.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an update. A - * bucket field will be overwritten if, and only if, it is in the update mask. - * `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucket() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const response = await loggingClient.updateBucket(request); - console.log(response); - } - - callUpdateBucket(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline deleted file mode 100644 index 16bcd37a6f78..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, cmekSettings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the CMEK settings to update. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The CMEK settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const cmekSettings = {} - /** - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateCmekSettings() { - // Construct request - const request = { - name, - cmekSettings, - }; - - // Run request - const response = await loggingClient.updateCmekSettings(request); - console.log(response); - } - - callUpdateCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_exclusion.js.baseline deleted file mode 100644 index 8a5a6efe15cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_exclusion.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, exclusion, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the exclusion to update: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - /** - * Required. New values for the existing exclusion. Only the fields specified in - * `update_mask` are relevant. - */ - // const exclusion = {} - /** - * Required. A non-empty list of fields to change in the existing exclusion. New values - * for the fields are taken from the corresponding fields in the - * LogExclusion google.logging.v2.LogExclusion included in this request. Fields not mentioned in - * `update_mask` are not changed and are ignored in the request. - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateExclusion() { - // Construct request - const request = { - name, - exclusion, - updateMask, - }; - - // Run request - const response = await loggingClient.updateExclusion(request); - console.log(response); - } - - callUpdateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_settings.js.baseline deleted file mode 100644 index 190d3707184b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_settings.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, settings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the settings to update. - * "organizations/[ORGANIZATION_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const settings = {} - /** - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSettings() { - // Construct request - const request = { - name, - settings, - }; - - // Run request - const response = await loggingClient.updateSettings(request); - console.log(response); - } - - callUpdateSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_sink.js.baseline deleted file mode 100644 index 7d0ce38467f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_sink.js.baseline +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName, sink) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to update, including the parent - * resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - /** - * Required. The updated sink, whose name is the same identifier that appears as part - * of `sink_name`. - */ - // const sink = {} - /** - * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - */ - // const uniqueWriterIdentity = true - /** - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * `destination,filter,includeChildren` - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSink() { - // Construct request - const request = { - sinkName, - sink, - }; - - // Run request - const response = await loggingClient.updateSink(request); - console.log(response); - } - - callUpdateSink(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_view.js.baseline deleted file mode 100644 index 0fc07bc1c5af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/config_service_v2.update_view.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, view) { - // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to update - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - /** - * Required. The updated view. - */ - // const view = {} - /** - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateView() { - // Construct request - const request = { - name, - view, - }; - - // Run request - const response = await loggingClient.updateView(request); - console.log(response); - } - - callUpdateView(); - // [END logging_v2_generated_ConfigServiceV2_UpdateView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.delete_log.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.delete_log.js.baseline deleted file mode 100644 index 9dadeea5c5cd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.delete_log.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(logName) { - // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the log to delete: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * For more information about log names, see - * LogEntry google.logging.v2.LogEntry. - */ - // const logName = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callDeleteLog() { - // Construct request - const request = { - logName, - }; - - // Run request - const response = await loggingClient.deleteLog(request); - console.log(response); - } - - callDeleteLog(); - // [END logging_v2_generated_LoggingServiceV2_DeleteLog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline deleted file mode 100644 index 8b1db23fa6ee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * Projects listed in the `project_ids` field are added to this list. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. A filter that chooses which log entries to return. See Advanced - * Logs Queries (https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - */ - // const filter = 'abc123' - /** - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - */ - // const orderBy = 'abc123' - /** - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const iterable = loggingClient.listLogEntriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_logs.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_logs.js.baseline deleted file mode 100644 index ed99f36bcd86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_logs.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name that owns the logs: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The resource name that owns the logs: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * To support legacy queries, it could also be: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const resourceNames = ['abc','def'] - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listLogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogs(); - // [END logging_v2_generated_LoggingServiceV2_ListLogs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline deleted file mode 100644 index 9e7193e0bd5a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - }; - - // Run request - const iterable = loggingClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline deleted file mode 100644 index 9e2ae9a55201..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of a parent resource from which to retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - */ - // const resourceNames = ['abc','def'] - /** - * Optional. A filter that chooses which log entries to return. See Advanced - * Logs Filters (https://cloud.google.com/logging/docs/view/advanced_filters). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not in `resource_names` will cause - * the filter to return no results. The maximum length of the filter is 20000 - * characters. - */ - // const filter = 'abc123' - /** - * Optional. The amount of time to buffer log entries at the server before - * being returned to prevent out of order results due to late arriving log - * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - * milliseconds. - */ - // const bufferWindow = {} - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callTailLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const stream = await loggingClient.tailLogEntries(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callTailLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline deleted file mode 100644 index e53125e23515..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(entries) { - // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example: - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - */ - // const logName = 'abc123' - /** - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * See LogEntry google.logging.v2.LogEntry. - */ - // const resource = {} - /** - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See LogEntry google.logging.v2.LogEntry. - */ - // const labels = [1,2,3,4] - /** - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * LogEntry google.logging.v2.LogEntry type. - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * Log entries with timestamps that are more than the - * logs retention period (https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be exported - * with - * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * To improve throughput and to avoid exceeding the - * quota limit (https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - */ - // const entries = [1,2,3,4] - /** - * Optional. Whether valid entries should be written even if some other - * entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - * entry is not written, then the response status is the error associated - * with one of the failed entries and the response includes error details - * keyed by the entries' zero-based index in the `entries.write` method. - */ - // const partialSuccess = true - /** - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - */ - // const dryRun = true - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callWriteLogEntries() { - // Construct request - const request = { - entries, - }; - - // Run request - const response = await loggingClient.writeLogEntries(request); - console.log(response); - } - - callWriteLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline deleted file mode 100644 index 5cc46e7112d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, metric) { - // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project in which to create the metric: - * "projects/[PROJECT_ID]" - * The new metric must be provided in the request. - */ - // const parent = 'abc123' - /** - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callCreateLogMetric() { - // Construct request - const request = { - parent, - metric, - }; - - // Run request - const response = await loggingClient.createLogMetric(request); - console.log(response); - } - - callCreateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline deleted file mode 100644 index afd6bd779e0e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to delete: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callDeleteLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.deleteLogMetric(request); - console.log(response); - } - - callDeleteLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline deleted file mode 100644 index 757570ddb21e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the desired metric: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callGetLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.getLogMetric(request); - console.log(response); - } - - callGetLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline deleted file mode 100644 index 715f32bb58a6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project containing the metrics: - * "projects/[PROJECT_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callListLogMetrics() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listLogMetricsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogMetrics(); - // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline deleted file mode 100644 index 610e3c0772fe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName, metric) { - // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to update: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - */ - // const metricName = 'abc123' - /** - * Required. The updated metric. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callUpdateLogMetric() { - // Construct request - const request = { - metricName, - metric, - }; - - // Run request - const response = await loggingClient.updateLogMetric(request); - console.log(response); - } - - callUpdateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline deleted file mode 100644 index 9181588b71bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline +++ /dev/null @@ -1,1691 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-logging", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.logging.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", - "title": "LoggingService listBuckets Sample", - "origin": "API_DEFINITION", - "description": " Lists log buckets.", - "canonical": true, - "file": "config_service_v2.list_buckets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListBucketsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", - "title": "LoggingService getBucket Sample", - "origin": "API_DEFINITION", - "description": " Gets a log bucket.", - "canonical": true, - "file": "config_service_v2.get_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", - "title": "LoggingService createBucket Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", - "title": "LoggingService updateBucket Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket. This method replaces the following fields in the existing bucket with values from the new bucket: `retention_period` If the retention period is decreased and the bucket is locked, `FAILED_PRECONDITION` will be returned. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", - "title": "LoggingService deleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", - "canonical": true, - "file": "config_service_v2.delete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", - "title": "LoggingService undeleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", - "canonical": true, - "file": "config_service_v2.undelete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", - "title": "LoggingService listViews Sample", - "origin": "API_DEFINITION", - "description": " Lists views on a log bucket.", - "canonical": true, - "file": "config_service_v2.list_views.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListViewsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", - "title": "LoggingService getView Sample", - "origin": "API_DEFINITION", - "description": " Gets a view on a log bucket..", - "canonical": true, - "file": "config_service_v2.get_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", - "title": "LoggingService createView Sample", - "origin": "API_DEFINITION", - "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", - "canonical": true, - "file": "config_service_v2.create_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", - "title": "LoggingService updateView Sample", - "origin": "API_DEFINITION", - "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.update_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", - "title": "LoggingService deleteView Sample", - "origin": "API_DEFINITION", - "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.delete_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", - "title": "LoggingService listSinks Sample", - "origin": "API_DEFINITION", - "description": " Lists sinks.", - "canonical": true, - "file": "config_service_v2.list_sinks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListSinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", - "title": "LoggingService getSink Sample", - "origin": "API_DEFINITION", - "description": " Gets a sink.", - "canonical": true, - "file": "config_service_v2.get_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", - "title": "LoggingService createSink Sample", - "origin": "API_DEFINITION", - "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", - "canonical": true, - "file": "config_service_v2.create_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", - "title": "LoggingService updateSink Sample", - "origin": "API_DEFINITION", - "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", - "canonical": true, - "file": "config_service_v2.update_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", - "title": "LoggingService deleteSink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", - "canonical": true, - "file": "config_service_v2.delete_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", - "title": "LoggingService listExclusions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the exclusions on the _Default sink in a parent resource.", - "canonical": true, - "file": "config_service_v2.list_exclusions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListExclusionsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", - "title": "LoggingService getExclusion Sample", - "origin": "API_DEFINITION", - "description": " Gets the description of an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.get_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", - "title": "LoggingService createExclusion Sample", - "origin": "API_DEFINITION", - "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", - "canonical": true, - "file": "config_service_v2.create_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", - "title": "LoggingService updateExclusion Sample", - "origin": "API_DEFINITION", - "description": " Changes one or more properties of an existing exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.update_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", - "title": "LoggingService deleteExclusion Sample", - "origin": "API_DEFINITION", - "description": " Deletes an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.delete_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", - "title": "LoggingService getCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", - "title": "LoggingService updateCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "cmek_settings", - "type": ".google.logging.v2.CmekSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", - "title": "LoggingService getSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", - "title": "LoggingService updateSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "settings", - "type": ".google.logging.v2.Settings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", - "title": "LoggingService copyLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", - "canonical": true, - "file": "config_service_v2.copy_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "destination", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", - "title": "LoggingService deleteLog Sample", - "origin": "API_DEFINITION", - "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", - "canonical": true, - "file": "logging_service_v2.delete_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", - "title": "LoggingService writeLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", - "canonical": true, - "file": "logging_service_v2.write_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 119, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.api.MonitoredResource" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "entries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "partial_success", - "type": "TYPE_BOOL" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.WriteLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", - "title": "LoggingService listLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", - "canonical": true, - "file": "logging_service_v2.list_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 99, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", - "title": "LoggingService listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for monitored resource types used by Logging.", - "canonical": true, - "file": "logging_service_v2.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", - "title": "LoggingService listLogs Sample", - "origin": "API_DEFINITION", - "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", - "canonical": true, - "file": "logging_service_v2.list_logs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "resource_names", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.logging.v2.ListLogsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", - "title": "LoggingService tailLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", - "canonical": true, - "file": "logging_service_v2.tail_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "buffer_window", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.logging.v2.TailLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", - "title": "LoggingService listLogMetrics Sample", - "origin": "API_DEFINITION", - "description": " Lists logs-based metrics.", - "canonical": true, - "file": "metrics_service_v2.list_log_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLogMetricsResponse", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", - "title": "LoggingService getLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Gets a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.get_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", - "title": "LoggingService createLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.create_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", - "title": "LoggingService updateLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.update_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", - "title": "LoggingService deleteLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Deletes a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.delete_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/logging-esm/webpack.config.cjs.baseline deleted file mode 100644 index 67067d1ac812..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'LoggingService', - filename: './logging-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.OwlBot.yaml.baseline deleted file mode 100644 index 7f3806ae0318..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/logging/google-logging-nodejs - dest: /owl-bot-staging/google-logging - -api-name: logging \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.jsdoc.js.baseline deleted file mode 100644 index e3b32a980363..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'logging', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/logging/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/logging/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/logging/README.md.baseline deleted file mode 100644 index 00c4032835df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Logging: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/logging.svg)](https://www.npmjs.org/package/logging) - -Logging client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Logging Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/logging/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Logging API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install logging -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install logging@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=logging.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-logging diff --git a/core/generator/gapic-generator-typescript/baselines/logging/package.json b/core/generator/gapic-generator-typescript/baselines/logging/package.json deleted file mode 100644 index 6b10e452bd2c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "logging", - "version": "0.1.0", - "description": "Logging client for Node.js", - "repository": "googleapis/nodejs-logging", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google logging", - "logging", - "config service v2", - "logging service v2", - "metrics service v2" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/http_request.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/http_request.proto.baseline deleted file mode 100644 index b878d60dce43..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/http_request.proto.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.type; - -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "HttpRequestProto"; -option java_package = "com.google.logging.type"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// A common proto for logging HTTP requests. Only contains semantics -// defined by the HTTP specification. Product-specific logging -// information MUST be defined in a separate message. -message HttpRequest { - // The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`. - string request_method = 1; - - // The scheme (http, https), the host name, the path and the query - // portion of the URL that was requested. - // Example: `"http://example.com/some/info?color=red"`. - string request_url = 2; - - // The size of the HTTP request message in bytes, including the request - // headers and the request body. - int64 request_size = 3; - - // The response code indicating the status of response. - // Examples: 200, 404. - int32 status = 4; - - // The size of the HTTP response message sent back to the client, in bytes, - // including the response headers and the response body. - int64 response_size = 5; - - // The user agent sent by the client. Example: - // `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET - // CLR 1.0.3705)"`. - string user_agent = 6; - - // The IP address (IPv4 or IPv6) of the client that issued the HTTP - // request. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string remote_ip = 7; - - // The IP address (IPv4 or IPv6) of the origin server that the request was - // sent to. This field can include port information. Examples: - // `"192.168.1.1"`, `"10.0.0.1:80"`, `"FE80::0202:B3FF:FE1E:8329"`. - string server_ip = 13; - - // The referer URL of the request, as defined in - // [HTTP/1.1 Header Field - // Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html). - string referer = 8; - - // The request processing latency on the server, from the time the request was - // received until the response was sent. - google.protobuf.Duration latency = 14; - - // Whether or not a cache lookup was attempted. - bool cache_lookup = 11; - - // Whether or not an entity was served from cache - // (with or without validation). - bool cache_hit = 9; - - // Whether or not the response was validated with the origin server before - // being served from cache. This field is only meaningful if `cache_hit` is - // True. - bool cache_validated_with_origin_server = 10; - - // The number of HTTP response bytes inserted into cache. Set only when a - // cache fill was attempted. - int64 cache_fill_bytes = 12; - - // Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket" - string protocol = 15; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/log_severity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/log_severity.proto.baseline deleted file mode 100644 index bed71935f948..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/type/log_severity.proto.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.type; - -option csharp_namespace = "Google.Cloud.Logging.Type"; -option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype"; -option java_multiple_files = true; -option java_outer_classname = "LogSeverityProto"; -option java_package = "com.google.logging.type"; -option objc_class_prefix = "GLOG"; -option php_namespace = "Google\\Cloud\\Logging\\Type"; -option ruby_package = "Google::Cloud::Logging::Type"; - -// The severity of the event described in a log entry, expressed as one of the -// standard severity levels listed below. For your reference, the levels are -// assigned the listed numeric values. The effect of using numeric values other -// than those listed is undefined. -// -// You can filter for log entries by severity. For example, the following -// filter expression will match log entries with severities `INFO`, `NOTICE`, -// and `WARNING`: -// -// severity > DEBUG AND severity <= WARNING -// -// If you are writing log entries, you should map other severity encodings to -// one of these standard levels. For example, you might map all of Java's FINE, -// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the -// original severity level in the log entry payload if you wish. -enum LogSeverity { - // (0) The log entry has no assigned severity level. - DEFAULT = 0; - - // (100) Debug or trace information. - DEBUG = 100; - - // (200) Routine information, such as ongoing status or performance. - INFO = 200; - - // (300) Normal but significant events, such as start up, shut down, or - // a configuration change. - NOTICE = 300; - - // (400) Warning events might cause problems. - WARNING = 400; - - // (500) Error events are likely to cause problems. - ERROR = 500; - - // (600) Critical events cause more severe problems or outages. - CRITICAL = 600; - - // (700) A person must take an action immediately. - ALERT = 700; - - // (800) One or more systems are unusable. - EMERGENCY = 800; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/log_entry.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/log_entry.proto.baseline deleted file mode 100644 index 99712936989e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/log_entry.proto.baseline +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/type/http_request.proto"; -import "google/logging/type/log_severity.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/struct.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LogEntryProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// An individual entry in a log. -message LogEntry { - option (google.api.resource) = { - type: "logging.googleapis.com/Log" - pattern: "projects/{project}/logs/{log}" - pattern: "organizations/{organization}/logs/{log}" - pattern: "folders/{folder}/logs/{log}" - pattern: "billingAccounts/{billing_account}/logs/{log}" - name_field: "log_name" - }; - - // Required. The resource name of the log to which this log entry belongs: - // - // "projects/[PROJECT_ID]/logs/[LOG_ID]" - // "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]" - // "folders/[FOLDER_ID]/logs/[LOG_ID]" - // - // A project number may be used in place of PROJECT_ID. The project number is - // translated to its corresponding PROJECT_ID internally and the `log_name` - // field will contain PROJECT_ID in queries and exports. - // - // `[LOG_ID]` must be URL-encoded within `log_name`. Example: - // `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - // - // `[LOG_ID]` must be less than 512 characters long and can only include the - // following characters: upper and lower case alphanumeric characters, - // forward-slash, underscore, hyphen, and period. - // - // For backward compatibility, if `log_name` begins with a forward-slash, such - // as `/projects/...`, then the log entry is ingested as usual, but the - // forward-slash is removed. Listing the log entry will not show the leading - // slash and filtering for a log name with a leading slash will never return - // any results. - string log_name = 12 [(google.api.field_behavior) = REQUIRED]; - - // Required. The monitored resource that produced this log entry. - // - // Example: a log entry that reports a database error would be associated with - // the monitored resource designating the particular database that reported - // the error. - google.api.MonitoredResource resource = 8 [(google.api.field_behavior) = REQUIRED]; - - // The log entry payload, which can be one of multiple types. - oneof payload { - // The log entry payload, represented as a protocol buffer. Some Google - // Cloud Platform services use this field for their log entry payloads. - // - // The following protocol buffer types are supported; user-defined types - // are not supported: - // - // "type.googleapis.com/google.cloud.audit.AuditLog" - // "type.googleapis.com/google.appengine.logging.v1.RequestLog" - google.protobuf.Any proto_payload = 2; - - // The log entry payload, represented as a Unicode string (UTF-8). - string text_payload = 3; - - // The log entry payload, represented as a structure that is - // expressed as a JSON object. - google.protobuf.Struct json_payload = 6; - } - - // Optional. The time the event described by the log entry occurred. This time is used - // to compute the log entry's age and to enforce the logs retention period. - // If this field is omitted in a new log entry, then Logging assigns it the - // current time. Timestamps have nanosecond accuracy, but trailing zeros in - // the fractional seconds might be omitted when the timestamp is displayed. - // - // Incoming log entries must have timestamps that don't exceed the - // [logs retention - // period](https://cloud.google.com/logging/quotas#logs_retention_periods) in - // the past, and that don't exceed 24 hours in the future. Log entries outside - // those time boundaries aren't ingested by Logging. - google.protobuf.Timestamp timestamp = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The time the log entry was received by Logging. - google.protobuf.Timestamp receive_timestamp = 24 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The severity of the log entry. The default value is `LogSeverity.DEFAULT`. - google.logging.type.LogSeverity severity = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A unique identifier for the log entry. If you provide a value, then - // Logging considers other log entries in the same project, with the same - // `timestamp`, and with the same `insert_id` to be duplicates which are - // removed in a single query result. However, there are no guarantees of - // de-duplication in the export of logs. - // - // If the `insert_id` is omitted when writing a log entry, the Logging API - // assigns its own unique identifier in this field. - // - // In queries, the `insert_id` is also used to order log entries that have - // the same `log_name` and `timestamp` values. - string insert_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about the HTTP request associated with this log entry, if - // applicable. - google.logging.type.HttpRequest http_request = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map of key, value pairs that provides additional information about the - // log entry. The labels can be user-defined or system-defined. - // - // User-defined labels are arbitrary key, value pairs that you can use to - // classify logs. - // - // System-defined labels are defined by GCP services for platform logs. - // They have two components - a service namespace component and the - // attribute name. For example: `compute.googleapis.com/resource_name`. - // - // Cloud Logging truncates label keys that exceed 512 B and label - // values that exceed 64 KB upon their associated log entry being - // written. The truncation is indicated by an ellipsis at the - // end of the character string. - map labels = 11 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information about an operation associated with the log entry, if - // applicable. - LogEntryOperation operation = 15 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Resource name of the trace associated with the log entry, if any. If it - // contains a relative resource name, the name is assumed to be relative to - // `//tracing.googleapis.com`. Example: - // `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824` - string trace = 22 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The span ID within the trace associated with the log entry. - // - // For Trace spans, this is the same format that the Trace API v2 uses: a - // 16-character hexadecimal encoding of an 8-byte array, such as - // `000000000000004a`. - string span_id = 27 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sampling decision of the trace associated with the log entry. - // - // True means that the trace resource name in the `trace` field was sampled - // for storage in a trace backend. False means that the trace was not sampled - // for storage when this log entry was written, or the sampling decision was - // unknown at the time. A non-sampled `trace` value is still useful as a - // request correlation identifier. The default is False. - bool trace_sampled = 30 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Source code location information associated with the log entry, if any. - LogEntrySourceLocation source_location = 23 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Information indicating this LogEntry is part of a sequence of multiple log - // entries split from a single LogEntry. - LogSplit split = 35 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information about a potentially long-running operation with which -// a log entry is associated. -message LogEntryOperation { - // Optional. An arbitrary operation identifier. Log entries with the same - // identifier are assumed to be part of the same operation. - string id = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An arbitrary producer identifier. The combination of `id` and - // `producer` must be globally unique. Examples for `producer`: - // `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`. - string producer = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the first log entry in the operation. - bool first = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Set this to True if this is the last log entry in the operation. - bool last = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information about the source code location that produced the log -// entry. -message LogEntrySourceLocation { - // Optional. Source file name. Depending on the runtime environment, this - // might be a simple name or a fully-qualified name. - string file = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Line within the source file. 1-based; 0 indicates no line number - // available. - int64 line = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Human-readable name of the function or method being invoked, with - // optional context such as the class or package name. This information may be - // used in contexts such as the logs viewer, where a file and line number are - // less meaningful. The format can vary by language. For example: - // `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function` - // (Python). - string function = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Additional information used to correlate multiple log entries. Used when a -// single LogEntry would exceed the Google Cloud Logging size limit and is -// split across multiple log entries. -message LogSplit { - // A globally unique identifier for all log entries in a sequence of split log - // entries. All log entries with the same |LogSplit.uid| are assumed to be - // part of the same sequence of split log entries. - string uid = 1; - - // The index of this LogEntry in the sequence of split log entries. Log - // entries are given |index| values 0, 1, ..., n-1 for a sequence of n log - // entries. - int32 index = 2; - - // The total number of log entries that the original LogEntry was split into. - int32 total_splits = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging.proto.baseline deleted file mode 100644 index b7f4f189d2ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging.proto.baseline +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/logging/v2/log_entry.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LoggingProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; - -// Service for ingesting and querying logs. -service LoggingServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read," - "https://www.googleapis.com/auth/logging.write"; - - // Deletes all the log entries in a log for the _Default Log Bucket. The log - // reappears if it receives new entries. Log entries written shortly before - // the delete operation might not be deleted. Entries received after the - // delete operation with a timestamp before the operation will be deleted. - rpc DeleteLog(DeleteLogRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{log_name=projects/*/logs/*}" - additional_bindings { - delete: "/v2/{log_name=*/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=organizations/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=folders/*/logs/*}" - } - additional_bindings { - delete: "/v2/{log_name=billingAccounts/*/logs/*}" - } - }; - option (google.api.method_signature) = "log_name"; - } - - // Writes log entries to Logging. This API method is the - // only way to send log entries to Logging. This method - // is used, directly or indirectly, by the Logging agent - // (fluentd) and all logging libraries configured to use Logging. - // A single request may contain log entries for a maximum of 1000 - // different resources (projects, organizations, billing accounts or - // folders) - rpc WriteLogEntries(WriteLogEntriesRequest) returns (WriteLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:write" - body: "*" - }; - option (google.api.method_signature) = "log_name,resource,labels,entries"; - } - - // Lists log entries. Use this method to retrieve log entries that originated - // from a project/folder/organization/billing account. For ways to export log - // entries, see [Exporting - // Logs](https://cloud.google.com/logging/docs/export). - rpc ListLogEntries(ListLogEntriesRequest) returns (ListLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:list" - body: "*" - }; - option (google.api.method_signature) = "resource_names,filter,order_by"; - } - - // Lists the descriptors for monitored resource types used by Logging. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v2/monitoredResourceDescriptors" - }; - } - - // Lists the logs in projects, organizations, folders, or billing accounts. - // Only logs that have entries are listed. - rpc ListLogs(ListLogsRequest) returns (ListLogsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/logs" - additional_bindings { - get: "/v2/{parent=projects/*}/logs" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/logs" - } - additional_bindings { - get: "/v2/{parent=folders/*}/logs" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/logs" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Streaming read of log entries as they are ingested. Until the stream is - // terminated, it will continue reading logs. - rpc TailLogEntries(stream TailLogEntriesRequest) returns (stream TailLogEntriesResponse) { - option (google.api.http) = { - post: "/v2/entries:tail" - body: "*" - }; - } -} - -// The parameters to DeleteLog. -message DeleteLogRequest { - // Required. The resource name of the log to delete: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example, - // `"projects/my-project-id/logs/syslog"`, - // `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - // - // For more information about log names, see - // [LogEntry][google.logging.v2.LogEntry]. - string log_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/Log" - } - ]; -} - -// The parameters to WriteLogEntries. -message WriteLogEntriesRequest { - // Optional. A default log resource name that is assigned to all log entries - // in `entries` that do not specify a value for `log_name`: - // - // * `projects/[PROJECT_ID]/logs/[LOG_ID]` - // * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - // * `folders/[FOLDER_ID]/logs/[LOG_ID]` - // - // `[LOG_ID]` must be URL-encoded. For example: - // - // "projects/my-project-id/logs/syslog" - // "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - // - // The permission `logging.logEntries.create` is needed on each project, - // organization, billing account, or folder that is receiving new log - // entries, whether the resource is specified in `logName` or in an - // individual log entry. - string log_name = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - type: "logging.googleapis.com/Log" - } - ]; - - // Optional. A default monitored resource object that is assigned to all log - // entries in `entries` that do not specify a value for `resource`. Example: - // - // { "type": "gce_instance", - // "labels": { - // "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - // - // See [LogEntry][google.logging.v2.LogEntry]. - google.api.MonitoredResource resource = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Default labels that are added to the `labels` field of all log - // entries in `entries`. If a log entry already has a label with the same key - // as a label in this parameter, then the log entry's label is not changed. - // See [LogEntry][google.logging.v2.LogEntry]. - map labels = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The log entries to send to Logging. The order of log - // entries in this list does not matter. Values supplied in this method's - // `log_name`, `resource`, and `labels` fields are copied into those log - // entries in this list that do not include values for their corresponding - // fields. For more information, see the - // [LogEntry][google.logging.v2.LogEntry] type. - // - // If the `timestamp` or `insert_id` fields are missing in log entries, then - // this method supplies the current time or a unique identifier, respectively. - // The supplied values are chosen so that, among the log entries that did not - // supply their own values, the entries earlier in the list will sort before - // the entries later in the list. See the `entries.list` method. - // - // Log entries with timestamps that are more than the - // [logs retention period](https://cloud.google.com/logging/quotas) in - // the past or more than 24 hours in the future will not be available when - // calling `entries.list`. However, those log entries can still be [exported - // with - // LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - // - // To improve throughput and to avoid exceeding the - // [quota limit](https://cloud.google.com/logging/quotas) for calls to - // `entries.write`, you should try to include several log entries in this - // list, rather than calling this method for each individual log entry. - repeated LogEntry entries = 4 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether valid entries should be written even if some other - // entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - // entry is not written, then the response status is the error associated - // with one of the failed entries and the response includes error details - // keyed by the entries' zero-based index in the `entries.write` method. - bool partial_success = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If true, the request should expect normal response, but the - // entries won't be persisted nor exported. Useful for checking whether the - // logging API endpoints are working properly before sending valuable data. - bool dry_run = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from WriteLogEntries. -message WriteLogEntriesResponse { - -} - -// Error details for WriteLogEntries with partial success. -message WriteLogEntriesPartialErrors { - // When `WriteLogEntriesRequest.partial_success` is true, records the error - // status for entries that were not written due to a permanent error, keyed - // by the entry's zero-based index in `WriteLogEntriesRequest.entries`. - // - // Failed requests for which no entries are written will not include - // per-entry errors. - map log_entry_errors = 1; -} - -// The parameters to `ListLogEntries`. -message ListLogEntriesRequest { - // Required. Names of one or more parent resources from which to - // retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // Projects listed in the `project_ids` field are added to this list. - repeated string resource_names = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. A filter that chooses which log entries to return. See [Advanced - // Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - // Only log entries that match the filter are returned. An empty filter - // matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not listed in `resource_names` will - // cause the filter to return no results. The maximum length of the filter is - // 20000 characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. How the results should be sorted. Presently, the only permitted - // values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - // option returns entries in order of increasing values of - // `LogEntry.timestamp` (oldest first), and the second option returns entries - // in order of decreasing timestamps (newest first). Entries with equal - // timestamps are returned in order of their `insert_id` values. - string order_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. Default is 50. - // If the value is negative or exceeds 1000, the request is rejected. The - // presence of `next_page_token` in the response indicates that more results - // might be available. - int32 page_size = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `page_token` must be the value of - // `next_page_token` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListLogEntries`. -message ListLogEntriesResponse { - // A list of log entries. If `entries` is empty, `nextPageToken` may still be - // returned, indicating that more entries may exist. See `nextPageToken` for - // more information. - repeated LogEntry entries = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - // - // If a value for `next_page_token` appears and the `entries` field is empty, - // it means that the search found no log entries so far but it did not have - // time to search all the possible log entries. Retry the method with this - // value for `page_token` to continue the search. Alternatively, consider - // speeding up the search by changing your filter to specify a single log name - // or resource type, or to narrow the time range of the search. - string next_page_token = 2; -} - -// The parameters to ListMonitoredResourceDescriptors -message ListMonitoredResourceDescriptorsRequest { - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListMonitoredResourceDescriptors. -message ListMonitoredResourceDescriptorsResponse { - // A list of resource descriptors. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to ListLogs. -message ListLogsRequest { - // Required. The resource name that owns the logs: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource name that owns the logs: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // - // To support legacy queries, it could also be: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - repeated string resource_names = 8 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/Log" - } - ]; -} - -// Result returned from ListLogs. -message ListLogsResponse { - // A list of log names. For example, - // `"projects/my-project/logs/syslog"` or - // `"organizations/123/logs/cloudresourcemanager.googleapis.com%2Factivity"`. - repeated string log_names = 3; - - // If there might be more results than those appearing in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `TailLogEntries`. -message TailLogEntriesRequest { - // Required. Name of a parent resource from which to retrieve log entries: - // - // * `projects/[PROJECT_ID]` - // * `organizations/[ORGANIZATION_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]` - // * `folders/[FOLDER_ID]` - // - // May alternatively be one or more views: - // - // * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - // * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - repeated string resource_names = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A filter that chooses which log entries to return. See [Advanced - // Logs Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - // Only log entries that match the filter are returned. An empty filter - // matches all log entries in the resources listed in `resource_names`. - // Referencing a parent resource that is not in `resource_names` will cause - // the filter to return no results. The maximum length of the filter is 20000 - // characters. - string filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The amount of time to buffer log entries at the server before - // being returned to prevent out of order results due to late arriving log - // entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - // milliseconds. - google.protobuf.Duration buffer_window = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `TailLogEntries`. -message TailLogEntriesResponse { - // Information about entries that were omitted from the session. - message SuppressionInfo { - // An indicator of why entries were omitted. - enum Reason { - // Unexpected default. - REASON_UNSPECIFIED = 0; - - // Indicates suppression occurred due to relevant entries being - // received in excess of rate limits. For quotas and limits, see - // [Logging API quotas and - // limits](https://cloud.google.com/logging/quotas#api-limits). - RATE_LIMIT = 1; - - // Indicates suppression occurred due to the client not consuming - // responses quickly enough. - NOT_CONSUMED = 2; - } - - // The reason that entries were omitted from the session. - Reason reason = 1; - - // A lower bound on the count of entries omitted due to `reason`. - int32 suppressed_count = 2; - } - - // A list of log entries. Each response in the stream will order entries with - // increasing values of `LogEntry.timestamp`. Ordering is not guaranteed - // between separate responses. - repeated LogEntry entries = 1; - - // If entries that otherwise would have been included in the session were not - // sent back to the client, counts of relevant entries omitted from the - // session with the reason that they were not included. There will be at most - // one of each reason per response. The counts represent the number of - // suppressed entries since the last streamed response. - repeated SuppressionInfo suppression_info = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging_config.proto.baseline deleted file mode 100644 index ef0024063d7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/protos/google/logging/v2/logging_config.proto.baseline +++ /dev/null @@ -1,1957 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.logging.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Logging.V2"; -option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging"; -option java_multiple_files = true; -option java_outer_classname = "LoggingConfigProto"; -option java_package = "com.google.logging.v2"; -option php_namespace = "Google\\Cloud\\Logging\\V2"; -option ruby_package = "Google::Cloud::Logging::V2"; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/OrganizationLocation" - pattern: "organizations/{organization}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/FolderLocation" - pattern: "folders/{folder}/locations/{location}" -}; -option (google.api.resource_definition) = { - type: "logging.googleapis.com/BillingAccountLocation" - pattern: "billingAccounts/{billing_account}/locations/{location}" -}; - -// Service for configuring sinks used to route log entries. -service ConfigServiceV2 { - option (google.api.default_host) = "logging.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-platform.read-only," - "https://www.googleapis.com/auth/logging.admin," - "https://www.googleapis.com/auth/logging.read"; - - // Lists log buckets. - rpc ListBuckets(ListBucketsRequest) returns (ListBucketsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*}/buckets" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*}/buckets" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a log bucket. - rpc GetBucket(GetBucketRequest) returns (LogBucket) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/buckets/*}" - } - }; - } - - // Creates a log bucket that can be used to store log entries. After a bucket - // has been created, the bucket's location cannot be changed. - rpc CreateBucket(CreateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*}/buckets" - body: "bucket" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*}/buckets" - body: "bucket" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*}/buckets" - body: "bucket" - } - }; - } - - // Updates a log bucket. This method replaces the following fields in the - // existing bucket with values from the new bucket: `retention_period` - // - // If the retention period is decreased and the bucket is locked, - // `FAILED_PRECONDITION` will be returned. - // - // If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - // `FAILED_PRECONDITION` will be returned. - // - // After a bucket has been created, the bucket's location cannot be changed. - rpc UpdateBucket(UpdateBucketRequest) returns (LogBucket) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*}" - body: "bucket" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*}" - body: "bucket" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - body: "bucket" - } - }; - } - - // Deletes a log bucket. - // - // Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - // After 7 days, the bucket will be purged and all log entries in the bucket - // will be permanently deleted. - rpc DeleteBucket(DeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*}" - } - }; - } - - // Undeletes a log bucket. A bucket that has been deleted can be undeleted - // within the grace period of 7 days. - rpc UndeleteBucket(UndeleteBucketRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2/{name=*/*/locations/*/buckets/*}:undelete" - body: "*" - additional_bindings { - post: "/v2/{name=projects/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=organizations/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=folders/*/locations/*/buckets/*}:undelete" - body: "*" - } - additional_bindings { - post: "/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete" - body: "*" - } - }; - } - - // Lists views on a log bucket. - rpc ListViews(ListViewsRequest) returns (ListViewsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*/locations/*/buckets/*}/views" - additional_bindings { - get: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a view on a log bucket.. - rpc GetView(GetViewRequest) returns (LogView) { - option (google.api.http) = { - get: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - get: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/buckets/*/views/*}" - } - }; - } - - // Creates a view over log entries in a log bucket. A bucket may contain a - // maximum of 30 views. - rpc CreateView(CreateViewRequest) returns (LogView) { - option (google.api.http) = { - post: "/v2/{parent=*/*/locations/*/buckets/*}/views" - body: "view" - additional_bindings { - post: "/v2/{parent=projects/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=organizations/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=folders/*/locations/*/buckets/*}/views" - body: "view" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views" - body: "view" - } - }; - } - - // Updates a view on a log bucket. This method replaces the following fields - // in the existing view with values from the new view: `filter`. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can update the view. If this occurs, please try again in a - // few minutes. - rpc UpdateView(UpdateViewRequest) returns (LogView) { - option (google.api.http) = { - patch: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - body: "view" - additional_bindings { - patch: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - body: "view" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - body: "view" - } - }; - } - - // Deletes a view on a log bucket. - // If an `UNAVAILABLE` error is returned, this indicates that system is not in - // a state where it can delete the view. If this occurs, please try again in a - // few minutes. - rpc DeleteView(DeleteViewRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/locations/*/buckets/*/views/*}" - additional_bindings { - delete: "/v2/{name=projects/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/locations/*/buckets/*/views/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}" - } - }; - } - - // Lists sinks. - rpc ListSinks(ListSinksRequest) returns (ListSinksResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/sinks" - additional_bindings { - get: "/v2/{parent=projects/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=folders/*}/sinks" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/sinks" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a sink. - rpc GetSink(GetSinkRequest) returns (LogSink) { - option (google.api.http) = { - get: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { - get: "/v2/{sink_name=projects/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=organizations/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=folders/*/sinks/*}" - } - additional_bindings { - get: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Creates a sink that exports specified log entries to a destination. The - // export of newly-ingested log entries begins immediately, unless the sink's - // `writer_identity` is not permitted to write to the destination. A sink can - // export log entries only from the resource owning the sink. - rpc CreateSink(CreateSinkRequest) returns (LogSink) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/sinks" - body: "sink" - additional_bindings { - post: "/v2/{parent=projects/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=folders/*}/sinks" - body: "sink" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/sinks" - body: "sink" - } - }; - option (google.api.method_signature) = "parent,sink"; - } - - // Updates a sink. This method replaces the following fields in the existing - // sink with values from the new sink: `destination`, and `filter`. - // - // The updated sink might also have a new `writer_identity`; see the - // `unique_writer_identity` field. - rpc UpdateSink(UpdateSinkRequest) returns (LogSink) { - option (google.api.http) = { - put: "/v2/{sink_name=*/*/sinks/*}" - body: "sink" - additional_bindings { - put: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - put: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=projects/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=organizations/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=folders/*/sinks/*}" - body: "sink" - } - additional_bindings { - patch: "/v2/{sink_name=billingAccounts/*/sinks/*}" - body: "sink" - } - }; - option (google.api.method_signature) = "sink_name,sink,update_mask"; - option (google.api.method_signature) = "sink_name,sink"; - } - - // Deletes a sink. If the sink has a unique `writer_identity`, then that - // service account is also deleted. - rpc DeleteSink(DeleteSinkRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{sink_name=*/*/sinks/*}" - additional_bindings { - delete: "/v2/{sink_name=projects/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=organizations/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=folders/*/sinks/*}" - } - additional_bindings { - delete: "/v2/{sink_name=billingAccounts/*/sinks/*}" - } - }; - option (google.api.method_signature) = "sink_name"; - } - - // Lists all the exclusions on the _Default sink in a parent resource. - rpc ListExclusions(ListExclusionsRequest) returns (ListExclusionsResponse) { - option (google.api.http) = { - get: "/v2/{parent=*/*}/exclusions" - additional_bindings { - get: "/v2/{parent=projects/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=organizations/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=folders/*}/exclusions" - } - additional_bindings { - get: "/v2/{parent=billingAccounts/*}/exclusions" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the description of an exclusion in the _Default sink. - rpc GetExclusion(GetExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - get: "/v2/{name=*/*/exclusions/*}" - additional_bindings { - get: "/v2/{name=projects/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=organizations/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=folders/*/exclusions/*}" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new exclusion in the _Default sink in a specified parent - // resource. Only log entries belonging to that resource can be excluded. You - // can have up to 10 exclusions in a resource. - rpc CreateExclusion(CreateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - post: "/v2/{parent=*/*}/exclusions" - body: "exclusion" - additional_bindings { - post: "/v2/{parent=projects/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=organizations/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=folders/*}/exclusions" - body: "exclusion" - } - additional_bindings { - post: "/v2/{parent=billingAccounts/*}/exclusions" - body: "exclusion" - } - }; - option (google.api.method_signature) = "parent,exclusion"; - } - - // Changes one or more properties of an existing exclusion in the _Default - // sink. - rpc UpdateExclusion(UpdateExclusionRequest) returns (LogExclusion) { - option (google.api.http) = { - patch: "/v2/{name=*/*/exclusions/*}" - body: "exclusion" - additional_bindings { - patch: "/v2/{name=projects/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=organizations/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=folders/*/exclusions/*}" - body: "exclusion" - } - additional_bindings { - patch: "/v2/{name=billingAccounts/*/exclusions/*}" - body: "exclusion" - } - }; - option (google.api.method_signature) = "name,exclusion,update_mask"; - } - - // Deletes an exclusion in the _Default sink. - rpc DeleteExclusion(DeleteExclusionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=*/*/exclusions/*}" - additional_bindings { - delete: "/v2/{name=projects/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=organizations/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=folders/*/exclusions/*}" - } - additional_bindings { - delete: "/v2/{name=billingAccounts/*/exclusions/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Gets the Logging CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can be configured for Google Cloud projects, - // folders, organizations and billing accounts. Once configured for an - // organization, it applies to all projects and folders in the Google Cloud - // organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetCmekSettings(GetCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/cmekSettings" - additional_bindings { - get: "/v2/{name=projects/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=organizations/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=folders/*}/cmekSettings" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*}/cmekSettings" - } - }; - } - - // Updates the Log Router CMEK settings for the given resource. - // - // Note: CMEK for the Log Router can currently only be configured for Google - // Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateCmekSettings(UpdateCmekSettingsRequest) returns (CmekSettings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/cmekSettings" - body: "cmek_settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/cmekSettings" - body: "cmek_settings" - } - }; - } - - // Gets the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can be get for Google Cloud projects, - // folders, organizations and billing accounts. Currently it can only be - // configured for organizations. Once configured for an organization, it - // applies to all projects and folders in the Google Cloud organization. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v2/{name=*/*}/settings" - additional_bindings { - get: "/v2/{name=projects/*}/settings" - } - additional_bindings { - get: "/v2/{name=organizations/*}/settings" - } - additional_bindings { - get: "/v2/{name=folders/*}/settings" - } - additional_bindings { - get: "/v2/{name=billingAccounts/*}/settings" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates the Log Router settings for the given resource. - // - // Note: Settings for the Log Router can currently only be configured for - // Google Cloud organizations. Once configured, it applies to all projects and - // folders in the Google Cloud organization. - // - // [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] - // will fail if 1) `kms_key_name` is invalid, or 2) the associated service - // account does not have the required - // `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - // 3) access to the key is disabled. 4) `location_id` is not supported by - // Logging. 5) `location_id` violate OrgPolicy. - // - // See [Enabling CMEK for Log - // Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - // for more information. - rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { - option (google.api.http) = { - patch: "/v2/{name=*/*}/settings" - body: "settings" - additional_bindings { - patch: "/v2/{name=organizations/*}/settings" - body: "settings" - } - additional_bindings { - patch: "/v2/{name=folders/*}/settings" - body: "settings" - } - }; - option (google.api.method_signature) = "settings,update_mask"; - } - - // Copies a set of log entries from a log bucket to a Cloud Storage bucket. - rpc CopyLogEntries(CopyLogEntriesRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2/entries:copy" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "CopyLogEntriesResponse" - metadata_type: "CopyLogEntriesMetadata" - }; - } -} - -// Describes a repository in which log entries are stored. -message LogBucket { - option (google.api.resource) = { - type: "logging.googleapis.com/LogBucket" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}" - }; - - // Output only. The resource name of the bucket. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket` - // - // For a list of supported locations, see [Supported - // Regions](https://cloud.google.com/logging/docs/region-support) - // - // For the location of `global` it is unspecified where log entries are - // actually stored. - // - // After a bucket has been created, the location cannot be changed. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Describes this bucket. - string description = 3; - - // Output only. The creation timestamp of the bucket. This is not set for any of the - // default buckets. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the bucket. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Logs will be retained by default for this amount of time, after which they - // will automatically be deleted. The minimum retention period is 1 day. If - // this value is set to zero at bucket creation time, the default time of 30 - // days will be used. - int32 retention_days = 11; - - // Whether the bucket is locked. - // - // The retention period on a locked bucket cannot be changed. Locked buckets - // may only be deleted if they are empty. - bool locked = 9; - - // Output only. The bucket lifecycle state. - LifecycleState lifecycle_state = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Log entry field paths that are denied access in this bucket. - // - // The following fields and their children are eligible: `textPayload`, - // `jsonPayload`, `protoPayload`, `httpRequest`, `labels`, `sourceLocation`. - // - // Restricting a repeated field will restrict all values. Adding a parent will - // block all child fields. (e.g. `foo.bar` will block `foo.bar.baz`) - repeated string restricted_fields = 15; - - // The CMEK settings of the log bucket. If present, new log entries written to - // this log bucket are encrypted using the CMEK key provided in this - // configuration. If a log bucket has CMEK settings, the CMEK settings cannot - // be disabled later by updating the log bucket. Changing the KMS key is - // allowed. - CmekSettings cmek_settings = 19; -} - -// Describes a view over log entries in a bucket. -message LogView { - option (google.api.resource) = { - type: "logging.googleapis.com/LogView" - pattern: "projects/{project}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}" - pattern: "billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}" - }; - - // The resource name of the view. - // - // For example: - // - // `projects/my-project/locations/global/buckets/my-bucket/views/my-view` - string name = 1; - - // Describes this view. - string description = 3; - - // Output only. The creation timestamp of the view. - google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the view. - google.protobuf.Timestamp update_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Filter that restricts which log entries in a bucket are visible in this - // view. - // - // Filters are restricted to be a logical AND of ==/!= of any of the - // following: - // - // - originating project/folder/organization/billing account. - // - resource type - // - log id - // - // For example: - // - // SOURCE("projects/myproject") AND resource.type = "gce_instance" - // AND LOG_ID("stdout") - string filter = 7; -} - -// Describes a sink used to export log entries to one of the following -// destinations in any project: a Cloud Storage bucket, a BigQuery dataset, a -// Pub/Sub topic or a Cloud Logging log bucket. A logs filter controls which log -// entries are exported. The sink must be created within a project, -// organization, billing account, or folder. -message LogSink { - option (google.api.resource) = { - type: "logging.googleapis.com/LogSink" - pattern: "projects/{project}/sinks/{sink}" - pattern: "organizations/{organization}/sinks/{sink}" - pattern: "folders/{folder}/sinks/{sink}" - pattern: "billingAccounts/{billing_account}/sinks/{sink}" - }; - - // Deprecated. This is unused. - enum VersionFormat { - // An unspecified format version that will default to V2. - VERSION_FORMAT_UNSPECIFIED = 0; - - // `LogEntry` version 2 format. - V2 = 1; - - // `LogEntry` version 1 format. - V1 = 2; - } - - // Required. The client-assigned sink identifier, unique within the project. - // - // For example: `"my-syslog-errors-to-pubsub"`. Sink identifiers are limited - // to 100 characters and can include only the following characters: upper and - // lower-case alphanumeric characters, underscores, hyphens, and periods. - // First character has to be alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The export destination: - // - // "storage.googleapis.com/[GCS_BUCKET]" - // "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]" - // "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]" - // - // The sink's `writer_identity`, set when the sink is created, must have - // permission to write to the destination or else the log entries are not - // exported. For more information, see - // [Exporting Logs with - // Sinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - string destination = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "*" - } - ]; - - // Optional. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries). The - // only exported log entries are those that are in the resource owning the - // sink and that match the filter. - // - // For example: - // - // `logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR` - string filter = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A description of this sink. - // - // The maximum length of the description is 8000 characters. - string description = 18 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, then this sink is disabled and it does not export any log - // entries. - bool disabled = 19 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Log entries that match any of these exclusion filters will not be exported. - // - // If a log entry is matched by both `filter` and one of `exclusion_filters` - // it will not be exported. - repeated LogExclusion exclusions = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Deprecated. This field is unused. - VersionFormat output_version_format = 6 [deprecated = true]; - - // Output only. An IAM identity—a service account or group—under which Cloud - // Logging writes the exported log entries to the sink's destination. This - // field is set by - // [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] and - // [sinks.update][google.logging.v2.ConfigServiceV2.UpdateSink] based on the - // value of `unique_writer_identity` in those methods. - // - // Until you grant this identity write-access to the destination, log entry - // exports from this sink will fail. For more information, see [Granting - // Access for a - // Resource](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource). - // Consult the destination service's documentation to determine the - // appropriate IAM roles to assign to the identity. - // - // Sinks that have a destination that is a log bucket in the same project as - // the sink do not have a writer_identity and no additional permissions are - // required. - string writer_identity = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This field applies only to sinks owned by organizations and folders. If the - // field is false, the default, only the logs owned by the sink's parent - // resource are available for export. If the field is true, then log entries - // from all the projects, folders, and billing accounts contained in the - // sink's parent resource are also available for export. Whether a particular - // log entry from the children is exported depends on the sink's filter - // expression. - // - // For example, if this field is true, then the filter - // `resource.type=gce_instance` would export all Compute Engine VM instance - // log entries from all projects in the sink's parent. - // - // To only export entries from certain child projects, filter on the project - // part of the log name: - // - // logName:("projects/test-project1/" OR "projects/test-project2/") AND - // resource.type=gce_instance - bool include_children = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Destination dependent options. - oneof options { - // Optional. Options that affect sinks exporting data to BigQuery. - BigQueryOptions bigquery_options = 12 [(google.api.field_behavior) = OPTIONAL]; - } - - // Output only. The creation timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the sink. - // - // This field may not be present for older sinks. - google.protobuf.Timestamp update_time = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Options that change functionality of a sink exporting data to BigQuery. -message BigQueryOptions { - // Optional. Whether to use [BigQuery's partition - // tables](https://cloud.google.com/bigquery/docs/partitioned-tables). By - // default, Cloud Logging creates dated tables based on the log entries' - // timestamps, e.g. syslog_20170523. With partitioned tables the date suffix - // is no longer present and [special query - // syntax](https://cloud.google.com/bigquery/docs/querying-partitioned-tables) - // has to be used instead. In both cases, tables are sharded based on UTC - // timezone. - bool use_partitioned_tables = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. True if new timestamp column based partitioning is in use, false if legacy - // ingestion-time partitioning is in use. - // - // All new sinks will have this field set true and will use timestamp column - // based partitioning. If use_partitioned_tables is false, this value has no - // meaning and will be false. Legacy sinks using partitioned tables will have - // this field set to false. - bool uses_timestamp_column_partitioning = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The parameters to `ListBuckets`. -message ListBucketsRequest { - // Required. The parent resource whose buckets are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - // - // Note: The locations portion of the resource must be specified, but - // supplying the character `-` in place of [LOCATION_ID] will return all - // buckets. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the preceding call - // to this method. `pageToken` must be the value of `nextPageToken` from the - // previous response. The values of other method parameters should be - // identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. Non-positive - // values are ignored. The presence of `nextPageToken` in the response - // indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListBuckets. -message ListBucketsResponse { - // A list of buckets. - repeated LogBucket buckets = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateBucket`. -message CreateBucketRequest { - // Required. The resource in which to create the log bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - // - // For example: - // - // `"projects/my-project/locations/global"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - // to 100 characters and can include only letters, digits, underscores, - // hyphens, and periods. - string bucket_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new bucket. The region specified in the new bucket must be compliant - // with any Location Restriction Org Policy. The name field in the bucket is - // ignored. - LogBucket bucket = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateBucket`. -message UpdateBucketRequest { - // Required. The full resource name of the bucket to update. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; - - // Required. The updated bucket. - LogBucket bucket = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Field mask that specifies the fields in `bucket` that need an update. A - // bucket field will be overwritten if, and only if, it is in the update mask. - // `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see: - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=retention_days` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `GetBucket`. -message GetBucketRequest { - // Required. The resource name of the bucket: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `DeleteBucket`. -message DeleteBucketRequest { - // Required. The full resource name of the bucket to delete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `UndeleteBucket`. -message UndeleteBucketRequest { - // Required. The full resource name of the bucket to undelete. - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogBucket" - } - ]; -} - -// The parameters to `ListViews`. -message ListViewsRequest { - // Required. The bucket whose views are to be listed: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If present, then retrieve the next batch of results from the preceding call - // to this method. `pageToken` must be the value of `nextPageToken` from the - // previous response. The values of other method parameters should be - // identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response from ListViews. -message ListViewsResponse { - // A list of views. - repeated LogView views = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `CreateView`. -message CreateViewRequest { - // Required. The bucket in which to create the view - // - // `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket"` - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The id to use for this view. - string view_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new view. - LogView view = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to `UpdateView`. -message UpdateViewRequest { - // Required. The full resource name of the view to update - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The updated view. - LogView view = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Field mask that specifies the fields in `view` that need - // an update. A field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `GetView`. -message GetViewRequest { - // Required. The resource name of the policy: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogView" - } - ]; -} - -// The parameters to `DeleteView`. -message DeleteViewRequest { - // Required. The full resource name of the view to delete: - // - // "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - // - // For example: - // - // `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogView" - } - ]; -} - -// The parameters to `ListSinks`. -message ListSinksRequest { - // Required. The parent resource whose sinks are to be listed: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from `ListSinks`. -message ListSinksResponse { - // A list of sinks. - repeated LogSink sinks = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call the same - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to `GetSink`. -message GetSinkRequest { - // Required. The resource name of the sink: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; -} - -// The parameters to `CreateSink`. -message CreateSinkRequest { - // Required. The resource in which to create the sink: - // - // "projects/[PROJECT_ID]" - // "organizations/[ORGANIZATION_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]" - // "folders/[FOLDER_ID]" - // - // For examples: - // - // `"projects/my-project"` - // `"organizations/123456789"` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The new sink, whose `name` parameter is a sink identifier that - // is not already in use. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines the kind of IAM identity returned as `writer_identity` - // in the new sink. If this value is omitted or set to false, and if the - // sink's parent is a project, then the value returned as `writer_identity` is - // the same group or service account used by Cloud Logging before the addition - // of writer identities to this API. The sink's destination must be in the - // same project as the sink itself. - // - // If this field is set to true, or if the sink is owned by a non-project - // resource such as an organization, then the value of `writer_identity` will - // be a unique service account used only for exports from the new sink. For - // more information, see `writer_identity` in [LogSink][google.logging.v2.LogSink]. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `UpdateSink`. -message UpdateSinkRequest { - // Required. The full resource name of the sink to update, including the parent - // resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; - - // Required. The updated sink, whose name is the same identifier that appears as part - // of `sink_name`. - LogSink sink = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. See [sinks.create][google.logging.v2.ConfigServiceV2.CreateSink] - // for a description of this field. When updating a sink, the effect of this - // field on the value of `writer_identity` in the updated sink depends on both - // the old and new values of this field: - // - // + If the old and new values of this field are both false or both true, - // then there is no change to the sink's `writer_identity`. - // + If the old value is false and the new value is true, then - // `writer_identity` is changed to a unique service account. - // + It is an error if the old value is true and the new value is - // set to false or defaulted to false. - bool unique_writer_identity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Field mask that specifies the fields in `sink` that need - // an update. A sink field will be overwritten if, and only if, it is - // in the update mask. `name` and output only fields cannot be updated. - // - // An empty `updateMask` is temporarily treated as using the following mask - // for backwards compatibility purposes: - // - // `destination,filter,includeChildren` - // - // At some point in the future, behavior will be removed and specifying an - // empty `updateMask` will be an error. - // - // For a detailed `FieldMask` definition, see - // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - // - // For example: `updateMask=filter` - google.protobuf.FieldMask update_mask = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// The parameters to `DeleteSink`. -message DeleteSinkRequest { - // Required. The full resource name of the sink to delete, including the parent - // resource and the sink identifier: - // - // "projects/[PROJECT_ID]/sinks/[SINK_ID]" - // "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - // "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - // "folders/[FOLDER_ID]/sinks/[SINK_ID]" - // - // For example: - // - // `"projects/my-project/sinks/my-sink"` - string sink_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogSink" - } - ]; -} - -// Specifies a set of log entries that are filtered out by a sink. If -// your Google Cloud resource receives a large volume of log entries, you can -// use exclusions to reduce your chargeable logs. Note that exclusions on -// organization-level and folder-level sinks don't apply to child resources. -// Note also that you cannot modify the _Required sink or exclude logs from it. -message LogExclusion { - option (google.api.resource) = { - type: "logging.googleapis.com/LogExclusion" - pattern: "projects/{project}/exclusions/{exclusion}" - pattern: "organizations/{organization}/exclusions/{exclusion}" - pattern: "folders/{folder}/exclusions/{exclusion}" - pattern: "billingAccounts/{billing_account}/exclusions/{exclusion}" - }; - - // Required. A client-assigned identifier, such as `"load-balancer-exclusion"`. - // Identifiers are limited to 100 characters and can include only letters, - // digits, underscores, hyphens, and periods. First character has to be - // alphanumeric. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A description of this exclusion. - string description = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. An [advanced logs - // filter](https://cloud.google.com/logging/docs/view/advanced-queries) that - // matches the log entries to be excluded. By using the [sample - // function](https://cloud.google.com/logging/docs/view/advanced-queries#sample), - // you can exclude less than 100% of the matching log entries. - // - // For example, the following query matches 99% of low-severity log entries - // from Google Cloud Storage buckets: - // - // `resource.type=gcs_bucket severity=ERROR" - // - // The maximum length of the filter is 20000 characters. - string filter = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. If set to True, then this metric is disabled and it does not - // generate any points. - bool disabled = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The metric descriptor associated with the logs-based metric. - // If unspecified, it uses a default metric descriptor with a DELTA metric - // kind, INT64 value type, with no labels and a unit of "1". Such a metric - // counts the number of log entries matching the `filter` expression. - // - // The `name`, `type`, and `description` fields in the `metric_descriptor` - // are output only, and is constructed using the `name` and `description` - // field in the LogMetric. - // - // To create a logs-based metric that records a distribution of log values, a - // DELTA metric kind with a DISTRIBUTION value type must be used along with - // a `value_extractor` expression in the LogMetric. - // - // Each label in the metric descriptor must have a matching label - // name as the key and an extractor expression as the value in the - // `label_extractors` map. - // - // The `metric_kind` and `value_type` fields in the `metric_descriptor` cannot - // be updated once initially configured. New labels can be added in the - // `metric_descriptor`, but existing labels cannot be modified except for - // their description. - google.api.MetricDescriptor metric_descriptor = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A `value_extractor` is required when using a distribution - // logs-based metric to extract the values to record from a log entry. - // Two functions are supported for value extraction: `EXTRACT(field)` or - // `REGEXP_EXTRACT(field, regex)`. The argument are: - // 1. field: The name of the log entry field from which the value is to be - // extracted. - // 2. regex: A regular expression using the Google RE2 syntax - // (https://github.com/google/re2/wiki/Syntax) with a single capture - // group to extract data from the specified log entry field. The value - // of the field is converted to a string before applying the regex. - // It is an error to specify a regex that does not include exactly one - // capture group. - // - // The result of the extraction must be convertible to a double type, as the - // distribution always records double values. If either the extraction or - // the conversion to double fails, then those values are not recorded in the - // distribution. - // - // Example: `REGEXP_EXTRACT(jsonPayload.request, ".*quantity=(\d+).*")` - string value_extractor = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A map from a label key string to an extractor expression which is - // used to extract data from a log entry field and assign as the label value. - // Each label key specified in the LabelDescriptor must have an associated - // extractor expression in this map. The syntax of the extractor expression - // is the same as for the `value_extractor` field. - // - // The extracted value is converted to the type defined in the label - // descriptor. If the either the extraction or the type conversion fails, - // the label will have a default value. The default value for a string - // label is an empty string, for an integer label its 0, and for a boolean - // label its `false`. - // - // Note that there are upper bounds on the maximum number of labels and the - // number of active time series that are allowed in a project. - map label_extractors = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The `bucket_options` are required when the logs-based metric is - // using a DISTRIBUTION value type and it describes the bucket boundaries - // used to create a histogram of the extracted values. - google.api.Distribution.BucketOptions bucket_options = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The creation timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp create_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update timestamp of the metric. - // - // This field may not be present for older metrics. - google.protobuf.Timestamp update_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Deprecated. The API version that created or updated this metric. - // The v2 format is used by default and cannot be changed. - ApiVersion version = 4 [deprecated = true]; -} - -// The parameters to ListLogMetrics. -message ListLogMetricsRequest { - // Required. The name of the project containing the metrics: - // - // "projects/[PROJECT_ID]" - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. If present, then retrieve the next batch of results from the - // preceding call to this method. `pageToken` must be the value of - // `nextPageToken` from the previous response. The values of other method - // parameters should be identical to those in the previous call. - string page_token = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The maximum number of results to return from this request. - // Non-positive values are ignored. The presence of `nextPageToken` in the - // response indicates that more results might be available. - int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Result returned from ListLogMetrics. -message ListLogMetricsResponse { - // A list of logs-based metrics. - repeated LogMetric metrics = 1; - - // If there might be more results than appear in this response, then - // `nextPageToken` is included. To get the next set of results, call this - // method again using the value of `nextPageToken` as `pageToken`. - string next_page_token = 2; -} - -// The parameters to GetLogMetric. -message GetLogMetricRequest { - // Required. The resource name of the desired metric: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} - -// The parameters to CreateLogMetric. -message CreateLogMetricRequest { - // Required. The resource name of the project in which to create the metric: - // - // "projects/[PROJECT_ID]" - // - // The new metric must be provided in the request. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The new logs-based metric, which must not have an identifier that - // already exists. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to UpdateLogMetric. -message UpdateLogMetricRequest { - // Required. The resource name of the metric to update: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - // - // The updated metric must be provided in the request and it's - // `name` field must be the same as `[METRIC_ID]` If the metric - // does not exist in `[PROJECT_ID]`, then a new metric is created. - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; - - // Required. The updated metric. - LogMetric metric = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The parameters to DeleteLogMetric. -message DeleteLogMetricRequest { - // Required. The resource name of the metric to delete: - // - // "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - string metric_name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "logging.googleapis.com/LogMetric" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline deleted file mode 100644 index 1c3061e72b2e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.copy_log_entries.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, destination) { - // [START logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Log bucket from which to copy log entries. - * For example: - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - */ - // const name = 'abc123' - /** - * Optional. A filter specifying which log entries to copy. The filter must be no more - * than 20k characters. An empty filter matches all log entries. - */ - // const filter = 'abc123' - /** - * Required. Destination to which to copy log entries. - */ - // const destination = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCopyLogEntries() { - // Construct request - const request = { - name, - destination, - }; - - // Run request - const [operation] = await loggingClient.copyLogEntries(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCopyLogEntries(); - // [END logging_v2_generated_ConfigServiceV2_CopyLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_bucket.js.baseline deleted file mode 100644 index 771360131be9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_bucket.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, bucketId, bucket) { - // [START logging_v2_generated_ConfigServiceV2_CreateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the log bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * For example: - * `"projects/my-project/locations/global"` - */ - // const parent = 'abc123' - /** - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - * to 100 characters and can include only letters, digits, underscores, - * hyphens, and periods. - */ - // const bucketId = 'abc123' - /** - * Required. The new bucket. The region specified in the new bucket must be compliant - * with any Location Restriction Org Policy. The name field in the bucket is - * ignored. - */ - // const bucket = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateBucket() { - // Construct request - const request = { - parent, - bucketId, - bucket, - }; - - // Run request - const response = await loggingClient.createBucket(request); - console.log(response); - } - - callCreateBucket(); - // [END logging_v2_generated_ConfigServiceV2_CreateBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_exclusion.js.baseline deleted file mode 100644 index 152d2bf9ddd3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_exclusion.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, exclusion) { - // [START logging_v2_generated_ConfigServiceV2_CreateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource in which to create the exclusion: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-logging-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - */ - // const exclusion = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateExclusion() { - // Construct request - const request = { - parent, - exclusion, - }; - - // Run request - const response = await loggingClient.createExclusion(request); - console.log(response); - } - - callCreateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_CreateExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_sink.js.baseline deleted file mode 100644 index 93646b5b4e91..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_sink.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, sink) { - // [START logging_v2_generated_ConfigServiceV2_CreateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource in which to create the sink: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * For examples: - * `"projects/my-project"` - * `"organizations/123456789"` - */ - // const parent = 'abc123' - /** - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - */ - // const sink = {} - /** - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in LogSink google.logging.v2.LogSink. - */ - // const uniqueWriterIdentity = true - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateSink() { - // Construct request - const request = { - parent, - sink, - }; - - // Run request - const response = await loggingClient.createSink(request); - console.log(response); - } - - callCreateSink(); - // [END logging_v2_generated_ConfigServiceV2_CreateSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_view.js.baseline deleted file mode 100644 index b47aabe3b6a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.create_view.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, viewId, view) { - // [START logging_v2_generated_ConfigServiceV2_CreateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket in which to create the view - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const parent = 'abc123' - /** - * Required. The id to use for this view. - */ - // const viewId = 'abc123' - /** - * Required. The new view. - */ - // const view = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callCreateView() { - // Construct request - const request = { - parent, - viewId, - view, - }; - - // Run request - const response = await loggingClient.createView(request); - console.log(response); - } - - callCreateView(); - // [END logging_v2_generated_ConfigServiceV2_CreateView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_bucket.js.baseline deleted file mode 100644 index dd6676b03c50..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to delete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteBucket(request); - console.log(response); - } - - callDeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_DeleteBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline deleted file mode 100644 index 3d0dc8ac2329..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_exclusion.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion to delete: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteExclusion(request); - console.log(response); - } - - callDeleteExclusion(); - // [END logging_v2_generated_ConfigServiceV2_DeleteExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_sink.js.baseline deleted file mode 100644 index af2c37cc2524..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_sink.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_DeleteSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to delete, including the parent - * resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.deleteSink(request); - console.log(response); - } - - callDeleteSink(); - // [END logging_v2_generated_ConfigServiceV2_DeleteSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_view.js.baseline deleted file mode 100644 index 8c7267a5f835..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.delete_view.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_DeleteView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to delete: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callDeleteView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.deleteView(request); - console.log(response); - } - - callDeleteView(); - // [END logging_v2_generated_ConfigServiceV2_DeleteView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_bucket.js.baseline deleted file mode 100644 index c540b330f073..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the bucket: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getBucket(request); - console.log(response); - } - - callGetBucket(); - // [END logging_v2_generated_ConfigServiceV2_GetBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline deleted file mode 100644 index 12c51710399e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_cmek_settings.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve CMEK settings. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetCmekSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getCmekSettings(request); - console.log(response); - } - - callGetCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetCmekSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_exclusion.js.baseline deleted file mode 100644 index f2c49bf6088f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_exclusion.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of an existing exclusion: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetExclusion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getExclusion(request); - console.log(response); - } - - callGetExclusion(); - // [END logging_v2_generated_ConfigServiceV2_GetExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_settings.js.baseline deleted file mode 100644 index 30ef52b74775..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_settings.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource for which to retrieve settings. - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END logging_v2_generated_ConfigServiceV2_GetSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_sink.js.baseline deleted file mode 100644 index 9b597a4b8aae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_sink.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName) { - // [START logging_v2_generated_ConfigServiceV2_GetSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the sink: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetSink() { - // Construct request - const request = { - sinkName, - }; - - // Run request - const response = await loggingClient.getSink(request); - console.log(response); - } - - callGetSink(); - // [END logging_v2_generated_ConfigServiceV2_GetSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_view.js.baseline deleted file mode 100644 index 708cf1c403e1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.get_view.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_GetView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the policy: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callGetView() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.getView(request); - console.log(response); - } - - callGetView(); - // [END logging_v2_generated_ConfigServiceV2_GetView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_buckets.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_buckets.js.baseline deleted file mode 100644 index 5dc536acb875..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_buckets.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListBuckets_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose buckets are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of LOCATION_ID will return all - * buckets. - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListBuckets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listBucketsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBuckets(); - // [END logging_v2_generated_ConfigServiceV2_ListBuckets_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_exclusions.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_exclusions.js.baseline deleted file mode 100644 index 4dadbf094736..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_exclusions.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListExclusions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose exclusions are to be listed. - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListExclusions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listExclusionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListExclusions(); - // [END logging_v2_generated_ConfigServiceV2_ListExclusions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_sinks.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_sinks.js.baseline deleted file mode 100644 index bbdd5697a6a2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_sinks.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListSinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource whose sinks are to be listed: - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListSinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listSinksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSinks(); - // [END logging_v2_generated_ConfigServiceV2_ListSinks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_views.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_views.js.baseline deleted file mode 100644 index 0c7779a881aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.list_views.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_ConfigServiceV2_ListViews_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The bucket whose views are to be listed: - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callListViews() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listViewsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListViews(); - // [END logging_v2_generated_ConfigServiceV2_ListViews_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline deleted file mode 100644 index 6f4c111057b9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.undelete_bucket.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to undelete. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUndeleteBucket() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await loggingClient.undeleteBucket(request); - console.log(response); - } - - callUndeleteBucket(); - // [END logging_v2_generated_ConfigServiceV2_UndeleteBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_bucket.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_bucket.js.baseline deleted file mode 100644 index 274220ab8257..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_bucket.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, bucket, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateBucket_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the bucket to update. - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket"` - */ - // const name = 'abc123' - /** - * Required. The updated bucket. - */ - // const bucket = {} - /** - * Required. Field mask that specifies the fields in `bucket` that need an update. A - * bucket field will be overwritten if, and only if, it is in the update mask. - * `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=retention_days` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateBucket() { - // Construct request - const request = { - name, - bucket, - updateMask, - }; - - // Run request - const response = await loggingClient.updateBucket(request); - console.log(response); - } - - callUpdateBucket(); - // [END logging_v2_generated_ConfigServiceV2_UpdateBucket_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline deleted file mode 100644 index 16bcd37a6f78..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_cmek_settings.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, cmekSettings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the CMEK settings to update. - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * For example: - * `"organizations/12345/cmekSettings"` - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The CMEK settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const cmekSettings = {} - /** - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateCmekSettings() { - // Construct request - const request = { - name, - cmekSettings, - }; - - // Run request - const response = await loggingClient.updateCmekSettings(request); - console.log(response); - } - - callUpdateCmekSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_exclusion.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_exclusion.js.baseline deleted file mode 100644 index 8a5a6efe15cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_exclusion.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, exclusion, updateMask) { - // [START logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the exclusion to update: - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * For example: - * `"projects/my-project/exclusions/my-exclusion"` - */ - // const name = 'abc123' - /** - * Required. New values for the existing exclusion. Only the fields specified in - * `update_mask` are relevant. - */ - // const exclusion = {} - /** - * Required. A non-empty list of fields to change in the existing exclusion. New values - * for the fields are taken from the corresponding fields in the - * LogExclusion google.logging.v2.LogExclusion included in this request. Fields not mentioned in - * `update_mask` are not changed and are ignored in the request. - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateExclusion() { - // Construct request - const request = { - name, - exclusion, - updateMask, - }; - - // Run request - const response = await loggingClient.updateExclusion(request); - console.log(response); - } - - callUpdateExclusion(); - // [END logging_v2_generated_ConfigServiceV2_UpdateExclusion_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_settings.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_settings.js.baseline deleted file mode 100644 index 190d3707184b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_settings.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, settings) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the settings to update. - * "organizations/[ORGANIZATION_ID]/settings" - * For example: - * `"organizations/12345/settings"` - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - */ - // const name = 'abc123' - /** - * Required. The settings to update. - * See Enabling CMEK for Log - * Router (https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - */ - // const settings = {} - /** - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * See FieldMask google.protobuf.FieldMask for more information. - * For example: `"updateMask=kmsKeyName"` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSettings() { - // Construct request - const request = { - name, - settings, - }; - - // Run request - const response = await loggingClient.updateSettings(request); - console.log(response); - } - - callUpdateSettings(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_sink.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_sink.js.baseline deleted file mode 100644 index 7d0ce38467f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_sink.js.baseline +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(sinkName, sink) { - // [START logging_v2_generated_ConfigServiceV2_UpdateSink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the sink to update, including the parent - * resource and the sink identifier: - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * For example: - * `"projects/my-project/sinks/my-sink"` - */ - // const sinkName = 'abc123' - /** - * Required. The updated sink, whose name is the same identifier that appears as part - * of `sink_name`. - */ - // const sink = {} - /** - * Optional. See sinks.create google.logging.v2.ConfigServiceV2.CreateSink - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - */ - // const uniqueWriterIdentity = true - /** - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * `destination,filter,includeChildren` - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateSink() { - // Construct request - const request = { - sinkName, - sink, - }; - - // Run request - const response = await loggingClient.updateSink(request); - console.log(response); - } - - callUpdateSink(); - // [END logging_v2_generated_ConfigServiceV2_UpdateSink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_view.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_view.js.baseline deleted file mode 100644 index 0fc07bc1c5af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/config_service_v2.update_view.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, view) { - // [START logging_v2_generated_ConfigServiceV2_UpdateView_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The full resource name of the view to update - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * For example: - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - */ - // const name = 'abc123' - /** - * Required. The updated view. - */ - // const view = {} - /** - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * For example: `updateMask=filter` - */ - // const updateMask = {} - - // Imports the Logging library - const {ConfigServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new ConfigServiceV2Client(); - - async function callUpdateView() { - // Construct request - const request = { - name, - view, - }; - - // Run request - const response = await loggingClient.updateView(request); - console.log(response); - } - - callUpdateView(); - // [END logging_v2_generated_ConfigServiceV2_UpdateView_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.delete_log.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.delete_log.js.baseline deleted file mode 100644 index 9dadeea5c5cd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.delete_log.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(logName) { - // [START logging_v2_generated_LoggingServiceV2_DeleteLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the log to delete: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * For more information about log names, see - * LogEntry google.logging.v2.LogEntry. - */ - // const logName = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callDeleteLog() { - // Construct request - const request = { - logName, - }; - - // Run request - const response = await loggingClient.deleteLog(request); - console.log(response); - } - - callDeleteLog(); - // [END logging_v2_generated_LoggingServiceV2_DeleteLog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline deleted file mode 100644 index 8b1db23fa6ee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_log_entries.js.baseline +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_ListLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * Projects listed in the `project_ids` field are added to this list. - */ - // const resourceNames = ['abc','def'] - /** - * Optional. A filter that chooses which log entries to return. See Advanced - * Logs Queries (https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - */ - // const filter = 'abc123' - /** - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - */ - // const orderBy = 'abc123' - /** - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const iterable = loggingClient.listLogEntriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_ListLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_logs.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_logs.js.baseline deleted file mode 100644 index ed99f36bcd86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_logs.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_LoggingServiceV2_ListLogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name that owns the logs: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The resource name that owns the logs: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * To support legacy queries, it could also be: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - */ - // const resourceNames = ['abc','def'] - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListLogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listLogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogs(); - // [END logging_v2_generated_LoggingServiceV2_ListLogs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline deleted file mode 100644 index 9e7193e0bd5a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - }; - - // Run request - const iterable = loggingClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline deleted file mode 100644 index 9e2ae9a55201..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.tail_log_entries.js.baseline +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resourceNames) { - // [START logging_v2_generated_LoggingServiceV2_TailLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of a parent resource from which to retrieve log entries: - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * May alternatively be one or more views: - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - */ - // const resourceNames = ['abc','def'] - /** - * Optional. A filter that chooses which log entries to return. See Advanced - * Logs Filters (https://cloud.google.com/logging/docs/view/advanced_filters). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not in `resource_names` will cause - * the filter to return no results. The maximum length of the filter is 20000 - * characters. - */ - // const filter = 'abc123' - /** - * Optional. The amount of time to buffer log entries at the server before - * being returned to prevent out of order results due to late arriving log - * entries. Valid values are between 0-60000 milliseconds. Defaults to 2000 - * milliseconds. - */ - // const bufferWindow = {} - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callTailLogEntries() { - // Construct request - const request = { - resourceNames, - }; - - // Run request - const stream = await loggingClient.tailLogEntries(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callTailLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_TailLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline deleted file mode 100644 index e53125e23515..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/logging_service_v2.write_log_entries.js.baseline +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(entries) { - // [START logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * `[LOG_ID]` must be URL-encoded. For example: - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - */ - // const logName = 'abc123' - /** - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * See LogEntry google.logging.v2.LogEntry. - */ - // const resource = {} - /** - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See LogEntry google.logging.v2.LogEntry. - */ - // const labels = [1,2,3,4] - /** - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * LogEntry google.logging.v2.LogEntry type. - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * Log entries with timestamps that are more than the - * logs retention period (https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be exported - * with - * LogSinks (https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * To improve throughput and to avoid exceeding the - * quota limit (https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - */ - // const entries = [1,2,3,4] - /** - * Optional. Whether valid entries should be written even if some other - * entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - * entry is not written, then the response status is the error associated - * with one of the failed entries and the response includes error details - * keyed by the entries' zero-based index in the `entries.write` method. - */ - // const partialSuccess = true - /** - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - */ - // const dryRun = true - - // Imports the Logging library - const {LoggingServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new LoggingServiceV2Client(); - - async function callWriteLogEntries() { - // Construct request - const request = { - entries, - }; - - // Run request - const response = await loggingClient.writeLogEntries(request); - console.log(response); - } - - callWriteLogEntries(); - // [END logging_v2_generated_LoggingServiceV2_WriteLogEntries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline deleted file mode 100644 index 5cc46e7112d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.create_log_metric.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, metric) { - // [START logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project in which to create the metric: - * "projects/[PROJECT_ID]" - * The new metric must be provided in the request. - */ - // const parent = 'abc123' - /** - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callCreateLogMetric() { - // Construct request - const request = { - parent, - metric, - }; - - // Run request - const response = await loggingClient.createLogMetric(request); - console.log(response); - } - - callCreateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_CreateLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline deleted file mode 100644 index afd6bd779e0e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.delete_log_metric.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to delete: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callDeleteLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.deleteLogMetric(request); - console.log(response); - } - - callDeleteLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline deleted file mode 100644 index 757570ddb21e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.get_log_metric.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName) { - // [START logging_v2_generated_MetricsServiceV2_GetLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the desired metric: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - */ - // const metricName = 'abc123' - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callGetLogMetric() { - // Construct request - const request = { - metricName, - }; - - // Run request - const response = await loggingClient.getLogMetric(request); - console.log(response); - } - - callGetLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_GetLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline deleted file mode 100644 index 715f32bb58a6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.list_log_metrics.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project containing the metrics: - * "projects/[PROJECT_ID]" - */ - // const parent = 'abc123' - /** - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - */ - // const pageToken = 'abc123' - /** - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - */ - // const pageSize = 1234 - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callListLogMetrics() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = loggingClient.listLogMetricsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListLogMetrics(); - // [END logging_v2_generated_MetricsServiceV2_ListLogMetrics_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline deleted file mode 100644 index 610e3c0772fe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/metrics_service_v2.update_log_metric.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(metricName, metric) { - // [START logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the metric to update: - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - */ - // const metricName = 'abc123' - /** - * Required. The updated metric. - */ - // const metric = {} - - // Imports the Logging library - const {MetricsServiceV2Client} = require('logging').v2; - - // Instantiates a client - const loggingClient = new MetricsServiceV2Client(); - - async function callUpdateLogMetric() { - // Construct request - const request = { - metricName, - metric, - }; - - // Run request - const response = await loggingClient.updateLogMetric(request); - console.log(response); - } - - callUpdateLogMetric(); - // [END logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline deleted file mode 100644 index 9181588b71bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/samples/generated/v2/snippet_metadata_google.logging.v2.json.baseline +++ /dev/null @@ -1,1691 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-logging", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.logging.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListBuckets_async", - "title": "LoggingService listBuckets Sample", - "origin": "API_DEFINITION", - "description": " Lists log buckets.", - "canonical": true, - "file": "config_service_v2.list_buckets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListBucketsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListBuckets", - "fullName": "google.logging.v2.ConfigServiceV2.ListBuckets", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetBucket_async", - "title": "LoggingService getBucket Sample", - "origin": "API_DEFINITION", - "description": " Gets a log bucket.", - "canonical": true, - "file": "config_service_v2.get_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetBucket", - "fullName": "google.logging.v2.ConfigServiceV2.GetBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateBucket_async", - "title": "LoggingService createBucket Sample", - "origin": "API_DEFINITION", - "description": " Creates a log bucket that can be used to store log entries. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.create_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "bucket_id", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.CreateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateBucket_async", - "title": "LoggingService updateBucket Sample", - "origin": "API_DEFINITION", - "description": " Updates a log bucket. This method replaces the following fields in the existing bucket with values from the new bucket: `retention_period` If the retention period is decreased and the bucket is locked, `FAILED_PRECONDITION` will be returned. If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then `FAILED_PRECONDITION` will be returned. After a bucket has been created, the bucket's location cannot be changed.", - "canonical": true, - "file": "config_service_v2.update_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "bucket", - "type": ".google.logging.v2.LogBucket" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogBucket", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteBucket_async", - "title": "LoggingService deleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Deletes a log bucket. Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. After 7 days, the bucket will be purged and all log entries in the bucket will be permanently deleted.", - "canonical": true, - "file": "config_service_v2.delete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UndeleteBucket_async", - "title": "LoggingService undeleteBucket Sample", - "origin": "API_DEFINITION", - "description": " Undeletes a log bucket. A bucket that has been deleted can be undeleted within the grace period of 7 days.", - "canonical": true, - "file": "config_service_v2.undelete_bucket.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UndeleteBucket", - "fullName": "google.logging.v2.ConfigServiceV2.UndeleteBucket", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListViews_async", - "title": "LoggingService listViews Sample", - "origin": "API_DEFINITION", - "description": " Lists views on a log bucket.", - "canonical": true, - "file": "config_service_v2.list_views.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListViewsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListViews", - "fullName": "google.logging.v2.ConfigServiceV2.ListViews", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetView_async", - "title": "LoggingService getView Sample", - "origin": "API_DEFINITION", - "description": " Gets a view on a log bucket..", - "canonical": true, - "file": "config_service_v2.get_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetView", - "fullName": "google.logging.v2.ConfigServiceV2.GetView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateView_async", - "title": "LoggingService createView Sample", - "origin": "API_DEFINITION", - "description": " Creates a view over log entries in a log bucket. A bucket may contain a maximum of 30 views.", - "canonical": true, - "file": "config_service_v2.create_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view_id", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateView", - "fullName": "google.logging.v2.ConfigServiceV2.CreateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateView_async", - "title": "LoggingService updateView Sample", - "origin": "API_DEFINITION", - "description": " Updates a view on a log bucket. This method replaces the following fields in the existing view with values from the new view: `filter`. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can update the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.update_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.logging.v2.LogView" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogView", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateView", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteView_async", - "title": "LoggingService deleteView Sample", - "origin": "API_DEFINITION", - "description": " Deletes a view on a log bucket. If an `UNAVAILABLE` error is returned, this indicates that system is not in a state where it can delete the view. If this occurs, please try again in a few minutes.", - "canonical": true, - "file": "config_service_v2.delete_view.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteView", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteView", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListSinks_async", - "title": "LoggingService listSinks Sample", - "origin": "API_DEFINITION", - "description": " Lists sinks.", - "canonical": true, - "file": "config_service_v2.list_sinks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListSinksResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListSinks", - "fullName": "google.logging.v2.ConfigServiceV2.ListSinks", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSink_async", - "title": "LoggingService getSink Sample", - "origin": "API_DEFINITION", - "description": " Gets a sink.", - "canonical": true, - "file": "config_service_v2.get_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSink", - "fullName": "google.logging.v2.ConfigServiceV2.GetSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateSink_async", - "title": "LoggingService createSink Sample", - "origin": "API_DEFINITION", - "description": " Creates a sink that exports specified log entries to a destination. The export of newly-ingested log entries begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export log entries only from the resource owning the sink.", - "canonical": true, - "file": "config_service_v2.create_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateSink", - "fullName": "google.logging.v2.ConfigServiceV2.CreateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSink_async", - "title": "LoggingService updateSink Sample", - "origin": "API_DEFINITION", - "description": " Updates a sink. This method replaces the following fields in the existing sink with values from the new sink: `destination`, and `filter`. The updated sink might also have a new `writer_identity`; see the `unique_writer_identity` field.", - "canonical": true, - "file": "config_service_v2.update_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 93, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - }, - { - "name": "sink", - "type": ".google.logging.v2.LogSink" - }, - { - "name": "unique_writer_identity", - "type": "TYPE_BOOL" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogSink", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSink", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteSink_async", - "title": "LoggingService deleteSink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a sink. If the sink has a unique `writer_identity`, then that service account is also deleted.", - "canonical": true, - "file": "config_service_v2.delete_sink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "async": true, - "parameters": [ - { - "name": "sink_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteSink", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteSink", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_ListExclusions_async", - "title": "LoggingService listExclusions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the exclusions on the _Default sink in a parent resource.", - "canonical": true, - "file": "config_service_v2.list_exclusions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListExclusionsResponse", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "ListExclusions", - "fullName": "google.logging.v2.ConfigServiceV2.ListExclusions", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetExclusion_async", - "title": "LoggingService getExclusion Sample", - "origin": "API_DEFINITION", - "description": " Gets the description of an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.get_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.GetExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CreateExclusion_async", - "title": "LoggingService createExclusion Sample", - "origin": "API_DEFINITION", - "description": " Creates a new exclusion in the _Default sink in a specified parent resource. Only log entries belonging to that resource can be excluded. You can have up to 10 exclusions in a resource.", - "canonical": true, - "file": "config_service_v2.create_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CreateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.CreateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateExclusion_async", - "title": "LoggingService updateExclusion Sample", - "origin": "API_DEFINITION", - "description": " Changes one or more properties of an existing exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.update_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "exclusion", - "type": ".google.logging.v2.LogExclusion" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.LogExclusion", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_DeleteExclusion_async", - "title": "LoggingService deleteExclusion Sample", - "origin": "API_DEFINITION", - "description": " Deletes an exclusion in the _Default sink.", - "canonical": true, - "file": "config_service_v2.delete_exclusion.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "DeleteExclusion", - "fullName": "google.logging.v2.ConfigServiceV2.DeleteExclusion", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetCmekSettings_async", - "title": "LoggingService getCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Logging CMEK settings for the given resource. Note: CMEK for the Log Router can be configured for Google Cloud projects, folders, organizations and billing accounts. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async", - "title": "LoggingService updateCmekSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router CMEK settings for the given resource. Note: CMEK for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateCmekSettings][google.logging.v2.ConfigServiceV2.UpdateCmekSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_cmek_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "cmek_settings", - "type": ".google.logging.v2.CmekSettings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.CmekSettings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateCmekSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateCmekSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_GetSettings_async", - "title": "LoggingService getSettings Sample", - "origin": "API_DEFINITION", - "description": " Gets the Log Router settings for the given resource. Note: Settings for the Log Router can be get for Google Cloud projects, folders, organizations and billing accounts. Currently it can only be configured for organizations. Once configured for an organization, it applies to all projects and folders in the Google Cloud organization. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.get_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "GetSettings", - "fullName": "google.logging.v2.ConfigServiceV2.GetSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_UpdateSettings_async", - "title": "LoggingService updateSettings Sample", - "origin": "API_DEFINITION", - "description": " Updates the Log Router settings for the given resource. Note: Settings for the Log Router can currently only be configured for Google Cloud organizations. Once configured, it applies to all projects and folders in the Google Cloud organization. [UpdateSettings][google.logging.v2.ConfigServiceV2.UpdateSettings] will fail if 1) `kms_key_name` is invalid, or 2) the associated service account does not have the required `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or 3) access to the key is disabled. 4) `location_id` is not supported by Logging. 5) `location_id` violate OrgPolicy. See [Enabling CMEK for Log Router](https://cloud.google.com/logging/docs/routing/managed-encryption) for more information.", - "canonical": true, - "file": "config_service_v2.update_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "settings", - "type": ".google.logging.v2.Settings" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.logging.v2.Settings", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "UpdateSettings", - "fullName": "google.logging.v2.ConfigServiceV2.UpdateSettings", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_ConfigServiceV2_CopyLogEntries_async", - "title": "LoggingService copyLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Copies a set of log entries from a log bucket to a Cloud Storage bucket.", - "canonical": true, - "file": "config_service_v2.copy_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "destination", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ConfigServiceV2Client", - "fullName": "google.logging.v2.ConfigServiceV2Client" - }, - "method": { - "shortName": "CopyLogEntries", - "fullName": "google.logging.v2.ConfigServiceV2.CopyLogEntries", - "service": { - "shortName": "ConfigServiceV2", - "fullName": "google.logging.v2.ConfigServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_DeleteLog_async", - "title": "LoggingService deleteLog Sample", - "origin": "API_DEFINITION", - "description": " Deletes all the log entries in a log for the _Default Log Bucket. The log reappears if it receives new entries. Log entries written shortly before the delete operation might not be deleted. Entries received after the delete operation with a timestamp before the operation will be deleted.", - "canonical": true, - "file": "logging_service_v2.delete_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "DeleteLog", - "fullName": "google.logging.v2.LoggingServiceV2.DeleteLog", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_WriteLogEntries_async", - "title": "LoggingService writeLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Writes log entries to Logging. This API method is the only way to send log entries to Logging. This method is used, directly or indirectly, by the Logging agent (fluentd) and all logging libraries configured to use Logging. A single request may contain log entries for a maximum of 1000 different resources (projects, organizations, billing accounts or folders)", - "canonical": true, - "file": "logging_service_v2.write_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 119, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "async": true, - "parameters": [ - { - "name": "log_name", - "type": "TYPE_STRING" - }, - { - "name": "resource", - "type": ".google.api.MonitoredResource" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "entries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "partial_success", - "type": "TYPE_BOOL" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.logging.v2.WriteLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "WriteLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.WriteLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogEntries_async", - "title": "LoggingService listLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Lists log entries. Use this method to retrieve log entries that originated from a project/folder/organization/billing account. For ways to export log entries, see [Exporting Logs](https://cloud.google.com/logging/docs/export).", - "canonical": true, - "file": "logging_service_v2.list_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 99, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async", - "title": "LoggingService listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for monitored resource types used by Logging.", - "canonical": true, - "file": "logging_service_v2.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptors", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_ListLogs_async", - "title": "LoggingService listLogs Sample", - "origin": "API_DEFINITION", - "description": " Lists the logs in projects, organizations, folders, or billing accounts. Only logs that have entries are listed.", - "canonical": true, - "file": "logging_service_v2.list_logs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "resource_names", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.logging.v2.ListLogsResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "ListLogs", - "fullName": "google.logging.v2.LoggingServiceV2.ListLogs", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_LoggingServiceV2_TailLogEntries_async", - "title": "LoggingService tailLogEntries Sample", - "origin": "API_DEFINITION", - "description": " Streaming read of log entries as they are ingested. Until the stream is terminated, it will continue reading logs.", - "canonical": true, - "file": "logging_service_v2.tail_log_entries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "async": true, - "parameters": [ - { - "name": "resource_names", - "type": "TYPE_STRING[]" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "buffer_window", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.logging.v2.TailLogEntriesResponse", - "client": { - "shortName": "LoggingServiceV2Client", - "fullName": "google.logging.v2.LoggingServiceV2Client" - }, - "method": { - "shortName": "TailLogEntries", - "fullName": "google.logging.v2.LoggingServiceV2.TailLogEntries", - "service": { - "shortName": "LoggingServiceV2", - "fullName": "google.logging.v2.LoggingServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_ListLogMetrics_async", - "title": "LoggingService listLogMetrics Sample", - "origin": "API_DEFINITION", - "description": " Lists logs-based metrics.", - "canonical": true, - "file": "metrics_service_v2.list_log_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - } - ], - "resultType": ".google.logging.v2.ListLogMetricsResponse", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "ListLogMetrics", - "fullName": "google.logging.v2.MetricsServiceV2.ListLogMetrics", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_GetLogMetric_async", - "title": "LoggingService getLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Gets a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.get_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "GetLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.GetLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_CreateLogMetric_async", - "title": "LoggingService createLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.create_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "CreateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.CreateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async", - "title": "LoggingService updateLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Creates or updates a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.update_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - }, - { - "name": "metric", - "type": ".google.logging.v2.LogMetric" - } - ], - "resultType": ".google.logging.v2.LogMetric", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "UpdateLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.UpdateLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - }, - { - "regionTag": "logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async", - "title": "LoggingService deleteLogMetric Sample", - "origin": "API_DEFINITION", - "description": " Deletes a logs-based metric.", - "canonical": true, - "file": "metrics_service_v2.delete_log_metric.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "async": true, - "parameters": [ - { - "name": "metric_name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricsServiceV2Client", - "fullName": "google.logging.v2.MetricsServiceV2Client" - }, - "method": { - "shortName": "DeleteLogMetric", - "fullName": "google.logging.v2.MetricsServiceV2.DeleteLogMetric", - "service": { - "shortName": "MetricsServiceV2", - "fullName": "google.logging.v2.MetricsServiceV2" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/index.ts.baseline deleted file mode 100644 index 84e5b85ed9c3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/index.ts.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2'; -const ConfigServiceV2Client = v2.ConfigServiceV2Client; -type ConfigServiceV2Client = v2.ConfigServiceV2Client; -const LoggingServiceV2Client = v2.LoggingServiceV2Client; -type LoggingServiceV2Client = v2.LoggingServiceV2Client; -const MetricsServiceV2Client = v2.MetricsServiceV2Client; -type MetricsServiceV2Client = v2.MetricsServiceV2Client; -export {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -export default {v2, ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client.ts.baseline deleted file mode 100644 index f9876a7c2965..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client.ts.baseline +++ /dev/null @@ -1,5011 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/config_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './config_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring sinks used to route log entries. - * @class - * @memberof v2 - */ -export class ConfigServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - configServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConfigServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 ConfigServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConfigServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listBuckets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), - listViews: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), - listSinks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), - listExclusions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const copyLogEntriesResponse = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesResponse') as gax.protobuf.Type; - const copyLogEntriesMetadata = protoFilesRoot.lookup( - '.google.logging.v2.CopyLogEntriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - copyLogEntries: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), - copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.ConfigServiceV2', gapicConfig as gax.ClientConfig, - 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.configServiceV2Stub) { - return this.configServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.ConfigServiceV2. - this.configServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.ConfigServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.ConfigServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const configServiceV2StubMethods = - ['listBuckets', 'getBucket', 'createBucket', 'updateBucket', 'deleteBucket', 'undeleteBucket', 'listViews', 'getView', 'createView', 'updateView', 'deleteView', 'listSinks', 'getSink', 'createSink', 'updateSink', 'deleteSink', 'listExclusions', 'getExclusion', 'createExclusion', 'updateExclusion', 'deleteExclusion', 'getCmekSettings', 'updateCmekSettings', 'getSettings', 'updateSettings', 'copyLogEntries']; - for (const methodName of configServiceV2StubMethods) { - const callPromise = this.configServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.configServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetBucket_async - */ - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request: protos.google.logging.v2.IGetBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): void; - getBucket( - request?: protos.google.logging.v2.IGetBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBucket response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IGetBucketRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a log bucket that can be used to store log entries. After a bucket - * has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the log bucket: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * - * For example: - * - * `"projects/my-project/locations/global"` - * @param {string} request.bucketId - * Required. A client-assigned identifier such as `"my-bucket"`. Identifiers are limited - * to 100 characters and can include only letters, digits, underscores, - * hyphens, and periods. - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The new bucket. The region specified in the new bucket must be compliant - * with any Location Restriction Org Policy. The name field in the bucket is - * ignored. - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucket_async - */ - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request: protos.google.logging.v2.ICreateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): void; - createBucket( - request?: protos.google.logging.v2.ICreateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBucket response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.ICreateBucketRequest|undefined, - {}|undefined - ]) => { - this._log.info('createBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a log bucket. This method replaces the following fields in the - * existing bucket with values from the new bucket: `retention_period` - * - * If the retention period is decreased and the bucket is locked, - * `FAILED_PRECONDITION` will be returned. - * - * If the bucket has a `lifecycle_state` of `DELETE_REQUESTED`, then - * `FAILED_PRECONDITION` will be returned. - * - * After a bucket has been created, the bucket's location cannot be changed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to update. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {google.logging.v2.LogBucket} request.bucket - * Required. The updated bucket. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Field mask that specifies the fields in `bucket` that need an update. A - * bucket field will be overwritten if, and only if, it is in the update mask. - * `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see: - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=retention_days` - * @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 {@link protos.google.logging.v2.LogBucket|LogBucket}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucket_async - */ - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request: protos.google.logging.v2.IUpdateBucketRequest, - callback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): void; - updateBucket( - request?: protos.google.logging.v2.IUpdateBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBucket request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBucket response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogBucket, - protos.google.logging.v2.IUpdateBucketRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a log bucket. - * - * Changes the bucket's `lifecycle_state` to the `DELETE_REQUESTED` state. - * After 7 days, the bucket will be purged and all log entries in the bucket - * will be permanently deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to delete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteBucket_async - */ - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request: protos.google.logging.v2.IDeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - deleteBucket( - request?: protos.google.logging.v2.IDeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBucket request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBucket response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteBucketRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Undeletes a log bucket. A bucket that has been deleted can be undeleted - * within the grace period of 7 days. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the bucket to undelete. - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.undelete_bucket.js - * region_tag:logging_v2_generated_ConfigServiceV2_UndeleteBucket_async - */ - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request: protos.google.logging.v2.IUndeleteBucketRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): void; - undeleteBucket( - request?: protos.google.logging.v2.IUndeleteBucketRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('undeleteBucket request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('undeleteBucket response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.undeleteBucket(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IUndeleteBucketRequest|undefined, - {}|undefined - ]) => { - this._log.info('undeleteBucket response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a view on a log bucket.. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the policy: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetView_async - */ - getView( - request?: protos.google.logging.v2.IGetViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>; - getView( - request: protos.google.logging.v2.IGetViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request: protos.google.logging.v2.IGetViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): void; - getView( - request?: protos.google.logging.v2.IGetViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getView response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IGetViewRequest|undefined, - {}|undefined - ]) => { - this._log.info('getView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a view over log entries in a log bucket. A bucket may contain a - * maximum of 30 views. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket in which to create the view - * - * `"projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]"` - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket"` - * @param {string} request.viewId - * Required. The id to use for this view. - * @param {google.logging.v2.LogView} request.view - * Required. The new view. - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateView_async - */ - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request: protos.google.logging.v2.ICreateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): void; - createView( - request?: protos.google.logging.v2.ICreateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createView response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.ICreateViewRequest|undefined, - {}|undefined - ]) => { - this._log.info('createView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a view on a log bucket. This method replaces the following fields - * in the existing view with values from the new view: `filter`. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can update the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to update - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @param {google.logging.v2.LogView} request.view - * Required. The updated view. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `view` that need - * an update. A field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @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 {@link protos.google.logging.v2.LogView|LogView}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateView_async - */ - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request: protos.google.logging.v2.IUpdateViewRequest, - callback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): void; - updateView( - request?: protos.google.logging.v2.IUpdateViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateView request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateView response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogView, - protos.google.logging.v2.IUpdateViewRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a view on a log bucket. - * If an `UNAVAILABLE` error is returned, this indicates that system is not in - * a state where it can delete the view. If this occurs, please try again in a - * few minutes. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The full resource name of the view to delete: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]" - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-bucket/views/my-view"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_view.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteView_async - */ - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request: protos.google.logging.v2.IDeleteViewRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): void; - deleteView( - request?: protos.google.logging.v2.IDeleteViewRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteView request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteView response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteView(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteViewRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteView response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The resource name of the sink: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSink_async - */ - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request: protos.google.logging.v2.IGetSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): void; - getSink( - request?: protos.google.logging.v2.IGetSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IGetSinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a sink that exports specified log entries to a destination. The - * export of newly-ingested log entries begins immediately, unless the sink's - * `writer_identity` is not permitted to write to the destination. A sink can - * export log entries only from the resource owning the sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource in which to create the sink: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The new sink, whose `name` parameter is a sink identifier that - * is not already in use. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. Determines the kind of IAM identity returned as `writer_identity` - * in the new sink. If this value is omitted or set to false, and if the - * sink's parent is a project, then the value returned as `writer_identity` is - * the same group or service account used by Cloud Logging before the addition - * of writer identities to this API. The sink's destination must be in the - * same project as the sink itself. - * - * If this field is set to true, or if the sink is owned by a non-project - * resource such as an organization, then the value of `writer_identity` will - * be a unique service account used only for exports from the new sink. For - * more information, see `writer_identity` in {@link protos.google.logging.v2.LogSink|LogSink}. - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateSink_async - */ - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request: protos.google.logging.v2.ICreateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): void; - createSink( - request?: protos.google.logging.v2.ICreateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.ICreateSinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a sink. This method replaces the following fields in the existing - * sink with values from the new sink: `destination`, and `filter`. - * - * The updated sink might also have a new `writer_identity`; see the - * `unique_writer_identity` field. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to update, including the parent - * resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @param {google.logging.v2.LogSink} request.sink - * Required. The updated sink, whose name is the same identifier that appears as part - * of `sink_name`. - * @param {boolean} [request.uniqueWriterIdentity] - * Optional. See {@link protos.google.logging.v2.ConfigServiceV2.CreateSink|sinks.create} - * for a description of this field. When updating a sink, the effect of this - * field on the value of `writer_identity` in the updated sink depends on both - * the old and new values of this field: - * - * + If the old and new values of this field are both false or both true, - * then there is no change to the sink's `writer_identity`. - * + If the old value is false and the new value is true, then - * `writer_identity` is changed to a unique service account. - * + It is an error if the old value is true and the new value is - * set to false or defaulted to false. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask that specifies the fields in `sink` that need - * an update. A sink field will be overwritten if, and only if, it is - * in the update mask. `name` and output only fields cannot be updated. - * - * An empty `updateMask` is temporarily treated as using the following mask - * for backwards compatibility purposes: - * - * `destination,filter,includeChildren` - * - * At some point in the future, behavior will be removed and specifying an - * empty `updateMask` will be an error. - * - * For a detailed `FieldMask` definition, see - * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.FieldMask - * - * For example: `updateMask=filter` - * @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 {@link protos.google.logging.v2.LogSink|LogSink}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSink_async - */ - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request: protos.google.logging.v2.IUpdateSinkRequest, - callback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): void; - updateSink( - request?: protos.google.logging.v2.IUpdateSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateSink request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogSink, - protos.google.logging.v2.IUpdateSinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a sink. If the sink has a unique `writer_identity`, then that - * service account is also deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.sinkName - * Required. The full resource name of the sink to delete, including the parent - * resource and the sink identifier: - * - * "projects/[PROJECT_ID]/sinks/[SINK_ID]" - * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]" - * "folders/[FOLDER_ID]/sinks/[SINK_ID]" - * - * For example: - * - * `"projects/my-project/sinks/my-sink"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_sink.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteSink_async - */ - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request: protos.google.logging.v2.IDeleteSinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): void; - deleteSink( - request?: protos.google.logging.v2.IDeleteSinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'sink_name': request.sinkName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSink request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteSink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteSinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteSink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the description of an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetExclusion_async - */ - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request: protos.google.logging.v2.IGetExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): void; - getExclusion( - request?: protos.google.logging.v2.IGetExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getExclusion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IGetExclusionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new exclusion in the _Default sink in a specified parent - * resource. Only log entries belonging to that resource can be excluded. You - * can have up to 10 exclusions in a resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource in which to create the exclusion: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * - * For examples: - * - * `"projects/my-logging-project"` - * `"organizations/123456789"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. The new exclusion, whose `name` parameter is an exclusion name - * that is not already used in the parent resource. - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.create_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_CreateExclusion_async - */ - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request: protos.google.logging.v2.ICreateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): void; - createExclusion( - request?: protos.google.logging.v2.ICreateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createExclusion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.ICreateExclusionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Changes one or more properties of an existing exclusion in the _Default - * sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the exclusion to update: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @param {google.logging.v2.LogExclusion} request.exclusion - * Required. New values for the existing exclusion. Only the fields specified in - * `update_mask` are relevant. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. A non-empty list of fields to change in the existing exclusion. New values - * for the fields are taken from the corresponding fields in the - * {@link protos.google.logging.v2.LogExclusion|LogExclusion} included in this request. Fields not mentioned in - * `update_mask` are not changed and are ignored in the request. - * - * For example, to change the filter and description of an exclusion, - * specify an `update_mask` of `"filter,description"`. - * @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 {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateExclusion_async - */ - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request: protos.google.logging.v2.IUpdateExclusionRequest, - callback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): void; - updateExclusion( - request?: protos.google.logging.v2.IUpdateExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateExclusion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogExclusion, - protos.google.logging.v2.IUpdateExclusionRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an exclusion in the _Default sink. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of an existing exclusion to delete: - * - * "projects/[PROJECT_ID]/exclusions/[EXCLUSION_ID]" - * "organizations/[ORGANIZATION_ID]/exclusions/[EXCLUSION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/exclusions/[EXCLUSION_ID]" - * "folders/[FOLDER_ID]/exclusions/[EXCLUSION_ID]" - * - * For example: - * - * `"projects/my-project/exclusions/my-exclusion"` - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.delete_exclusion.js - * region_tag:logging_v2_generated_ConfigServiceV2_DeleteExclusion_async - */ - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request: protos.google.logging.v2.IDeleteExclusionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): void; - deleteExclusion( - request?: protos.google.logging.v2.IDeleteExclusionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteExclusion request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteExclusion response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteExclusion(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteExclusionRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteExclusion response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the Logging CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve CMEK settings. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can be configured for Google Cloud projects, - * folders, organizations and billing accounts. Once configured for an - * organization, it applies to all projects and folders in the Google Cloud - * organization. - * @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 {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetCmekSettings_async - */ - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request: protos.google.logging.v2.IGetCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - getCmekSettings( - request?: protos.google.logging.v2.IGetCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCmekSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCmekSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getCmekSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IGetCmekSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCmekSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the Log Router CMEK settings for the given resource. - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateCmekSettings|UpdateCmekSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the CMEK settings to update. - * - * "projects/[PROJECT_ID]/cmekSettings" - * "organizations/[ORGANIZATION_ID]/cmekSettings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/cmekSettings" - * "folders/[FOLDER_ID]/cmekSettings" - * - * For example: - * - * `"organizations/12345/cmekSettings"` - * - * Note: CMEK for the Log Router can currently only be configured for Google - * Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.CmekSettings} request.cmekSettings - * Required. The CMEK settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `cmek_settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @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 {@link protos.google.logging.v2.CmekSettings|CmekSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_cmek_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateCmekSettings_async - */ - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request: protos.google.logging.v2.IUpdateCmekSettingsRequest, - callback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateCmekSettings( - request?: protos.google.logging.v2.IUpdateCmekSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCmekSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCmekSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCmekSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ICmekSettings, - protos.google.logging.v2.IUpdateCmekSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCmekSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource for which to retrieve settings. - * - * "projects/[PROJECT_ID]/settings" - * "organizations/[ORGANIZATION_ID]/settings" - * "billingAccounts/[BILLING_ACCOUNT_ID]/settings" - * "folders/[FOLDER_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can be get for Google Cloud projects, - * folders, organizations and billing accounts. Currently it can only be - * configured for organizations. Once configured for an organization, it - * applies to all projects and folders in the Google Cloud organization. - * @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 {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.get_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_GetSettings_async - */ - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.logging.v2.IGetSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.logging.v2.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IGetSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the Log Router settings for the given resource. - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * - * {@link protos.google.logging.v2.ConfigServiceV2.UpdateSettings|UpdateSettings} - * will fail if 1) `kms_key_name` is invalid, or 2) the associated service - * account does not have the required - * `roles/cloudkms.cryptoKeyEncrypterDecrypter` role assigned for the key, or - * 3) access to the key is disabled. 4) `location_id` is not supported by - * Logging. 5) `location_id` violate OrgPolicy. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the settings to update. - * - * "organizations/[ORGANIZATION_ID]/settings" - * - * For example: - * - * `"organizations/12345/settings"` - * - * Note: Settings for the Log Router can currently only be configured for - * Google Cloud organizations. Once configured, it applies to all projects and - * folders in the Google Cloud organization. - * @param {google.logging.v2.Settings} request.settings - * Required. The settings to update. - * - * See [Enabling CMEK for Log - * Router](https://cloud.google.com/logging/docs/routing/managed-encryption) - * for more information. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask identifying which fields from `settings` should - * be updated. A field will be overwritten if and only if it is in the update - * mask. Output only fields cannot be updated. - * - * See {@link protos.google.protobuf.FieldMask|FieldMask} for more information. - * - * For example: `"updateMask=kmsKeyName"` - * @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 {@link protos.google.logging.v2.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.update_settings.js - * region_tag:logging_v2_generated_ConfigServiceV2_UpdateSettings_async - */ - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.logging.v2.IUpdateSettingsRequest, - callback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.logging.v2.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateSettings request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ISettings, - protos.google.logging.v2.IUpdateSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Copies a set of log entries from a log bucket to a Cloud Storage bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Log bucket from which to copy log entries. - * - * For example: - * - * `"projects/my-project/locations/global/buckets/my-source-bucket"` - * @param {string} [request.filter] - * Optional. A filter specifying which log entries to copy. The filter must be no more - * than 20k characters. An empty filter matches all log entries. - * @param {string} request.destination - * Required. Destination to which to copy log 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request: protos.google.logging.v2.ICopyLogEntriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - copyLogEntries( - request?: protos.google.logging.v2.ICopyLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('copyLogEntries response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('copyLogEntries request %j', request); - return this.innerApiCalls.copyLogEntries(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('copyLogEntries response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `copyLogEntries()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js - * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async - */ - async checkCopyLogEntriesProgress(name: string): Promise>{ - this._log.info('copyLogEntries long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists log buckets. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogBucket|LogBucket}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBucketsAsync()` - * 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. - */ - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request: protos.google.logging.v2.IListBucketsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): void; - listBuckets( - request?: protos.google.logging.v2.IListBucketsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>, - callback?: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>): - Promise<[ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListBucketsRequest, - protos.google.logging.v2.IListBucketsResponse|null|undefined, - protos.google.logging.v2.ILogBucket>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBuckets values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listBuckets request %j', request); - return this.innerApiCalls - .listBuckets(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogBucket[], - protos.google.logging.v2.IListBucketsRequest|null, - protos.google.logging.v2.IListBucketsResponse - ]) => { - this._log.info('listBuckets values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBuckets`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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.logging.v2.LogBucket|LogBucket} 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 `listBucketsAsync()` - * 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. - */ - listBucketsStream( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBuckets stream %j', request); - return this.descriptors.page.listBuckets.createStream( - this.innerApiCalls.listBuckets as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBuckets`, 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. The parent resource whose buckets are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" - * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" - * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" - * - * Note: The locations portion of the resource must be specified, but - * supplying the character `-` in place of [LOCATION_ID] will return all - * buckets. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Non-positive - * values are ignored. The presence of `nextPageToken` in the response - * indicates that more results might be available. - * @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.logging.v2.LogBucket|LogBucket}. 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 include:samples/generated/v2/config_service_v2.list_buckets.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async - */ - listBucketsAsync( - request?: protos.google.logging.v2.IListBucketsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBuckets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBuckets iterate %j', request); - return this.descriptors.page.listBuckets.asyncIterate( - this.innerApiCalls['listBuckets'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists views on a log bucket. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogView|LogView}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listViewsAsync()` - * 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. - */ - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request: protos.google.logging.v2.IListViewsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): void; - listViews( - request?: protos.google.logging.v2.IListViewsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>, - callback?: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>): - Promise<[ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListViewsRequest, - protos.google.logging.v2.IListViewsResponse|null|undefined, - protos.google.logging.v2.ILogView>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listViews values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listViews request %j', request); - return this.innerApiCalls - .listViews(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogView[], - protos.google.logging.v2.IListViewsRequest|null, - protos.google.logging.v2.IListViewsResponse - ]) => { - this._log.info('listViews values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listViews`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogView|LogView} 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 `listViewsAsync()` - * 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. - */ - listViewsStream( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listViews stream %j', request); - return this.descriptors.page.listViews.createStream( - this.innerApiCalls.listViews as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listViews`, 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. The bucket whose views are to be listed: - * - * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the preceding call - * to this method. `pageToken` must be the value of `nextPageToken` from the - * previous response. The values of other method parameters should be - * identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogView|LogView}. 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 include:samples/generated/v2/config_service_v2.list_views.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async - */ - listViewsAsync( - request?: protos.google.logging.v2.IListViewsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listViews']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listViews iterate %j', request); - return this.descriptors.page.listViews.asyncIterate( - this.innerApiCalls['listViews'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists sinks. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogSink|LogSink}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSinksAsync()` - * 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. - */ - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request: protos.google.logging.v2.IListSinksRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): void; - listSinks( - request?: protos.google.logging.v2.IListSinksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>, - callback?: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>): - Promise<[ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListSinksRequest, - protos.google.logging.v2.IListSinksResponse|null|undefined, - protos.google.logging.v2.ILogSink>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSinks values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSinks request %j', request); - return this.innerApiCalls - .listSinks(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogSink[], - protos.google.logging.v2.IListSinksRequest|null, - protos.google.logging.v2.IListSinksResponse - ]) => { - this._log.info('listSinks values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSinks`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogSink|LogSink} 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 `listSinksAsync()` - * 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. - */ - listSinksStream( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSinks stream %j', request); - return this.descriptors.page.listSinks.createStream( - this.innerApiCalls.listSinks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSinks`, 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. The parent resource whose sinks are to be listed: - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogSink|LogSink}. 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 include:samples/generated/v2/config_service_v2.list_sinks.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async - */ - listSinksAsync( - request?: protos.google.logging.v2.IListSinksRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listSinks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSinks iterate %j', request); - return this.descriptors.page.listSinks.asyncIterate( - this.innerApiCalls['listSinks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists all the exclusions on the _Default sink in a parent resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogExclusion|LogExclusion}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listExclusionsAsync()` - * 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. - */ - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request: protos.google.logging.v2.IListExclusionsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): void; - listExclusions( - request?: protos.google.logging.v2.IListExclusionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>, - callback?: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>): - Promise<[ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListExclusionsRequest, - protos.google.logging.v2.IListExclusionsResponse|null|undefined, - protos.google.logging.v2.ILogExclusion>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listExclusions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listExclusions request %j', request); - return this.innerApiCalls - .listExclusions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogExclusion[], - protos.google.logging.v2.IListExclusionsRequest|null, - protos.google.logging.v2.IListExclusionsResponse - ]) => { - this._log.info('listExclusions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listExclusions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogExclusion|LogExclusion} 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 `listExclusionsAsync()` - * 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. - */ - listExclusionsStream( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listExclusions stream %j', request); - return this.descriptors.page.listExclusions.createStream( - this.innerApiCalls.listExclusions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listExclusions`, 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. The parent resource whose exclusions are to be listed. - * - * "projects/[PROJECT_ID]" - * "organizations/[ORGANIZATION_ID]" - * "billingAccounts/[BILLING_ACCOUNT_ID]" - * "folders/[FOLDER_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogExclusion|LogExclusion}. 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 include:samples/generated/v2/config_service_v2.list_exclusions.js - * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async - */ - listExclusionsAsync( - request?: protos.google.logging.v2.IListExclusionsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listExclusions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listExclusions iterate %j', request); - return this.descriptors.page.listExclusions.asyncIterate( - this.innerApiCalls['listExclusions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.configServiceV2Stub && !this._terminated) { - return this.configServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client_config.json.baseline deleted file mode 100644 index 5ae5608c2c43..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_client_config.json.baseline +++ /dev/null @@ -1,145 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.ConfigServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListBuckets": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UndeleteBucket": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListViews": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteView": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSinks": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateSink": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteSink": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListExclusions": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateExclusion": { - "timeout_millis": 120000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteExclusion": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateCmekSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CopyLogEntries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/config_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/index.ts.baseline deleted file mode 100644 index aa0593f3ee79..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/index.ts.baseline +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2026 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. ** - -export {ConfigServiceV2Client} from './config_service_v2_client'; -export {LoggingServiceV2Client} from './logging_service_v2_client'; -export {MetricsServiceV2Client} from './metrics_service_v2_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client.ts.baseline deleted file mode 100644 index 1931a4643857..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client.ts.baseline +++ /dev/null @@ -1,2630 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/logging_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './logging_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for ingesting and querying logs. - * @class - * @memberof v2 - */ -export class LoggingServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - loggingServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of LoggingServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 LoggingServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof LoggingServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listLogEntries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listLogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // Some methods on this API support automatically batching - // requests; denote this. - - this.descriptors.batching = { - writeLogEntries: new this._gaxModule.BundleDescriptor( - 'entries', - ['log_name','resource','labels'], - null, - this._gaxModule.GrpcClient.createByteLengthFunction( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - protoFilesRoot.lookupType('google.logging.v2.LogEntry') as any - ) - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.LoggingServiceV2', gapicConfig as gax.ClientConfig, - 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.loggingServiceV2Stub) { - return this.loggingServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.LoggingServiceV2. - this.loggingServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.LoggingServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.LoggingServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const loggingServiceV2StubMethods = - ['deleteLog', 'writeLogEntries', 'listLogEntries', 'listMonitoredResourceDescriptors', 'listLogs', 'tailLogEntries']; - for (const methodName of loggingServiceV2StubMethods) { - const callPromise = this.loggingServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.batching?.[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.loggingServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Deletes all the log entries in a log for the _Default Log Bucket. The log - * reappears if it receives new entries. Log entries written shortly before - * the delete operation might not be deleted. Entries received after the - * delete operation with a timestamp before the operation will be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.logName - * Required. The resource name of the log to delete: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example, - * `"projects/my-project-id/logs/syslog"`, - * `"organizations/123/logs/cloudaudit.googleapis.com%2Factivity"`. - * - * For more information about log names, see - * {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.delete_log.js - * region_tag:logging_v2_generated_LoggingServiceV2_DeleteLog_async - */ - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request: protos.google.logging.v2.IDeleteLogRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): void; - deleteLog( - request?: protos.google.logging.v2.IDeleteLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'log_name': request.logName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteLog request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteLog response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteLog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteLog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Writes log entries to Logging. This API method is the - * only way to send log entries to Logging. This method - * is used, directly or indirectly, by the Logging agent - * (fluentd) and all logging libraries configured to use Logging. - * A single request may contain log entries for a maximum of 1000 - * different resources (projects, organizations, billing accounts or - * folders) - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.logName] - * Optional. A default log resource name that is assigned to all log entries - * in `entries` that do not specify a value for `log_name`: - * - * * `projects/[PROJECT_ID]/logs/[LOG_ID]` - * * `organizations/[ORGANIZATION_ID]/logs/[LOG_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]` - * * `folders/[FOLDER_ID]/logs/[LOG_ID]` - * - * `[LOG_ID]` must be URL-encoded. For example: - * - * "projects/my-project-id/logs/syslog" - * "organizations/123/logs/cloudaudit.googleapis.com%2Factivity" - * - * The permission `logging.logEntries.create` is needed on each project, - * organization, billing account, or folder that is receiving new log - * entries, whether the resource is specified in `logName` or in an - * individual log entry. - * @param {google.api.MonitoredResource} [request.resource] - * Optional. A default monitored resource object that is assigned to all log - * entries in `entries` that do not specify a value for `resource`. Example: - * - * { "type": "gce_instance", - * "labels": { - * "zone": "us-central1-a", "instance_id": "00000000000000000000" }} - * - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} [request.labels] - * Optional. Default labels that are added to the `labels` field of all log - * entries in `entries`. If a log entry already has a label with the same key - * as a label in this parameter, then the log entry's label is not changed. - * See {@link protos.google.logging.v2.LogEntry|LogEntry}. - * @param {number[]} request.entries - * Required. The log entries to send to Logging. The order of log - * entries in this list does not matter. Values supplied in this method's - * `log_name`, `resource`, and `labels` fields are copied into those log - * entries in this list that do not include values for their corresponding - * fields. For more information, see the - * {@link protos.google.logging.v2.LogEntry|LogEntry} type. - * - * If the `timestamp` or `insert_id` fields are missing in log entries, then - * this method supplies the current time or a unique identifier, respectively. - * The supplied values are chosen so that, among the log entries that did not - * supply their own values, the entries earlier in the list will sort before - * the entries later in the list. See the `entries.list` method. - * - * Log entries with timestamps that are more than the - * [logs retention period](https://cloud.google.com/logging/quotas) in - * the past or more than 24 hours in the future will not be available when - * calling `entries.list`. However, those log entries can still be [exported - * with - * LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs). - * - * To improve throughput and to avoid exceeding the - * [quota limit](https://cloud.google.com/logging/quotas) for calls to - * `entries.write`, you should try to include several log entries in this - * list, rather than calling this method for each individual log entry. - * @param {boolean} [request.partialSuccess] - * Optional. Whether valid entries should be written even if some other - * entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any - * entry is not written, then the response status is the error associated - * with one of the failed entries and the response includes error details - * keyed by the entries' zero-based index in the `entries.write` method. - * @param {boolean} [request.dryRun] - * Optional. If true, the request should expect normal response, but the - * entries won't be persisted nor exported. Useful for checking whether the - * logging API endpoints are working properly before sending valuable data. - * @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 {@link protos.google.logging.v2.WriteLogEntriesResponse|WriteLogEntriesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.write_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_WriteLogEntries_async - */ - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request: protos.google.logging.v2.IWriteLogEntriesRequest, - callback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): void; - writeLogEntries( - request?: protos.google.logging.v2.IWriteLogEntriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('writeLogEntries request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('writeLogEntries response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.writeLogEntries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.IWriteLogEntriesResponse, - protos.google.logging.v2.IWriteLogEntriesRequest|undefined, - {}|undefined - ]) => { - this._log.info('writeLogEntries response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Streaming read of log entries as they are ingested. Until the stream is - * terminated, it will continue reading logs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and - * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async - */ - tailLogEntries( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('tailLogEntries stream %j', options); - return this.innerApiCalls.tailLogEntries(null, options); - } - - /** - * Lists log entries. Use this method to retrieve log entries that originated - * from a project/folder/organization/billing account. For ways to export log - * entries, see [Exporting - * Logs](https://cloud.google.com/logging/docs/export). - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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 Array of {@link protos.google.logging.v2.LogEntry|LogEntry}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogEntriesAsync()` - * 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. - */ - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request: protos.google.logging.v2.IListLogEntriesRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): void; - listLogEntries( - request?: protos.google.logging.v2.IListLogEntriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>): - Promise<[ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogEntriesRequest, - protos.google.logging.v2.IListLogEntriesResponse|null|undefined, - protos.google.logging.v2.ILogEntry>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogEntries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listLogEntries request %j', request); - return this.innerApiCalls - .listLogEntries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogEntry[], - protos.google.logging.v2.IListLogEntriesRequest|null, - protos.google.logging.v2.IListLogEntriesResponse - ]) => { - this._log.info('listLogEntries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogEntries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.logging.v2.LogEntry|LogEntry} 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 `listLogEntriesAsync()` - * 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. - */ - listLogEntriesStream( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogEntries stream %j', request); - return this.descriptors.page.listLogEntries.createStream( - this.innerApiCalls.listLogEntries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogEntries`, 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.resourceNames - * Required. Names of one or more parent resources from which to - * retrieve log entries: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * - * May alternatively be one or more views: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * Projects listed in the `project_ids` field are added to this list. - * @param {string} [request.filter] - * Optional. A filter that chooses which log entries to return. See [Advanced - * Logs Queries](https://cloud.google.com/logging/docs/view/advanced-queries). - * Only log entries that match the filter are returned. An empty filter - * matches all log entries in the resources listed in `resource_names`. - * Referencing a parent resource that is not listed in `resource_names` will - * cause the filter to return no results. The maximum length of the filter is - * 20000 characters. - * @param {string} [request.orderBy] - * Optional. How the results should be sorted. Presently, the only permitted - * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first - * option returns entries in order of increasing values of - * `LogEntry.timestamp` (oldest first), and the second option returns entries - * in order of decreasing timestamps (newest first). Entries with equal - * timestamps are returned in order of their `insert_id` values. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. Default is 50. - * If the value is negative or exceeds 1000, the request is rejected. The - * presence of `next_page_token` in the response indicates that more results - * might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `page_token` must be the value of - * `next_page_token` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.logging.v2.LogEntry|LogEntry}. 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 include:samples/generated/v2/logging_service_v2.list_log_entries.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async - */ - listLogEntriesAsync( - request?: protos.google.logging.v2.IListLogEntriesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listLogEntries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogEntries iterate %j', request); - return this.descriptors.page.listLogEntries.asyncIterate( - this.innerApiCalls['listLogEntries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the descriptors for monitored resource types used by Logging. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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 Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMonitoredResourceDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listMonitoredResourceDescriptors request %j', request); - return this.innerApiCalls - .listMonitoredResourceDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest|null, - protos.google.logging.v2.IListMonitoredResourceDescriptorsResponse - ]) => { - this._log.info('listMonitoredResourceDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} 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 `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors stream %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, 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 {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. 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 include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.logging.v2.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors iterate %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the logs in projects, organizations, folders, or billing accounts. - * Only logs that have entries are listed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_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 Array of string. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogsAsync()` - * 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. - */ - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request: protos.google.logging.v2.IListLogsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): void; - listLogs( - request?: protos.google.logging.v2.IListLogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogsRequest, - protos.google.logging.v2.IListLogsResponse|null|undefined, - string>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listLogs request %j', request); - return this.innerApiCalls - .listLogs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - string[], - protos.google.logging.v2.IListLogsRequest|null, - protos.google.logging.v2.IListLogsResponse - ]) => { - this._log.info('listLogs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @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 string 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 `listLogsAsync()` - * 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. - */ - listLogsStream( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogs stream %j', request); - return this.descriptors.page.listLogs.createStream( - this.innerApiCalls.listLogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogs`, 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. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {string[]} [request.resourceNames] - * Optional. The resource name that owns the logs: - * - * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` - * - * To support legacy queries, it could also be: - * - * * `projects/[PROJECT_ID]` - * * `organizations/[ORGANIZATION_ID]` - * * `billingAccounts/[BILLING_ACCOUNT_ID]` - * * `folders/[FOLDER_ID]` - * @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 - * string. 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 include:samples/generated/v2/logging_service_v2.list_logs.js - * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async - */ - listLogsAsync( - request?: protos.google.logging.v2.IListLogsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogs iterate %j', request); - return this.descriptors.page.listLogs.asyncIterate( - this.innerApiCalls['listLogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.loggingServiceV2Stub && !this._terminated) { - return this.loggingServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client_config.json.baseline deleted file mode 100644 index 342e96e9b3e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_client_config.json.baseline +++ /dev/null @@ -1,67 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.LoggingServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "DeleteLog": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "WriteLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default", - "bundling": { - "element_count_threshold": 1000, - "request_byte_threshold": 1048576, - "delay_threshold_millis": 50, - "element_count_limit": 1000000 - } - }, - "ListLogEntries": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListMonitoredResourceDescriptors": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "ListLogs": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "TailLogEntries": { - "timeout_millis": 3600000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/logging_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client.ts.baseline deleted file mode 100644 index df1cb1cc8bc2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client.ts.baseline +++ /dev/null @@ -1,2174 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/metrics_service_v2_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './metrics_service_v2_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for configuring logs-based metrics. - * @class - * @memberof v2 - */ -export class MetricsServiceV2Client { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('logging'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricsServiceV2Stub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricsServiceV2Client. - * - * @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://cloud.google.com/docs/authentication/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 MetricsServiceV2Client({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricsServiceV2Client; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'logging.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/cmekSettings' - ), - billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/exclusions/{exclusion}' - ), - billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}' - ), - billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}' - ), - billingAccountLogPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/logs/{log}' - ), - billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/settings' - ), - billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate( - 'billingAccounts/{billing_account}/sinks/{sink}' - ), - folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/cmekSettings' - ), - folderExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/exclusions/{exclusion}' - ), - folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}' - ), - folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}' - ), - folderLogPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/logs/{log}' - ), - folderSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/settings' - ), - folderSinkPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/sinks/{sink}' - ), - logMetricPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metrics/{metric}' - ), - organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/cmekSettings' - ), - organizationExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/exclusions/{exclusion}' - ), - organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}' - ), - organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}' - ), - organizationLogPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/logs/{log}' - ), - organizationSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/settings' - ), - organizationSinkPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/sinks/{sink}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/cmekSettings' - ), - projectExclusionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exclusions/{exclusion}' - ), - projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}' - ), - projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/buckets/{bucket}/views/{view}' - ), - projectLogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/logs/{log}' - ), - projectSettingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/settings' - ), - projectSinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/sinks/{sink}' - ), - }; - - // 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 = { - listLogMetrics: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.logging.v2.MetricsServiceV2', gapicConfig as gax.ClientConfig, - 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.metricsServiceV2Stub) { - return this.metricsServiceV2Stub; - } - - // Put together the "service stub" for - // google.logging.v2.MetricsServiceV2. - this.metricsServiceV2Stub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.logging.v2.MetricsServiceV2') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.logging.v2.MetricsServiceV2, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const metricsServiceV2StubMethods = - ['listLogMetrics', 'getLogMetric', 'createLogMetric', 'updateLogMetric', 'deleteLogMetric']; - for (const methodName of metricsServiceV2StubMethods) { - const callPromise = this.metricsServiceV2Stub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.metricsServiceV2Stub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'logging.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-platform.read-only', - 'https://www.googleapis.com/auth/logging.admin', - 'https://www.googleapis.com/auth/logging.read', - 'https://www.googleapis.com/auth/logging.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the desired metric: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.get_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_GetLogMetric_async - */ - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request: protos.google.logging.v2.IGetLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): void; - getLogMetric( - request?: protos.google.logging.v2.IGetLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLogMetric response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IGetLogMetricRequest|undefined, - {}|undefined - ]) => { - this._log.info('getLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project in which to create the metric: - * - * "projects/[PROJECT_ID]" - * - * The new metric must be provided in the request. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The new logs-based metric, which must not have an identifier that - * already exists. - * @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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.create_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_CreateLogMetric_async - */ - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request: protos.google.logging.v2.ICreateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - createLogMetric( - request?: protos.google.logging.v2.ICreateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createLogMetric response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.ICreateLogMetricRequest|undefined, - {}|undefined - ]) => { - this._log.info('createLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates or updates a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to update: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" - * - * The updated metric must be provided in the request and it's - * `name` field must be the same as `[METRIC_ID]` If the metric - * does not exist in `[PROJECT_ID]`, then a new metric is created. - * @param {google.logging.v2.LogMetric} request.metric - * Required. The updated metric. - * @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 {@link protos.google.logging.v2.LogMetric|LogMetric}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.update_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_UpdateLogMetric_async - */ - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request: protos.google.logging.v2.IUpdateLogMetricRequest, - callback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): void; - updateLogMetric( - request?: protos.google.logging.v2.IUpdateLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateLogMetric response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.logging.v2.ILogMetric, - protos.google.logging.v2.IUpdateLogMetricRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a logs-based metric. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.metricName - * Required. The resource name of the metric to delete: - * - * "projects/[PROJECT_ID]/metrics/[METRIC_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/metrics_service_v2.delete_log_metric.js - * region_tag:logging_v2_generated_MetricsServiceV2_DeleteLogMetric_async - */ - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request: protos.google.logging.v2.IDeleteLogMetricRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): void; - deleteLogMetric( - request?: protos.google.logging.v2.IDeleteLogMetricRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'metric_name': request.metricName ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteLogMetric request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteLogMetric response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteLogMetric(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.logging.v2.IDeleteLogMetricRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteLogMetric response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists logs-based metrics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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 Array of {@link protos.google.logging.v2.LogMetric|LogMetric}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listLogMetricsAsync()` - * 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. - */ - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request: protos.google.logging.v2.IListLogMetricsRequest, - callback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): void; - listLogMetrics( - request?: protos.google.logging.v2.IListLogMetricsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>, - callback?: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>): - Promise<[ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.logging.v2.IListLogMetricsRequest, - protos.google.logging.v2.IListLogMetricsResponse|null|undefined, - protos.google.logging.v2.ILogMetric>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listLogMetrics values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listLogMetrics request %j', request); - return this.innerApiCalls - .listLogMetrics(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.logging.v2.ILogMetric[], - protos.google.logging.v2.IListLogMetricsRequest|null, - protos.google.logging.v2.IListLogMetricsResponse - ]) => { - this._log.info('listLogMetrics values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listLogMetrics`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogMetric|LogMetric} 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 `listLogMetricsAsync()` - * 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. - */ - listLogMetricsStream( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogMetrics stream %j', request); - return this.descriptors.page.listLogMetrics.createStream( - this.innerApiCalls.listLogMetrics as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listLogMetrics`, 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. The name of the project containing the metrics: - * - * "projects/[PROJECT_ID]" - * @param {string} [request.pageToken] - * Optional. If present, then retrieve the next batch of results from the - * preceding call to this method. `pageToken` must be the value of - * `nextPageToken` from the previous response. The values of other method - * parameters should be identical to those in the previous call. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to return from this request. - * Non-positive values are ignored. The presence of `nextPageToken` in the - * response indicates that more results might be available. - * @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.logging.v2.LogMetric|LogMetric}. 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 include:samples/generated/v2/metrics_service_v2.list_log_metrics.js - * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async - */ - listLogMetricsAsync( - request?: protos.google.logging.v2.IListLogMetricsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listLogMetrics']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listLogMetrics iterate %j', request); - return this.descriptors.page.listLogMetrics.asyncIterate( - this.innerApiCalls['listLogMetrics'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified billingAccountCmekSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountCmekSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountCmekSettings resource. - * - * @param {string} billingAccountCmekSettingsName - * A fully-qualified path representing billing_account_cmekSettings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName: string) { - return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountExclusion resource name string. - * - * @param {string} billing_account - * @param {string} exclusion - * @returns {string} Resource name string. - */ - billingAccountExclusionPath(billingAccount:string,exclusion:string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.render({ - billing_account: billingAccount, - exclusion: exclusion, - }); - } - - /** - * Parse the billing_account from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; - } - - /** - * Parse the exclusion from BillingAccountExclusion resource. - * - * @param {string} billingAccountExclusionName - * A fully-qualified path representing billing_account_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName: string) { - return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; - } - - /** - * Return a fully-qualified billingAccountLocationBucket resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - billingAccountLocationBucketPath(billingAccount:string,location:string,bucket:string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucket resource. - * - * @param {string} billingAccountLocationBucketName - * A fully-qualified path representing billing_account_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName: string) { - return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; - } - - /** - * Return a fully-qualified billingAccountLocationBucketView resource name string. - * - * @param {string} billing_account - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - billingAccountLocationBucketViewPath(billingAccount:string,location:string,bucket:string,view:string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ - billing_account: billingAccount, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the billing_account from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; - } - - /** - * Parse the location from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; - } - - /** - * Parse the bucket from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; - } - - /** - * Parse the view from BillingAccountLocationBucketView resource. - * - * @param {string} billingAccountLocationBucketViewName - * A fully-qualified path representing billing_account_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName: string) { - return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; - } - - /** - * Return a fully-qualified billingAccountLog resource name string. - * - * @param {string} billing_account - * @param {string} log - * @returns {string} Resource name string. - */ - billingAccountLogPath(billingAccount:string,log:string) { - return this.pathTemplates.billingAccountLogPathTemplate.render({ - billing_account: billingAccount, - log: log, - }); - } - - /** - * Parse the billing_account from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; - } - - /** - * Parse the log from BillingAccountLog resource. - * - * @param {string} billingAccountLogName - * A fully-qualified path representing billing_account_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromBillingAccountLogName(billingAccountLogName: string) { - return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; - } - - /** - * Return a fully-qualified billingAccountSettings resource name string. - * - * @param {string} billing_account - * @returns {string} Resource name string. - */ - billingAccountSettingsPath(billingAccount:string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.render({ - billing_account: billingAccount, - }); - } - - /** - * Parse the billing_account from BillingAccountSettings resource. - * - * @param {string} billingAccountSettingsName - * A fully-qualified path representing billing_account_settings resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName: string) { - return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; - } - - /** - * Return a fully-qualified billingAccountSink resource name string. - * - * @param {string} billing_account - * @param {string} sink - * @returns {string} Resource name string. - */ - billingAccountSinkPath(billingAccount:string,sink:string) { - return this.pathTemplates.billingAccountSinkPathTemplate.render({ - billing_account: billingAccount, - sink: sink, - }); - } - - /** - * Parse the billing_account from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the billing_account. - */ - matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; - } - - /** - * Parse the sink from BillingAccountSink resource. - * - * @param {string} billingAccountSinkName - * A fully-qualified path representing billing_account_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromBillingAccountSinkName(billingAccountSinkName: string) { - return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; - } - - /** - * Return a fully-qualified folderCmekSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderCmekSettingsPath(folder:string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderCmekSettings resource. - * - * @param {string} folderCmekSettingsName - * A fully-qualified path representing folder_cmekSettings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderCmekSettingsName(folderCmekSettingsName: string) { - return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; - } - - /** - * Return a fully-qualified folderExclusion resource name string. - * - * @param {string} folder - * @param {string} exclusion - * @returns {string} Resource name string. - */ - folderExclusionPath(folder:string,exclusion:string) { - return this.pathTemplates.folderExclusionPathTemplate.render({ - folder: folder, - exclusion: exclusion, - }); - } - - /** - * Parse the folder from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; - } - - /** - * Parse the exclusion from FolderExclusion resource. - * - * @param {string} folderExclusionName - * A fully-qualified path representing folder_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromFolderExclusionName(folderExclusionName: string) { - return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; - } - - /** - * Return a fully-qualified folderLocationBucket resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - folderLocationBucketPath(folder:string,location:string,bucket:string) { - return this.pathTemplates.folderLocationBucketPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the folder from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; - } - - /** - * Parse the location from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; - } - - /** - * Parse the bucket from FolderLocationBucket resource. - * - * @param {string} folderLocationBucketName - * A fully-qualified path representing folder_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketName(folderLocationBucketName: string) { - return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; - } - - /** - * Return a fully-qualified folderLocationBucketView resource name string. - * - * @param {string} folder - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - folderLocationBucketViewPath(folder:string,location:string,bucket:string,view:string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ - folder: folder, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the folder from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; - } - - /** - * Parse the location from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; - } - - /** - * Parse the bucket from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; - } - - /** - * Parse the view from FolderLocationBucketView resource. - * - * @param {string} folderLocationBucketViewName - * A fully-qualified path representing folder_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName: string) { - return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; - } - - /** - * Return a fully-qualified folderLog resource name string. - * - * @param {string} folder - * @param {string} log - * @returns {string} Resource name string. - */ - folderLogPath(folder:string,log:string) { - return this.pathTemplates.folderLogPathTemplate.render({ - folder: folder, - log: log, - }); - } - - /** - * Parse the folder from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; - } - - /** - * Parse the log from FolderLog resource. - * - * @param {string} folderLogName - * A fully-qualified path representing folder_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromFolderLogName(folderLogName: string) { - return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; - } - - /** - * Return a fully-qualified folderSettings resource name string. - * - * @param {string} folder - * @returns {string} Resource name string. - */ - folderSettingsPath(folder:string) { - return this.pathTemplates.folderSettingsPathTemplate.render({ - folder: folder, - }); - } - - /** - * Parse the folder from FolderSettings resource. - * - * @param {string} folderSettingsName - * A fully-qualified path representing folder_settings resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSettingsName(folderSettingsName: string) { - return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; - } - - /** - * Return a fully-qualified folderSink resource name string. - * - * @param {string} folder - * @param {string} sink - * @returns {string} Resource name string. - */ - folderSinkPath(folder:string,sink:string) { - return this.pathTemplates.folderSinkPathTemplate.render({ - folder: folder, - sink: sink, - }); - } - - /** - * Parse the folder from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).folder; - } - - /** - * Parse the sink from FolderSink resource. - * - * @param {string} folderSinkName - * A fully-qualified path representing folder_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromFolderSinkName(folderSinkName: string) { - return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; - } - - /** - * Return a fully-qualified logMetric resource name string. - * - * @param {string} project - * @param {string} metric - * @returns {string} Resource name string. - */ - logMetricPath(project:string,metric:string) { - return this.pathTemplates.logMetricPathTemplate.render({ - project: project, - metric: metric, - }); - } - - /** - * Parse the project from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).project; - } - - /** - * Parse the metric from LogMetric resource. - * - * @param {string} logMetricName - * A fully-qualified path representing LogMetric resource. - * @returns {string} A string representing the metric. - */ - matchMetricFromLogMetricName(logMetricName: string) { - return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; - } - - /** - * Return a fully-qualified organizationCmekSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationCmekSettingsPath(organization:string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationCmekSettings resource. - * - * @param {string} organizationCmekSettingsName - * A fully-qualified path representing organization_cmekSettings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName: string) { - return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; - } - - /** - * Return a fully-qualified organizationExclusion resource name string. - * - * @param {string} organization - * @param {string} exclusion - * @returns {string} Resource name string. - */ - organizationExclusionPath(organization:string,exclusion:string) { - return this.pathTemplates.organizationExclusionPathTemplate.render({ - organization: organization, - exclusion: exclusion, - }); - } - - /** - * Parse the organization from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; - } - - /** - * Parse the exclusion from OrganizationExclusion resource. - * - * @param {string} organizationExclusionName - * A fully-qualified path representing organization_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromOrganizationExclusionName(organizationExclusionName: string) { - return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; - } - - /** - * Return a fully-qualified organizationLocationBucket resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - organizationLocationBucketPath(organization:string,location:string,bucket:string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the organization from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; - } - - /** - * Parse the location from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucket resource. - * - * @param {string} organizationLocationBucketName - * A fully-qualified path representing organization_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName: string) { - return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; - } - - /** - * Return a fully-qualified organizationLocationBucketView resource name string. - * - * @param {string} organization - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - organizationLocationBucketViewPath(organization:string,location:string,bucket:string,view:string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ - organization: organization, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the organization from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; - } - - /** - * Parse the location from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; - } - - /** - * Parse the bucket from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; - } - - /** - * Parse the view from OrganizationLocationBucketView resource. - * - * @param {string} organizationLocationBucketViewName - * A fully-qualified path representing organization_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName: string) { - return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; - } - - /** - * Return a fully-qualified organizationLog resource name string. - * - * @param {string} organization - * @param {string} log - * @returns {string} Resource name string. - */ - organizationLogPath(organization:string,log:string) { - return this.pathTemplates.organizationLogPathTemplate.render({ - organization: organization, - log: log, - }); - } - - /** - * Parse the organization from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; - } - - /** - * Parse the log from OrganizationLog resource. - * - * @param {string} organizationLogName - * A fully-qualified path representing organization_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromOrganizationLogName(organizationLogName: string) { - return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; - } - - /** - * Return a fully-qualified organizationSettings resource name string. - * - * @param {string} organization - * @returns {string} Resource name string. - */ - organizationSettingsPath(organization:string) { - return this.pathTemplates.organizationSettingsPathTemplate.render({ - organization: organization, - }); - } - - /** - * Parse the organization from OrganizationSettings resource. - * - * @param {string} organizationSettingsName - * A fully-qualified path representing organization_settings resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSettingsName(organizationSettingsName: string) { - return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; - } - - /** - * Return a fully-qualified organizationSink resource name string. - * - * @param {string} organization - * @param {string} sink - * @returns {string} Resource name string. - */ - organizationSinkPath(organization:string,sink:string) { - return this.pathTemplates.organizationSinkPathTemplate.render({ - organization: organization, - sink: sink, - }); - } - - /** - * Parse the organization from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; - } - - /** - * Parse the sink from OrganizationSink resource. - * - * @param {string} organizationSinkName - * A fully-qualified path representing organization_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromOrganizationSinkName(organizationSinkName: string) { - return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified projectCmekSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectCmekSettingsPath(project:string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectCmekSettings resource. - * - * @param {string} projectCmekSettingsName - * A fully-qualified path representing project_cmekSettings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectCmekSettingsName(projectCmekSettingsName: string) { - return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; - } - - /** - * Return a fully-qualified projectExclusion resource name string. - * - * @param {string} project - * @param {string} exclusion - * @returns {string} Resource name string. - */ - projectExclusionPath(project:string,exclusion:string) { - return this.pathTemplates.projectExclusionPathTemplate.render({ - project: project, - exclusion: exclusion, - }); - } - - /** - * Parse the project from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; - } - - /** - * Parse the exclusion from ProjectExclusion resource. - * - * @param {string} projectExclusionName - * A fully-qualified path representing project_exclusion resource. - * @returns {string} A string representing the exclusion. - */ - matchExclusionFromProjectExclusionName(projectExclusionName: string) { - return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; - } - - /** - * Return a fully-qualified projectLocationBucket resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @returns {string} Resource name string. - */ - projectLocationBucketPath(project:string,location:string,bucket:string) { - return this.pathTemplates.projectLocationBucketPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - }); - } - - /** - * Parse the project from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; - } - - /** - * Parse the location from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; - } - - /** - * Parse the bucket from ProjectLocationBucket resource. - * - * @param {string} projectLocationBucketName - * A fully-qualified path representing project_location_bucket resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketName(projectLocationBucketName: string) { - return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; - } - - /** - * Return a fully-qualified projectLocationBucketView resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} bucket - * @param {string} view - * @returns {string} Resource name string. - */ - projectLocationBucketViewPath(project:string,location:string,bucket:string,view:string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ - project: project, - location: location, - bucket: bucket, - view: view, - }); - } - - /** - * Parse the project from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; - } - - /** - * Parse the location from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; - } - - /** - * Parse the bucket from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the bucket. - */ - matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; - } - - /** - * Parse the view from ProjectLocationBucketView resource. - * - * @param {string} projectLocationBucketViewName - * A fully-qualified path representing project_location_bucket_view resource. - * @returns {string} A string representing the view. - */ - matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName: string) { - return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; - } - - /** - * Return a fully-qualified projectLog resource name string. - * - * @param {string} project - * @param {string} log - * @returns {string} Resource name string. - */ - projectLogPath(project:string,log:string) { - return this.pathTemplates.projectLogPathTemplate.render({ - project: project, - log: log, - }); - } - - /** - * Parse the project from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).project; - } - - /** - * Parse the log from ProjectLog resource. - * - * @param {string} projectLogName - * A fully-qualified path representing project_log resource. - * @returns {string} A string representing the log. - */ - matchLogFromProjectLogName(projectLogName: string) { - return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; - } - - /** - * Return a fully-qualified projectSettings resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectSettingsPath(project:string) { - return this.pathTemplates.projectSettingsPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from ProjectSettings resource. - * - * @param {string} projectSettingsName - * A fully-qualified path representing project_settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSettingsName(projectSettingsName: string) { - return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; - } - - /** - * Return a fully-qualified projectSink resource name string. - * - * @param {string} project - * @param {string} sink - * @returns {string} Resource name string. - */ - projectSinkPath(project:string,sink:string) { - return this.pathTemplates.projectSinkPathTemplate.render({ - project: project, - sink: sink, - }); - } - - /** - * Parse the project from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).project; - } - - /** - * Parse the sink from ProjectSink resource. - * - * @param {string} projectSinkName - * A fully-qualified path representing project_sink resource. - * @returns {string} A string representing the sink. - */ - matchSinkFromProjectSinkName(projectSinkName: string) { - return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName).sink; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.metricsServiceV2Stub && !this._terminated) { - return this.metricsServiceV2Stub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client_config.json.baseline deleted file mode 100644 index 014688ab775a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_client_config.json.baseline +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.logging.v2.MetricsServiceV2": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "deadline_exceeded_internal_unavailable": [ - "DEADLINE_EXCEEDED", - "INTERNAL", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListLogMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "GetLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "CreateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - }, - "DeleteLogMetric": { - "timeout_millis": 60000, - "retry_codes_name": "deadline_exceeded_internal_unavailable", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_proto_list.json.baseline deleted file mode 100644 index fd41d3bfa051..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/src/v2/metrics_service_v2_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/logging/type/http_request.proto", - "../../protos/google/logging/type/log_severity.proto", - "../../protos/google/logging/v2/log_entry.proto", - "../../protos/google/logging/v2/logging.proto", - "../../protos/google/logging/v2/logging_config.proto", - "../../protos/google/logging/v2/logging_metrics.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 1782c59b6c3f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const logging = require('logging'); - -function main() { - const configServiceV2Client = new logging.ConfigServiceV2Client(); - const loggingServiceV2Client = new logging.LoggingServiceV2Client(); - const metricsServiceV2Client = new logging.MetricsServiceV2Client(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 4718840c897b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2026 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. ** - -import {ConfigServiceV2Client, LoggingServiceV2Client, MetricsServiceV2Client} from 'logging'; - -// check that the client class type name can be used -function doStuffWithConfigServiceV2Client(client: ConfigServiceV2Client) { - client.close(); -} -function doStuffWithLoggingServiceV2Client(client: LoggingServiceV2Client) { - client.close(); -} -function doStuffWithMetricsServiceV2Client(client: MetricsServiceV2Client) { - client.close(); -} - -function main() { - // check that the client instance can be created - const configServiceV2Client = new ConfigServiceV2Client(); - doStuffWithConfigServiceV2Client(configServiceV2Client); - // check that the client instance can be created - const loggingServiceV2Client = new LoggingServiceV2Client(); - doStuffWithLoggingServiceV2Client(loggingServiceV2Client); - // check that the client instance can be created - const metricsServiceV2Client = new MetricsServiceV2Client(); - doStuffWithMetricsServiceV2Client(metricsServiceV2Client); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_config_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_config_service_v2_v2.ts.baseline deleted file mode 100644 index bde6151a8398..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_config_service_v2_v2.ts.baseline +++ /dev/null @@ -1,4844 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as configservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.ConfigServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = configservicev2Module.v2.ConfigServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = configservicev2Module.v2.ConfigServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new configservicev2Module.v2.ConfigServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = configservicev2Module.v2.ConfigServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - await client.initialize(); - assert(client.configServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.configServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.configServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getBucket', () => { - it('invokes getBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCall(expectedResponse); - const [response] = await client.getBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.getBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBucket(request), expectedError); - }); - }); - - describe('createBucket', () => { - it('invokes createBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCall(expectedResponse); - const [response] = await client.createBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.createBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateBucketRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBucket(request), expectedError); - }); - }); - - describe('updateBucket', () => { - it('invokes updateBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCall(expectedResponse); - const [response] = await client.updateBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogBucket() - ); - client.innerApiCalls.updateBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBucket( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBucket(request), expectedError); - }); - }); - - describe('deleteBucket', () => { - it('invokes deleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBucket(request), expectedError); - }); - }); - - describe('undeleteBucket', () => { - it('invokes undeleteBucket without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCall(expectedResponse); - const [response] = await client.undeleteBucket(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.undeleteBucket = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeleteBucket( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.undeleteBucket = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.undeleteBucket(request), expectedError); - const actualRequest = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.undeleteBucket as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes undeleteBucket with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UndeleteBucketRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UndeleteBucketRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.undeleteBucket(request), expectedError); - }); - }); - - describe('getView', () => { - it('invokes getView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCall(expectedResponse); - const [response] = await client.getView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.getView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getView(request), expectedError); - const actualRequest = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getView(request), expectedError); - }); - }); - - describe('createView', () => { - it('invokes createView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCall(expectedResponse); - const [response] = await client.createView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.createView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createView(request), expectedError); - const actualRequest = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateViewRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createView(request), expectedError); - }); - }); - - describe('updateView', () => { - it('invokes updateView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCall(expectedResponse); - const [response] = await client.updateView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogView() - ); - client.innerApiCalls.updateView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateView( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateView(request), expectedError); - const actualRequest = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateView(request), expectedError); - }); - }); - - describe('deleteView', () => { - it('invokes deleteView without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCall(expectedResponse); - const [response] = await client.deleteView(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteView = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteView( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteView = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteView(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteView as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteView with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteViewRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteViewRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteView(request), expectedError); - }); - }); - - describe('getSink', () => { - it('invokes getSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCall(expectedResponse); - const [response] = await client.getSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.getSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSink(request), expectedError); - const actualRequest = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSink(request), expectedError); - }); - }); - - describe('createSink', () => { - it('invokes createSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCall(expectedResponse); - const [response] = await client.createSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.createSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSink(request), expectedError); - const actualRequest = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateSinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSink(request), expectedError); - }); - }); - - describe('updateSink', () => { - it('invokes updateSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCall(expectedResponse); - const [response] = await client.updateSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogSink() - ); - client.innerApiCalls.updateSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSink( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSink(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSink(request), expectedError); - }); - }); - - describe('deleteSink', () => { - it('invokes deleteSink without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedHeaderRequestParams = `sink_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSink with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteSinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteSinkRequest', ['sinkName']); - request.sinkName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSink(request), expectedError); - }); - }); - - describe('getExclusion', () => { - it('invokes getExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.getExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.getExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getExclusion(request), expectedError); - }); - }); - - describe('createExclusion', () => { - it('invokes createExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.createExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.createExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateExclusionRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createExclusion(request), expectedError); - }); - }); - - describe('updateExclusion', () => { - it('invokes updateExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.updateExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogExclusion() - ); - client.innerApiCalls.updateExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateExclusion( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateExclusion(request), expectedError); - }); - }); - - describe('deleteExclusion', () => { - it('invokes deleteExclusion without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCall(expectedResponse); - const [response] = await client.deleteExclusion(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteExclusion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteExclusion( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteExclusion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteExclusion(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteExclusion as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteExclusion with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteExclusionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteExclusionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteExclusion(request), expectedError); - }); - }); - - describe('getCmekSettings', () => { - it('invokes getCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.getCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCmekSettings(request), expectedError); - }); - }); - - describe('updateCmekSettings', () => { - it('invokes updateCmekSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateCmekSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.CmekSettings() - ); - client.innerApiCalls.updateCmekSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCmekSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ICmekSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCmekSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCmekSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCmekSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCmekSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateCmekSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateCmekSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCmekSettings(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.logging.v2.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with closed client', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSettings(request), expectedError); - }); - }); - - describe('copyLogEntries', () => { - it('invokes copyLogEntries without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(expectedResponse); - const [operation] = await client.copyLogEntries(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.copyLogEntries = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.copyLogEntries( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes copyLogEntries with call error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.copyLogEntries(request), expectedError); - }); - - it('invokes copyLogEntries with LRO error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CopyLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.copyLogEntries = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.copyLogEntries(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkCopyLogEntriesProgress without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCopyLogEntriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCopyLogEntriesProgress with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCopyLogEntriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listBuckets', () => { - it('invokes listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCall(expectedResponse); - const [response] = await client.listBuckets(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.innerApiCalls.listBuckets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBuckets( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogBucket[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBuckets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBuckets(request), expectedError); - const actualRequest = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBuckets as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBucketsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBucketsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBucketsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogBucket[] = []; - stream.on('data', (response: protos.google.logging.v2.LogBucket) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBuckets, request)); - assert( - (client.descriptors.page.listBuckets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - generateSampleMessage(new protos.google.logging.v2.LogBucket()), - ]; - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogBucket[] = []; - const iterable = client.listBucketsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBuckets with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListBucketsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListBucketsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBuckets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBucketsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogBucket[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBuckets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listViews', () => { - it('invokes listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCall(expectedResponse); - const [response] = await client.listViews(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.innerApiCalls.listViews = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listViews( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogView[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listViews = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listViews(request), expectedError); - const actualRequest = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listViews as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listViewsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listViewsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listViewsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogView[] = []; - stream.on('data', (response: protos.google.logging.v2.LogView) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listViews, request)); - assert( - (client.descriptors.page.listViews.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - generateSampleMessage(new protos.google.logging.v2.LogView()), - ]; - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogView[] = []; - const iterable = client.listViewsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listViews with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListViewsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListViewsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listViews.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listViewsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogView[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listViews.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listSinks', () => { - it('invokes listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCall(expectedResponse); - const [response] = await client.listSinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.innerApiCalls.listSinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSinks( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogSink[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listSinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listSinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listSinksStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listSinksStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSinksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogSink[] = []; - stream.on('data', (response: protos.google.logging.v2.LogSink) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSinks, request)); - assert( - (client.descriptors.page.listSinks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - generateSampleMessage(new protos.google.logging.v2.LogSink()), - ]; - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogSink[] = []; - const iterable = client.listSinksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listSinks with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListSinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListSinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listSinks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSinksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogSink[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listSinks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listExclusions', () => { - it('invokes listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCall(expectedResponse); - const [response] = await client.listExclusions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions without error using callback', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.innerApiCalls.listExclusions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listExclusions( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogExclusion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listExclusions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listExclusions(request), expectedError); - const actualRequest = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listExclusions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listExclusionsStream without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listExclusionsStream with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listExclusionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogExclusion[] = []; - stream.on('data', (response: protos.google.logging.v2.LogExclusion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listExclusions, request)); - assert( - (client.descriptors.page.listExclusions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions without error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - generateSampleMessage(new protos.google.logging.v2.LogExclusion()), - ]; - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogExclusion[] = []; - const iterable = client.listExclusionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listExclusions with error', async () => { - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListExclusionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListExclusionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listExclusions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listExclusionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogExclusion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listExclusions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', async () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', async () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', async () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', async () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', async () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', async () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', async () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', async () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', async () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', async () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', async () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', async () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', async () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', async () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', async () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', async () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', async () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', async () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', async () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', async () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', async () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', async () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', async () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', async () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', async () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', async () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', async () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new configservicev2Module.v2.ConfigServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_logging_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_logging_service_v2_v2.ts.baseline deleted file mode 100644 index 12256c5f1e8b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_logging_service_v2_v2.ts.baseline +++ /dev/null @@ -1,2263 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as loggingservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.LoggingServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = loggingservicev2Module.v2.LoggingServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = loggingservicev2Module.v2.LoggingServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new loggingservicev2Module.v2.LoggingServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = loggingservicev2Module.v2.LoggingServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - await client.initialize(); - assert(client.loggingServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.loggingServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.loggingServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('deleteLog', () => { - it('invokes deleteLog without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLog( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedHeaderRequestParams = `log_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLog(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLog with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogRequest', ['logName']); - request.logName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteLog(request), expectedError); - }); - }); - - describe('writeLogEntries', () => { - it('invokes writeLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.writeLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesResponse() - ); - client.innerApiCalls.writeLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.IWriteLogEntriesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes writeLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.writeLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - - it('invokes writeLogEntries with closed client', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.WriteLogEntriesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.writeLogEntries(request), expectedError); - }); - }); - - describe('tailLogEntries', () => { - it('invokes tailLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesResponse() - ); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(expectedResponse); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes tailLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.TailLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.tailLogEntries = stubBidiStreamingCall(undefined, expectedError); - const stream = client.tailLogEntries(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.logging.v2.TailLogEntriesResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.tailLogEntries as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('listLogEntries', () => { - it('invokes listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCall(expectedResponse); - const [response] = await client.listLogEntries(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.innerApiCalls.listLogEntries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogEntries( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogEntry[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listLogEntries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogEntries(request), expectedError); - }); - - it('invokes listLogEntriesStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('invokes listLogEntriesStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogEntriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogEntry[] = []; - stream.on('data', (response: protos.google.logging.v2.LogEntry) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogEntries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogEntries, request)); - }); - - it('uses async iteration with listLogEntries without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - generateSampleMessage(new protos.google.logging.v2.LogEntry()), - ]; - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogEntry[] = []; - const iterable = client.listLogEntriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listLogEntries with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogEntriesRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listLogEntries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogEntriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogEntry[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogEntries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListMonitoredResourceDescriptorsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listLogs', () => { - it('invokes listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCall(expectedResponse); - const [response] = await client.listLogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs without error using callback', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.listLogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogs( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogsStream without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogsStream with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogs, request)); - assert( - (client.descriptors.page.listLogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs without error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.listLogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogs with error', async () => { - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', async () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', async () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', async () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', async () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', async () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', async () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', async () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', async () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', async () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', async () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', async () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', async () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', async () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', async () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', async () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', async () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', async () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', async () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', async () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', async () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', async () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', async () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', async () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', async () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', async () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', async () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', async () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new loggingservicev2Module.v2.LoggingServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_metrics_service_v2_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_metrics_service_v2_v2.ts.baseline deleted file mode 100644 index 42c74d03e950..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/test/gapic_metrics_service_v2_v2.ts.baseline +++ /dev/null @@ -1,2105 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricsservicev2Module from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.MetricsServiceV2Client', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = metricsservicev2Module.v2.MetricsServiceV2Client.servicePath; - assert.strictEqual(servicePath, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = metricsservicev2Module.v2.MetricsServiceV2Client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'logging.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'logging.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new metricsservicev2Module.v2.MetricsServiceV2Client({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = metricsservicev2Module.v2.MetricsServiceV2Client.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - await client.initialize(); - assert(client.metricsServiceV2Stub); - }); - - it('has close method for the initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.metricsServiceV2Stub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricsServiceV2Stub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getLogMetric', () => { - it('invokes getLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.getLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.getLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.GetLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.GetLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLogMetric(request), expectedError); - }); - }); - - describe('createLogMetric', () => { - it('invokes createLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.createLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.createLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.CreateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.CreateLogMetricRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createLogMetric(request), expectedError); - }); - }); - - describe('updateLogMetric', () => { - it('invokes updateLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.updateLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.logging.v2.LogMetric() - ); - client.innerApiCalls.updateLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLogMetric( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.UpdateLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.UpdateLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateLogMetric(request), expectedError); - }); - }); - - describe('deleteLogMetric', () => { - it('invokes deleteLogMetric without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(expectedResponse); - const [response] = await client.deleteLogMetric(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteLogMetric = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteLogMetric( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedHeaderRequestParams = `metric_name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteLogMetric = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteLogMetric(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteLogMetric as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteLogMetric with closed client', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.DeleteLogMetricRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.DeleteLogMetricRequest', ['metricName']); - request.metricName = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteLogMetric(request), expectedError); - }); - }); - - describe('listLogMetrics', () => { - it('invokes listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCall(expectedResponse); - const [response] = await client.listLogMetrics(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics without error using callback', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.innerApiCalls.listLogMetrics = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listLogMetrics( - request, - (err?: Error|null, result?: protos.google.logging.v2.ILogMetric[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listLogMetrics = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listLogMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listLogMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listLogMetricsStream without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listLogMetricsStream with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listLogMetricsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.logging.v2.LogMetric[] = []; - stream.on('data', (response: protos.google.logging.v2.LogMetric) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listLogMetrics, request)); - assert( - (client.descriptors.page.listLogMetrics.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics without error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - generateSampleMessage(new protos.google.logging.v2.LogMetric()), - ]; - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.logging.v2.ILogMetric[] = []; - const iterable = client.listLogMetricsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listLogMetrics with error', async () => { - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.logging.v2.ListLogMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.logging.v2.ListLogMetricsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listLogMetrics.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLogMetricsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.logging.v2.ILogMetric[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listLogMetrics.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('billingAccountCmekSettings', async () => { - const fakePath = "/rendered/path/billingAccountCmekSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountCmekSettingsPath', () => { - const result = client.billingAccountCmekSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountCmekSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountCmekSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountExclusion', async () => { - const fakePath = "/rendered/path/billingAccountExclusion"; - const expectedParameters = { - billing_account: "billingAccountValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountExclusionPath', () => { - const result = client.billingAccountExclusionPath("billingAccountValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountExclusionName', () => { - const result = client.matchBillingAccountFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromBillingAccountExclusionName', () => { - const result = client.matchExclusionFromBillingAccountExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.billingAccountExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucket', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucket"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketPath', () => { - const result = client.billingAccountLocationBucketPath("billingAccountValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLocationBucketView', async () => { - const fakePath = "/rendered/path/billingAccountLocationBucketView"; - const expectedParameters = { - billing_account: "billingAccountValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLocationBucketViewPath', () => { - const result = client.billingAccountLocationBucketViewPath("billingAccountValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBillingAccountFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBillingAccountLocationBucketViewName', () => { - const result = client.matchLocationFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromBillingAccountLocationBucketViewName', () => { - const result = client.matchBucketFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromBillingAccountLocationBucketViewName', () => { - const result = client.matchViewFromBillingAccountLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.billingAccountLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountLog', async () => { - const fakePath = "/rendered/path/billingAccountLog"; - const expectedParameters = { - billing_account: "billingAccountValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountLogPath', () => { - const result = client.billingAccountLogPath("billingAccountValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountLogName', () => { - const result = client.matchBillingAccountFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromBillingAccountLogName', () => { - const result = client.matchLogFromBillingAccountLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.billingAccountLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSettings', async () => { - const fakePath = "/rendered/path/billingAccountSettings"; - const expectedParameters = { - billing_account: "billingAccountValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSettingsPath', () => { - const result = client.billingAccountSettingsPath("billingAccountValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSettingsName', () => { - const result = client.matchBillingAccountFromBillingAccountSettingsName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('billingAccountSink', async () => { - const fakePath = "/rendered/path/billingAccountSink"; - const expectedParameters = { - billing_account: "billingAccountValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.billingAccountSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.billingAccountSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('billingAccountSinkPath', () => { - const result = client.billingAccountSinkPath("billingAccountValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.billingAccountSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchBillingAccountFromBillingAccountSinkName', () => { - const result = client.matchBillingAccountFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "billingAccountValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromBillingAccountSinkName', () => { - const result = client.matchSinkFromBillingAccountSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.billingAccountSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderCmekSettings', async () => { - const fakePath = "/rendered/path/folderCmekSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderCmekSettingsPath', () => { - const result = client.folderCmekSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderCmekSettingsName', () => { - const result = client.matchFolderFromFolderCmekSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderExclusion', async () => { - const fakePath = "/rendered/path/folderExclusion"; - const expectedParameters = { - folder: "folderValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderExclusionPath', () => { - const result = client.folderExclusionPath("folderValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderExclusionName', () => { - const result = client.matchFolderFromFolderExclusionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromFolderExclusionName', () => { - const result = client.matchExclusionFromFolderExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.folderExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucket', async () => { - const fakePath = "/rendered/path/folderLocationBucket"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketPath', () => { - const result = client.folderLocationBucketPath("folderValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketName', () => { - const result = client.matchFolderFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketName', () => { - const result = client.matchLocationFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketName', () => { - const result = client.matchBucketFromFolderLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLocationBucketView', async () => { - const fakePath = "/rendered/path/folderLocationBucketView"; - const expectedParameters = { - folder: "folderValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLocationBucketViewPath', () => { - const result = client.folderLocationBucketViewPath("folderValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLocationBucketViewName', () => { - const result = client.matchFolderFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromFolderLocationBucketViewName', () => { - const result = client.matchLocationFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromFolderLocationBucketViewName', () => { - const result = client.matchBucketFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromFolderLocationBucketViewName', () => { - const result = client.matchViewFromFolderLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.folderLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderLog', async () => { - const fakePath = "/rendered/path/folderLog"; - const expectedParameters = { - folder: "folderValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderLogPath', () => { - const result = client.folderLogPath("folderValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderLogName', () => { - const result = client.matchFolderFromFolderLogName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromFolderLogName', () => { - const result = client.matchLogFromFolderLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.folderLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSettings', async () => { - const fakePath = "/rendered/path/folderSettings"; - const expectedParameters = { - folder: "folderValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSettingsPath', () => { - const result = client.folderSettingsPath("folderValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSettingsName', () => { - const result = client.matchFolderFromFolderSettingsName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderSink', async () => { - const fakePath = "/rendered/path/folderSink"; - const expectedParameters = { - folder: "folderValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderSinkPath', () => { - const result = client.folderSinkPath("folderValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderSinkName', () => { - const result = client.matchFolderFromFolderSinkName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromFolderSinkName', () => { - const result = client.matchSinkFromFolderSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.folderSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('logMetric', async () => { - const fakePath = "/rendered/path/logMetric"; - const expectedParameters = { - project: "projectValue", - metric: "metricValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.logMetricPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.logMetricPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('logMetricPath', () => { - const result = client.logMetricPath("projectValue", "metricValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.logMetricPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLogMetricName', () => { - const result = client.matchProjectFromLogMetricName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricFromLogMetricName', () => { - const result = client.matchMetricFromLogMetricName(fakePath); - assert.strictEqual(result, "metricValue"); - assert((client.pathTemplates.logMetricPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationCmekSettings', async () => { - const fakePath = "/rendered/path/organizationCmekSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationCmekSettingsPath', () => { - const result = client.organizationCmekSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationCmekSettingsName', () => { - const result = client.matchOrganizationFromOrganizationCmekSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationExclusion', async () => { - const fakePath = "/rendered/path/organizationExclusion"; - const expectedParameters = { - organization: "organizationValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationExclusionPath', () => { - const result = client.organizationExclusionPath("organizationValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationExclusionName', () => { - const result = client.matchOrganizationFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromOrganizationExclusionName', () => { - const result = client.matchExclusionFromOrganizationExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.organizationExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucket', async () => { - const fakePath = "/rendered/path/organizationLocationBucket"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketPath', () => { - const result = client.organizationLocationBucketPath("organizationValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketName', () => { - const result = client.matchLocationFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketName', () => { - const result = client.matchBucketFromOrganizationLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLocationBucketView', async () => { - const fakePath = "/rendered/path/organizationLocationBucketView"; - const expectedParameters = { - organization: "organizationValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLocationBucketViewPath', () => { - const result = client.organizationLocationBucketViewPath("organizationValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLocationBucketViewName', () => { - const result = client.matchOrganizationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromOrganizationLocationBucketViewName', () => { - const result = client.matchLocationFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromOrganizationLocationBucketViewName', () => { - const result = client.matchBucketFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromOrganizationLocationBucketViewName', () => { - const result = client.matchViewFromOrganizationLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.organizationLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationLog', async () => { - const fakePath = "/rendered/path/organizationLog"; - const expectedParameters = { - organization: "organizationValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationLogPath', () => { - const result = client.organizationLogPath("organizationValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationLogName', () => { - const result = client.matchOrganizationFromOrganizationLogName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromOrganizationLogName', () => { - const result = client.matchLogFromOrganizationLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.organizationLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSettings', async () => { - const fakePath = "/rendered/path/organizationSettings"; - const expectedParameters = { - organization: "organizationValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSettingsPath', () => { - const result = client.organizationSettingsPath("organizationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSettingsName', () => { - const result = client.matchOrganizationFromOrganizationSettingsName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationSink', async () => { - const fakePath = "/rendered/path/organizationSink"; - const expectedParameters = { - organization: "organizationValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationSinkPath', () => { - const result = client.organizationSinkPath("organizationValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationSinkName', () => { - const result = client.matchOrganizationFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromOrganizationSinkName', () => { - const result = client.matchSinkFromOrganizationSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.organizationSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectCmekSettings', async () => { - const fakePath = "/rendered/path/projectCmekSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectCmekSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectCmekSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectCmekSettingsPath', () => { - const result = client.projectCmekSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectCmekSettingsName', () => { - const result = client.matchProjectFromProjectCmekSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectCmekSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectExclusion', async () => { - const fakePath = "/rendered/path/projectExclusion"; - const expectedParameters = { - project: "projectValue", - exclusion: "exclusionValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectExclusionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExclusionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExclusionPath', () => { - const result = client.projectExclusionPath("projectValue", "exclusionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExclusionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExclusionName', () => { - const result = client.matchProjectFromProjectExclusionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExclusionFromProjectExclusionName', () => { - const result = client.matchExclusionFromProjectExclusionName(fakePath); - assert.strictEqual(result, "exclusionValue"); - assert((client.pathTemplates.projectExclusionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucket', async () => { - const fakePath = "/rendered/path/projectLocationBucket"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketPath', () => { - const result = client.projectLocationBucketPath("projectValue", "locationValue", "bucketValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketName', () => { - const result = client.matchProjectFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketName', () => { - const result = client.matchLocationFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketName', () => { - const result = client.matchBucketFromProjectLocationBucketName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLocationBucketView', async () => { - const fakePath = "/rendered/path/projectLocationBucketView"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - bucket: "bucketValue", - view: "viewValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLocationBucketViewPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLocationBucketViewPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLocationBucketViewPath', () => { - const result = client.projectLocationBucketViewPath("projectValue", "locationValue", "bucketValue", "viewValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLocationBucketViewName', () => { - const result = client.matchProjectFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProjectLocationBucketViewName', () => { - const result = client.matchLocationFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBucketFromProjectLocationBucketViewName', () => { - const result = client.matchBucketFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "bucketValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchViewFromProjectLocationBucketViewName', () => { - const result = client.matchViewFromProjectLocationBucketViewName(fakePath); - assert.strictEqual(result, "viewValue"); - assert((client.pathTemplates.projectLocationBucketViewPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectLog', async () => { - const fakePath = "/rendered/path/projectLog"; - const expectedParameters = { - project: "projectValue", - log: "logValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectLogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectLogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectLogPath', () => { - const result = client.projectLogPath("projectValue", "logValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectLogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectLogName', () => { - const result = client.matchProjectFromProjectLogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLogFromProjectLogName', () => { - const result = client.matchLogFromProjectLogName(fakePath); - assert.strictEqual(result, "logValue"); - assert((client.pathTemplates.projectLogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSettings', async () => { - const fakePath = "/rendered/path/projectSettings"; - const expectedParameters = { - project: "projectValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSettingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSettingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSettingsPath', () => { - const result = client.projectSettingsPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSettingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSettingsName', () => { - const result = client.matchProjectFromProjectSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSettingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectSink', async () => { - const fakePath = "/rendered/path/projectSink"; - const expectedParameters = { - project: "projectValue", - sink: "sinkValue", - }; - const client = new metricsservicev2Module.v2.MetricsServiceV2Client({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectSinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectSinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectSinkPath', () => { - const result = client.projectSinkPath("projectValue", "sinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectSinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectSinkName', () => { - const result = client.matchProjectFromProjectSinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSinkFromProjectSinkName', () => { - const result = client.matchSinkFromProjectSinkName(fakePath); - assert.strictEqual(result, "sinkValue"); - assert((client.pathTemplates.projectSinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/logging/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/logging/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/logging/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/logging/webpack.config.js.baseline deleted file mode 100644 index 67067d1ac812..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/logging/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'LoggingService', - filename: './logging-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 8c6c51102fdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/monitoring/google-monitoring-nodejs - dest: /owl-bot-staging/google-monitoring - -api-name: monitoring \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 64b28c98e492..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'monitoring', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/README.md.baseline deleted file mode 100644 index 076f8cc1073a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Monitoring: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/monitoring.svg)](https://www.npmjs.org/package/monitoring) - -Monitoring client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Monitoring Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/monitoring/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Monitoring API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install monitoring -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install monitoring@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=monitoring.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/index.ts.baseline deleted file mode 100644 index c72b2783391b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2026 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. ** - -import * as v3 from './v3/index.js'; -const AlertPolicyServiceClient = v3.AlertPolicyServiceClient; -type AlertPolicyServiceClient = v3.AlertPolicyServiceClient; -const GroupServiceClient = v3.GroupServiceClient; -type GroupServiceClient = v3.GroupServiceClient; -const MetricServiceClient = v3.MetricServiceClient; -type MetricServiceClient = v3.MetricServiceClient; -const NotificationChannelServiceClient = v3.NotificationChannelServiceClient; -type NotificationChannelServiceClient = v3.NotificationChannelServiceClient; -const ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; -type ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; -const UptimeCheckServiceClient = v3.UptimeCheckServiceClient; -type UptimeCheckServiceClient = v3.UptimeCheckServiceClient; -export {v3, AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient}; -export default {v3, AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client.ts.baseline deleted file mode 100644 index ef8c6adb0934..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client.ts.baseline +++ /dev/null @@ -1,2075 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as alert_policy_service_client_config from './alert_policy_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/alert_policy_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'alert_policy_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The AlertPolicyService API is used to manage (list, create, delete, - * edit) alert policies in Stackdriver Monitoring. An alerting policy is - * a description of the conditions under which some aspect of your - * system is considered to be "unhealthy" and the ways to notify - * people or services about this state. In addition to using this API, alert - * policies can also be managed through - * [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), - * which can be reached by clicking the "Monitoring" tab in - * [Cloud Console](https://console.cloud.google.com/). - * @class - * @memberof v3 - */ -export class AlertPolicyServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - alertPolicyServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AlertPolicyServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 AlertPolicyServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AlertPolicyServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listAlertPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'alertPolicies') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.AlertPolicyService', gapicConfig as gax.ClientConfig, - 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.alertPolicyServiceStub) { - return this.alertPolicyServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.AlertPolicyService. - this.alertPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.AlertPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.AlertPolicyService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const alertPolicyServiceStubMethods = - ['listAlertPolicies', 'getAlertPolicy', 'createAlertPolicy', 'deleteAlertPolicy', 'updateAlertPolicy']; - for (const methodName of alertPolicyServiceStubMethods) { - const callPromise = this.alertPolicyServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.alertPolicyServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to retrieve. The format is - * - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.get_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async - */ - getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>; - getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('getAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project in which to create the alerting policy. The format is - * `projects/[PROJECT_ID]`. - * - * Note that this field names the parent container in which the alerting - * policy will be written, not the name of the created policy. The alerting - * policy that is returned will have a name that contains a normalized - * representation of this name as a prefix but adds a suffix of the form - * `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including - * a new [ALERT_POLICY_ID] value. - * @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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.create_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async - */ - createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>; - createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('createAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to delete. The format is: - * - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * - * For more information, see {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.delete_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async - */ - deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>; - deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an alerting policy. You can either replace the entire policy with - * a new one or replace only certain fields in the current alerting policy by - * specifying the fields to be updated via `updateMask`. Returns the - * updated alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. A list of alerting policy field names. If this field is not - * empty, each listed field in the existing alerting policy is set to the - * value of the corresponding field in the supplied policy (`alert_policy`), - * or to the field's default value if the field is not in the supplied - * alerting policy. Fields not listed retain their previous value. - * - * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, - * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - * - * If this field is empty, then the supplied alerting policy replaces the - * existing policy. It is the same as deleting the existing policy and - * adding the supplied policy, except for the following: - * - * + The new policy will have the same `[ALERT_POLICY_ID]` as the former - * policy. This gives you continuity with the former policy in your - * notifications and incidents. - * + Conditions in the new policy will keep their former `[CONDITION_ID]` if - * the supplied condition includes the `name` field with that - * `[CONDITION_ID]`. If the supplied condition omits the `name` field, - * then a new `[CONDITION_ID]` is created. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The updated alerting policy or the updated values for the - * fields listed in `update_mask`. - * If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - * @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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.update_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async - */ - updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>; - updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'alert_policy.name': request.alertPolicy!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('updateAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing alerting policies for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAlertPoliciesAsync()` - * 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. - */ - listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>; - listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; - listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; - listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listAlertPolicies values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listAlertPolicies request %j', request); - return this.innerApiCalls - .listAlertPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]) => { - this._log.info('listAlertPolicies values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listAlertPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.AlertPolicy|AlertPolicy} 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 `listAlertPoliciesAsync()` - * 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. - */ - listAlertPoliciesStream( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listAlertPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listAlertPolicies stream %j', request); - return this.descriptors.page.listAlertPolicies.createStream( - this.innerApiCalls.listAlertPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAlertPolicies`, 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.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.AlertPolicy|AlertPolicy}. 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 include:samples/generated/v3/alert_policy_service.list_alert_policies.js - * region_tag:monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async - */ - listAlertPoliciesAsync( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listAlertPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listAlertPolicies iterate %j', request); - return this.descriptors.page.listAlertPolicies.asyncIterate( - this.innerApiCalls['listAlertPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.alertPolicyServiceStub && !this._terminated) { - return this.alertPolicyServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client_config.json.baseline deleted file mode 100644 index 5c3935f3cf30..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.AlertPolicyService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListAlertPolicies": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/alert_policy_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client.ts.baseline deleted file mode 100644 index d17af876d1ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client.ts.baseline +++ /dev/null @@ -1,2275 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as group_service_client_config from './group_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/group_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'group_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The Group API lets you inspect and manage your - * [groups](#google.monitoring.v3.Group). - * - * A group is a named filter that is used to identify - * a collection of monitored resources. Groups are typically used to - * mirror the physical and/or logical topology of the environment. - * Because group membership is computed dynamically, monitored - * resources that are started in the future are automatically placed - * in matching groups. By using a group to name monitored resources in, - * for example, an alert policy, the target of that alert policy is - * updated automatically as monitored resources are added and removed - * from the infrastructure. - * @class - * @memberof v3 - */ -export class GroupServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - groupServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GroupServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 GroupServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GroupServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'group'), - listGroupMembers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'members') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.GroupService', gapicConfig as gax.ClientConfig, - 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.groupServiceStub) { - return this.groupServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.GroupService. - this.groupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.GroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.GroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const groupServiceStubMethods = - ['listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'listGroupMembers']; - for (const methodName of groupServiceStubMethods) { - const callPromise = this.groupServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.groupServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to retrieve. The format is - * `"projects/{project_id_or_number}/groups/{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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.get_group.js - * region_tag:monitoring_v3_generated_GroupService_GetGroup_async - */ - getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>; - getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGroup response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]) => { - this._log.info('getGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project in which to create the group. The format is - * `"projects/{project_id_or_number}"`. - * @param {google.monitoring.v3.Group} request.group - * Required. A group definition. It is an error to define the `name` field because - * the system assigns the name. - * @param {boolean} request.validateOnly - * If true, validate this request but do not create the 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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.create_group.js - * region_tag:monitoring_v3_generated_GroupService_CreateGroup_async - */ - createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>; - createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; - createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; - createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createGroup response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]) => { - this._log.info('createGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an existing group. - * You can change any group attributes except `name`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Group} request.group - * Required. The new definition of the group. All fields of the existing group, - * excepting `name`, are replaced with the corresponding fields of this group. - * @param {boolean} request.validateOnly - * If true, validate this request but do not update the existing 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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.update_group.js - * region_tag:monitoring_v3_generated_GroupService_UpdateGroup_async - */ - updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>; - updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; - updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; - updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group.name': request.group!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGroup response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]) => { - this._log.info('updateGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an existing group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to delete. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {boolean} request.recursive - * If this field is true, then the request means to delete a group with all - * its descendants. Otherwise, the request means to delete a group only when - * it has no descendants. The default value is false. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.delete_group.js - * region_tag:monitoring_v3_generated_GroupService_DeleteGroup_async - */ - deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>; - deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteGroup request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteGroup response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing groups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.Group|Group}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * 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. - */ - listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>; - listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; - listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; - listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGroups values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listGroups request %j', request); - return this.innerApiCalls - .listGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]) => { - this._log.info('listGroups values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Group|Group} 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 `listGroupsAsync()` - * 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. - */ - listGroupsStream( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroups stream %j', request); - return this.descriptors.page.listGroups.createStream( - this.innerApiCalls.listGroups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGroups`, 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.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Group|Group}. 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 include:samples/generated/v3/group_service.list_groups.js - * region_tag:monitoring_v3_generated_GroupService_ListGroups_async - */ - listGroupsAsync( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroups iterate %j', request); - return this.descriptors.page.listGroups.asyncIterate( - this.innerApiCalls['listGroups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the monitored resources that are members of a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute 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 Array of {@link protos.google.api.MonitoredResource|MonitoredResource}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupMembersAsync()` - * 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. - */ - listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>; - listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; - listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; - listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGroupMembers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listGroupMembers request %j', request); - return this.innerApiCalls - .listGroupMembers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]) => { - this._log.info('listGroupMembers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGroupMembers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute 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 {@link protos.google.api.MonitoredResource|MonitoredResource} 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 `listGroupMembersAsync()` - * 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. - */ - listGroupMembersStream( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroupMembers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroupMembers stream %j', request); - return this.descriptors.page.listGroupMembers.createStream( - this.innerApiCalls.listGroupMembers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGroupMembers`, 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.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - * @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.api.MonitoredResource|MonitoredResource}. 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 include:samples/generated/v3/group_service.list_group_members.js - * region_tag:monitoring_v3_generated_GroupService_ListGroupMembers_async - */ - listGroupMembersAsync( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroupMembers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroupMembers iterate %j', request); - return this.descriptors.page.listGroupMembers.asyncIterate( - this.innerApiCalls['listGroupMembers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.groupServiceStub && !this._terminated) { - return this.groupServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client_config.json.baseline deleted file mode 100644 index e63f2afe355b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.GroupService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListGroups": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGroupMembers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/group_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/index.ts.baseline deleted file mode 100644 index 90525166d49a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {AlertPolicyServiceClient} from './alert_policy_service_client.js'; -export {GroupServiceClient} from './group_service_client.js'; -export {MetricServiceClient} from './metric_service_client.js'; -export {NotificationChannelServiceClient} from './notification_channel_service_client.js'; -export {ServiceMonitoringServiceClient} from './service_monitoring_service_client.js'; -export {UptimeCheckServiceClient} from './uptime_check_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client.ts.baseline deleted file mode 100644 index 20932e97b055..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client.ts.baseline +++ /dev/null @@ -1,2855 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as metric_service_client_config from './metric_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/metric_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'metric_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Manages metric descriptors, monitored resource descriptors, and - * time series data. - * @class - * @memberof v3 - */ -export class MetricServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 MetricServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/metricDescriptors/{metric_descriptor=**}' - ), - folderMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}' - ), - organizationMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metricDescriptors/{metric_descriptor=**}' - ), - projectMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listMetricDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metricDescriptors'), - listTimeSeries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'timeSeries') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.MetricService', gapicConfig as gax.ClientConfig, - 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.metricServiceStub) { - return this.metricServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.MetricService. - this.metricServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.MetricService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.MetricService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const metricServiceStubMethods = - ['listMonitoredResourceDescriptors', 'getMonitoredResourceDescriptor', 'listMetricDescriptors', 'getMetricDescriptor', 'createMetricDescriptor', 'deleteMetricDescriptor', 'listTimeSeries', 'createTimeSeries']; - for (const methodName of metricServiceStubMethods) { - const callPromise = this.metricServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.metricServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read', - 'https://www.googleapis.com/auth/monitoring.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single monitored resource descriptor. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The monitored resource descriptor to get. The format is - * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - * The `{resource_type}` is a predefined type, such as - * `cloudsql_database`. - * @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 {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_monitored_resource_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async - */ - getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>; - getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getMonitoredResourceDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getMonitoredResourceDescriptor response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getMonitoredResourceDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]) => { - this._log.info('getMonitoredResourceDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a single metric descriptor. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example value of `{metric_id}` is - * `"compute.googleapis.com/instance/disk/read_bytes_count"`. - * @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 {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMetricDescriptor_async - */ - getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>; - getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]) => { - this._log.info('getMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new metric descriptor. - * User-created metric descriptors define - * [custom metrics](/monitoring/custom-metrics). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {google.api.MetricDescriptor} request.metricDescriptor - * Required. The new [custom metric](/monitoring/custom-metrics) - * descriptor. - * @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 {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_CreateMetricDescriptor_async - */ - createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>; - createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]) => { - this._log.info('createMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a metric descriptor. Only user-created - * [custom metrics](/monitoring/custom-metrics) can be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example of `{metric_id}` is: - * `"custom.googleapis.com/my_test_metric"`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.delete_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async - */ - deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>; - deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates or adds data to one or more time series. - * The response is empty if all time series in the request were written. - * If any time series could not be written, a corresponding failure message is - * included in the error response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {number[]} request.timeSeries - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * - * The maximum number of `TimeSeries` objects per `Create` request is 200. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_time_series.js - * region_tag:monitoring_v3_generated_MetricService_CreateTimeSeries_async - */ - createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>; - createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; - createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; - createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createTimeSeries request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createTimeSeries response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createTimeSeries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]) => { - this._log.info('createTimeSeries response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMonitoredResourceDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listMonitoredResourceDescriptors request %j', request); - return this.innerApiCalls - .listMonitoredResourceDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]) => { - this._log.info('listMonitoredResourceDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} 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 `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors stream %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, 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.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. 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 include:samples/generated/v3/metric_service.list_monitored_resource_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors iterate %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists metric descriptors that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetricDescriptorsAsync()` - * 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. - */ - listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>; - listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; - listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; - listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMetricDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listMetricDescriptors request %j', request); - return this.innerApiCalls - .listMetricDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]) => { - this._log.info('listMetricDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMetricDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MetricDescriptor|MetricDescriptor} 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 `listMetricDescriptorsAsync()` - * 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. - */ - listMetricDescriptorsStream( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMetricDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMetricDescriptors stream %j', request); - return this.descriptors.page.listMetricDescriptors.createStream( - this.innerApiCalls.listMetricDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetricDescriptors`, 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.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MetricDescriptor|MetricDescriptor}. 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 include:samples/generated/v3/metric_service.list_metric_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMetricDescriptors_async - */ - listMetricDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMetricDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMetricDescriptors iterate %j', request); - return this.descriptors.page.listMetricDescriptors.asyncIterate( - this.innerApiCalls['listMetricDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists time series that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTimeSeriesAsync()` - * 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. - */ - listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>; - listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; - listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; - listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTimeSeries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listTimeSeries request %j', request); - return this.innerApiCalls - .listTimeSeries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]) => { - this._log.info('listTimeSeries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTimeSeries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.TimeSeries|TimeSeries} 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 `listTimeSeriesAsync()` - * 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. - */ - listTimeSeriesStream( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listTimeSeries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTimeSeries stream %j', request); - return this.descriptors.page.listTimeSeries.createStream( - this.innerApiCalls.listTimeSeries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTimeSeries`, 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.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.TimeSeries|TimeSeries}. 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 include:samples/generated/v3/metric_service.list_time_series.js - * region_tag:monitoring_v3_generated_MetricService_ListTimeSeries_async - */ - listTimeSeriesAsync( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listTimeSeries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTimeSeries iterate %j', request); - return this.descriptors.page.listTimeSeries.asyncIterate( - this.innerApiCalls['listTimeSeries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderMetricDescriptor resource name string. - * - * @param {string} folder - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - folderMetricDescriptorPath(folder:string,metricDescriptor:string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.render({ - folder: folder, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the folder from FolderMetricDescriptor resource. - * - * @param {string} folderMetricDescriptorName - * A fully-qualified path representing folder_metric_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).folder; - } - - /** - * Parse the metric_descriptor from FolderMetricDescriptor resource. - * - * @param {string} folderMetricDescriptorName - * A fully-qualified path representing folder_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified folderMonitoredResourceDescriptor resource name string. - * - * @param {string} folder - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - folderMonitoredResourceDescriptorPath(folder:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render({ - folder: folder, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the folder from FolderMonitoredResourceDescriptor resource. - * - * @param {string} folderMonitoredResourceDescriptorName - * A fully-qualified path representing folder_monitored_resource_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).folder; - } - - /** - * Parse the monitored_resource_descriptor from FolderMonitoredResourceDescriptor resource. - * - * @param {string} folderMonitoredResourceDescriptorName - * A fully-qualified path representing folder_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationMetricDescriptor resource name string. - * - * @param {string} organization - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - organizationMetricDescriptorPath(organization:string,metricDescriptor:string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.render({ - organization: organization, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the organization from OrganizationMetricDescriptor resource. - * - * @param {string} organizationMetricDescriptorName - * A fully-qualified path representing organization_metric_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).organization; - } - - /** - * Parse the metric_descriptor from OrganizationMetricDescriptor resource. - * - * @param {string} organizationMetricDescriptorName - * A fully-qualified path representing organization_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified organizationMonitoredResourceDescriptor resource name string. - * - * @param {string} organization - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - organizationMonitoredResourceDescriptorPath(organization:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render({ - organization: organization, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the organization from OrganizationMonitoredResourceDescriptor resource. - * - * @param {string} organizationMonitoredResourceDescriptorName - * A fully-qualified path representing organization_monitored_resource_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).organization; - } - - /** - * Parse the monitored_resource_descriptor from OrganizationMonitoredResourceDescriptor resource. - * - * @param {string} organizationMonitoredResourceDescriptorName - * A fully-qualified path representing organization_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectMetricDescriptor resource name string. - * - * @param {string} project - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - projectMetricDescriptorPath(project:string,metricDescriptor:string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.render({ - project: project, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the project from ProjectMetricDescriptor resource. - * - * @param {string} projectMetricDescriptorName - * A fully-qualified path representing project_metric_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).project; - } - - /** - * Parse the metric_descriptor from ProjectMetricDescriptor resource. - * - * @param {string} projectMetricDescriptorName - * A fully-qualified path representing project_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified projectMonitoredResourceDescriptor resource name string. - * - * @param {string} project - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - projectMonitoredResourceDescriptorPath(project:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render({ - project: project, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the project from ProjectMonitoredResourceDescriptor resource. - * - * @param {string} projectMonitoredResourceDescriptorName - * A fully-qualified path representing project_monitored_resource_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).project; - } - - /** - * Parse the monitored_resource_descriptor from ProjectMonitoredResourceDescriptor resource. - * - * @param {string} projectMonitoredResourceDescriptorName - * A fully-qualified path representing project_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.metricServiceStub && !this._terminated) { - return this.metricServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client_config.json.baseline deleted file mode 100644 index c1826e96c804..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.MetricService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMonitoredResourceDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetMonitoredResourceDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetricDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTimeSeries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTimeSeries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/metric_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client.ts.baseline deleted file mode 100644 index aaec51a6efb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client.ts.baseline +++ /dev/null @@ -1,2697 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as notification_channel_service_client_config from './notification_channel_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/notification_channel_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'notification_channel_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The Notification Channel API provides access to configuration that - * controls how messages related to incidents are sent. - * @class - * @memberof v3 - */ -export class NotificationChannelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - notificationChannelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of NotificationChannelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 NotificationChannelServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NotificationChannelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listNotificationChannelDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channelDescriptors'), - listNotificationChannels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationChannels') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.NotificationChannelService', gapicConfig as gax.ClientConfig, - 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.notificationChannelServiceStub) { - return this.notificationChannelServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.NotificationChannelService. - this.notificationChannelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.NotificationChannelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.NotificationChannelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const notificationChannelServiceStubMethods = - ['listNotificationChannelDescriptors', 'getNotificationChannelDescriptor', 'listNotificationChannels', 'getNotificationChannel', 'createNotificationChannel', 'updateNotificationChannel', 'deleteNotificationChannel', 'sendNotificationChannelVerificationCode', 'getNotificationChannelVerificationCode', 'verifyNotificationChannel']; - for (const methodName of notificationChannelServiceStubMethods) { - const callPromise = this.notificationChannelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.notificationChannelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single channel descriptor. The descriptor indicates which fields - * are expected / permitted for a notification channel of the given type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel type for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - * @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 {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async - */ - getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>; - getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannelDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelDescriptor response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getNotificationChannelDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]) => { - this._log.info('getNotificationChannelDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a single notification channel. The channel includes the relevant - * configuration details with which the channel was created. However, the - * response may truncate or omit passwords, API keys, or other private key - * matter and thus the response may not be 100% identical to the information - * that was supplied in the call to the create method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async - */ - getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>; - getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]) => { - this._log.info('getNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new notification channel, representing a single notification - * endpoint such as an email address, SMS number, or PagerDuty service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is: - * - * projects/[PROJECT_ID] - * - * Note that this names the container into which the channel will be - * written. This does not name the newly created channel. The resulting - * channel's name will have a normalized version of this field as a prefix, - * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. The definition of the `NotificationChannel` 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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.create_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async - */ - createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>; - createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]) => { - this._log.info('createNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a notification channel. Fields not specified in the field mask - * remain unchanged. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. A description of the changes to be applied to the specified - * notification channel. The description must provide a definition for - * fields to be updated; the names of these fields should also be - * included in the `update_mask`. - * @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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.update_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async - */ - updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>; - updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'notification_channel.name': request.notificationChannel!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]) => { - this._log.info('updateNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a notification channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - * @param {boolean} request.force - * If true, the notification channel will be deleted regardless of its - * use in alert policies (the policies will be updated to remove the - * channel). If false, channels that are still referenced by an existing - * alerting policy will fail to be deleted in a delete operation. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.delete_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async - */ - deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>; - deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Causes a verification code to be delivered to the channel. The code - * can then be supplied in `VerifyNotificationChannel` to verify the channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to which to send a verification code. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async - */ - sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; - sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('sendNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('sendNotificationChannelVerificationCode response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.sendNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]) => { - this._log.info('sendNotificationChannelVerificationCode response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Requests a verification code for an already verified channel that can then - * be used in a call to VerifyNotificationChannel() on a different channel - * with an equivalent identity in the same or in a different project. This - * makes it possible to copy a channel between projects without requiring - * manual reverification of the channel. If the channel is not in the - * verified state, this method will fail (in other words, this may only be - * used if the SendNotificationChannelVerificationCode and - * VerifyNotificationChannel paths have already been used to put the given - * channel into the verified state). - * - * There is no guarantee that the verification codes returned by this method - * will be of a similar structure or form as the ones that are delivered - * to the channel via SendNotificationChannelVerificationCode; while - * VerifyNotificationChannel() will recognize both the codes delivered via - * SendNotificationChannelVerificationCode() and returned from - * GetNotificationChannelVerificationCode(), it is typically the case that - * the verification codes delivered via - * SendNotificationChannelVerificationCode() will be shorter and also - * have a shorter expiration (e.g. codes such as "G-123456") whereas - * GetVerificationCode() will typically return a much longer, websafe base - * 64 encoded string that has a longer expiration time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel for which a verification code is to be generated - * and retrieved. This must name a channel that is already verified; if - * the specified channel is not verified, the request will fail. - * @param {google.protobuf.Timestamp} request.expireTime - * The desired expiration time. If specified, the API will guarantee that - * the returned code will not be valid after the specified timestamp; - * however, the API cannot guarantee that the returned code will be - * valid for at least as long as the requested time (the API puts an upper - * bound on the amount of time for which a code may be valid). If omitted, - * a default expiration will be used, which may be less than the max - * permissible expiration (so specifying an expiration may extend the - * code's lifetime over omitting an expiration, even though the API does - * impose an upper limit on the maximum expiration that is permitted). - * @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 {@link protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse|GetNotificationChannelVerificationCodeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async - */ - getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; - getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelVerificationCode response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]) => { - this._log.info('getNotificationChannelVerificationCode response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Verifies a `NotificationChannel` by proving receipt of the code - * delivered to the channel as a result of calling - * `SendNotificationChannelVerificationCode`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to verify. - * @param {string} request.code - * Required. The verification code that was delivered to the channel as - * a result of invoking the `SendNotificationChannelVerificationCode` API - * method or that was retrieved from a verified channel via - * `GetNotificationChannelVerificationCode`. For example, one might have - * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - * guaranteed that the code is valid UTF-8; one should not - * make any assumptions regarding the structure or format of the code). - * @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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.verify_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async - */ - verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>; - verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.verifyNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]) => { - this._log.info('verifyNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the descriptors for supported channel types. The use of descriptors - * makes it possible for new channel types to be dynamically added. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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 Array of {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelDescriptorsAsync()` - * 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. - */ - listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>; - listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; - listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; - listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listNotificationChannelDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listNotificationChannelDescriptors request %j', request); - return this.innerApiCalls - .listNotificationChannelDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]) => { - this._log.info('listNotificationChannelDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listNotificationChannelDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor} 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 `listNotificationChannelDescriptorsAsync()` - * 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. - */ - listNotificationChannelDescriptorsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannelDescriptors stream %j', request); - return this.descriptors.page.listNotificationChannelDescriptors.createStream( - this.innerApiCalls.listNotificationChannelDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationChannelDescriptors`, 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.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. 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 include:samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async - */ - listNotificationChannelDescriptorsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannelDescriptors iterate %j', request); - return this.descriptors.page.listNotificationChannelDescriptors.asyncIterate( - this.innerApiCalls['listNotificationChannelDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the notification channels that have been created for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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 Array of {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelsAsync()` - * 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. - */ - listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>; - listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; - listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; - listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listNotificationChannels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listNotificationChannels request %j', request); - return this.innerApiCalls - .listNotificationChannels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]) => { - this._log.info('listNotificationChannels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listNotificationChannels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannel|NotificationChannel} 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 `listNotificationChannelsAsync()` - * 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. - */ - listNotificationChannelsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannels stream %j', request); - return this.descriptors.page.listNotificationChannels.createStream( - this.innerApiCalls.listNotificationChannels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationChannels`, 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.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannel|NotificationChannel}. 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 include:samples/generated/v3/notification_channel_service.list_notification_channels.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async - */ - listNotificationChannelsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannels iterate %j', request); - return this.descriptors.page.listNotificationChannels.asyncIterate( - this.innerApiCalls['listNotificationChannels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.notificationChannelServiceStub && !this._terminated) { - return this.notificationChannelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client_config.json.baseline deleted file mode 100644 index 781b3f0a6e26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.NotificationChannelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListNotificationChannelDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannelDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNotificationChannels": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendNotificationChannelVerificationCode": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannelVerificationCode": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/notification_channel_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client.ts.baseline deleted file mode 100644 index f0a2bf22c559..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client.ts.baseline +++ /dev/null @@ -1,2646 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as service_monitoring_service_client_config from './service_monitoring_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/service_monitoring_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'service_monitoring_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for - * managing and querying aspects of a workspace's services. These include the - * `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy - * of categorized Health Metrics. - * @class - * @memberof v3 - */ -export class ServiceMonitoringServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - serviceMonitoringServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServiceMonitoringServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ServiceMonitoringServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServiceMonitoringServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listServiceLevelObjectives: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serviceLevelObjectives') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.ServiceMonitoringService', gapicConfig as gax.ClientConfig, - 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.serviceMonitoringServiceStub) { - return this.serviceMonitoringServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.ServiceMonitoringService. - this.serviceMonitoringServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.ServiceMonitoringService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.ServiceMonitoringService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const serviceMonitoringServiceStubMethods = - ['createService', 'getService', 'listServices', 'updateService', 'deleteService', 'createServiceLevelObjective', 'getServiceLevelObjective', 'listServiceLevelObjectives', 'updateServiceLevelObjective', 'deleteServiceLevelObjective']; - for (const methodName of serviceMonitoringServiceStubMethods) { - const callPromise = this.serviceMonitoringServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.serviceMonitoringServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent workspace. - * Of the form `projects/{project_id}`. - * @param {string} request.serviceId - * Optional. The Service id to use for this Service. If omitted, an id will be - * generated instead. Must match the pattern [a-z0-9\-]+ - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` 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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateService_async - */ - createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>; - createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createService response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]) => { - this._log.info('createService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get the named `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service`. - * Of the form `projects/{project_id}/services/{service_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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetService_async - */ - getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getService response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]) => { - this._log.info('getService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateService_async - */ - updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>; - updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateService response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]) => { - this._log.info('updateService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Soft delete this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service` to delete. - * Of the form `projects/{project_id}/services/{service_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteService_async - */ - deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteService request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteService response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a `ServiceLevelObjective` for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.serviceLevelObjectiveId - * Optional. The ServiceLevelObjective id to use for this - * ServiceLevelObjective. If omitted, an id will be generated instead. Must - * match the pattern [a-z0-9\-]+ - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to create. - * The provided `name` will be respected if no `ServiceLevelObjective` exists - * with this name. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async - */ - createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]) => { - this._log.info('createServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get a `ServiceLevelObjective` by name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to get. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async - */ - getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]) => { - this._log.info('getServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async - */ - updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service_level_objective.name': request.serviceLevelObjective!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]) => { - this._log.info('updateServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to delete. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async - */ - deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * List `Service`s for this workspace. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * 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. - */ - listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>; - listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; - listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; - listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServices values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listServices request %j', request); - return this.innerApiCalls - .listServices(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]) => { - this._log.info('listServices values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServices`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Service|Service} 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 `listServicesAsync()` - * 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. - */ - listServicesStream( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServices stream %j', request); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, 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. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Service|Service}. 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 include:samples/generated/v3/service_monitoring_service.list_services.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServices_async - */ - listServicesAsync( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServices iterate %j', request); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the `ServiceLevelObjective`s for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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 Array of {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServiceLevelObjectivesAsync()` - * 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. - */ - listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>; - listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; - listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; - listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServiceLevelObjectives values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listServiceLevelObjectives request %j', request); - return this.innerApiCalls - .listServiceLevelObjectives(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]) => { - this._log.info('listServiceLevelObjectives values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServiceLevelObjectives`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective} 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 `listServiceLevelObjectivesAsync()` - * 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. - */ - listServiceLevelObjectivesStream( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServiceLevelObjectives']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServiceLevelObjectives stream %j', request); - return this.descriptors.page.listServiceLevelObjectives.createStream( - this.innerApiCalls.listServiceLevelObjectives as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServiceLevelObjectives`, 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. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. 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 include:samples/generated/v3/service_monitoring_service.list_service_level_objectives.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async - */ - listServiceLevelObjectivesAsync( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServiceLevelObjectives']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServiceLevelObjectives iterate %j', request); - return this.descriptors.page.listServiceLevelObjectives.asyncIterate( - this.innerApiCalls['listServiceLevelObjectives'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.serviceMonitoringServiceStub && !this._terminated) { - return this.serviceMonitoringServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client_config.json.baseline deleted file mode 100644 index fe621866841d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.ServiceMonitoringService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServices": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServiceLevelObjectives": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/service_monitoring_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client.ts.baseline deleted file mode 100644 index 4e00f5f15bd1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client.ts.baseline +++ /dev/null @@ -1,2197 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as uptime_check_service_client_config from './uptime_check_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3/uptime_check_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'uptime_check_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * The UptimeCheckService API is used to manage (list, create, delete, edit) - * Uptime check configurations in the Stackdriver Monitoring product. An Uptime - * check is a piece of configuration that determines which resources and - * services to monitor for availability. These configurations can also be - * configured interactively by navigating to the [Cloud Console] - * (http://console.cloud.google.com), selecting the appropriate project, - * clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, - * and then clicking on "Uptime". - * @class - * @memberof v3 - */ -export class UptimeCheckServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - uptimeCheckServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of UptimeCheckServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 UptimeCheckServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof UptimeCheckServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listUptimeCheckConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckConfigs'), - listUptimeCheckIps: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckIps') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.UptimeCheckService', gapicConfig as gax.ClientConfig, - 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.uptimeCheckServiceStub) { - return this.uptimeCheckServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.UptimeCheckService. - this.uptimeCheckServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.UptimeCheckService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.UptimeCheckService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const uptimeCheckServiceStubMethods = - ['listUptimeCheckConfigs', 'getUptimeCheckConfig', 'createUptimeCheckConfig', 'updateUptimeCheckConfig', 'deleteUptimeCheckConfig', 'listUptimeCheckIps']; - for (const methodName of uptimeCheckServiceStubMethods) { - const callPromise = this.uptimeCheckServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.uptimeCheckServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to retrieve. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.get_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async - */ - getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which to create the Uptime check. The format - * is `projects/[PROJECT_ID]`. - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. The new Uptime check configuration. - * @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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.create_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async - */ - createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('createUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an Uptime check configuration. You can either replace the entire - * configuration with a new one or replace only certain fields in the current - * configuration by specifying the fields to be updated via `updateMask`. - * Returns the updated configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. If present, only the listed fields in the current Uptime check - * configuration are updated with values from the new configuration. If this - * field is empty, then the current configuration is completely replaced with - * the new configuration. - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. If an `updateMask` has been specified, this field gives - * the values for the set of fields mentioned in the `updateMask`. If an - * `updateMask` has not been given, this Uptime check configuration replaces - * the current configuration. If a field is mentioned in `updateMask` but - * the corresonding field is omitted in this partial Uptime check - * configuration, it has the effect of deleting/clearing the field from the - * configuration on the server. - * - * The following fields can be updated: `display_name`, - * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - * `selected_regions`. - * @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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.update_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async - */ - updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'uptime_check_config.name': request.uptimeCheckConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an Uptime check configuration. Note that this method will fail - * if the Uptime check configuration is referenced by an alert policy or - * other dependent configs that would be rendered invalid by the deletion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to delete. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.delete_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async - */ - deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing valid Uptime check configurations for the project - * (leaving out any invalid configurations). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckConfigsAsync()` - * 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. - */ - listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>; - listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; - listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; - listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUptimeCheckConfigs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listUptimeCheckConfigs request %j', request); - return this.innerApiCalls - .listUptimeCheckConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]) => { - this._log.info('listUptimeCheckConfigs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUptimeCheckConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig} 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 `listUptimeCheckConfigsAsync()` - * 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. - */ - listUptimeCheckConfigsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckConfigs stream %j', request); - return this.descriptors.page.listUptimeCheckConfigs.createStream( - this.innerApiCalls.listUptimeCheckConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUptimeCheckConfigs`, 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. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. 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 include:samples/generated/v3/uptime_check_service.list_uptime_check_configs.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async - */ - listUptimeCheckConfigsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckConfigs iterate %j', request); - return this.descriptors.page.listUptimeCheckConfigs.asyncIterate( - this.innerApiCalls['listUptimeCheckConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns the list of IP addresses that checkers run from - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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 Array of {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckIpsAsync()` - * 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. - */ - listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>; - listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; - listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; - listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUptimeCheckIps values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listUptimeCheckIps request %j', request); - return this.innerApiCalls - .listUptimeCheckIps(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]) => { - this._log.info('listUptimeCheckIps values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUptimeCheckIps`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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.monitoring.v3.UptimeCheckIp|UptimeCheckIp} 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 `listUptimeCheckIpsAsync()` - * 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. - */ - listUptimeCheckIpsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUptimeCheckIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckIps stream %j', request); - return this.descriptors.page.listUptimeCheckIps.createStream( - this.innerApiCalls.listUptimeCheckIps as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUptimeCheckIps`, 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 {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. 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 include:samples/generated/v3/uptime_check_service.list_uptime_check_ips.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async - */ - listUptimeCheckIpsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUptimeCheckIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckIps iterate %j', request); - return this.descriptors.page.listUptimeCheckIps.asyncIterate( - this.innerApiCalls['listUptimeCheckIps'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.uptimeCheckServiceStub && !this._terminated) { - return this.uptimeCheckServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client_config.json.baseline deleted file mode 100644 index 0e638c2dfbdb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.UptimeCheckService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListUptimeCheckConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUptimeCheckIps": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/src/v3/uptime_check_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index cc002fa20ab1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const monitoring = require('monitoring'); - -function main() { - const alertPolicyServiceClient = new monitoring.AlertPolicyServiceClient(); - const groupServiceClient = new monitoring.GroupServiceClient(); - const metricServiceClient = new monitoring.MetricServiceClient(); - const notificationChannelServiceClient = new monitoring.NotificationChannelServiceClient(); - const serviceMonitoringServiceClient = new monitoring.ServiceMonitoringServiceClient(); - const uptimeCheckServiceClient = new monitoring.UptimeCheckServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index bf1d810273f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as monitoring from 'monitoring'; - -function main() { - const alertPolicyServiceClient = new monitoring.AlertPolicyServiceClient(); - const groupServiceClient = new monitoring.GroupServiceClient(); - const metricServiceClient = new monitoring.MetricServiceClient(); - const notificationChannelServiceClient = new monitoring.NotificationChannelServiceClient(); - const serviceMonitoringServiceClient = new monitoring.ServiceMonitoringServiceClient(); - const uptimeCheckServiceClient = new monitoring.UptimeCheckServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 826cea87912e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient} from 'monitoring'; - -// check that the client class type name can be used -function doStuffWithAlertPolicyServiceClient(client: AlertPolicyServiceClient) { - client.close(); -} -function doStuffWithGroupServiceClient(client: GroupServiceClient) { - client.close(); -} -function doStuffWithMetricServiceClient(client: MetricServiceClient) { - client.close(); -} -function doStuffWithNotificationChannelServiceClient(client: NotificationChannelServiceClient) { - client.close(); -} -function doStuffWithServiceMonitoringServiceClient(client: ServiceMonitoringServiceClient) { - client.close(); -} -function doStuffWithUptimeCheckServiceClient(client: UptimeCheckServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const alertPolicyServiceClient = new AlertPolicyServiceClient(); - doStuffWithAlertPolicyServiceClient(alertPolicyServiceClient); - // check that the client instance can be created - const groupServiceClient = new GroupServiceClient(); - doStuffWithGroupServiceClient(groupServiceClient); - // check that the client instance can be created - const metricServiceClient = new MetricServiceClient(); - doStuffWithMetricServiceClient(metricServiceClient); - // check that the client instance can be created - const notificationChannelServiceClient = new NotificationChannelServiceClient(); - doStuffWithNotificationChannelServiceClient(notificationChannelServiceClient); - // check that the client instance can be created - const serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); - doStuffWithServiceMonitoringServiceClient(serviceMonitoringServiceClient); - // check that the client instance can be created - const uptimeCheckServiceClient = new UptimeCheckServiceClient(); - doStuffWithUptimeCheckServiceClient(uptimeCheckServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_alert_policy_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_alert_policy_service_v3.ts.baseline deleted file mode 100644 index 9e9365388883..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_alert_policy_service_v3.ts.baseline +++ /dev/null @@ -1,1914 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as alertpolicyserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.AlertPolicyServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = alertpolicyserviceModule.v3.AlertPolicyServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = alertpolicyserviceModule.v3.AlertPolicyServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = alertpolicyserviceModule.v3.AlertPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - await client.initialize(); - assert(client.alertPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.alertPolicyServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getAlertPolicy', () => { - it('invokes getAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAlertPolicy(request), expectedError); - }); - }); - - describe('createAlertPolicy', () => { - it('invokes createAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.createAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createAlertPolicy(request), expectedError); - }); - }); - - describe('deleteAlertPolicy', () => { - it('invokes deleteAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAlertPolicy( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); - }); - }); - - describe('updateAlertPolicy', () => { - it('invokes updateAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.updateAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - }); - }); - - describe('listAlertPolicies', () => { - it('invokes listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAlertPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPolicies without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAlertPolicies( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAlertPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAlertPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPoliciesStream without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAlertPoliciesStream with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - const iterable = client.listAlertPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAlertPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_group_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_group_service_v3.ts.baseline deleted file mode 100644 index 16ae9b02f3ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_group_service_v3.ts.baseline +++ /dev/null @@ -1,2159 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as groupserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.GroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = groupserviceModule.v3.GroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = groupserviceModule.v3.GroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = groupserviceModule.v3.GroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - await client.initialize(); - assert(client.groupServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.groupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getGroup', () => { - it('invokes getGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGroup(request), expectedError); - }); - }); - - describe('createGroup', () => { - it('invokes createGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCall(expectedResponse); - const [response] = await client.createGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createGroup(request), expectedError); - }); - }); - - describe('updateGroup', () => { - it('invokes updateGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCall(expectedResponse); - const [response] = await client.updateGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGroup(request), expectedError); - }); - }); - - describe('deleteGroup', () => { - it('invokes deleteGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGroup( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteGroup(request), expectedError); - }); - }); - - describe('listGroups', () => { - it('invokes listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroups( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupsStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGroupsStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IGroup[] = []; - const iterable = client.listGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listGroupMembers', () => { - it('invokes listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCall(expectedResponse); - const [response] = await client.listGroupMembers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroupMembers( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroupMembers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroupMembers(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembersStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGroupMembersStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResource[] = []; - const iterable = client.listGroupMembersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupMembersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_metric_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_metric_service_v3.ts.baseline deleted file mode 100644 index d837dd6e58c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_metric_service_v3.ts.baseline +++ /dev/null @@ -1,2736 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.MetricServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = metricserviceModule.v3.MetricServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = metricserviceModule.v3.MetricServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = metricserviceModule.v3.MetricServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - await client.initialize(); - assert(client.metricServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.metricServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getMonitoredResourceDescriptor', () => { - it('invokes getMonitoredResourceDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMonitoredResourceDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMonitoredResourceDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - }); - }); - - describe('getMetricDescriptor', () => { - it('invokes getMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - }); - }); - - describe('createMetricDescriptor', () => { - it('invokes createMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.createMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - }); - }); - - describe('deleteMetricDescriptor', () => { - it('invokes deleteMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - }); - }); - - describe('createTimeSeries', () => { - it('invokes createTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.createTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTimeSeries( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createTimeSeries(request), expectedError); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetricDescriptors', () => { - it('invokes listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMetricDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetricDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetricDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetricDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMetricDescriptor[] = []; - const iterable = client.listMetricDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetricDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMetricDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTimeSeries', () => { - it('invokes listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.listTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTimeSeries( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ITimeSeries[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeriesStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTimeSeriesStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - const iterable = client.listTimeSeriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTimeSeriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMetricDescriptor', () => { - const fakePath = "/rendered/path/folderMetricDescriptor"; - const expectedParameters = { - folder: "folderValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMetricDescriptorPath', () => { - const result = client.folderMetricDescriptorPath("folderValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMetricDescriptorName', () => { - const result = client.matchFolderFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromFolderMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMonitoredResourceDescriptor', () => { - const fakePath = "/rendered/path/folderMonitoredResourceDescriptor"; - const expectedParameters = { - folder: "folderValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMonitoredResourceDescriptorPath', () => { - const result = client.folderMonitoredResourceDescriptorPath("folderValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchFolderFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMetricDescriptor', () => { - const fakePath = "/rendered/path/organizationMetricDescriptor"; - const expectedParameters = { - organization: "organizationValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMetricDescriptorPath', () => { - const result = client.organizationMetricDescriptorPath("organizationValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMetricDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromOrganizationMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMonitoredResourceDescriptor', () => { - const fakePath = "/rendered/path/organizationMonitoredResourceDescriptor"; - const expectedParameters = { - organization: "organizationValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMonitoredResourceDescriptorPath', () => { - const result = client.organizationMonitoredResourceDescriptorPath("organizationValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMetricDescriptor', () => { - const fakePath = "/rendered/path/projectMetricDescriptor"; - const expectedParameters = { - project: "projectValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMetricDescriptorPath', () => { - const result = client.projectMetricDescriptorPath("projectValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMetricDescriptorName', () => { - const result = client.matchProjectFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromProjectMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMonitoredResourceDescriptor', () => { - const fakePath = "/rendered/path/projectMonitoredResourceDescriptor"; - const expectedParameters = { - project: "projectValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMonitoredResourceDescriptorPath', () => { - const result = client.projectMonitoredResourceDescriptorPath("projectValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchProjectFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_notification_channel_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_notification_channel_service_v3.ts.baseline deleted file mode 100644 index b8f5cbb4948e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_notification_channel_service_v3.ts.baseline +++ /dev/null @@ -1,2591 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as notificationchannelserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.NotificationChannelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = notificationchannelserviceModule.v3.NotificationChannelServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = notificationchannelserviceModule.v3.NotificationChannelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = notificationchannelserviceModule.v3.NotificationChannelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - await client.initialize(); - assert(client.notificationChannelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.notificationChannelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getNotificationChannelDescriptor', () => { - it('invokes getNotificationChannelDescriptor without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelDescriptor( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); - }); - }); - - describe('getNotificationChannel', () => { - it('invokes getNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannel(request), expectedError); - }); - }); - - describe('createNotificationChannel', () => { - it('invokes createNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createNotificationChannel(request), expectedError); - }); - }); - - describe('updateNotificationChannel', () => { - it('invokes updateNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - }); - }); - - describe('deleteNotificationChannel', () => { - it('invokes deleteNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationChannel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - }); - }); - - describe('sendNotificationChannelVerificationCode', () => { - it('invokes sendNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.sendNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.sendNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - }); - }); - - describe('getNotificationChannelVerificationCode', () => { - it('invokes getNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - }); - }); - - describe('verifyNotificationChannel', () => { - it('invokes verifyNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.verifyNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - }); - }); - - describe('listNotificationChannelDescriptors', () => { - it('invokes listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannelDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptors without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannelDescriptors( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannelDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptorsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationChannelDescriptorsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - const iterable = client.listNotificationChannelDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotificationChannels', () => { - it('invokes listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannels( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannels(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationChannelsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - const iterable = client.listNotificationChannelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_service_monitoring_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_service_monitoring_service_v3.ts.baseline deleted file mode 100644 index eaa15a638191..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_service_monitoring_service_v3.ts.baseline +++ /dev/null @@ -1,2595 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as servicemonitoringserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.ServiceMonitoringServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - await client.initialize(); - assert(client.serviceMonitoringServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.serviceMonitoringServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCall(expectedResponse); - const [response] = await client.createService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createService(request), expectedError); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCall(expectedResponse); - const [response] = await client.updateService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateService(request), expectedError); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCall(expectedResponse); - const [response] = await client.deleteService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteService(request), expectedError); - }); - }); - - describe('createServiceLevelObjective', () => { - it('invokes createServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.createServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - }); - }); - - describe('getServiceLevelObjective', () => { - it('invokes getServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.getServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - }); - }); - - describe('updateServiceLevelObjective', () => { - it('invokes updateServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.updateServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - }); - }); - - describe('deleteServiceLevelObjective', () => { - it('invokes deleteServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.deleteServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listServiceLevelObjectives', () => { - it('invokes listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(expectedResponse); - const [response] = await client.listServiceLevelObjectives(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServiceLevelObjectives( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServiceLevelObjectives(request), expectedError); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectivesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServiceLevelObjectivesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - const iterable = client.listServiceLevelObjectivesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServiceLevelObjectivesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_uptime_check_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_uptime_check_service_v3.ts.baseline deleted file mode 100644 index 8c656b1300af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/esm/test/gapic_uptime_check_service_v3.ts.baseline +++ /dev/null @@ -1,2089 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as uptimecheckserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.UptimeCheckServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = uptimecheckserviceModule.v3.UptimeCheckServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = uptimecheckserviceModule.v3.UptimeCheckServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = uptimecheckserviceModule.v3.UptimeCheckServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - await client.initialize(); - assert(client.uptimeCheckServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.uptimeCheckServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getUptimeCheckConfig', () => { - it('invokes getUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - }); - }); - - describe('createUptimeCheckConfig', () => { - it('invokes createUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - }); - }); - - describe('updateUptimeCheckConfig', () => { - it('invokes updateUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - }); - }); - - describe('deleteUptimeCheckConfig', () => { - it('invokes deleteUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - }); - }); - - describe('listUptimeCheckConfigs', () => { - it('invokes listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigs without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckConfigs( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUptimeCheckConfigsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - const iterable = client.listUptimeCheckConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUptimeCheckIps', () => { - it('invokes listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckIps(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckIps( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckIp[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckIps(request), expectedError); - }); - - it('invokes listUptimeCheckIpsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); - - it('invokes listUptimeCheckIpsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); - - it('uses async iteration with listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - const iterable = client.listUptimeCheckIpsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckIpsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json deleted file mode 100644 index df3eec55f353..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "monitoring", - "version": "0.1.0", - "description": "Monitoring client for Node.js", - "repository": "googleapis/nodejs-monitoring", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google monitoring", - "monitoring", - "alert policy service", - "group service", - "metric service", - "notification channel service", - "service monitoring service", - "uptime check service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert.proto.baseline deleted file mode 100644 index 1e13bd6fb3f3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert.proto.baseline +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/mutation_record.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "AlertProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A description of the conditions under which some aspect of your system is -// considered to be "unhealthy" and the ways to notify people or services about -// this state. For an overview of alert policies, see -// [Introduction to Alerting](/monitoring/alerts/). -message AlertPolicy { - option (google.api.resource) = { - type: "monitoring.googleapis.com/AlertPolicy" - pattern: "projects/{project}/alertPolicies/{alert_policy}" - pattern: "organizations/{organization}/alertPolicies/{alert_policy}" - pattern: "folders/{folder}/alertPolicies/{alert_policy}" - pattern: "*" - }; - - // A content string and a MIME type that describes the content string's - // format. - message Documentation { - // The text of the documentation, interpreted according to `mime_type`. - // The content may not exceed 8,192 Unicode characters and may not exceed - // more than 10,240 bytes when encoded in UTF-8 format, whichever is - // smaller. - string content = 1; - - // The format of the `content` field. Presently, only the value - // `"text/markdown"` is supported. See - // [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. - string mime_type = 2; - } - - // A condition is a true/false test that determines when an alerting policy - // should open an incident. If a condition evaluates to true, it signifies - // that something is wrong. - message Condition { - option (google.api.resource) = { - type: "monitoring.googleapis.com/AlertPolicyCondition" - pattern: "projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "*" - }; - - // Specifies how many time series must fail a predicate to trigger a - // condition. If not specified, then a `{count: 1}` trigger is used. - message Trigger { - // A type of trigger. - oneof type { - // The absolute number of time series that must fail - // the predicate for the condition to be triggered. - int32 count = 1; - - // The percentage of time series that must fail the - // predicate for the condition to be triggered. - double percent = 2; - } - } - - // A condition type that compares a collection of time series - // against a threshold. - message MetricThreshold { - // A [filter](/monitoring/api/v3/filters) that - // identifies which time series should be compared with the threshold. - // - // The filter is similar to the one that is specified in the - // [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that - // call is useful to verify the time series that will be retrieved / - // processed) and must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string filter = 2; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resrouces). Multiple aggregations - // are applied in the order specified. - // - // This field is similar to the one in the [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It - // is advisable to use the `ListTimeSeries` method when debugging this - // field. - repeated Aggregation aggregations = 8; - - // A [filter](/monitoring/api/v3/filters) that identifies a time - // series that should be used as the denominator of a ratio that will be - // compared with the threshold. If a `denominator_filter` is specified, - // the time series specified by the `filter` field will be used as the - // numerator. - // - // The filter must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string denominator_filter = 9; - - // Specifies the alignment of data points in individual time series - // selected by `denominatorFilter` as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resources). - // - // When computing ratios, the `aggregations` and - // `denominator_aggregations` fields must use the same alignment period - // and produce time series that have the same periodicity and labels. - repeated Aggregation denominator_aggregations = 10; - - // The comparison to apply between the time series (indicated by `filter` - // and `aggregation`) and the threshold (indicated by `threshold_value`). - // The comparison is applied on each time series, with the time series - // on the left-hand side and the threshold on the right-hand side. - // - // Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. - ComparisonType comparison = 4; - - // A value against which to compare the time series. - double threshold_value = 5; - - // The amount of time that a time series must violate the - // threshold to be considered failing. Currently, only values - // that are a multiple of a minute--e.g., 0, 60, 120, or 300 - // seconds--are supported. If an invalid value is given, an - // error will be returned. When choosing a duration, it is useful to - // keep in mind the frequency of the underlying time series data - // (which may also be affected by any alignments specified in the - // `aggregations` field); a good duration is long enough so that a single - // outlier does not generate spurious alerts, but short enough that - // unhealthy states are detected and alerted on quickly. - google.protobuf.Duration duration = 6; - - // The number/percent of time series for which the comparison must hold - // in order for the condition to trigger. If unspecified, then the - // condition will trigger if the comparison is true for any of the - // time series that have been identified by `filter` and `aggregations`, - // or by the ratio, if `denominator_filter` and `denominator_aggregations` - // are specified. - Trigger trigger = 7; - } - - // A condition type that checks that monitored resources - // are reporting data. The configuration defines a metric and - // a set of monitored resources. The predicate is considered in violation - // when a time series for the specified metric of a monitored - // resource does not include any data in the specified `duration`. - message MetricAbsence { - // A [filter](/monitoring/api/v3/filters) that - // identifies which time series should be compared with the threshold. - // - // The filter is similar to the one that is specified in the - // [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that - // call is useful to verify the time series that will be retrieved / - // processed) and must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string filter = 1; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resrouces). Multiple aggregations - // are applied in the order specified. - // - // This field is similar to the one in the [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It - // is advisable to use the `ListTimeSeries` method when debugging this - // field. - repeated Aggregation aggregations = 5; - - // The amount of time that a time series must fail to report new - // data to be considered failing. Currently, only values that - // are a multiple of a minute--e.g. 60, 120, or 300 - // seconds--are supported. If an invalid value is given, an - // error will be returned. The `Duration.nanos` field is - // ignored. - google.protobuf.Duration duration = 2; - - // The number/percent of time series for which the comparison must hold - // in order for the condition to trigger. If unspecified, then the - // condition will trigger if the comparison is true for any of the - // time series that have been identified by `filter` and `aggregations`. - Trigger trigger = 3; - } - - // Required if the condition exists. The unique resource name for this - // condition. Its syntax is: - // - // projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] - // - // `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the - // condition is created as part of a new or updated alerting policy. - // - // When calling the - // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] - // method, do not include the `name` field in the conditions of the - // requested alerting policy. Stackdriver Monitoring creates the - // condition identifiers and includes them in the new policy. - // - // When calling the - // [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] - // method to update a policy, including a condition `name` causes the - // existing condition to be updated. Conditions without names are added to - // the updated policy. Existing conditions are deleted if they are not - // updated. - // - // Best practice is to preserve `[CONDITION_ID]` if you make only small - // changes, such as those to condition thresholds, durations, or trigger - // values. Otherwise, treat the change as a new condition and let the - // existing condition be deleted. - string name = 12; - - // A short name or phrase used to identify the condition in dashboards, - // notifications, and incidents. To avoid confusion, don't use the same - // display name for multiple conditions in the same policy. - string display_name = 6; - - // Only one of the following condition types will be specified. - oneof condition { - // A condition that compares a time series against a threshold. - MetricThreshold condition_threshold = 1; - - // A condition that checks that a time series continues to - // receive new data points. - MetricAbsence condition_absent = 2; - } - } - - // Operators for combining conditions. - enum ConditionCombinerType { - // An unspecified combiner. - COMBINE_UNSPECIFIED = 0; - - // Combine conditions using the logical `AND` operator. An - // incident is created only if all conditions are met - // simultaneously. This combiner is satisfied if all conditions are - // met, even if they are met on completely different resources. - AND = 1; - - // Combine conditions using the logical `OR` operator. An incident - // is created if any of the listed conditions is met. - OR = 2; - - // Combine conditions using logical `AND` operator, but unlike the regular - // `AND` option, an incident is created only if all conditions are met - // simultaneously on at least one resource. - AND_WITH_MATCHING_RESOURCE = 3; - } - - // Required if the policy exists. The resource name for this policy. The - // syntax is: - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - // - // `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy - // is created. When calling the - // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] - // method, do not include the `name` field in the alerting policy passed as - // part of the request. - string name = 1; - - // A short name or phrase used to identify the policy in dashboards, - // notifications, and incidents. To avoid confusion, don't use the same - // display name for multiple policies in the same project. The name is - // limited to 512 Unicode characters. - string display_name = 2; - - // Documentation that is included with notifications and incidents related to - // this policy. Best practice is for the documentation to include information - // to help responders understand, mitigate, escalate, and correct the - // underlying problems detected by the alerting policy. Notification channels - // that have limited capacity might not show this documentation. - Documentation documentation = 13; - - // User-supplied key/value data to be used for organizing and - // identifying the `AlertPolicy` objects. - // - // The field can contain up to 64 entries. Each key and value is limited to - // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and - // values can contain only lowercase letters, numerals, underscores, and - // dashes. Keys must begin with a letter. - map user_labels = 16; - - // A list of conditions for the policy. The conditions are combined by AND or - // OR according to the `combiner` field. If the combined conditions evaluate - // to true, then an incident is created. A policy can have from one to six - // conditions. - // If |condition_time_series_uery_language| is present, it must be the only - // |condition|. - repeated Condition conditions = 12; - - // How to combine the results of multiple conditions to determine if an - // incident should be opened. - // If condition_time_series_query_language is present, this must be - // COMBINE_UNSPECIFIED. - ConditionCombinerType combiner = 6; - - // Whether or not the policy is enabled. On write, the default interpretation - // if unset is that the policy is enabled. On read, clients should not make - // any assumption about the state if it has not been populated. The - // field should always be populated on List and Get operations, unless - // a field projection has been specified that strips it out. - google.protobuf.BoolValue enabled = 17; - - // Read-only description of how the alert policy is invalid. OK if the alert - // policy is valid. If not OK, the alert policy will not generate incidents. - google.rpc.Status validity = 18; - - // Identifies the notification channels to which notifications should be sent - // when incidents are opened or closed or when new violations occur on - // an already opened incident. Each element of this array corresponds to - // the `name` field in each of the - // [`NotificationChannel`][google.monitoring.v3.NotificationChannel] - // objects that are returned from the [`ListNotificationChannels`] - // [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] - // method. The syntax of the entries in this field is: - // - // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID] - repeated string notification_channels = 14; - - // A read-only record of the creation of the alerting policy. If provided - // in a call to create or update, this field will be ignored. - MutationRecord creation_record = 10; - - // A read-only record of the most recent change to the alerting policy. If - // provided in a call to create or update, this field will be ignored. - MutationRecord mutation_record = 11; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert_service.proto.baseline deleted file mode 100644 index b38381f3c626..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/alert_service.proto.baseline +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/alert.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "AlertServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The AlertPolicyService API is used to manage (list, create, delete, -// edit) alert policies in Stackdriver Monitoring. An alerting policy is -// a description of the conditions under which some aspect of your -// system is considered to be "unhealthy" and the ways to notify -// people or services about this state. In addition to using this API, alert -// policies can also be managed through -// [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), -// which can be reached by clicking the "Monitoring" tab in -// [Cloud Console](https://console.cloud.google.com/). -service AlertPolicyService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing alerting policies for the project. - rpc ListAlertPolicies(ListAlertPoliciesRequest) returns (ListAlertPoliciesResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/alertPolicies" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single alerting policy. - rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - get: "/v3/{name=projects/*/alertPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new alerting policy. - rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/alertPolicies" - body: "alert_policy" - }; - option (google.api.method_signature) = "name,alert_policy"; - } - - // Deletes an alerting policy. - rpc DeleteAlertPolicy(DeleteAlertPolicyRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/alertPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an alerting policy. You can either replace the entire policy with - // a new one or replace only certain fields in the current alerting policy by - // specifying the fields to be updated via `updateMask`. Returns the - // updated alerting policy. - rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}" - body: "alert_policy" - }; - option (google.api.method_signature) = "update_mask,alert_policy"; - } -} - -// The protocol for the `CreateAlertPolicy` request. -message CreateAlertPolicyRequest { - // Required. The project in which to create the alerting policy. The format is - // `projects/[PROJECT_ID]`. - // - // Note that this field names the parent container in which the alerting - // policy will be written, not the name of the created policy. The alerting - // policy that is returned will have a name that contains a normalized - // representation of this name as a prefix but adds a suffix of the form - // `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/AlertPolicy" - } - ]; - - // Required. The requested alerting policy. You should omit the `name` field in this - // policy. The name will be returned in the new policy, including - // a new [ALERT_POLICY_ID] value. - AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `GetAlertPolicy` request. -message GetAlertPolicyRequest { - // Required. The alerting policy to retrieve. The format is - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/AlertPolicy" - } - ]; -} - -// The protocol for the `ListAlertPolicies` request. -message ListAlertPoliciesRequest { - // Required. The project whose alert policies are to be listed. The format is - // - // projects/[PROJECT_ID] - // - // Note that this field names the parent container in which the alerting - // policies to be listed are stored. To retrieve a single alerting policy - // by name, use the - // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] - // operation, instead. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/AlertPolicy" - } - ]; - - // If provided, this field specifies the criteria that must be met by - // alert policies to be included in the response. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string filter = 5; - - // A comma-separated list of fields by which to sort the result. Supports - // the same set of field references as the `filter` field. Entries can be - // prefixed with a minus sign to sort by the field in descending order. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string order_by = 6; - - // The maximum number of results to return in a single response. - int32 page_size = 2; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - string page_token = 3; -} - -// The protocol for the `ListAlertPolicies` response. -message ListAlertPoliciesResponse { - // The returned alert policies. - repeated AlertPolicy alert_policies = 3; - - // If there might be more results than were returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The protocol for the `UpdateAlertPolicy` request. -message UpdateAlertPolicyRequest { - // Optional. A list of alerting policy field names. If this field is not - // empty, each listed field in the existing alerting policy is set to the - // value of the corresponding field in the supplied policy (`alert_policy`), - // or to the field's default value if the field is not in the supplied - // alerting policy. Fields not listed retain their previous value. - // - // Examples of valid field masks include `display_name`, `documentation`, - // `documentation.content`, `documentation.mime_type`, `user_labels`, - // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - // - // If this field is empty, then the supplied alerting policy replaces the - // existing policy. It is the same as deleting the existing policy and - // adding the supplied policy, except for the following: - // - // + The new policy will have the same `[ALERT_POLICY_ID]` as the former - // policy. This gives you continuity with the former policy in your - // notifications and incidents. - // + Conditions in the new policy will keep their former `[CONDITION_ID]` if - // the supplied condition includes the `name` field with that - // `[CONDITION_ID]`. If the supplied condition omits the `name` field, - // then a new `[CONDITION_ID]` is created. - google.protobuf.FieldMask update_mask = 2; - - // Required. The updated alerting policy or the updated values for the - // fields listed in `update_mask`. - // If `update_mask` is not empty, any fields in this policy that are - // not in `update_mask` are ignored. - AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `DeleteAlertPolicy` request. -message DeleteAlertPolicyRequest { - // Required. The alerting policy to delete. The format is: - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - // - // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/AlertPolicy" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/common.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/common.proto.baseline deleted file mode 100644 index 50f8c54af315..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/common.proto.baseline +++ /dev/null @@ -1,475 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/distribution.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A single strongly-typed value. -message TypedValue { - // The typed value field. - oneof value { - // A Boolean value: `true` or `false`. - bool bool_value = 1; - - // A 64-bit integer. Its range is approximately ±9.2x1018. - int64 int64_value = 2; - - // A 64-bit double-precision floating-point number. Its magnitude - // is approximately ±10±300 and it has 16 - // significant digits of precision. - double double_value = 3; - - // A variable-length string value. - string string_value = 4; - - // A distribution value. - google.api.Distribution distribution_value = 5; - } -} - -// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. In no case can the end time be earlier than the start time. -// -// * For a `GAUGE` metric, the `startTime` value is technically optional; if -// no value is specified, the start time defaults to the value of the -// end time, and the interval represents a single point in time. If both -// start and end times are specified, they must be identical. Such an -// interval is valid only for `GAUGE` metrics, which are point-in-time -// measurements. -// -// * For `DELTA` and `CUMULATIVE` metrics, the start time must be earlier -// than the end time. -// -// * In all cases, the start time of the next interval must be -// at least a microsecond after the end time of the previous interval. -// Because the interval is closed, if the start time of a new interval -// is the same as the end time of the previous interval, data written -// at the new start time could overwrite data written at the previous -// end time. -message TimeInterval { - // Required. The end of the time interval. - google.protobuf.Timestamp end_time = 2; - - // Optional. The beginning of the time interval. The default value - // for the start time is the end time. The start time must not be - // later than the end time. - google.protobuf.Timestamp start_time = 1; -} - -// Describes how to combine multiple time series to provide a different view of -// the data. Aggregation of time series is done in two steps. First, each time -// series in the set is _aligned_ to the same time interval boundaries, then the -// set of time series is optionally _reduced_ in number. -// -// Alignment consists of applying the `per_series_aligner` operation -// to each time series after its data has been divided into regular -// `alignment_period` time intervals. This process takes _all_ of the data -// points in an alignment period, applies a mathematical transformation such as -// averaging, minimum, maximum, delta, etc., and converts them into a single -// data point per period. -// -// Reduction is when the aligned and transformed time series can optionally be -// combined, reducing the number of time series through similar mathematical -// transformations. Reduction involves applying a `cross_series_reducer` to -// all the time series, optionally sorting the time series into subsets with -// `group_by_fields`, and applying the reducer to each subset. -// -// The raw time series data can contain a huge amount of information from -// multiple sources. Alignment and reduction transforms this mass of data into -// a more manageable and representative collection of data, for example "the -// 95% latency across the average of all tasks in a cluster". This -// representative data can be more easily graphed and comprehended, and the -// individual time series data is still available for later drilldown. For more -// details, see [Aggregating Time -// Series](/monitoring/api/v3/metrics#aggregating_time_series). -message Aggregation { - // The `Aligner` specifies the operation that will be applied to the data - // points in each alignment period in a time series. Except for - // `ALIGN_NONE`, which specifies that no operation be applied, each alignment - // operation replaces the set of data values in each alignment period with - // a single value: the result of applying the operation to the data values. - // An aligned time series has a single data value at the end of each - // `alignment_period`. - // - // An alignment operation can change the data type of the values, too. For - // example, if you apply a counting operation to boolean values, the data - // `value_type` in the original time series is `BOOLEAN`, but the `value_type` - // in the aligned result is `INT64`. - enum Aligner { - // No alignment. Raw data is returned. Not valid if cross-series reduction - // is requested. The `value_type` of the result is the same as the - // `value_type` of the input. - ALIGN_NONE = 0; - - // Align and convert to - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. - // The output is `delta = y1 - y0`. - // - // This alignment is valid for - // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and - // `DELTA` metrics. If the selected alignment period results in periods - // with no data, then the aligned value for such a period is created by - // interpolation. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_DELTA = 1; - - // Align and convert to a rate. The result is computed as - // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". - // Think of this aligner as providing the slope of the line that passes - // through the value at the start and at the end of the `alignment_period`. - // - // This aligner is valid for `CUMULATIVE` - // and `DELTA` metrics with numeric values. If the selected alignment - // period results in periods with no data, then the aligned value for - // such a period is created by interpolation. The output is a `GAUGE` - // metric with `value_type` `DOUBLE`. - // - // If, by "rate", you mean "percentage change", see the - // `ALIGN_PERCENT_CHANGE` aligner instead. - ALIGN_RATE = 2; - - // Align by interpolating between adjacent points around the alignment - // period boundary. This aligner is valid for `GAUGE` metrics with - // numeric values. The `value_type` of the aligned result is the same as the - // `value_type` of the input. - ALIGN_INTERPOLATE = 3; - - // Align by moving the most recent data point before the end of the - // alignment period to the boundary at the end of the alignment - // period. This aligner is valid for `GAUGE` metrics. The `value_type` of - // the aligned result is the same as the `value_type` of the input. - ALIGN_NEXT_OLDER = 4; - - // Align the time series by returning the minimum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MIN = 10; - - // Align the time series by returning the maximum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MAX = 11; - - // Align the time series by returning the mean value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is `DOUBLE`. - ALIGN_MEAN = 12; - - // Align the time series by returning the number of values in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric or Boolean values. The `value_type` of the aligned result is - // `INT64`. - ALIGN_COUNT = 13; - - // Align the time series by returning the sum of the values in each - // alignment period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with numeric and distribution values. The `value_type` of the - // aligned result is the same as the `value_type` of the input. - ALIGN_SUM = 14; - - // Align the time series by returning the standard deviation of the values - // in each alignment period. This aligner is valid for `GAUGE` and - // `DELTA` metrics with numeric values. The `value_type` of the output is - // `DOUBLE`. - ALIGN_STDDEV = 15; - - // Align the time series by returning the number of `True` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_TRUE = 16; - - // Align the time series by returning the number of `False` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_FALSE = 24; - - // Align the time series by returning the ratio of the number of `True` - // values to the total number of values in each alignment period. This - // aligner is valid for `GAUGE` metrics with Boolean values. The output - // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. - ALIGN_FRACTION_TRUE = 17; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 99th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_99 = 18; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 95th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_95 = 19; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 50th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_50 = 20; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 5th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_05 = 21; - - // Align and convert to a percentage change. This aligner is valid for - // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns - // `((current - previous)/previous) * 100`, where the value of `previous` is - // determined based on the `alignment_period`. - // - // If the values of `current` and `previous` are both 0, then the returned - // value is 0. If only `previous` is 0, the returned value is infinity. - // - // A 10-minute moving mean is computed at each point of the alignment period - // prior to the above calculation to smooth the metric and prevent false - // positives from very short-lived spikes. The moving mean is only - // applicable for data whose values are `>= 0`. Any values `< 0` are - // treated as a missing datapoint, and are ignored. While `DELTA` - // metrics are accepted by this alignment, special care should be taken that - // the values for the metric will always be positive. The output is a - // `GAUGE` metric with `value_type` `DOUBLE`. - ALIGN_PERCENT_CHANGE = 23; - } - - // A Reducer operation describes how to aggregate data points from multiple - // time series into a single time series, where the value of each data point - // in the resulting series is a function of all the already aligned values in - // the input time series. - enum Reducer { - // No cross-time series reduction. The output of the `Aligner` is - // returned. - REDUCE_NONE = 0; - - // Reduce by computing the mean value across time series for each - // alignment period. This reducer is valid for - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and - // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with - // numeric or distribution values. The `value_type` of the output is - // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. - REDUCE_MEAN = 1; - - // Reduce by computing the minimum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MIN = 2; - - // Reduce by computing the maximum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MAX = 3; - - // Reduce by computing the sum across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric and distribution values. The `value_type` of the output is - // the same as the `value_type` of the input. - REDUCE_SUM = 4; - - // Reduce by computing the standard deviation across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics with numeric or distribution values. The `value_type` - // of the output is `DOUBLE`. - REDUCE_STDDEV = 5; - - // Reduce by computing the number of data points across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of numeric, Boolean, distribution, and string - // `value_type`. The `value_type` of the output is `INT64`. - REDUCE_COUNT = 6; - - // Reduce by computing the number of `True`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_TRUE = 7; - - // Reduce by computing the number of `False`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_FALSE = 15; - - // Reduce by computing the ratio of the number of `True`-valued data points - // to the total number of data points for each alignment period. This - // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. - // The output value is in the range [0.0, 1.0] and has `value_type` - // `DOUBLE`. - REDUCE_FRACTION_TRUE = 8; - - // Reduce by computing the [99th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_99 = 9; - - // Reduce by computing the [95th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_95 = 10; - - // Reduce by computing the [50th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_50 = 11; - - // Reduce by computing the [5th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_05 = 12; - } - - // The `alignment_period` specifies a time interval, in seconds, that is used - // to divide the data in all the - // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of - // time. This will be done before the per-series aligner can be applied to - // the data. - // - // The value must be at least 60 seconds. If a per-series aligner other than - // `ALIGN_NONE` is specified, this field is required or an error is returned. - // If no per-series aligner is specified, or the aligner `ALIGN_NONE` is - // specified, then this field is ignored. - google.protobuf.Duration alignment_period = 1; - - // An `Aligner` describes how to bring the data points in a single - // time series into temporal alignment. Except for `ALIGN_NONE`, all - // alignments cause all the data points in an `alignment_period` to be - // mathematically grouped together, resulting in a single data point for - // each `alignment_period` with end timestamp at the end of the period. - // - // Not all alignment operations may be applied to all time series. The valid - // choices depend on the `metric_kind` and `value_type` of the original time - // series. Alignment can change the `metric_kind` or the `value_type` of - // the time series. - // - // Time series data must be aligned in order to perform cross-time - // series reduction. If `cross_series_reducer` is specified, then - // `per_series_aligner` must be specified and not equal to `ALIGN_NONE` - // and `alignment_period` must be specified; otherwise, an error is - // returned. - Aligner per_series_aligner = 2; - - // The reduction operation to be used to combine time series into a single - // time series, where the value of each data point in the resulting series is - // a function of all the already aligned values in the input time series. - // - // Not all reducer operations can be applied to all time series. The valid - // choices depend on the `metric_kind` and the `value_type` of the original - // time series. Reduction can yield a time series with a different - // `metric_kind` or `value_type` than the input time series. - // - // Time series data must first be aligned (see `per_series_aligner`) in order - // to perform cross-time series reduction. If `cross_series_reducer` is - // specified, then `per_series_aligner` must be specified, and must not be - // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an - // error is returned. - Reducer cross_series_reducer = 4; - - // The set of fields to preserve when `cross_series_reducer` is - // specified. The `group_by_fields` determine how the time series are - // partitioned into subsets prior to applying the aggregation - // operation. Each subset contains time series that have the same - // value for each of the grouping fields. Each individual time - // series is a member of exactly one subset. The - // `cross_series_reducer` is applied to each subset of time series. - // It is not possible to reduce across different resource types, so - // this field implicitly contains `resource.type`. Fields not - // specified in `group_by_fields` are aggregated away. If - // `group_by_fields` is not specified and all the time series have - // the same resource type, then the time series are aggregated into - // a single output time series. If `cross_series_reducer` is not - // defined, this field is ignored. - repeated string group_by_fields = 5; -} - -// Specifies an ordering relationship on two arguments, called `left` and -// `right`. -enum ComparisonType { - // No ordering relationship is specified. - COMPARISON_UNSPECIFIED = 0; - - // True if the left argument is greater than the right argument. - COMPARISON_GT = 1; - - // True if the left argument is greater than or equal to the right argument. - COMPARISON_GE = 2; - - // True if the left argument is less than the right argument. - COMPARISON_LT = 3; - - // True if the left argument is less than or equal to the right argument. - COMPARISON_LE = 4; - - // True if the left argument is equal to the right argument. - COMPARISON_EQ = 5; - - // True if the left argument is not equal to the right argument. - COMPARISON_NE = 6; -} - -// The tier of service for a Workspace. Please see the -// [service tiers -// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more -// details. -enum ServiceTier { - option deprecated = true; - - // An invalid sentinel value, used to indicate that a tier has not - // been provided explicitly. - SERVICE_TIER_UNSPECIFIED = 0; - - // The Stackdriver Basic tier, a free tier of service that provides basic - // features, a moderate allotment of logs, and access to built-in metrics. - // A number of features are not available in this tier. For more details, - // see [the service tiers - // documentation](https://cloud.google.com/monitoring/workspaces/tiers). - SERVICE_TIER_BASIC = 1; - - // The Stackdriver Premium tier, a higher, more expensive tier of service - // that provides access to all Stackdriver features, lets you use Stackdriver - // with AWS accounts, and has a larger allotments for logs and metrics. For - // more details, see [the service tiers - // documentation](https://cloud.google.com/monitoring/workspaces/tiers). - SERVICE_TIER_PREMIUM = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/dropped_labels.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/dropped_labels.proto.baseline deleted file mode 100644 index 977f1a3775b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/dropped_labels.proto.baseline +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "DroppedLabelsProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A set of (label, value) pairs which were dropped during aggregation, attached -// to google.api.Distribution.Exemplars in google.api.Distribution values during -// aggregation. -// -// These values are used in combination with the label values that remain on the -// aggregated Distribution timeseries to construct the full label set for the -// exemplar values. The resulting full label set may be used to identify the -// specific task/job/instance (for example) which may be contributing to a -// long-tail, while allowing the storage savings of only storing aggregated -// distribution values for a large group. -// -// Note that there are no guarantees on ordering of the labels from -// exemplar-to-exemplar and from distribution-to-distribution in the same -// stream, and there may be duplicates. It is up to clients to resolve any -// ambiguities. -message DroppedLabels { - // Map from label to its value, for all labels dropped in any aggregation. - map label = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group.proto.baseline deleted file mode 100644 index 988365251959..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group.proto.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "GroupProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The description of a dynamic collection of monitored resources. Each group -// has a filter that is matched against monitored resources and their associated -// metadata. If a group's filter matches an available monitored resource, then -// that resource is a member of that group. Groups can contain any number of -// monitored resources, and each monitored resource can be a member of any -// number of groups. -// -// Groups can be nested in parent-child hierarchies. The `parentName` field -// identifies an optional parent for each group. If a group has a parent, then -// the only monitored resources available to be matched by the group's filter -// are the resources contained in the parent group. In other words, a group -// contains the monitored resources that match its filter and the filters of all -// the group's ancestors. A group without a parent can contain any monitored -// resource. -// -// For example, consider an infrastructure running a set of instances with two -// user-defined tags: `"environment"` and `"role"`. A parent group has a filter, -// `environment="production"`. A child of that parent group has a filter, -// `role="transcoder"`. The parent group contains all instances in the -// production environment, regardless of their roles. The child group contains -// instances that have the transcoder role *and* are in the production -// environment. -// -// The monitored resources contained in a group can change at any moment, -// depending on what resources exist and what filters are associated with the -// group and its ancestors. -message Group { - option (google.api.resource) = { - type: "monitoring.googleapis.com/Group" - pattern: "projects/{project}/groups/{group}" - pattern: "organizations/{organization}/groups/{group}" - pattern: "folders/{folder}/groups/{group}" - pattern: "*" - }; - - // Output only. The name of this group. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - // When creating a group, this field is ignored and a new name is created - // consisting of the project specified in the call to `CreateGroup` - // and a unique `{group_id}` that is generated automatically. - string name = 1; - - // A user-assigned name for this group, used only for display purposes. - string display_name = 2; - - // The name of the group's parent, if it has one. - // The format is `"projects/{project_id_or_number}/groups/{group_id}"`. - // For groups with no parent, `parentName` is the empty string, `""`. - string parent_name = 3; - - // The filter used to determine which monitored resources belong to this - // group. - string filter = 5; - - // If true, the members of this group are considered to be a cluster. - // The system can perform additional analysis on groups that are clusters. - bool is_cluster = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group_service.proto.baseline deleted file mode 100644 index 553d6a049c07..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/group_service.proto.baseline +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/group.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "GroupServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Group API lets you inspect and manage your -// [groups](#google.monitoring.v3.Group). -// -// A group is a named filter that is used to identify -// a collection of monitored resources. Groups are typically used to -// mirror the physical and/or logical topology of the environment. -// Because group membership is computed dynamically, monitored -// resources that are started in the future are automatically placed -// in matching groups. By using a group to name monitored resources in, -// for example, an alert policy, the target of that alert policy is -// updated automatically as monitored resources are added and removed -// from the infrastructure. -service GroupService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing groups. - rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/groups" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single group. - rpc GetGroup(GetGroupRequest) returns (Group) { - option (google.api.http) = { - get: "/v3/{name=projects/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new group. - rpc CreateGroup(CreateGroupRequest) returns (Group) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/groups" - body: "group" - }; - option (google.api.method_signature) = "name,group"; - } - - // Updates an existing group. - // You can change any group attributes except `name`. - rpc UpdateGroup(UpdateGroupRequest) returns (Group) { - option (google.api.http) = { - put: "/v3/{group.name=projects/*/groups/*}" - body: "group" - }; - option (google.api.method_signature) = "group"; - } - - // Deletes an existing group. - rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists the monitored resources that are members of a group. - rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*/groups/*}/members" - }; - option (google.api.method_signature) = "name"; - } -} - -// The `ListGroup` request. -message ListGroupsRequest { - // Required. The project whose groups are to be listed. The format is - // `"projects/{project_id_or_number}"`. - string name = 7 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Group" - } - ]; - - // An optional filter consisting of a single group name. The filters limit - // the groups returned based on their parent-child relationship with the - // specified group. If no filter is specified, all groups are returned. - oneof filter { - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns groups whose `parentName` field contains the group - // name. If no groups have this parent, the results are empty. - string children_of_group = 2 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns groups that are ancestors of the specified group. - // The groups are returned in order, starting with the immediate parent and - // ending with the most distant ancestor. If the specified group has no - // immediate parent, the results are empty. - string ancestors_of_group = 3 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns the descendants of the specified group. This is a superset of - // the results returned by the `childrenOfGroup` filter, and includes - // children-of-children, and so forth. - string descendants_of_group = 4 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - } - - // A positive number that is the maximum number of results to return. - int32 page_size = 5; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 6; -} - -// The `ListGroups` response. -message ListGroupsResponse { - // The groups that match the specified filters. - repeated Group group = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetGroup` request. -message GetGroupRequest { - // Required. The group to retrieve. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; -} - -// The `CreateGroup` request. -message CreateGroupRequest { - // Required. The project in which to create the group. The format is - // `"projects/{project_id_or_number}"`. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Group" - } - ]; - - // Required. A group definition. It is an error to define the `name` field because - // the system assigns the name. - Group group = 2 [(google.api.field_behavior) = REQUIRED]; - - // If true, validate this request but do not create the group. - bool validate_only = 3; -} - -// The `UpdateGroup` request. -message UpdateGroupRequest { - // Required. The new definition of the group. All fields of the existing group, - // excepting `name`, are replaced with the corresponding fields of this group. - Group group = 2 [(google.api.field_behavior) = REQUIRED]; - - // If true, validate this request but do not update the existing group. - bool validate_only = 3; -} - -// The `DeleteGroup` request. The default behavior is to be able to delete a -// single group without any descendants. -message DeleteGroupRequest { - // Required. The group to delete. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; - - // If this field is true, then the request means to delete a group with all - // its descendants. Otherwise, the request means to delete a group only when - // it has no descendants. The default value is false. - bool recursive = 4; -} - -// The `ListGroupMembers` request. -message ListGroupMembersRequest { - // Required. The group whose members are listed. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 7 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; - - // An optional [list filter](/monitoring/api/learn_more#filtering) describing - // the members to be returned. The filter may reference the type, labels, and - // metadata of monitored resources that comprise the group. - // For example, to return only resources representing Compute Engine VM - // instances, use this filter: - // - // resource.type = "gce_instance" - string filter = 5; - - // An optional time interval for which results should be returned. Only - // members that were part of the group during the specified interval are - // included in the response. If no interval is provided then the group - // membership over the last minute is returned. - TimeInterval interval = 6; -} - -// The `ListGroupMembers` response. -message ListGroupMembersResponse { - // A set of monitored resources in the group. - repeated google.api.MonitoredResource members = 1; - - // If there are more results than have been returned, then this field is - // set to a non-empty value. To see the additional results, use that value as - // `pageToken` in the next call to this method. - string next_page_token = 2; - - // The total number of elements matching this request. - int32 total_size = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric.proto.baseline deleted file mode 100644 index 320779d589e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric.proto.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/monitoring/v3/common.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MetricProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A single data point in a time series. -message Point { - // The time interval to which the data point applies. For `GAUGE` metrics, - // the start time is optional, but if it is supplied, it must equal the - // end time. For `DELTA` metrics, the start - // and end time should specify a non-zero interval, with subsequent points - // specifying contiguous and non-overlapping intervals. For `CUMULATIVE` - // metrics, the start and end time should specify a non-zero interval, with - // subsequent points specifying the same start time and increasing end times, - // until an event resets the cumulative value to zero and sets a new start - // time for the following points. - TimeInterval interval = 1; - - // The value of the data point. - TypedValue value = 2; -} - -// A collection of data points that describes the time-varying values -// of a metric. A time series is identified by a combination of a -// fully-specified monitored resource and a fully-specified metric. -// This type is used for both listing and creating time series. -message TimeSeries { - // The associated metric. A fully-specified metric used to identify the time - // series. - google.api.Metric metric = 1; - - // The associated monitored resource. Custom metrics can use only certain - // monitored resource types in their time series data. - google.api.MonitoredResource resource = 2; - - // Output only. The associated monitored resource metadata. When reading a - // a timeseries, this field will include metadata labels that are explicitly - // named in the reduction. When creating a timeseries, this field is ignored. - google.api.MonitoredResourceMetadata metadata = 7; - - // The metric kind of the time series. When listing time series, this metric - // kind might be different from the metric kind of the associated metric if - // this time series is an alignment or reduction of other time series. - // - // When creating a time series, this field is optional. If present, it must be - // the same as the metric kind of the associated metric. If the associated - // metric's descriptor must be auto-created, then this field specifies the - // metric kind of the new descriptor and must be either `GAUGE` (the default) - // or `CUMULATIVE`. - google.api.MetricDescriptor.MetricKind metric_kind = 3; - - // The value type of the time series. When listing time series, this value - // type might be different from the value type of the associated metric if - // this time series is an alignment or reduction of other time series. - // - // When creating a time series, this field is optional. If present, it must be - // the same as the type of the data in the `points` field. - google.api.MetricDescriptor.ValueType value_type = 4; - - // The data points of this time series. When listing time series, points are - // returned in reverse time order. - // - // When creating a time series, this field must contain exactly one point and - // the point's type must be the same as the value type of the associated - // metric. If the associated metric's descriptor must be auto-created, then - // the value type of the descriptor is determined by the point's type, which - // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. - repeated Point points = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric_service.proto.baseline deleted file mode 100644 index e87d11219c3b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/metric_service.proto.baseline +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/metric.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MetricServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; -option (google.api.resource_definition) = { - type: "monitoring.googleapis.com/MetricDescriptor" - pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}" - pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}" - pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN -}; -option (google.api.resource_definition) = { - type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN -}; - -// Manages metric descriptors, monitored resource descriptors, and -// time series data. -service MetricService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read," - "https://www.googleapis.com/auth/monitoring.write"; - - // Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/monitoredResourceDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single monitored resource descriptor. This method does not require a Stackdriver account. - rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists metric descriptors that match a filter. This method does not require a Stackdriver account. - rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/metricDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single metric descriptor. This method does not require a Stackdriver account. - rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/metricDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new metric descriptor. - // User-created metric descriptors define - // [custom metrics](/monitoring/custom-metrics). - rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/metricDescriptors" - body: "metric_descriptor" - }; - option (google.api.method_signature) = "name,metric_descriptor"; - } - - // Deletes a metric descriptor. Only user-created - // [custom metrics](/monitoring/custom-metrics) can be deleted. - rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/metricDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists time series that match a filter. This method does not require a Stackdriver account. - rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/timeSeries" - }; - option (google.api.method_signature) = "name,filter,interval,view"; - } - - // Creates or adds data to one or more time series. - // The response is empty if all time series in the request were written. - // If any time series could not be written, a corresponding failure message is - // included in the error response. - rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/timeSeries" - body: "*" - }; - option (google.api.method_signature) = "name,time_series"; - } -} - -// The `ListMonitoredResourceDescriptors` request. -message ListMonitoredResourceDescriptorsRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - } - ]; - - // An optional [filter](/monitoring/api/v3/filters) describing - // the descriptors to be returned. The filter can reference - // the descriptor's type and labels. For example, the - // following filter returns only Google Compute Engine descriptors - // that have an `id` label: - // - // resource.type = starts_with("gce_") AND resource.label:id - string filter = 2; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListMonitoredResourceDescriptors` response. -message ListMonitoredResourceDescriptorsResponse { - // The monitored resource descriptors that are available to this project - // and that match `filter`, if present. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetMonitoredResourceDescriptor` request. -message GetMonitoredResourceDescriptorRequest { - // Required. The monitored resource descriptor to get. The format is - // `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - // The `{resource_type}` is a predefined type, such as - // `cloudsql_database`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - } - ]; -} - -// The `ListMetricDescriptors` request. -message ListMetricDescriptorsRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; - - // If this field is empty, all custom and - // system-defined metric descriptors are returned. - // Otherwise, the [filter](/monitoring/api/v3/filters) - // specifies which metric descriptors are to be - // returned. For example, the following filter matches all - // [custom metrics](/monitoring/custom-metrics): - // - // metric.type = starts_with("custom.googleapis.com/") - string filter = 2; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListMetricDescriptors` response. -message ListMetricDescriptorsResponse { - // The metric descriptors that are available to the project - // and that match the value of `filter`, if present. - repeated google.api.MetricDescriptor metric_descriptors = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetMetricDescriptor` request. -message GetMetricDescriptorRequest { - // Required. The metric descriptor on which to execute the request. The format is - // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - // An example value of `{metric_id}` is - // `"compute.googleapis.com/instance/disk/read_bytes_count"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; -} - -// The `CreateMetricDescriptor` request. -message CreateMetricDescriptorRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; - - // Required. The new [custom metric](/monitoring/custom-metrics) - // descriptor. - google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `DeleteMetricDescriptor` request. -message DeleteMetricDescriptorRequest { - // Required. The metric descriptor on which to execute the request. The format is - // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - // An example of `{metric_id}` is: - // `"custom.googleapis.com/my_test_metric"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; -} - -// The `ListTimeSeries` request. -message ListTimeSeriesRequest { - // Controls which fields are returned by `ListTimeSeries`. - enum TimeSeriesView { - // Returns the identity of the metric(s), the time series, - // and the time series data. - FULL = 0; - - // Returns the identity of the metric and the time series resource, - // but not the time series data. - HEADERS = 1; - } - - // Required. The project on which to execute the request. The format is - // "projects/{project_id_or_number}". - string name = 10 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/TimeSeries" - } - ]; - - // Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - // series should be returned. The filter must specify a single metric type, - // and can additionally specify metric labels and other information. For - // example: - // - // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - // metric.labels.instance_name = "my-instance-name" - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time interval for which results should be returned. Only time series - // that contain data points in the specified interval are included - // in the response. - TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series across specified labels. - // - // By default (if no `aggregation` is explicitly specified), the raw time - // series data is returned. - Aggregation aggregation = 5; - - // Unsupported: must be left blank. The points in each time series are - // currently returned in reverse time order (most recent to oldest). - string order_by = 6; - - // Required. Specifies which information is returned about the time series. - TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED]; - - // A positive number that is the maximum number of results to return. If - // `page_size` is empty or more than 100,000 results, the effective - // `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - // maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - // the maximum number of `TimeSeries` returned. - int32 page_size = 8; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 9; -} - -// The `ListTimeSeries` response. -message ListTimeSeriesResponse { - // One or more time series that match the filter included in the request. - repeated TimeSeries time_series = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; - - // Query execution errors that may have caused the time series data returned - // to be incomplete. - repeated google.rpc.Status execution_errors = 3; -} - -// The `CreateTimeSeries` request. -message CreateTimeSeriesRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/TimeSeries" - } - ]; - - // Required. The new data to be added to a list of time series. - // Adds at most one data point to each of several time series. The new data - // point must be more recent than any other point in its time series. Each - // `TimeSeries` value must fully specify a unique time series by supplying - // all label values for the metric and the monitored resource. - // - // The maximum number of `TimeSeries` objects per `Create` request is 200. - repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// DEPRECATED. Used to hold per-time-series error status. -message CreateTimeSeriesError { - // DEPRECATED. Time series ID that resulted in the `status` error. - TimeSeries time_series = 1 [deprecated = true]; - - // DEPRECATED. The status of the requested write operation for `time_series`. - google.rpc.Status status = 2 [deprecated = true]; -} - -// Summary of the result of a failed request to write data to a time series. -message CreateTimeSeriesSummary { - // Detailed information about an error category. - message Error { - // The status of the requested write operation. - google.rpc.Status status = 1; - - // The number of points that couldn't be written because of `status`. - int32 point_count = 2; - } - - // The number of points in the request. - int32 total_point_count = 1; - - // The number of points that were successfully written. - int32 success_point_count = 2; - - // The number of points that failed to be written. Order is not guaranteed. - repeated Error errors = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/mutation_record.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/mutation_record.proto.baseline deleted file mode 100644 index b79e58d042f5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/mutation_record.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MutationRecordProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// Describes a change made to a configuration. -message MutationRecord { - // When the change occurred. - google.protobuf.Timestamp mutate_time = 1; - - // The email address of the user making the change. - string mutated_by = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification.proto.baseline deleted file mode 100644 index 855e3c96df4b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification.proto.baseline +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "NotificationProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A description of a notification channel. The descriptor includes -// the properties of the channel and the set of labels or fields that -// must be specified to configure channels of a given type. -message NotificationChannelDescriptor { - option (google.api.resource) = { - type: "monitoring.googleapis.com/NotificationChannelDescriptor" - pattern: "projects/{project}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "folders/{folder}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "*" - }; - - // The full REST resource name for this descriptor. The syntax is: - // - // projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE] - // - // In the above, `[TYPE]` is the value of the `type` field. - string name = 6; - - // The type of notification channel, such as "email", "sms", etc. - // Notification channel types are globally unique. - string type = 1; - - // A human-readable name for the notification channel type. This - // form of the name is suitable for a user interface. - string display_name = 2; - - // A human-readable description of the notification channel - // type. The description may include a description of the properties - // of the channel and pointers to external documentation. - string description = 3; - - // The set of labels that must be defined to identify a particular - // channel of the corresponding type. Each label includes a - // description for how that field should be populated. - repeated google.api.LabelDescriptor labels = 4; - - // The tiers that support this notification channel; the project service tier - // must be one of the supported_tiers. - repeated ServiceTier supported_tiers = 5 [deprecated = true]; - - // The product launch stage for channels of this type. - google.api.LaunchStage launch_stage = 7; -} - -// A `NotificationChannel` is a medium through which an alert is -// delivered when a policy violation is detected. Examples of channels -// include email, SMS, and third-party messaging applications. Fields -// containing sensitive information like authentication tokens or -// contact info are only partially populated on retrieval. -message NotificationChannel { - option (google.api.resource) = { - type: "monitoring.googleapis.com/NotificationChannel" - pattern: "projects/{project}/notificationChannels/{notification_channel}" - pattern: "organizations/{organization}/notificationChannels/{notification_channel}" - pattern: "folders/{folder}/notificationChannels/{notification_channel}" - pattern: "*" - }; - - // Indicates whether the channel has been verified or not. It is illegal - // to specify this field in a - // [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel] - // or an - // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] - // operation. - enum VerificationStatus { - // Sentinel value used to indicate that the state is unknown, omitted, or - // is not applicable (as in the case of channels that neither support - // nor require verification in order to function). - VERIFICATION_STATUS_UNSPECIFIED = 0; - - // The channel has yet to be verified and requires verification to function. - // Note that this state also applies to the case where the verification - // process has been initiated by sending a verification code but where - // the verification code has not been submitted to complete the process. - UNVERIFIED = 1; - - // It has been proven that notifications can be received on this - // notification channel and that someone on the project has access - // to messages that are delivered to that channel. - VERIFIED = 2; - } - - // The type of the notification channel. This field matches the - // value of the [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] field. - string type = 1; - - // The full REST resource name for this channel. The syntax is: - // - // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID] - // - // The `[CHANNEL_ID]` is automatically assigned by the server on creation. - string name = 6; - - // An optional human-readable name for this notification channel. It is - // recommended that you specify a non-empty and unique name in order to - // make it easier to identify the channels in your project, though this is - // not enforced. The display name is limited to 512 Unicode characters. - string display_name = 3; - - // An optional human-readable description of this notification channel. This - // description may provide additional details, beyond the display - // name, for the channel. This may not exceed 1024 Unicode characters. - string description = 4; - - // Configuration fields that define the channel and its behavior. The - // permissible and required labels are specified in the - // [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] of the - // `NotificationChannelDescriptor` corresponding to the `type` field. - map labels = 5; - - // User-supplied key/value data that does not need to conform to - // the corresponding `NotificationChannelDescriptor`'s schema, unlike - // the `labels` field. This field is intended to be used for organizing - // and identifying the `NotificationChannel` objects. - // - // The field can contain up to 64 entries. Each key and value is limited to - // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and - // values can contain only lowercase letters, numerals, underscores, and - // dashes. Keys must begin with a letter. - map user_labels = 8; - - // Indicates whether this channel has been verified or not. On a - // [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] - // or - // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] - // operation, this field is expected to be populated. - // - // If the value is `UNVERIFIED`, then it indicates that the channel is - // non-functioning (it both requires verification and lacks verification); - // otherwise, it is assumed that the channel works. - // - // If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that - // the channel is of a type that does not require verification or that - // this specific channel has been exempted from verification because it was - // created prior to verification being required for channels of this type. - // - // This field cannot be modified using a standard - // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] - // operation. To change the value of this field, you must call - // [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. - VerificationStatus verification_status = 9; - - // Whether notifications are forwarded to the described channel. This makes - // it possible to disable delivery of notifications to a particular channel - // without removing the channel from all alerting policies that reference - // the channel. This is a more convenient approach when the change is - // temporary and you want to receive notifications from the same set - // of alerting policies on the channel at some point in the future. - google.protobuf.BoolValue enabled = 11; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification_service.proto.baseline deleted file mode 100644 index 061f652973b5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/notification_service.proto.baseline +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/notification.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "NotificationServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Notification Channel API provides access to configuration that -// controls how messages related to incidents are sent. -service NotificationChannelService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the descriptors for supported channel types. The use of descriptors - // makes it possible for new channel types to be dynamically added. - rpc ListNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest) returns (ListNotificationChannelDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/notificationChannelDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single channel descriptor. The descriptor indicates which fields - // are expected / permitted for a notification channel of the given type. - rpc GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest) returns (NotificationChannelDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/notificationChannelDescriptors/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists the notification channels that have been created for the project. - rpc ListNotificationChannels(ListNotificationChannelsRequest) returns (ListNotificationChannelsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/notificationChannels" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single notification channel. The channel includes the relevant - // configuration details with which the channel was created. However, the - // response may truncate or omit passwords, API keys, or other private key - // matter and thus the response may not be 100% identical to the information - // that was supplied in the call to the create method. - rpc GetNotificationChannel(GetNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - get: "/v3/{name=projects/*/notificationChannels/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new notification channel, representing a single notification - // endpoint such as an email address, SMS number, or PagerDuty service. - rpc CreateNotificationChannel(CreateNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/notificationChannels" - body: "notification_channel" - }; - option (google.api.method_signature) = "name,notification_channel"; - } - - // Updates a notification channel. Fields not specified in the field mask - // remain unchanged. - rpc UpdateNotificationChannel(UpdateNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - patch: "/v3/{notification_channel.name=projects/*/notificationChannels/*}" - body: "notification_channel" - }; - option (google.api.method_signature) = "update_mask,notification_channel"; - } - - // Deletes a notification channel. - rpc DeleteNotificationChannel(DeleteNotificationChannelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/notificationChannels/*}" - }; - option (google.api.method_signature) = "name,force"; - } - - // Causes a verification code to be delivered to the channel. The code - // can then be supplied in `VerifyNotificationChannel` to verify the channel. - rpc SendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Requests a verification code for an already verified channel that can then - // be used in a call to VerifyNotificationChannel() on a different channel - // with an equivalent identity in the same or in a different project. This - // makes it possible to copy a channel between projects without requiring - // manual reverification of the channel. If the channel is not in the - // verified state, this method will fail (in other words, this may only be - // used if the SendNotificationChannelVerificationCode and - // VerifyNotificationChannel paths have already been used to put the given - // channel into the verified state). - // - // There is no guarantee that the verification codes returned by this method - // will be of a similar structure or form as the ones that are delivered - // to the channel via SendNotificationChannelVerificationCode; while - // VerifyNotificationChannel() will recognize both the codes delivered via - // SendNotificationChannelVerificationCode() and returned from - // GetNotificationChannelVerificationCode(), it is typically the case that - // the verification codes delivered via - // SendNotificationChannelVerificationCode() will be shorter and also - // have a shorter expiration (e.g. codes such as "G-123456") whereas - // GetVerificationCode() will typically return a much longer, websafe base - // 64 encoded string that has a longer expiration time. - rpc GetNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest) returns (GetNotificationChannelVerificationCodeResponse) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Verifies a `NotificationChannel` by proving receipt of the code - // delivered to the channel as a result of calling - // `SendNotificationChannelVerificationCode`. - rpc VerifyNotificationChannel(VerifyNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:verify" - body: "*" - }; - option (google.api.method_signature) = "name,code"; - } -} - -// The `ListNotificationChannelDescriptors` request. -message ListNotificationChannelDescriptorsRequest { - // Required. The REST resource name of the parent from which to retrieve - // the notification channel descriptors. The expected syntax is: - // - // projects/[PROJECT_ID] - // - // Note that this names the parent container in which to look for the - // descriptors; to retrieve a single descriptor by name, use the - // [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] - // operation, instead. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannelDescriptor" - } - ]; - - // The maximum number of results to return in a single response. If - // not set to a positive number, a reasonable value will be chosen by the - // service. - int32 page_size = 2; - - // If non-empty, `page_token` must contain a value returned as the - // `next_page_token` in a previous response to request the next set - // of results. - string page_token = 3; -} - -// The `ListNotificationChannelDescriptors` response. -message ListNotificationChannelDescriptorsResponse { - // The monitored resource descriptors supported for the specified - // project, optionally filtered. - repeated NotificationChannelDescriptor channel_descriptors = 1; - - // If not empty, indicates that there may be more results that match - // the request. Use the value in the `page_token` field in a - // subsequent request to fetch the next set of results. If empty, - // all results have been returned. - string next_page_token = 2; -} - -// The `GetNotificationChannelDescriptor` response. -message GetNotificationChannelDescriptorRequest { - // Required. The channel type for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannelDescriptor" - } - ]; -} - -// The `CreateNotificationChannel` request. -message CreateNotificationChannelRequest { - // Required. The project on which to execute the request. The format is: - // - // projects/[PROJECT_ID] - // - // Note that this names the container into which the channel will be - // written. This does not name the newly created channel. The resulting - // channel's name will have a normalized version of this field as a prefix, - // but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // Required. The definition of the `NotificationChannel` to create. - NotificationChannel notification_channel = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `ListNotificationChannels` request. -message ListNotificationChannelsRequest { - // Required. The project on which to execute the request. The format is - // `projects/[PROJECT_ID]`. That is, this names the container - // in which to look for the notification channels; it does not name a - // specific channel. To query a specific channel by REST resource name, use - // the - // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] - // operation. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // If provided, this field specifies the criteria that must be met by - // notification channels to be included in the response. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string filter = 6; - - // A comma-separated list of fields by which to sort the result. Supports - // the same set of fields as in `filter`. Entries can be prefixed with - // a minus sign to sort in descending rather than ascending order. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string order_by = 7; - - // The maximum number of results to return in a single response. If - // not set to a positive number, a reasonable value will be chosen by the - // service. - int32 page_size = 3; - - // If non-empty, `page_token` must contain a value returned as the - // `next_page_token` in a previous response to request the next set - // of results. - string page_token = 4; -} - -// The `ListNotificationChannels` response. -message ListNotificationChannelsResponse { - // The notification channels defined for the specified project. - repeated NotificationChannel notification_channels = 3; - - // If not empty, indicates that there may be more results that match - // the request. Use the value in the `page_token` field in a - // subsequent request to fetch the next set of results. If empty, - // all results have been returned. - string next_page_token = 2; -} - -// The `GetNotificationChannel` request. -message GetNotificationChannelRequest { - // Required. The channel for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; -} - -// The `UpdateNotificationChannel` request. -message UpdateNotificationChannelRequest { - // The fields to update. - google.protobuf.FieldMask update_mask = 2; - - // Required. A description of the changes to be applied to the specified - // notification channel. The description must provide a definition for - // fields to be updated; the names of these fields should also be - // included in the `update_mask`. - NotificationChannel notification_channel = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The `DeleteNotificationChannel` request. -message DeleteNotificationChannelRequest { - // Required. The channel for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // If true, the notification channel will be deleted regardless of its - // use in alert policies (the policies will be updated to remove the - // channel). If false, channels that are still referenced by an existing - // alerting policy will fail to be deleted in a delete operation. - bool force = 5; -} - -// The `SendNotificationChannelVerificationCode` request. -message SendNotificationChannelVerificationCodeRequest { - // Required. The notification channel to which to send a verification code. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; -} - -// The `GetNotificationChannelVerificationCode` request. -message GetNotificationChannelVerificationCodeRequest { - // Required. The notification channel for which a verification code is to be generated - // and retrieved. This must name a channel that is already verified; if - // the specified channel is not verified, the request will fail. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // The desired expiration time. If specified, the API will guarantee that - // the returned code will not be valid after the specified timestamp; - // however, the API cannot guarantee that the returned code will be - // valid for at least as long as the requested time (the API puts an upper - // bound on the amount of time for which a code may be valid). If omitted, - // a default expiration will be used, which may be less than the max - // permissible expiration (so specifying an expiration may extend the - // code's lifetime over omitting an expiration, even though the API does - // impose an upper limit on the maximum expiration that is permitted). - google.protobuf.Timestamp expire_time = 2; -} - -// The `GetNotificationChannelVerificationCode` request. -message GetNotificationChannelVerificationCodeResponse { - // The verification code, which may be used to verify other channels - // that have an equivalent identity (i.e. other channels of the same - // type with the same fingerprint such as other email channels with - // the same email address or other sms channels with the same number). - string code = 1; - - // The expiration time associated with the code that was returned. If - // an expiration was provided in the request, this is the minimum of the - // requested expiration in the request and the max permitted expiration. - google.protobuf.Timestamp expire_time = 2; -} - -// The `VerifyNotificationChannel` request. -message VerifyNotificationChannelRequest { - // Required. The notification channel to verify. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // Required. The verification code that was delivered to the channel as - // a result of invoking the `SendNotificationChannelVerificationCode` API - // method or that was retrieved from a verified channel via - // `GetNotificationChannelVerificationCode`. For example, one might have - // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - // guaranteed that the code is valid UTF-8; one should not - // make any assumptions regarding the structure or format of the code). - string code = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service.proto.baseline deleted file mode 100644 index 1600f4e92c9d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service.proto.baseline +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/type/calendar_period.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMonitoringProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A `Service` is a discrete, autonomous, and network-accessible unit, designed -// to solve an individual concern -// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In -// Stackdriver Monitoring, a `Service` acts as the root resource under which -// operational aspects of the service are accessible. -message Service { - option (google.api.resource) = { - type: "monitoring.googleapis.com/Service" - pattern: "projects/{project}/services/{service}" - pattern: "organizations/{organization}/services/{service}" - pattern: "folders/{folder}/services/{service}" - pattern: "*" - }; - - // Custom view of service telemetry. Currently a place-holder pending final - // design. - message Custom { - - } - - // App Engine service. Learn more at https://cloud.google.com/appengine. - message AppEngine { - // The ID of the App Engine module underlying this service. Corresponds to - // the `module_id` resource label in the `gae_app` monitored resource: - // https://cloud.google.com/monitoring/api/resources#tag_gae_app - string module_id = 1; - } - - // Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints. - message CloudEndpoints { - // The name of the Cloud Endpoints service underlying this service. - // Corresponds to the `service` resource label in the `api` monitored - // resource: https://cloud.google.com/monitoring/api/resources#tag_api - string service = 1; - } - - // Istio service. Learn more at http://istio.io. - message ClusterIstio { - // The location of the Kubernetes cluster in which this Istio service is - // defined. Corresponds to the `location` resource label in `k8s_cluster` - // resources. - string location = 1; - - // The name of the Kubernetes cluster in which this Istio service is - // defined. Corresponds to the `cluster_name` resource label in - // `k8s_cluster` resources. - string cluster_name = 2; - - // The namespace of the Istio service underlying this service. Corresponds - // to the `destination_service_namespace` metric label in Istio metrics. - string service_namespace = 3; - - // The name of the Istio service underlying this service. Corresponds to the - // `destination_service_name` metric label in Istio metrics. - string service_name = 4; - } - - // Configuration for how to query telemetry on a Service. - message Telemetry { - // The full name of the resource that defines this service. Formatted as - // described in https://cloud.google.com/apis/design/resource_names. - string resource_name = 1; - } - - // Resource name for this Service. Of the form - // `projects/{project_id}/services/{service_id}`. - string name = 1; - - // Name used for UI elements listing this Service. - string display_name = 2; - - // REQUIRED. Service-identifying atoms specifying the underlying service. - oneof identifier { - // Custom service type. - Custom custom = 6; - - // Type used for App Engine services. - AppEngine app_engine = 7; - - // Type used for Cloud Endpoints services. - CloudEndpoints cloud_endpoints = 8; - - // Type used for Istio services that live in a Kubernetes cluster. - ClusterIstio cluster_istio = 9; - } - - // Configuration for how to query telemetry on a Service. - Telemetry telemetry = 13; -} - -// A Service-Level Objective (SLO) describes a level of desired good service. It -// consists of a service-level indicator (SLI), a performance goal, and a period -// over which the objective is to be evaluated against that goal. The SLO can -// use SLIs defined in a number of different manners. Typical SLOs might include -// "99% of requests in each rolling week have latency below 200 milliseconds" or -// "99.5% of requests in each calendar month return successfully." -message ServiceLevelObjective { - option (google.api.resource) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // `ServiceLevelObjective.View` determines what form of - // `ServiceLevelObjective` is returned from `GetServiceLevelObjective`, - // `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs. - enum View { - // Same as FULL. - VIEW_UNSPECIFIED = 0; - - // Return the embedded `ServiceLevelIndicator` in the form in which it was - // defined. If it was defined using a `BasicSli`, return that `BasicSli`. - FULL = 2; - - // For `ServiceLevelIndicator`s using `BasicSli` articulation, instead - // return the `ServiceLevelIndicator` with its mode of computation fully - // spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using - // `RequestBasedSli` or `WindowsBasedSli`, return the - // `ServiceLevelIndicator` as it was provided. - EXPLICIT = 1; - } - - // Resource name for this `ServiceLevelObjective`. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1; - - // Name used for UI elements listing this SLO. - string display_name = 11; - - // The definition of good service, used to measure and calculate the quality - // of the `Service`'s performance with respect to a single aspect of service - // quality. - ServiceLevelIndicator service_level_indicator = 3; - - // The fraction of service that must be good in order for this objective to be - // met. `0 < goal <= 0.999`. - double goal = 4; - - // The time period over which the objective will be evaluated. - oneof period { - // A rolling time period, semantically "in the past ``". - // Must be an integer multiple of 1 day no larger than 30 days. - google.protobuf.Duration rolling_period = 5; - - // A calendar period, semantically "since the start of the current - // ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and - // `MONTH` are supported. - google.type.CalendarPeriod calendar_period = 6; - } -} - -// A Service-Level Indicator (SLI) describes the "performance" of a service. For -// some services, the SLI is well-defined. In such cases, the SLI can be -// described easily by referencing the well-known SLI and providing the needed -// parameters. Alternatively, a "custom" SLI can be defined with a query to the -// underlying metric store. An SLI is defined to be `good_service / -// total_service` over any queried time interval. The value of performance -// always falls into the range `0 <= performance <= 1`. A custom SLI describes -// how to compute this ratio, whether this is by dividing values from a pair of -// time series, cutting a `Distribution` into good and bad counts, or counting -// time windows in which the service complies with a criterion. For separation -// of concerns, a single Service-Level Indicator measures performance for only -// one aspect of service quality, such as fraction of successful queries or -// fast-enough queries. -message ServiceLevelIndicator { - // Service level indicators can be grouped by whether the "unit" of service - // being measured is based on counts of good requests or on counts of good - // time windows - oneof type { - // Basic SLI on a well-known service type. - BasicSli basic_sli = 4; - - // Request-based SLIs - RequestBasedSli request_based = 1; - - // Windows-based SLIs - WindowsBasedSli windows_based = 2; - } -} - -// An SLI measuring performance on a well-known service type. Performance will -// be computed on the basis of pre-defined metrics. The type of the -// `service_resource` determines the metrics to use and the -// `service_resource.labels` and `metric_labels` are used to construct a -// monitoring filter to filter that metric down to just the data relevant to -// this service. -message BasicSli { - // Future parameters for the availability SLI. - message AvailabilityCriteria { - - } - - // Parameters for a latency threshold SLI. - message LatencyCriteria { - // Good service is defined to be the count of requests made to this service - // that return in no more than `threshold`. - google.protobuf.Duration threshold = 3; - } - - // OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from - // other methods will not be used to calculate performance for this SLI. If - // omitted, this SLI applies to all the Service's methods. For service types - // that don't support breaking down by method, setting this field will result - // in an error. - repeated string method = 7; - - // OPTIONAL: The set of locations to which this SLI is relevant. Telemetry - // from other locations will not be used to calculate performance for this - // SLI. If omitted, this SLI applies to all locations in which the Service has - // activity. For service types that don't support breaking down by location, - // setting this field will result in an error. - repeated string location = 8; - - // OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry - // from other API versions will not be used to calculate performance for this - // SLI. If omitted, this SLI applies to all API versions. For service types - // that don't support breaking down by version, setting this field will result - // in an error. - repeated string version = 9; - - // This SLI can be evaluated on the basis of availability or latency. - oneof sli_criteria { - // Good service is defined to be the count of requests made to this service - // that return successfully. - AvailabilityCriteria availability = 2; - - // Good service is defined to be the count of requests made to this service - // that are fast enough with respect to `latency.threshold`. - LatencyCriteria latency = 3; - } -} - -// Range of numerical values, inclusive of `min` and exclusive of `max`. If the -// open range "< range.max" is desired, set `range.min = -infinity`. If the open -// range ">= range.min" is desired, set `range.max = infinity`. -message Range { - // Range minimum. - double min = 1; - - // Range maximum. - double max = 2; -} - -// Service Level Indicators for which atomic units of service are counted -// directly. -message RequestBasedSli { - // The means to compute a ratio of `good_service` to `total_service`. - oneof method { - // `good_total_ratio` is used when the ratio of `good_service` to - // `total_service` is computed from two `TimeSeries`. - TimeSeriesRatio good_total_ratio = 1; - - // `distribution_cut` is used when `good_service` is a count of values - // aggregated in a `Distribution` that fall into a good range. The - // `total_service` is the total count of all values aggregated in the - // `Distribution`. - DistributionCut distribution_cut = 3; - } -} - -// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the -// `good_service / total_service` ratio. The specified `TimeSeries` must have -// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = -// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify -// exactly two of good, bad, and total, and the relationship `good_service + -// bad_service = total_service` will be assumed. -message TimeSeriesRatio { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying good service provided. Must have - // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = - // DELTA` or `MetricKind = CUMULATIVE`. - string good_service_filter = 4; - - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying bad service, either demanded service - // that was not provided or demanded service that was of inadequate quality. - // Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have - // `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. - string bad_service_filter = 5; - - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying total demanded service. Must have - // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = - // DELTA` or `MetricKind = CUMULATIVE`. - string total_service_filter = 6; -} - -// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring -// good service and total service. The `TimeSeries` must have `ValueType = -// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The -// computed `good_service` will be the count of values x in the `Distribution` -// such that `range.min <= x < range.max`. -message DistributionCut { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` aggregating values. Must have `ValueType = - // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. - string distribution_filter = 4; - - // Range of values considered "good." For a one-sided range, set one bound to - // an infinite value. - Range range = 5; -} - -// A `WindowsBasedSli` defines `good_service` as the count of time windows for -// which the provided service was of good quality. Criteria for determining -// if service was good are embedded in the `window_criterion`. -message WindowsBasedSli { - // A `PerformanceThreshold` is used when each window is good when that window - // has a sufficiently high `performance`. - message PerformanceThreshold { - // The means, either a request-based SLI or a basic SLI, by which to compute - // performance over a window. - oneof type { - // `RequestBasedSli` to evaluate to judge window quality. - RequestBasedSli performance = 1; - - // `BasicSli` to evaluate to judge window quality. - BasicSli basic_sli_performance = 3; - } - - // If window `performance >= threshold`, the window is counted as good. - double threshold = 2; - } - - // A `MetricRange` is used when each window is good when the value x of a - // single `TimeSeries` satisfies `range.min <= x < range.max`. The provided - // `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and - // `MetricKind = GAUGE`. - message MetricRange { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying the `TimeSeries` to use for evaluating window quality. - string time_series = 1; - - // Range of values considered "good." For a one-sided range, set one bound - // to an infinite value. - Range range = 4; - } - - // The criterion to use for evaluating window goodness. - oneof window_criterion { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if - // any `true` values appear in the window. - string good_bad_metric_filter = 5; - - // A window is good if its `performance` is high enough. - PerformanceThreshold good_total_ratio_threshold = 2; - - // A window is good if the metric's value is in a good range, averaged - // across returned streams. - MetricRange metric_mean_in_range = 6; - - // A window is good if the metric's value is in a good range, summed across - // returned streams. - MetricRange metric_sum_in_range = 7; - } - - // Duration over which window quality is evaluated. Must be an integer - // fraction of a day and at least `60s`. - google.protobuf.Duration window_period = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service_service.proto.baseline deleted file mode 100644 index d592f241db7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/service_service.proto.baseline +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/service.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMonitoringServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for -// managing and querying aspects of a workspace's services. These include the -// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy -// of categorized Health Metrics. -service ServiceMonitoringService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Create a `Service`. - rpc CreateService(CreateServiceRequest) returns (Service) { - option (google.api.http) = { - post: "/v3/{parent=*/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service"; - } - - // Get the named `Service`. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v3/{name=*/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List `Service`s for this workspace. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v3/{parent=*/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Update this `Service`. - rpc UpdateService(UpdateServiceRequest) returns (Service) { - option (google.api.http) = { - patch: "/v3/{service.name=*/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service"; - } - - // Soft delete this `Service`. - rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=*/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Create a `ServiceLevelObjective` for the given `Service`. - rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" - body: "service_level_objective" - }; - option (google.api.method_signature) = "parent,service_level_objective"; - } - - // Get a `ServiceLevelObjective` by name. - rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List the `ServiceLevelObjective`s for the given `Service`. - rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) { - option (google.api.http) = { - get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" - }; - option (google.api.method_signature) = "parent"; - } - - // Update the given `ServiceLevelObjective`. - rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}" - body: "service_level_objective" - }; - option (google.api.method_signature) = "service_level_objective"; - } - - // Delete the given `ServiceLevelObjective`. - rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// The `CreateService` request. -message CreateServiceRequest { - // Required. Resource name of the parent workspace. - // Of the form `projects/{project_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Service" - } - ]; - - // Optional. The Service id to use for this Service. If omitted, an id will be - // generated instead. Must match the pattern [a-z0-9\-]+ - string service_id = 3; - - // Required. The `Service` to create. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `GetService` request. -message GetServiceRequest { - // Required. Resource name of the `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; -} - -// The `ListServices` request. -message ListServicesRequest { - // Required. Resource name of the parent `Workspace`. - // Of the form `projects/{project_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Service" - } - ]; - - // A filter specifying what `Service`s to return. The filter currently - // supports the following fields: - // - // - `identifier_case` - // - `app_engine.module_id` - // - `cloud_endpoints.service` - // - `cluster_istio.location` - // - `cluster_istio.cluster_name` - // - `cluster_istio.service_namespace` - // - `cluster_istio.service_name` - // - // `identifier_case` refers to which option in the identifier oneof is - // populated. For example, the filter `identifier_case = "CUSTOM"` would match - // all services with a value for the `custom` field. Valid options are - // "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - string filter = 2; - - // A non-negative number that is the maximum number of results to return. - // When 0, use default page size. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListServices` response. -message ListServicesResponse { - // The `Service`s matching the specified filter. - repeated Service services = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `UpdateService` request. -message UpdateServiceRequest { - // Required. The `Service` to draw updates from. - // The given `name` specifies the resource to update. - Service service = 1 [(google.api.field_behavior) = REQUIRED]; - - // A set of field paths defining which fields to use for the update. - google.protobuf.FieldMask update_mask = 2; -} - -// The `DeleteService` request. -message DeleteServiceRequest { - // Required. Resource name of the `Service` to delete. - // Of the form `projects/{project_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; -} - -// The `CreateServiceLevelObjective` request. -message CreateServiceLevelObjectiveRequest { - // Required. Resource name of the parent `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; - - // Optional. The ServiceLevelObjective id to use for this - // ServiceLevelObjective. If omitted, an id will be generated instead. Must - // match the pattern [a-z0-9\-]+ - string service_level_objective_id = 3; - - // Required. The `ServiceLevelObjective` to create. - // The provided `name` will be respected if no `ServiceLevelObjective` exists - // with this name. - ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `GetServiceLevelObjective` request. -message GetServiceLevelObjectiveRequest { - // Required. Resource name of the `ServiceLevelObjective` to get. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - } - ]; - - // View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - ServiceLevelObjective.View view = 2; -} - -// The `ListServiceLevelObjectives` request. -message ListServiceLevelObjectivesRequest { - // Required. Resource name of the parent `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; - - // A filter specifying what `ServiceLevelObjective`s to return. - string filter = 2; - - // A non-negative number that is the maximum number of results to return. - // When 0, use default page size. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; - - // View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - ServiceLevelObjective.View view = 5; -} - -// The `ListServiceLevelObjectives` response. -message ListServiceLevelObjectivesResponse { - // The `ServiceLevelObjective`s matching the specified filter. - repeated ServiceLevelObjective service_level_objectives = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `UpdateServiceLevelObjective` request. -message UpdateServiceLevelObjectiveRequest { - // Required. The `ServiceLevelObjective` to draw updates from. - // The given `name` specifies the resource to update. - ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED]; - - // A set of field paths defining which fields to use for the update. - google.protobuf.FieldMask update_mask = 2; -} - -// The `DeleteServiceLevelObjective` request. -message DeleteServiceLevelObjectiveRequest { - // Required. Resource name of the `ServiceLevelObjective` to delete. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/span_context.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/span_context.proto.baseline deleted file mode 100644 index 220d6f7bafff..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/span_context.proto.baseline +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "SpanContextProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The context of a span, attached to google.api.Distribution.Exemplars -// in google.api.Distribution values during aggregation. -// -// It contains the name of a span with format: -// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID] -message SpanContext { - // The resource name of the span in the following format: - // - // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID] - // - // [TRACE_ID] is a unique identifier for a trace within a project; - // it is a 32-character hexadecimal encoding of a 16-byte array. - // - // [SPAN_ID] is a unique identifier for a span within a trace; it - // is a 16-character hexadecimal encoding of an 8-byte array. - string span_name = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime.proto.baseline deleted file mode 100644 index 443090450c40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime.proto.baseline +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "UptimeProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The regions from which an Uptime check can be run. -enum UptimeCheckRegion { - // Default value if no region is specified. Will result in Uptime checks - // running from all regions. - REGION_UNSPECIFIED = 0; - - // Allows checks to run from locations within the United States of America. - USA = 1; - - // Allows checks to run from locations within the continent of Europe. - EUROPE = 2; - - // Allows checks to run from locations within the continent of South - // America. - SOUTH_AMERICA = 3; - - // Allows checks to run from locations within the Asia Pacific area (ex: - // Singapore). - ASIA_PACIFIC = 4; -} - -// An internal checker allows Uptime checks to run on private/internal GCP -// resources. -message InternalChecker { - option deprecated = true; - - // Operational states for an internal checker. - enum State { - // An internal checker should never be in the unspecified state. - UNSPECIFIED = 0; - - // The checker is being created, provisioned, and configured. A checker in - // this state can be returned by `ListInternalCheckers` or - // `GetInternalChecker`, as well as by examining the [long running - // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) - // that created it. - CREATING = 1; - - // The checker is running and available for use. A checker in this state - // can be returned by `ListInternalCheckers` or `GetInternalChecker` as - // well as by examining the [long running - // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) - // that created it. - // If a checker is being torn down, it is neither visible nor usable, so - // there is no "deleting" or "down" state. - RUNNING = 2; - } - - // A unique resource name for this InternalChecker. The format is: - // - // `projects/[PROJECT_ID]/internalCheckers/[INTERNAL_CHECKER_ID]`. - // - // `[PROJECT_ID]` is the Stackdriver Workspace project for the - // Uptime check config associated with the internal checker. - string name = 1; - - // The checker's human-readable name. The display name - // should be unique within a Stackdriver Workspace in order to make it easier - // to identify; however, uniqueness is not enforced. - string display_name = 2; - - // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the - // internal resource lives (ex: "default"). - string network = 3; - - // The GCP zone the Uptime check should egress from. Only respected for - // internal Uptime checks, where internal_network is specified. - string gcp_zone = 4; - - // The GCP project ID where the internal checker lives. Not necessary - // the same as the Workspace project. - string peer_project_id = 6; - - // The current operational state of the internal checker. - State state = 7; -} - -// This message configures which resources and services to monitor for -// availability. -message UptimeCheckConfig { - option (google.api.resource) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - pattern: "projects/{project}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "folders/{folder}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "*" - }; - - // The resource submessage for group checks. It can be used instead of a - // monitored resource, when multiple resources are being monitored. - message ResourceGroup { - // The group of resources being monitored. Should be only the `[GROUP_ID]`, - // and not the full-path `projects/[PROJECT_ID]/groups/[GROUP_ID]`. - string group_id = 1; - - // The resource type of the group members. - GroupResourceType resource_type = 2; - } - - // Information involved in an HTTP/HTTPS Uptime check request. - message HttpCheck { - // The authentication parameters to provide to the specified resource or - // URL that requires a username and password. Currently, only - // [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is - // supported in Uptime checks. - message BasicAuthentication { - // The username to use when authenticating with the HTTP server. - string username = 1; - - // The password to use when authenticating with the HTTP server. - string password = 2; - } - - // If `true`, use HTTPS instead of HTTP to run the check. - bool use_ssl = 1; - - // Optional (defaults to "/"). The path to the page against which to run - // the check. Will be combined with the `host` (specified within the - // `monitored_resource`) and `port` to construct the full URL. If the - // provided path does not begin with "/", a "/" will be prepended - // automatically. - string path = 2; - - // Optional (defaults to 80 when `use_ssl` is `false`, and 443 when - // `use_ssl` is `true`). The TCP port on the HTTP server against which to - // run the check. Will be combined with host (specified within the - // `monitored_resource`) and `path` to construct the full URL. - int32 port = 3; - - // The authentication information. Optional when creating an HTTP check; - // defaults to empty. - BasicAuthentication auth_info = 4; - - // Boolean specifiying whether to encrypt the header information. - // Encryption should be specified for any headers related to authentication - // that you do not wish to be seen when retrieving the configuration. The - // server will be responsible for encrypting the headers. - // On Get/List calls, if `mask_headers` is set to `true` then the headers - // will be obscured with `******.` - bool mask_headers = 5; - - // The list of headers to send as part of the Uptime check request. - // If two headers have the same key and different values, they should - // be entered as a single header, with the value being a comma-separated - // list of all the desired values as described at - // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). - // Entering two separate headers with the same key in a Create call will - // cause the first to be overwritten by the second. - // The maximum number of headers allowed is 100. - map headers = 6; - - // Boolean specifying whether to include SSL certificate validation as a - // part of the Uptime check. Only applies to checks where - // `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, - // setting `validate_ssl` to `true` has no effect. - bool validate_ssl = 7; - } - - // Information required for a TCP Uptime check request. - message TcpCheck { - // The TCP port on the server against which to run the check. Will be - // combined with host (specified within the `monitored_resource`) to - // construct the full URL. Required. - int32 port = 1; - } - - // Optional. Used to perform content matching. This allows matching based on - // substrings and regular expressions, together with their negations. Only the - // first 4 MB of an HTTP or HTTPS check's response (and the first - // 1 MB of a TCP check's response) are examined for purposes of content - // matching. - message ContentMatcher { - // Options to perform content matching. - enum ContentMatcherOption { - // No content matcher type specified (maintained for backward - // compatibility, but deprecated for future use). - // Treated as `CONTAINS_STRING`. - CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; - - // Selects substring matching. The match succeeds if the output contains - // the `content` string. This is the default value for checks without - // a `matcher` option, or where the value of `matcher` is - // `CONTENT_MATCHER_OPTION_UNSPECIFIED`. - CONTAINS_STRING = 1; - - // Selects negation of substring matching. The match succeeds if the - // output does _NOT_ contain the `content` string. - NOT_CONTAINS_STRING = 2; - - // Selects regular-expression matching. The match succeeds of the output - // matches the regular expression specified in the `content` string. - MATCHES_REGEX = 3; - - // Selects negation of regular-expression matching. The match succeeds if - // the output does _NOT_ match the regular expression specified in the - // `content` string. - NOT_MATCHES_REGEX = 4; - } - - // String or regex content to match. Maximum 1024 bytes. An empty `content` - // string indicates no content matching is to be performed. - string content = 1; - - // The type of content matcher that will be applied to the server output, - // compared to the `content` string when the check is run. - ContentMatcherOption matcher = 2; - } - - // A unique resource name for this Uptime check configuration. The format is: - // - // `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - // - // This field should be omitted when creating the Uptime check configuration; - // on create, the resource name is assigned by the server and included in the - // response. - string name = 1; - - // A human-friendly name for the Uptime check configuration. The display name - // should be unique within a Stackdriver Workspace in order to make it easier - // to identify; however, uniqueness is not enforced. Required. - string display_name = 2; - - // The resource the check is checking. Required. - oneof resource { - // The [monitored - // resource](https://cloud.google.com/monitoring/api/resources) associated - // with the configuration. - // The following monitored resource types are supported for Uptime checks: - // `uptime_url`, - // `gce_instance`, - // `gae_app`, - // `aws_ec2_instance`, - // `aws_elb_load_balancer` - google.api.MonitoredResource monitored_resource = 3; - - // The group resource associated with the configuration. - ResourceGroup resource_group = 4; - } - - // The type of Uptime check request. - oneof check_request_type { - // Contains information needed to make an HTTP or HTTPS check. - HttpCheck http_check = 5; - - // Contains information needed to make a TCP check. - TcpCheck tcp_check = 6; - } - - // How often, in seconds, the Uptime check is performed. - // Currently, the only supported values are `60s` (1 minute), `300s` - // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, - // defaults to `60s`. - google.protobuf.Duration period = 7; - - // The maximum amount of time to wait for the request to complete (must be - // between 1 and 60 seconds). Required. - google.protobuf.Duration timeout = 8; - - // The content that is expected to appear in the data returned by the target - // server against which the check is run. Currently, only the first entry - // in the `content_matchers` list is supported, and additional entries will - // be ignored. This field is optional and should only be specified if a - // content match is required as part of the/ Uptime check. - repeated ContentMatcher content_matchers = 9; - - // The list of regions from which the check will be run. - // Some regions contain one location, and others contain more than one. - // If this field is specified, enough regions must be provided to include a - // minimum of 3 locations. Not specifying this field will result in Uptime - // checks running from all available regions. - repeated UptimeCheckRegion selected_regions = 10; - - // If this is `true`, then checks are made only from the 'internal_checkers'. - // If it is `false`, then checks are made only from the 'selected_regions'. - // It is an error to provide 'selected_regions' when is_internal is `true`, - // or to provide 'internal_checkers' when is_internal is `false`. - bool is_internal = 15 [deprecated = true]; - - // The internal checkers that this check will egress from. If `is_internal` is - // `true` and this list is empty, the check will egress from all the - // InternalCheckers configured for the project that owns this - // `UptimeCheckConfig`. - repeated InternalChecker internal_checkers = 14 [deprecated = true]; -} - -// The supported resource types that can be used as values of -// `group_resource.resource_type`. -// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types. -// The resource types `gae_app` and `uptime_url` are not valid here because -// group checks on App Engine modules and URLs are not allowed. -enum GroupResourceType { - // Default value (not valid). - RESOURCE_TYPE_UNSPECIFIED = 0; - - // A group of instances from Google Cloud Platform (GCP) or - // Amazon Web Services (AWS). - INSTANCE = 1; - - // A group of Amazon ELB load balancers. - AWS_ELB_LOAD_BALANCER = 2; -} - -// Contains the region, location, and list of IP -// addresses where checkers in the location run from. -message UptimeCheckIp { - // A broad region category in which the IP address is located. - UptimeCheckRegion region = 1; - - // A more specific location within the region that typically encodes - // a particular city/town/metro (and its containing state/province or country) - // within the broader umbrella region category. - string location = 2; - - // The IP address from which the Uptime check originates. This is a fully - // specified IP address (not an IP address range). Most IP addresses, as of - // this publication, are in IPv4 format; however, one should not rely on the - // IP addresses being in IPv4 format indefinitely, and should support - // interpreting this field in either IPv4 or IPv6 format. - string ip_address = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime_service.proto.baseline deleted file mode 100644 index b4c2fc47ac10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/protos/google/monitoring/v3/uptime_service.proto.baseline +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/uptime.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "UptimeServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The UptimeCheckService API is used to manage (list, create, delete, edit) -// Uptime check configurations in the Stackdriver Monitoring product. An Uptime -// check is a piece of configuration that determines which resources and -// services to monitor for availability. These configurations can also be -// configured interactively by navigating to the [Cloud Console] -// (http://console.cloud.google.com), selecting the appropriate project, -// clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, -// and then clicking on "Uptime". -service UptimeCheckService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing valid Uptime check configurations for the project - // (leaving out any invalid configurations). - rpc ListUptimeCheckConfigs(ListUptimeCheckConfigsRequest) returns (ListUptimeCheckConfigsResponse) { - option (google.api.http) = { - get: "/v3/{parent=projects/*}/uptimeCheckConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a single Uptime check configuration. - rpc GetUptimeCheckConfig(GetUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - get: "/v3/{name=projects/*/uptimeCheckConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Uptime check configuration. - rpc CreateUptimeCheckConfig(CreateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - post: "/v3/{parent=projects/*}/uptimeCheckConfigs" - body: "uptime_check_config" - }; - option (google.api.method_signature) = "parent,uptime_check_config"; - } - - // Updates an Uptime check configuration. You can either replace the entire - // configuration with a new one or replace only certain fields in the current - // configuration by specifying the fields to be updated via `updateMask`. - // Returns the updated configuration. - rpc UpdateUptimeCheckConfig(UpdateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - patch: "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}" - body: "uptime_check_config" - }; - option (google.api.method_signature) = "uptime_check_config"; - } - - // Deletes an Uptime check configuration. Note that this method will fail - // if the Uptime check configuration is referenced by an alert policy or - // other dependent configs that would be rendered invalid by the deletion. - rpc DeleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/uptimeCheckConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns the list of IP addresses that checkers run from - rpc ListUptimeCheckIps(ListUptimeCheckIpsRequest) returns (ListUptimeCheckIpsResponse) { - option (google.api.http) = { - get: "/v3/uptimeCheckIps" - }; - } -} - -// The protocol for the `ListUptimeCheckConfigs` request. -message ListUptimeCheckConfigsRequest { - // Required. The project whose Uptime check configurations are listed. The format - // is `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; - - // The maximum number of results to return in a single response. The server - // may further constrain the maximum number of results returned in a single - // page. If the page_size is <=0, the server will decide the number of results - // to be returned. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - string page_token = 4; -} - -// The protocol for the `ListUptimeCheckConfigs` response. -message ListUptimeCheckConfigsResponse { - // The returned Uptime check configurations. - repeated UptimeCheckConfig uptime_check_configs = 1; - - // This field represents the pagination token to retrieve the next page of - // results. If the value is empty, it means no further results for the - // request. To retrieve the next page of results, the value of the - // next_page_token is passed to the subsequent List method call (in the - // request message's page_token field). - string next_page_token = 2; - - // The total number of Uptime check configurations for the project, - // irrespective of any pagination. - int32 total_size = 3; -} - -// The protocol for the `GetUptimeCheckConfig` request. -message GetUptimeCheckConfigRequest { - // Required. The Uptime check configuration to retrieve. The format - // is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; -} - -// The protocol for the `CreateUptimeCheckConfig` request. -message CreateUptimeCheckConfigRequest { - // Required. The project in which to create the Uptime check. The format - // is `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; - - // Required. The new Uptime check configuration. - UptimeCheckConfig uptime_check_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `UpdateUptimeCheckConfig` request. -message UpdateUptimeCheckConfigRequest { - // Optional. If present, only the listed fields in the current Uptime check - // configuration are updated with values from the new configuration. If this - // field is empty, then the current configuration is completely replaced with - // the new configuration. - google.protobuf.FieldMask update_mask = 2; - - // Required. If an `updateMask` has been specified, this field gives - // the values for the set of fields mentioned in the `updateMask`. If an - // `updateMask` has not been given, this Uptime check configuration replaces - // the current configuration. If a field is mentioned in `updateMask` but - // the corresonding field is omitted in this partial Uptime check - // configuration, it has the effect of deleting/clearing the field from the - // configuration on the server. - // - // The following fields can be updated: `display_name`, - // `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - // `selected_regions`. - UptimeCheckConfig uptime_check_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `DeleteUptimeCheckConfig` request. -message DeleteUptimeCheckConfigRequest { - // Required. The Uptime check configuration to delete. The format - // is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; -} - -// The protocol for the `ListUptimeCheckIps` request. -message ListUptimeCheckIpsRequest { - // The maximum number of results to return in a single response. The server - // may further constrain the maximum number of results returned in a single - // page. If the page_size is <=0, the server will decide the number of results - // to be returned. - // NOTE: this field is not yet implemented - int32 page_size = 2; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - // NOTE: this field is not yet implemented - string page_token = 3; -} - -// The protocol for the `ListUptimeCheckIps` response. -message ListUptimeCheckIpsResponse { - // The returned list of IP addresses (including region and location) that the - // checkers run from. - repeated UptimeCheckIp uptime_check_ips = 1; - - // This field represents the pagination token to retrieve the next page of - // results. If the value is empty, it means no further results for the - // request. To retrieve the next page of results, the value of the - // next_page_token is passed to the subsequent List method call (in the - // request message's page_token field). - // NOTE: this field is not yet implemented - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline deleted file mode 100644 index 968d29928eae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, alertPolicy) { - // [START monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the alerting policy. The format is - * `projects/[PROJECT_ID]`. - * Note that this field names the parent container in which the alerting - * policy will be written, not the name of the created policy. The alerting - * policy that is returned will have a name that contains a normalized - * representation of this name as a prefix but adds a suffix of the form - * `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - */ - // const name = 'abc123' - /** - * Required. The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including - * a new ALERT_POLICY_ID value. - */ - // const alertPolicy = {} - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callCreateAlertPolicy() { - // Construct request - const request = { - name, - alertPolicy, - }; - - // Run request - const response = await monitoringClient.createAlertPolicy(request); - console.log(response); - } - - callCreateAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline deleted file mode 100644 index d009d518ca10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The alerting policy to delete. The format is: - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * For more information, see AlertPolicy google.monitoring.v3.AlertPolicy. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callDeleteAlertPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteAlertPolicy(request); - console.log(response); - } - - callDeleteAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline deleted file mode 100644 index 1297eabd1db1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The alerting policy to retrieve. The format is - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callGetAlertPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getAlertPolicy(request); - console.log(response); - } - - callGetAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline deleted file mode 100644 index 5afbf8d77956..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose alert policies are to be listed. The format is - * projects/[PROJECT_ID] - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * GetAlertPolicy google.monitoring.v3.AlertPolicyService.GetAlertPolicy - * operation, instead. - */ - // const name = 'abc123' - /** - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const orderBy = 'abc123' - /** - * The maximum number of results to return in a single response. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callListAlertPolicies() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listAlertPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAlertPolicies(); - // [END monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline deleted file mode 100644 index 6e7751d303f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(alertPolicy) { - // [START monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A list of alerting policy field names. If this field is not - * empty, each listed field in the existing alerting policy is set to the - * value of the corresponding field in the supplied policy (`alert_policy`), - * or to the field's default value if the field is not in the supplied - * alerting policy. Fields not listed retain their previous value. - * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, - * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - * If this field is empty, then the supplied alerting policy replaces the - * existing policy. It is the same as deleting the existing policy and - * adding the supplied policy, except for the following: - * + The new policy will have the same `[ALERT_POLICY_ID]` as the former - * policy. This gives you continuity with the former policy in your - * notifications and incidents. - * + Conditions in the new policy will keep their former `[CONDITION_ID]` if - * the supplied condition includes the `name` field with that - * `[CONDITION_ID]`. If the supplied condition omits the `name` field, - * then a new `[CONDITION_ID]` is created. - */ - // const updateMask = {} - /** - * Required. The updated alerting policy or the updated values for the - * fields listed in `update_mask`. - * If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - */ - // const alertPolicy = {} - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callUpdateAlertPolicy() { - // Construct request - const request = { - alertPolicy, - }; - - // Run request - const response = await monitoringClient.updateAlertPolicy(request); - console.log(response); - } - - callUpdateAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.create_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.create_group.js.baseline deleted file mode 100644 index 018024ccc3ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.create_group.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, group) { - // [START monitoring_v3_generated_GroupService_CreateGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the group. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. A group definition. It is an error to define the `name` field because - * the system assigns the name. - */ - // const group = {} - /** - * If true, validate this request but do not create the group. - */ - // const validateOnly = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callCreateGroup() { - // Construct request - const request = { - name, - group, - }; - - // Run request - const response = await monitoringClient.createGroup(request); - console.log(response); - } - - callCreateGroup(); - // [END monitoring_v3_generated_GroupService_CreateGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.delete_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.delete_group.js.baseline deleted file mode 100644 index d4b3ac2b4b9a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.delete_group.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_DeleteGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group to delete. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - /** - * If this field is true, then the request means to delete a group with all - * its descendants. Otherwise, the request means to delete a group only when - * it has no descendants. The default value is false. - */ - // const recursive = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callDeleteGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteGroup(request); - console.log(response); - } - - callDeleteGroup(); - // [END monitoring_v3_generated_GroupService_DeleteGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.get_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.get_group.js.baseline deleted file mode 100644 index 93e2d085beba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.get_group.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_GetGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group to retrieve. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callGetGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getGroup(request); - console.log(response); - } - - callGetGroup(); - // [END monitoring_v3_generated_GroupService_GetGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_group_members.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_group_members.js.baseline deleted file mode 100644 index fd1fa12bd0a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_group_members.js.baseline +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_ListGroupMembers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - /** - * An optional list filter (/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * resource.type = "gce_instance" - */ - // const filter = 'abc123' - /** - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - */ - // const interval = {} - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callListGroupMembers() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listGroupMembersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGroupMembers(); - // [END monitoring_v3_generated_GroupService_ListGroupMembers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_groups.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_groups.js.baseline deleted file mode 100644 index 34ab326150ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.list_groups.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_ListGroups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - */ - // const childrenOfGroup = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - */ - // const ancestorsOfGroup = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - */ - // const descendantsOfGroup = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callListGroups() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listGroupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGroups(); - // [END monitoring_v3_generated_GroupService_ListGroups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.update_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.update_group.js.baseline deleted file mode 100644 index a701decff0df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/group_service.update_group.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(group) { - // [START monitoring_v3_generated_GroupService_UpdateGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new definition of the group. All fields of the existing group, - * excepting `name`, are replaced with the corresponding fields of this group. - */ - // const group = {} - /** - * If true, validate this request but do not update the existing group. - */ - // const validateOnly = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callUpdateGroup() { - // Construct request - const request = { - group, - }; - - // Run request - const response = await monitoringClient.updateGroup(request); - console.log(response); - } - - callUpdateGroup(); - // [END monitoring_v3_generated_GroupService_UpdateGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline deleted file mode 100644 index 03781ba1ca9a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, metricDescriptor) { - // [START monitoring_v3_generated_MetricService_CreateMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. The new custom metric (/monitoring/custom-metrics) - * descriptor. - */ - // const metricDescriptor = {} - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callCreateMetricDescriptor() { - // Construct request - const request = { - name, - metricDescriptor, - }; - - // Run request - const response = await monitoringClient.createMetricDescriptor(request); - console.log(response); - } - - callCreateMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_CreateMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_time_series.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_time_series.js.baseline deleted file mode 100644 index 29142c6a304b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.create_time_series.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, timeSeries) { - // [START monitoring_v3_generated_MetricService_CreateTimeSeries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * The maximum number of `TimeSeries` objects per `Create` request is 200. - */ - // const timeSeries = [1,2,3,4] - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callCreateTimeSeries() { - // Construct request - const request = { - name, - timeSeries, - }; - - // Run request - const response = await monitoringClient.createTimeSeries(request); - console.log(response); - } - - callCreateTimeSeries(); - // [END monitoring_v3_generated_MetricService_CreateTimeSeries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline deleted file mode 100644 index 1c32361086a8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example of `{metric_id}` is: - * `"custom.googleapis.com/my_test_metric"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callDeleteMetricDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteMetricDescriptor(request); - console.log(response); - } - - callDeleteMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline deleted file mode 100644 index 71365551c9db..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_GetMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example value of `{metric_id}` is - * `"compute.googleapis.com/instance/disk/read_bytes_count"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callGetMetricDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getMetricDescriptor(request); - console.log(response); - } - - callGetMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_GetMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline deleted file mode 100644 index ada4b561d4c8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The monitored resource descriptor to get. The format is - * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - * The `{resource_type}` is a predefined type, such as - * `cloudsql_database`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callGetMonitoredResourceDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getMonitoredResourceDescriptor(request); - console.log(response); - } - - callGetMonitoredResourceDescriptor(); - // [END monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline deleted file mode 100644 index 7b9f15d2c987..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_ListMetricDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the filter (/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * custom metrics (/monitoring/custom-metrics): - * metric.type = starts_with("custom.googleapis.com/") - */ - // const filter = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListMetricDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listMetricDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetricDescriptors(); - // [END monitoring_v3_generated_MetricService_ListMetricDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline deleted file mode 100644 index 1b59c28ec72e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * An optional filter (/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * resource.type = starts_with("gce_") AND resource.label:id - */ - // const filter = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_time_series.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_time_series.js.baseline deleted file mode 100644 index d81ebe219e8c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/metric_service.list_time_series.js.baseline +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, filter, interval, view) { - // [START monitoring_v3_generated_MetricService_ListTimeSeries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - */ - // const name = 'abc123' - /** - * Required. A monitoring filter (/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - */ - // const filter = 'abc123' - /** - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - */ - // const interval = {} - /** - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - */ - // const aggregation = {} - /** - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - */ - // const orderBy = 'abc123' - /** - * Required. Specifies which information is returned about the time series. - */ - // const view = {} - /** - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListTimeSeries() { - // Construct request - const request = { - name, - filter, - interval, - view, - }; - - // Run request - const iterable = monitoringClient.listTimeSeriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTimeSeries(); - // [END monitoring_v3_generated_MetricService_ListTimeSeries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline deleted file mode 100644 index 0eec81e81373..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, notificationChannel) { - // [START monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is: - * projects/[PROJECT_ID] - * Note that this names the container into which the channel will be - * written. This does not name the newly created channel. The resulting - * channel's name will have a normalized version of this field as a prefix, - * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - */ - // const name = 'abc123' - /** - * Required. The definition of the `NotificationChannel` to create. - */ - // const notificationChannel = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callCreateNotificationChannel() { - // Construct request - const request = { - name, - notificationChannel, - }; - - // Run request - const response = await monitoringClient.createNotificationChannel(request); - console.log(response); - } - - callCreateNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline deleted file mode 100644 index e3f28ec17171..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - */ - // const name = 'abc123' - /** - * If true, the notification channel will be deleted regardless of its - * use in alert policies (the policies will be updated to remove the - * channel). If false, channels that are still referenced by an existing - * alerting policy will fail to be deleted in a delete operation. - */ - // const force = true - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callDeleteNotificationChannel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteNotificationChannel(request); - console.log(response); - } - - callDeleteNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline deleted file mode 100644 index 4c6ad2f00b7e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannel(request); - console.log(response); - } - - callGetNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline deleted file mode 100644 index 3915845d984d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel type for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannelDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannelDescriptor(request); - console.log(response); - } - - callGetNotificationChannelDescriptor(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline deleted file mode 100644 index 1b0b8eaff172..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel for which a verification code is to be generated - * and retrieved. This must name a channel that is already verified; if - * the specified channel is not verified, the request will fail. - */ - // const name = 'abc123' - /** - * The desired expiration time. If specified, the API will guarantee that - * the returned code will not be valid after the specified timestamp; - * however, the API cannot guarantee that the returned code will be - * valid for at least as long as the requested time (the API puts an upper - * bound on the amount of time for which a code may be valid). If omitted, - * a default expiration will be used, which may be less than the max - * permissible expiration (so specifying an expiration may extend the - * code's lifetime over omitting an expiration, even though the API does - * impose an upper limit on the maximum expiration that is permitted). - */ - // const expireTime = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannelVerificationCode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannelVerificationCode(request); - console.log(response); - } - - callGetNotificationChannelVerificationCode(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline deleted file mode 100644 index 6d7b91df73a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * projects/[PROJECT_ID] - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * GetNotificationChannelDescriptor google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor - * operation, instead. - */ - // const name = 'abc123' - /** - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - */ - // const pageSize = 1234 - /** - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callListNotificationChannelDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listNotificationChannelDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationChannelDescriptors(); - // [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline deleted file mode 100644 index f91fe89b8611..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * `GetNotificationChannel` google.monitoring.v3.NotificationChannelService.GetNotificationChannel - * operation. - */ - // const name = 'abc123' - /** - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const orderBy = 'abc123' - /** - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - */ - // const pageSize = 1234 - /** - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callListNotificationChannels() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listNotificationChannelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationChannels(); - // [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline deleted file mode 100644 index 69a0e42fe127..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel to which to send a verification code. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callSendNotificationChannelVerificationCode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.sendNotificationChannelVerificationCode(request); - console.log(response); - } - - callSendNotificationChannelVerificationCode(); - // [END monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline deleted file mode 100644 index 9e890f9ce89c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(notificationChannel) { - // [START monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The fields to update. - */ - // const updateMask = {} - /** - * Required. A description of the changes to be applied to the specified - * notification channel. The description must provide a definition for - * fields to be updated; the names of these fields should also be - * included in the `update_mask`. - */ - // const notificationChannel = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callUpdateNotificationChannel() { - // Construct request - const request = { - notificationChannel, - }; - - // Run request - const response = await monitoringClient.updateNotificationChannel(request); - console.log(response); - } - - callUpdateNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline deleted file mode 100644 index 5b9d2b438b78..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, code) { - // [START monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel to verify. - */ - // const name = 'abc123' - /** - * Required. The verification code that was delivered to the channel as - * a result of invoking the `SendNotificationChannelVerificationCode` API - * method or that was retrieved from a verified channel via - * `GetNotificationChannelVerificationCode`. For example, one might have - * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - * guaranteed that the code is valid UTF-8; one should not - * make any assumptions regarding the structure or format of the code). - */ - // const code = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callVerifyNotificationChannel() { - // Construct request - const request = { - name, - code, - }; - - // Run request - const response = await monitoringClient.verifyNotificationChannel(request); - console.log(response); - } - - callVerifyNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service.js.baseline deleted file mode 100644 index e7cc9887a64e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, service) { - // [START monitoring_v3_generated_ServiceMonitoringService_CreateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent workspace. - * Of the form `projects/{project_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The Service id to use for this Service. If omitted, an id will be - * generated instead. Must match the pattern [a-z0-9\-]+ - */ - // const serviceId = 'abc123' - /** - * Required. The `Service` to create. - */ - // const service = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - service, - }; - - // Run request - const response = await monitoringClient.createService(request); - console.log(response); - } - - callCreateService(); - // [END monitoring_v3_generated_ServiceMonitoringService_CreateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline deleted file mode 100644 index d6c0ce3c8d83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, serviceLevelObjective) { - // [START monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The ServiceLevelObjective id to use for this - * ServiceLevelObjective. If omitted, an id will be generated instead. Must - * match the pattern [a-z0-9\-]+ - */ - // const serviceLevelObjectiveId = 'abc123' - /** - * Required. The `ServiceLevelObjective` to create. - * The provided `name` will be respected if no `ServiceLevelObjective` exists - * with this name. - */ - // const serviceLevelObjective = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callCreateServiceLevelObjective() { - // Construct request - const request = { - parent, - serviceLevelObjective, - }; - - // Run request - const response = await monitoringClient.createServiceLevelObjective(request); - console.log(response); - } - - callCreateServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service.js.baseline deleted file mode 100644 index ee75d6b2ab86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_DeleteService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `Service` to delete. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteService(request); - console.log(response); - } - - callDeleteService(); - // [END monitoring_v3_generated_ServiceMonitoringService_DeleteService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline deleted file mode 100644 index 639c28ba7242..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `ServiceLevelObjective` to delete. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callDeleteServiceLevelObjective() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteServiceLevelObjective(request); - console.log(response); - } - - callDeleteServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service.js.baseline deleted file mode 100644 index e850c90c900d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_GetService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getService(request); - console.log(response); - } - - callGetService(); - // [END monitoring_v3_generated_ServiceMonitoringService_GetService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline deleted file mode 100644 index b1f23ada2b34..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `ServiceLevelObjective` to get. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - */ - // const name = 'abc123' - /** - * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - */ - // const view = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callGetServiceLevelObjective() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getServiceLevelObjective(request); - console.log(response); - } - - callGetServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline deleted file mode 100644 index 63f1f07a3fe8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * A filter specifying what `ServiceLevelObjective`s to return. - */ - // const filter = 'abc123' - /** - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - /** - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - */ - // const view = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callListServiceLevelObjectives() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listServiceLevelObjectivesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServiceLevelObjectives(); - // [END monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_services.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_services.js.baseline deleted file mode 100644 index f1bd1aa6cc67..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.list_services.js.baseline +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_ServiceMonitoringService_ListServices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - */ - // const parent = 'abc123' - /** - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - */ - // const filter = 'abc123' - /** - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END monitoring_v3_generated_ServiceMonitoringService_ListServices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service.js.baseline deleted file mode 100644 index fb791fe8b7b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(service) { - // [START monitoring_v3_generated_ServiceMonitoringService_UpdateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `Service` to draw updates from. - * The given `name` specifies the resource to update. - */ - // const service = {} - /** - * A set of field paths defining which fields to use for the update. - */ - // const updateMask = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callUpdateService() { - // Construct request - const request = { - service, - }; - - // Run request - const response = await monitoringClient.updateService(request); - console.log(response); - } - - callUpdateService(); - // [END monitoring_v3_generated_ServiceMonitoringService_UpdateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline deleted file mode 100644 index 580c78bda9b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(serviceLevelObjective) { - // [START monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `ServiceLevelObjective` to draw updates from. - * The given `name` specifies the resource to update. - */ - // const serviceLevelObjective = {} - /** - * A set of field paths defining which fields to use for the update. - */ - // const updateMask = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callUpdateServiceLevelObjective() { - // Construct request - const request = { - serviceLevelObjective, - }; - - // Run request - const response = await monitoringClient.updateServiceLevelObjective(request); - console.log(response); - } - - callUpdateServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline deleted file mode 100644 index fbb0677640e3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline +++ /dev/null @@ -1,2071 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-monitoring", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.monitoring.v3", - "version": "v3" - } - ] - }, - "snippets": [ - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async", - "title": "monitoring listAlertPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing alerting policies for the project.", - "canonical": true, - "file": "alert_policy_service.list_alert_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAlertPolicies", - "fullName": "google.monitoring.v3.AlertPolicyService.ListAlertPolicies", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListAlertPoliciesResponse", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "ListAlertPolicies", - "fullName": "google.monitoring.v3.AlertPolicyService.ListAlertPolicies", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async", - "title": "monitoring getAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets a single alerting policy.", - "canonical": true, - "file": "alert_policy_service.get_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.GetAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "GetAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.GetAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async", - "title": "monitoring createAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates a new alerting policy.", - "canonical": true, - "file": "alert_policy_service.create_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.CreateAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "alert_policy", - "type": ".google.monitoring.v3.AlertPolicy" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "CreateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.CreateAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async", - "title": "monitoring deleteAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes an alerting policy.", - "canonical": true, - "file": "alert_policy_service.delete_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.DeleteAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "DeleteAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.DeleteAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async", - "title": "monitoring updateAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via `updateMask`. Returns the updated alerting policy.", - "canonical": true, - "file": "alert_policy_service.update_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "alert_policy", - "type": ".google.monitoring.v3.AlertPolicy" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "UpdateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_ListGroups_async", - "title": "monitoring listGroups Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing groups.", - "canonical": true, - "file": "group_service.list_groups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGroups", - "fullName": "google.monitoring.v3.GroupService.ListGroups", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "children_of_group", - "type": "TYPE_STRING" - }, - { - "name": "ancestors_of_group", - "type": "TYPE_STRING" - }, - { - "name": "descendants_of_group", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListGroupsResponse", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "ListGroups", - "fullName": "google.monitoring.v3.GroupService.ListGroups", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_GetGroup_async", - "title": "monitoring getGroup Sample", - "origin": "API_DEFINITION", - "description": " Gets a single group.", - "canonical": true, - "file": "group_service.get_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGroup", - "fullName": "google.monitoring.v3.GroupService.GetGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "GetGroup", - "fullName": "google.monitoring.v3.GroupService.GetGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_CreateGroup_async", - "title": "monitoring createGroup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new group.", - "canonical": true, - "file": "group_service.create_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGroup", - "fullName": "google.monitoring.v3.GroupService.CreateGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "group", - "type": ".google.monitoring.v3.Group" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "CreateGroup", - "fullName": "google.monitoring.v3.GroupService.CreateGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_UpdateGroup_async", - "title": "monitoring updateGroup Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing group. You can change any group attributes except `name`.", - "canonical": true, - "file": "group_service.update_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGroup", - "fullName": "google.monitoring.v3.GroupService.UpdateGroup", - "async": true, - "parameters": [ - { - "name": "group", - "type": ".google.monitoring.v3.Group" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "UpdateGroup", - "fullName": "google.monitoring.v3.GroupService.UpdateGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_DeleteGroup_async", - "title": "monitoring deleteGroup Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing group.", - "canonical": true, - "file": "group_service.delete_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGroup", - "fullName": "google.monitoring.v3.GroupService.DeleteGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "recursive", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "DeleteGroup", - "fullName": "google.monitoring.v3.GroupService.DeleteGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_ListGroupMembers_async", - "title": "monitoring listGroupMembers Sample", - "origin": "API_DEFINITION", - "description": " Lists the monitored resources that are members of a group.", - "canonical": true, - "file": "group_service.list_group_members.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGroupMembers", - "fullName": "google.monitoring.v3.GroupService.ListGroupMembers", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "interval", - "type": ".google.monitoring.v3.TimeInterval" - } - ], - "resultType": ".google.monitoring.v3.ListGroupMembersResponse", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "ListGroupMembers", - "fullName": "google.monitoring.v3.GroupService.ListGroupMembers", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async", - "title": "monitoring listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async", - "title": "monitoring getMonitoredResourceDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single monitored resource descriptor. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.get_monitored_resource_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMonitoredResourceDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.MonitoredResourceDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "GetMonitoredResourceDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListMetricDescriptors_async", - "title": "monitoring listMetricDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists metric descriptors that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_metric_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetricDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMetricDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListMetricDescriptorsResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListMetricDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMetricDescriptors", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_GetMetricDescriptor_async", - "title": "monitoring getMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single metric descriptor. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.get_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.MetricDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "GetMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_CreateMetricDescriptor_async", - "title": "monitoring createMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics).", - "canonical": true, - "file": "metric_service.create_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.CreateMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "metric_descriptor", - "type": ".google.api.MetricDescriptor" - } - ], - "resultType": ".google.api.MetricDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "CreateMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.CreateMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async", - "title": "monitoring deleteMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted.", - "canonical": true, - "file": "metric_service.delete_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.DeleteMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "DeleteMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.DeleteMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListTimeSeries_async", - "title": "monitoring listTimeSeries Sample", - "origin": "API_DEFINITION", - "description": " Lists time series that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_time_series.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 104, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTimeSeries", - "fullName": "google.monitoring.v3.MetricService.ListTimeSeries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "interval", - "type": ".google.monitoring.v3.TimeInterval" - }, - { - "name": "aggregation", - "type": ".google.monitoring.v3.Aggregation" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListTimeSeriesResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListTimeSeries", - "fullName": "google.monitoring.v3.MetricService.ListTimeSeries", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_CreateTimeSeries_async", - "title": "monitoring createTimeSeries Sample", - "origin": "API_DEFINITION", - "description": " Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.", - "canonical": true, - "file": "metric_service.create_time_series.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTimeSeries", - "fullName": "google.monitoring.v3.MetricService.CreateTimeSeries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "time_series", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "CreateTimeSeries", - "fullName": "google.monitoring.v3.MetricService.CreateTimeSeries", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async", - "title": "monitoring listNotificationChannelDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.", - "canonical": true, - "file": "notification_channel_service.list_notification_channel_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationChannelDescriptors", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListNotificationChannelDescriptorsResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "ListNotificationChannelDescriptors", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptors", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async", - "title": "monitoring getNotificationChannelDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannelDescriptor", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannelDescriptor", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannelDescriptor", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async", - "title": "monitoring listNotificationChannels Sample", - "origin": "API_DEFINITION", - "description": " Lists the notification channels that have been created for the project.", - "canonical": true, - "file": "notification_channel_service.list_notification_channels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationChannels", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannels", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListNotificationChannelsResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "ListNotificationChannels", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannels", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async", - "title": "monitoring getNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async", - "title": "monitoring createNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.", - "canonical": true, - "file": "notification_channel_service.create_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.CreateNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "notification_channel", - "type": ".google.monitoring.v3.NotificationChannel" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "CreateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.CreateNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async", - "title": "monitoring updateNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification channel. Fields not specified in the field mask remain unchanged.", - "canonical": true, - "file": "notification_channel_service.update_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "notification_channel", - "type": ".google.monitoring.v3.NotificationChannel" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "UpdateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async", - "title": "monitoring deleteNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification channel.", - "canonical": true, - "file": "notification_channel_service.delete_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.DeleteNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "DeleteNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.DeleteNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async", - "title": "monitoring sendNotificationChannelVerificationCode Sample", - "origin": "API_DEFINITION", - "description": " Causes a verification code to be delivered to the channel. The code can then be supplied in `VerifyNotificationChannel` to verify the channel.", - "canonical": true, - "file": "notification_channel_service.send_notification_channel_verification_code.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SendNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "SendNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCode", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async", - "title": "monitoring getNotificationChannelVerificationCode Sample", - "origin": "API_DEFINITION", - "description": " Requests a verification code for an already verified channel that can then be used in a call to VerifyNotificationChannel() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state). There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as \"G-123456\") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel_verification_code.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "expire_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.monitoring.v3.GetNotificationChannelVerificationCodeResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCode", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async", - "title": "monitoring verifyNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a result of calling `SendNotificationChannelVerificationCode`.", - "canonical": true, - "file": "notification_channel_service.verify_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "VerifyNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "VerifyNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_CreateService_async", - "title": "monitoring createService Sample", - "origin": "API_DEFINITION", - "description": " Create a `Service`.", - "canonical": true, - "file": "service_monitoring_service.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.monitoring.v3.Service" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_GetService_async", - "title": "monitoring getService Sample", - "origin": "API_DEFINITION", - "description": " Get the named `Service`.", - "canonical": true, - "file": "service_monitoring_service.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_ListServices_async", - "title": "monitoring listServices Sample", - "origin": "API_DEFINITION", - "description": " List `Service`s for this workspace.", - "canonical": true, - "file": "service_monitoring_service.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListServicesResponse", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServices", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_UpdateService_async", - "title": "monitoring updateService Sample", - "origin": "API_DEFINITION", - "description": " Update this `Service`.", - "canonical": true, - "file": "service_monitoring_service.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateService", - "async": true, - "parameters": [ - { - "name": "service", - "type": ".google.monitoring.v3.Service" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_DeleteService_async", - "title": "monitoring deleteService Sample", - "origin": "API_DEFINITION", - "description": " Soft delete this `Service`.", - "canonical": true, - "file": "service_monitoring_service.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async", - "title": "monitoring createServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Create a `ServiceLevelObjective` for the given `Service`.", - "canonical": true, - "file": "service_monitoring_service.create_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_level_objective_id", - "type": "TYPE_STRING" - }, - { - "name": "service_level_objective", - "type": ".google.monitoring.v3.ServiceLevelObjective" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "CreateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async", - "title": "monitoring getServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Get a `ServiceLevelObjective` by name.", - "canonical": true, - "file": "service_monitoring_service.get_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ServiceLevelObjective.View" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "GetServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async", - "title": "monitoring listServiceLevelObjectives Sample", - "origin": "API_DEFINITION", - "description": " List the `ServiceLevelObjective`s for the given `Service`.", - "canonical": true, - "file": "service_monitoring_service.list_service_level_objectives.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServiceLevelObjectives", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectives", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ServiceLevelObjective.View" - } - ], - "resultType": ".google.monitoring.v3.ListServiceLevelObjectivesResponse", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "ListServiceLevelObjectives", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectives", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async", - "title": "monitoring updateServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Update the given `ServiceLevelObjective`.", - "canonical": true, - "file": "service_monitoring_service.update_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "service_level_objective", - "type": ".google.monitoring.v3.ServiceLevelObjective" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "UpdateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async", - "title": "monitoring deleteServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Delete the given `ServiceLevelObjective`.", - "canonical": true, - "file": "service_monitoring_service.delete_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "DeleteServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async", - "title": "monitoring listUptimeCheckConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).", - "canonical": true, - "file": "uptime_check_service.list_uptime_check_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUptimeCheckConfigs", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListUptimeCheckConfigsResponse", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "ListUptimeCheckConfigs", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigs", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async", - "title": "monitoring getUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a single Uptime check configuration.", - "canonical": true, - "file": "uptime_check_service.get_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "GetUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async", - "title": "monitoring createUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Uptime check configuration.", - "canonical": true, - "file": "uptime_check_service.create_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "uptime_check_config", - "type": ".google.monitoring.v3.UptimeCheckConfig" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "CreateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async", - "title": "monitoring updateUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.", - "canonical": true, - "file": "uptime_check_service.update_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "uptime_check_config", - "type": ".google.monitoring.v3.UptimeCheckConfig" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "UpdateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async", - "title": "monitoring deleteUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.", - "canonical": true, - "file": "uptime_check_service.delete_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "DeleteUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async", - "title": "monitoring listUptimeCheckIps Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of IP addresses that checkers run from", - "canonical": true, - "file": "uptime_check_service.list_uptime_check_ips.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUptimeCheckIps", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckIps", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListUptimeCheckIpsResponse", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "ListUptimeCheckIps", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckIps", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline deleted file mode 100644 index 71bedd61471f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, uptimeCheckConfig) { - // [START monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the Uptime check. The format - * is `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * Required. The new Uptime check configuration. - */ - // const uptimeCheckConfig = {} - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callCreateUptimeCheckConfig() { - // Construct request - const request = { - parent, - uptimeCheckConfig, - }; - - // Run request - const response = await monitoringClient.createUptimeCheckConfig(request); - console.log(response); - } - - callCreateUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline deleted file mode 100644 index b48481e88b2c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Uptime check configuration to delete. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callDeleteUptimeCheckConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteUptimeCheckConfig(request); - console.log(response); - } - - callDeleteUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline deleted file mode 100644 index b1632faa65f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Uptime check configuration to retrieve. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callGetUptimeCheckConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getUptimeCheckConfig(request); - console.log(response); - } - - callGetUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline deleted file mode 100644 index 3df2513ed779..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callListUptimeCheckConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listUptimeCheckConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUptimeCheckConfigs(); - // [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline deleted file mode 100644 index a81284fc33b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callListUptimeCheckIps() { - // Construct request - const request = { - }; - - // Run request - const iterable = monitoringClient.listUptimeCheckIpsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUptimeCheckIps(); - // [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline deleted file mode 100644 index 8825be1c264d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(uptimeCheckConfig) { - // [START monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. If present, only the listed fields in the current Uptime check - * configuration are updated with values from the new configuration. If this - * field is empty, then the current configuration is completely replaced with - * the new configuration. - */ - // const updateMask = {} - /** - * Required. If an `updateMask` has been specified, this field gives - * the values for the set of fields mentioned in the `updateMask`. If an - * `updateMask` has not been given, this Uptime check configuration replaces - * the current configuration. If a field is mentioned in `updateMask` but - * the corresonding field is omitted in this partial Uptime check - * configuration, it has the effect of deleting/clearing the field from the - * configuration on the server. - * The following fields can be updated: `display_name`, - * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - * `selected_regions`. - */ - // const uptimeCheckConfig = {} - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callUpdateUptimeCheckConfig() { - // Construct request - const request = { - uptimeCheckConfig, - }; - - // Run request - const response = await monitoringClient.updateUptimeCheckConfig(request); - console.log(response); - } - - callUpdateUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring-esm/webpack.config.cjs.baseline deleted file mode 100644 index 7f81732c413d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'monitoring', - filename: './monitoring.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.OwlBot.yaml.baseline deleted file mode 100644 index 8c6c51102fdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/monitoring/google-monitoring-nodejs - dest: /owl-bot-staging/google-monitoring - -api-name: monitoring \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.jsdoc.js.baseline deleted file mode 100644 index d93230d97c65..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'monitoring', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/README.md.baseline deleted file mode 100644 index 076f8cc1073a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Monitoring: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/monitoring.svg)](https://www.npmjs.org/package/monitoring) - -Monitoring client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Monitoring Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/monitoring/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Monitoring API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install monitoring -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install monitoring@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=monitoring.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-monitoring diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/package.json b/core/generator/gapic-generator-typescript/baselines/monitoring/package.json deleted file mode 100644 index 8a476819d8c6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "monitoring", - "version": "0.1.0", - "description": "Monitoring client for Node.js", - "repository": "googleapis/nodejs-monitoring", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google monitoring", - "monitoring", - "alert policy service", - "group service", - "metric service", - "notification channel service", - "service monitoring service", - "uptime check service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert.proto.baseline deleted file mode 100644 index 1e13bd6fb3f3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert.proto.baseline +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/mutation_record.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "AlertProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A description of the conditions under which some aspect of your system is -// considered to be "unhealthy" and the ways to notify people or services about -// this state. For an overview of alert policies, see -// [Introduction to Alerting](/monitoring/alerts/). -message AlertPolicy { - option (google.api.resource) = { - type: "monitoring.googleapis.com/AlertPolicy" - pattern: "projects/{project}/alertPolicies/{alert_policy}" - pattern: "organizations/{organization}/alertPolicies/{alert_policy}" - pattern: "folders/{folder}/alertPolicies/{alert_policy}" - pattern: "*" - }; - - // A content string and a MIME type that describes the content string's - // format. - message Documentation { - // The text of the documentation, interpreted according to `mime_type`. - // The content may not exceed 8,192 Unicode characters and may not exceed - // more than 10,240 bytes when encoded in UTF-8 format, whichever is - // smaller. - string content = 1; - - // The format of the `content` field. Presently, only the value - // `"text/markdown"` is supported. See - // [Markdown](https://en.wikipedia.org/wiki/Markdown) for more information. - string mime_type = 2; - } - - // A condition is a true/false test that determines when an alerting policy - // should open an incident. If a condition evaluates to true, it signifies - // that something is wrong. - message Condition { - option (google.api.resource) = { - type: "monitoring.googleapis.com/AlertPolicyCondition" - pattern: "projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}" - pattern: "*" - }; - - // Specifies how many time series must fail a predicate to trigger a - // condition. If not specified, then a `{count: 1}` trigger is used. - message Trigger { - // A type of trigger. - oneof type { - // The absolute number of time series that must fail - // the predicate for the condition to be triggered. - int32 count = 1; - - // The percentage of time series that must fail the - // predicate for the condition to be triggered. - double percent = 2; - } - } - - // A condition type that compares a collection of time series - // against a threshold. - message MetricThreshold { - // A [filter](/monitoring/api/v3/filters) that - // identifies which time series should be compared with the threshold. - // - // The filter is similar to the one that is specified in the - // [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that - // call is useful to verify the time series that will be retrieved / - // processed) and must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string filter = 2; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resrouces). Multiple aggregations - // are applied in the order specified. - // - // This field is similar to the one in the [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It - // is advisable to use the `ListTimeSeries` method when debugging this - // field. - repeated Aggregation aggregations = 8; - - // A [filter](/monitoring/api/v3/filters) that identifies a time - // series that should be used as the denominator of a ratio that will be - // compared with the threshold. If a `denominator_filter` is specified, - // the time series specified by the `filter` field will be used as the - // numerator. - // - // The filter must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string denominator_filter = 9; - - // Specifies the alignment of data points in individual time series - // selected by `denominatorFilter` as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resources). - // - // When computing ratios, the `aggregations` and - // `denominator_aggregations` fields must use the same alignment period - // and produce time series that have the same periodicity and labels. - repeated Aggregation denominator_aggregations = 10; - - // The comparison to apply between the time series (indicated by `filter` - // and `aggregation`) and the threshold (indicated by `threshold_value`). - // The comparison is applied on each time series, with the time series - // on the left-hand side and the threshold on the right-hand side. - // - // Only `COMPARISON_LT` and `COMPARISON_GT` are supported currently. - ComparisonType comparison = 4; - - // A value against which to compare the time series. - double threshold_value = 5; - - // The amount of time that a time series must violate the - // threshold to be considered failing. Currently, only values - // that are a multiple of a minute--e.g., 0, 60, 120, or 300 - // seconds--are supported. If an invalid value is given, an - // error will be returned. When choosing a duration, it is useful to - // keep in mind the frequency of the underlying time series data - // (which may also be affected by any alignments specified in the - // `aggregations` field); a good duration is long enough so that a single - // outlier does not generate spurious alerts, but short enough that - // unhealthy states are detected and alerted on quickly. - google.protobuf.Duration duration = 6; - - // The number/percent of time series for which the comparison must hold - // in order for the condition to trigger. If unspecified, then the - // condition will trigger if the comparison is true for any of the - // time series that have been identified by `filter` and `aggregations`, - // or by the ratio, if `denominator_filter` and `denominator_aggregations` - // are specified. - Trigger trigger = 7; - } - - // A condition type that checks that monitored resources - // are reporting data. The configuration defines a metric and - // a set of monitored resources. The predicate is considered in violation - // when a time series for the specified metric of a monitored - // resource does not include any data in the specified `duration`. - message MetricAbsence { - // A [filter](/monitoring/api/v3/filters) that - // identifies which time series should be compared with the threshold. - // - // The filter is similar to the one that is specified in the - // [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) (that - // call is useful to verify the time series that will be retrieved / - // processed) and must specify the metric type and optionally may contain - // restrictions on resource type, resource labels, and metric labels. - // This field may not exceed 2048 Unicode characters in length. - string filter = 1; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series together (such as - // when aggregating multiple streams on each resource to a single - // stream for each resource or when aggregating streams across all - // members of a group of resrouces). Multiple aggregations - // are applied in the order specified. - // - // This field is similar to the one in the [`ListTimeSeries` - // request](/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list). It - // is advisable to use the `ListTimeSeries` method when debugging this - // field. - repeated Aggregation aggregations = 5; - - // The amount of time that a time series must fail to report new - // data to be considered failing. Currently, only values that - // are a multiple of a minute--e.g. 60, 120, or 300 - // seconds--are supported. If an invalid value is given, an - // error will be returned. The `Duration.nanos` field is - // ignored. - google.protobuf.Duration duration = 2; - - // The number/percent of time series for which the comparison must hold - // in order for the condition to trigger. If unspecified, then the - // condition will trigger if the comparison is true for any of the - // time series that have been identified by `filter` and `aggregations`. - Trigger trigger = 3; - } - - // Required if the condition exists. The unique resource name for this - // condition. Its syntax is: - // - // projects/[PROJECT_ID]/alertPolicies/[POLICY_ID]/conditions/[CONDITION_ID] - // - // `[CONDITION_ID]` is assigned by Stackdriver Monitoring when the - // condition is created as part of a new or updated alerting policy. - // - // When calling the - // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] - // method, do not include the `name` field in the conditions of the - // requested alerting policy. Stackdriver Monitoring creates the - // condition identifiers and includes them in the new policy. - // - // When calling the - // [alertPolicies.update][google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy] - // method to update a policy, including a condition `name` causes the - // existing condition to be updated. Conditions without names are added to - // the updated policy. Existing conditions are deleted if they are not - // updated. - // - // Best practice is to preserve `[CONDITION_ID]` if you make only small - // changes, such as those to condition thresholds, durations, or trigger - // values. Otherwise, treat the change as a new condition and let the - // existing condition be deleted. - string name = 12; - - // A short name or phrase used to identify the condition in dashboards, - // notifications, and incidents. To avoid confusion, don't use the same - // display name for multiple conditions in the same policy. - string display_name = 6; - - // Only one of the following condition types will be specified. - oneof condition { - // A condition that compares a time series against a threshold. - MetricThreshold condition_threshold = 1; - - // A condition that checks that a time series continues to - // receive new data points. - MetricAbsence condition_absent = 2; - } - } - - // Operators for combining conditions. - enum ConditionCombinerType { - // An unspecified combiner. - COMBINE_UNSPECIFIED = 0; - - // Combine conditions using the logical `AND` operator. An - // incident is created only if all conditions are met - // simultaneously. This combiner is satisfied if all conditions are - // met, even if they are met on completely different resources. - AND = 1; - - // Combine conditions using the logical `OR` operator. An incident - // is created if any of the listed conditions is met. - OR = 2; - - // Combine conditions using logical `AND` operator, but unlike the regular - // `AND` option, an incident is created only if all conditions are met - // simultaneously on at least one resource. - AND_WITH_MATCHING_RESOURCE = 3; - } - - // Required if the policy exists. The resource name for this policy. The - // syntax is: - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - // - // `[ALERT_POLICY_ID]` is assigned by Stackdriver Monitoring when the policy - // is created. When calling the - // [alertPolicies.create][google.monitoring.v3.AlertPolicyService.CreateAlertPolicy] - // method, do not include the `name` field in the alerting policy passed as - // part of the request. - string name = 1; - - // A short name or phrase used to identify the policy in dashboards, - // notifications, and incidents. To avoid confusion, don't use the same - // display name for multiple policies in the same project. The name is - // limited to 512 Unicode characters. - string display_name = 2; - - // Documentation that is included with notifications and incidents related to - // this policy. Best practice is for the documentation to include information - // to help responders understand, mitigate, escalate, and correct the - // underlying problems detected by the alerting policy. Notification channels - // that have limited capacity might not show this documentation. - Documentation documentation = 13; - - // User-supplied key/value data to be used for organizing and - // identifying the `AlertPolicy` objects. - // - // The field can contain up to 64 entries. Each key and value is limited to - // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and - // values can contain only lowercase letters, numerals, underscores, and - // dashes. Keys must begin with a letter. - map user_labels = 16; - - // A list of conditions for the policy. The conditions are combined by AND or - // OR according to the `combiner` field. If the combined conditions evaluate - // to true, then an incident is created. A policy can have from one to six - // conditions. - // If |condition_time_series_uery_language| is present, it must be the only - // |condition|. - repeated Condition conditions = 12; - - // How to combine the results of multiple conditions to determine if an - // incident should be opened. - // If condition_time_series_query_language is present, this must be - // COMBINE_UNSPECIFIED. - ConditionCombinerType combiner = 6; - - // Whether or not the policy is enabled. On write, the default interpretation - // if unset is that the policy is enabled. On read, clients should not make - // any assumption about the state if it has not been populated. The - // field should always be populated on List and Get operations, unless - // a field projection has been specified that strips it out. - google.protobuf.BoolValue enabled = 17; - - // Read-only description of how the alert policy is invalid. OK if the alert - // policy is valid. If not OK, the alert policy will not generate incidents. - google.rpc.Status validity = 18; - - // Identifies the notification channels to which notifications should be sent - // when incidents are opened or closed or when new violations occur on - // an already opened incident. Each element of this array corresponds to - // the `name` field in each of the - // [`NotificationChannel`][google.monitoring.v3.NotificationChannel] - // objects that are returned from the [`ListNotificationChannels`] - // [google.monitoring.v3.NotificationChannelService.ListNotificationChannels] - // method. The syntax of the entries in this field is: - // - // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID] - repeated string notification_channels = 14; - - // A read-only record of the creation of the alerting policy. If provided - // in a call to create or update, this field will be ignored. - MutationRecord creation_record = 10; - - // A read-only record of the most recent change to the alerting policy. If - // provided in a call to create or update, this field will be ignored. - MutationRecord mutation_record = 11; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert_service.proto.baseline deleted file mode 100644 index b38381f3c626..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/alert_service.proto.baseline +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/alert.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "AlertServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The AlertPolicyService API is used to manage (list, create, delete, -// edit) alert policies in Stackdriver Monitoring. An alerting policy is -// a description of the conditions under which some aspect of your -// system is considered to be "unhealthy" and the ways to notify -// people or services about this state. In addition to using this API, alert -// policies can also be managed through -// [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), -// which can be reached by clicking the "Monitoring" tab in -// [Cloud Console](https://console.cloud.google.com/). -service AlertPolicyService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing alerting policies for the project. - rpc ListAlertPolicies(ListAlertPoliciesRequest) returns (ListAlertPoliciesResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/alertPolicies" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single alerting policy. - rpc GetAlertPolicy(GetAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - get: "/v3/{name=projects/*/alertPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new alerting policy. - rpc CreateAlertPolicy(CreateAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/alertPolicies" - body: "alert_policy" - }; - option (google.api.method_signature) = "name,alert_policy"; - } - - // Deletes an alerting policy. - rpc DeleteAlertPolicy(DeleteAlertPolicyRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/alertPolicies/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an alerting policy. You can either replace the entire policy with - // a new one or replace only certain fields in the current alerting policy by - // specifying the fields to be updated via `updateMask`. Returns the - // updated alerting policy. - rpc UpdateAlertPolicy(UpdateAlertPolicyRequest) returns (AlertPolicy) { - option (google.api.http) = { - patch: "/v3/{alert_policy.name=projects/*/alertPolicies/*}" - body: "alert_policy" - }; - option (google.api.method_signature) = "update_mask,alert_policy"; - } -} - -// The protocol for the `CreateAlertPolicy` request. -message CreateAlertPolicyRequest { - // Required. The project in which to create the alerting policy. The format is - // `projects/[PROJECT_ID]`. - // - // Note that this field names the parent container in which the alerting - // policy will be written, not the name of the created policy. The alerting - // policy that is returned will have a name that contains a normalized - // representation of this name as a prefix but adds a suffix of the form - // `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/AlertPolicy" - } - ]; - - // Required. The requested alerting policy. You should omit the `name` field in this - // policy. The name will be returned in the new policy, including - // a new [ALERT_POLICY_ID] value. - AlertPolicy alert_policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `GetAlertPolicy` request. -message GetAlertPolicyRequest { - // Required. The alerting policy to retrieve. The format is - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/AlertPolicy" - } - ]; -} - -// The protocol for the `ListAlertPolicies` request. -message ListAlertPoliciesRequest { - // Required. The project whose alert policies are to be listed. The format is - // - // projects/[PROJECT_ID] - // - // Note that this field names the parent container in which the alerting - // policies to be listed are stored. To retrieve a single alerting policy - // by name, use the - // [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] - // operation, instead. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/AlertPolicy" - } - ]; - - // If provided, this field specifies the criteria that must be met by - // alert policies to be included in the response. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string filter = 5; - - // A comma-separated list of fields by which to sort the result. Supports - // the same set of field references as the `filter` field. Entries can be - // prefixed with a minus sign to sort by the field in descending order. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string order_by = 6; - - // The maximum number of results to return in a single response. - int32 page_size = 2; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - string page_token = 3; -} - -// The protocol for the `ListAlertPolicies` response. -message ListAlertPoliciesResponse { - // The returned alert policies. - repeated AlertPolicy alert_policies = 3; - - // If there might be more results than were returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The protocol for the `UpdateAlertPolicy` request. -message UpdateAlertPolicyRequest { - // Optional. A list of alerting policy field names. If this field is not - // empty, each listed field in the existing alerting policy is set to the - // value of the corresponding field in the supplied policy (`alert_policy`), - // or to the field's default value if the field is not in the supplied - // alerting policy. Fields not listed retain their previous value. - // - // Examples of valid field masks include `display_name`, `documentation`, - // `documentation.content`, `documentation.mime_type`, `user_labels`, - // `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - // - // If this field is empty, then the supplied alerting policy replaces the - // existing policy. It is the same as deleting the existing policy and - // adding the supplied policy, except for the following: - // - // + The new policy will have the same `[ALERT_POLICY_ID]` as the former - // policy. This gives you continuity with the former policy in your - // notifications and incidents. - // + Conditions in the new policy will keep their former `[CONDITION_ID]` if - // the supplied condition includes the `name` field with that - // `[CONDITION_ID]`. If the supplied condition omits the `name` field, - // then a new `[CONDITION_ID]` is created. - google.protobuf.FieldMask update_mask = 2; - - // Required. The updated alerting policy or the updated values for the - // fields listed in `update_mask`. - // If `update_mask` is not empty, any fields in this policy that are - // not in `update_mask` are ignored. - AlertPolicy alert_policy = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `DeleteAlertPolicy` request. -message DeleteAlertPolicyRequest { - // Required. The alerting policy to delete. The format is: - // - // projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - // - // For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/AlertPolicy" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/common.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/common.proto.baseline deleted file mode 100644 index 50f8c54af315..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/common.proto.baseline +++ /dev/null @@ -1,475 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/distribution.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A single strongly-typed value. -message TypedValue { - // The typed value field. - oneof value { - // A Boolean value: `true` or `false`. - bool bool_value = 1; - - // A 64-bit integer. Its range is approximately ±9.2x1018. - int64 int64_value = 2; - - // A 64-bit double-precision floating-point number. Its magnitude - // is approximately ±10±300 and it has 16 - // significant digits of precision. - double double_value = 3; - - // A variable-length string value. - string string_value = 4; - - // A distribution value. - google.api.Distribution distribution_value = 5; - } -} - -// A closed time interval. It extends from the start time to the end time, and includes both: `[startTime, endTime]`. Valid time intervals depend on the [`MetricKind`](/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricKind) of the metric value. In no case can the end time be earlier than the start time. -// -// * For a `GAUGE` metric, the `startTime` value is technically optional; if -// no value is specified, the start time defaults to the value of the -// end time, and the interval represents a single point in time. If both -// start and end times are specified, they must be identical. Such an -// interval is valid only for `GAUGE` metrics, which are point-in-time -// measurements. -// -// * For `DELTA` and `CUMULATIVE` metrics, the start time must be earlier -// than the end time. -// -// * In all cases, the start time of the next interval must be -// at least a microsecond after the end time of the previous interval. -// Because the interval is closed, if the start time of a new interval -// is the same as the end time of the previous interval, data written -// at the new start time could overwrite data written at the previous -// end time. -message TimeInterval { - // Required. The end of the time interval. - google.protobuf.Timestamp end_time = 2; - - // Optional. The beginning of the time interval. The default value - // for the start time is the end time. The start time must not be - // later than the end time. - google.protobuf.Timestamp start_time = 1; -} - -// Describes how to combine multiple time series to provide a different view of -// the data. Aggregation of time series is done in two steps. First, each time -// series in the set is _aligned_ to the same time interval boundaries, then the -// set of time series is optionally _reduced_ in number. -// -// Alignment consists of applying the `per_series_aligner` operation -// to each time series after its data has been divided into regular -// `alignment_period` time intervals. This process takes _all_ of the data -// points in an alignment period, applies a mathematical transformation such as -// averaging, minimum, maximum, delta, etc., and converts them into a single -// data point per period. -// -// Reduction is when the aligned and transformed time series can optionally be -// combined, reducing the number of time series through similar mathematical -// transformations. Reduction involves applying a `cross_series_reducer` to -// all the time series, optionally sorting the time series into subsets with -// `group_by_fields`, and applying the reducer to each subset. -// -// The raw time series data can contain a huge amount of information from -// multiple sources. Alignment and reduction transforms this mass of data into -// a more manageable and representative collection of data, for example "the -// 95% latency across the average of all tasks in a cluster". This -// representative data can be more easily graphed and comprehended, and the -// individual time series data is still available for later drilldown. For more -// details, see [Aggregating Time -// Series](/monitoring/api/v3/metrics#aggregating_time_series). -message Aggregation { - // The `Aligner` specifies the operation that will be applied to the data - // points in each alignment period in a time series. Except for - // `ALIGN_NONE`, which specifies that no operation be applied, each alignment - // operation replaces the set of data values in each alignment period with - // a single value: the result of applying the operation to the data values. - // An aligned time series has a single data value at the end of each - // `alignment_period`. - // - // An alignment operation can change the data type of the values, too. For - // example, if you apply a counting operation to boolean values, the data - // `value_type` in the original time series is `BOOLEAN`, but the `value_type` - // in the aligned result is `INT64`. - enum Aligner { - // No alignment. Raw data is returned. Not valid if cross-series reduction - // is requested. The `value_type` of the result is the same as the - // `value_type` of the input. - ALIGN_NONE = 0; - - // Align and convert to - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA]. - // The output is `delta = y1 - y0`. - // - // This alignment is valid for - // [CUMULATIVE][google.api.MetricDescriptor.MetricKind.CUMULATIVE] and - // `DELTA` metrics. If the selected alignment period results in periods - // with no data, then the aligned value for such a period is created by - // interpolation. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_DELTA = 1; - - // Align and convert to a rate. The result is computed as - // `rate = (y1 - y0)/(t1 - t0)`, or "delta over time". - // Think of this aligner as providing the slope of the line that passes - // through the value at the start and at the end of the `alignment_period`. - // - // This aligner is valid for `CUMULATIVE` - // and `DELTA` metrics with numeric values. If the selected alignment - // period results in periods with no data, then the aligned value for - // such a period is created by interpolation. The output is a `GAUGE` - // metric with `value_type` `DOUBLE`. - // - // If, by "rate", you mean "percentage change", see the - // `ALIGN_PERCENT_CHANGE` aligner instead. - ALIGN_RATE = 2; - - // Align by interpolating between adjacent points around the alignment - // period boundary. This aligner is valid for `GAUGE` metrics with - // numeric values. The `value_type` of the aligned result is the same as the - // `value_type` of the input. - ALIGN_INTERPOLATE = 3; - - // Align by moving the most recent data point before the end of the - // alignment period to the boundary at the end of the alignment - // period. This aligner is valid for `GAUGE` metrics. The `value_type` of - // the aligned result is the same as the `value_type` of the input. - ALIGN_NEXT_OLDER = 4; - - // Align the time series by returning the minimum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MIN = 10; - - // Align the time series by returning the maximum value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is the same as - // the `value_type` of the input. - ALIGN_MAX = 11; - - // Align the time series by returning the mean value in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric values. The `value_type` of the aligned result is `DOUBLE`. - ALIGN_MEAN = 12; - - // Align the time series by returning the number of values in each alignment - // period. This aligner is valid for `GAUGE` and `DELTA` metrics with - // numeric or Boolean values. The `value_type` of the aligned result is - // `INT64`. - ALIGN_COUNT = 13; - - // Align the time series by returning the sum of the values in each - // alignment period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with numeric and distribution values. The `value_type` of the - // aligned result is the same as the `value_type` of the input. - ALIGN_SUM = 14; - - // Align the time series by returning the standard deviation of the values - // in each alignment period. This aligner is valid for `GAUGE` and - // `DELTA` metrics with numeric values. The `value_type` of the output is - // `DOUBLE`. - ALIGN_STDDEV = 15; - - // Align the time series by returning the number of `True` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_TRUE = 16; - - // Align the time series by returning the number of `False` values in - // each alignment period. This aligner is valid for `GAUGE` metrics with - // Boolean values. The `value_type` of the output is `INT64`. - ALIGN_COUNT_FALSE = 24; - - // Align the time series by returning the ratio of the number of `True` - // values to the total number of values in each alignment period. This - // aligner is valid for `GAUGE` metrics with Boolean values. The output - // value is in the range [0.0, 1.0] and has `value_type` `DOUBLE`. - ALIGN_FRACTION_TRUE = 17; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 99th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_99 = 18; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 95th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_95 = 19; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 50th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_50 = 20; - - // Align the time series by using [percentile - // aggregation](https://en.wikipedia.org/wiki/Percentile). The resulting - // data point in each alignment period is the 5th percentile of all data - // points in the period. This aligner is valid for `GAUGE` and `DELTA` - // metrics with distribution values. The output is a `GAUGE` metric with - // `value_type` `DOUBLE`. - ALIGN_PERCENTILE_05 = 21; - - // Align and convert to a percentage change. This aligner is valid for - // `GAUGE` and `DELTA` metrics with numeric values. This alignment returns - // `((current - previous)/previous) * 100`, where the value of `previous` is - // determined based on the `alignment_period`. - // - // If the values of `current` and `previous` are both 0, then the returned - // value is 0. If only `previous` is 0, the returned value is infinity. - // - // A 10-minute moving mean is computed at each point of the alignment period - // prior to the above calculation to smooth the metric and prevent false - // positives from very short-lived spikes. The moving mean is only - // applicable for data whose values are `>= 0`. Any values `< 0` are - // treated as a missing datapoint, and are ignored. While `DELTA` - // metrics are accepted by this alignment, special care should be taken that - // the values for the metric will always be positive. The output is a - // `GAUGE` metric with `value_type` `DOUBLE`. - ALIGN_PERCENT_CHANGE = 23; - } - - // A Reducer operation describes how to aggregate data points from multiple - // time series into a single time series, where the value of each data point - // in the resulting series is a function of all the already aligned values in - // the input time series. - enum Reducer { - // No cross-time series reduction. The output of the `Aligner` is - // returned. - REDUCE_NONE = 0; - - // Reduce by computing the mean value across time series for each - // alignment period. This reducer is valid for - // [DELTA][google.api.MetricDescriptor.MetricKind.DELTA] and - // [GAUGE][google.api.MetricDescriptor.MetricKind.GAUGE] metrics with - // numeric or distribution values. The `value_type` of the output is - // [DOUBLE][google.api.MetricDescriptor.ValueType.DOUBLE]. - REDUCE_MEAN = 1; - - // Reduce by computing the minimum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MIN = 2; - - // Reduce by computing the maximum value across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric values. The `value_type` of the output is the same as the - // `value_type` of the input. - REDUCE_MAX = 3; - - // Reduce by computing the sum across time series for each - // alignment period. This reducer is valid for `DELTA` and `GAUGE` metrics - // with numeric and distribution values. The `value_type` of the output is - // the same as the `value_type` of the input. - REDUCE_SUM = 4; - - // Reduce by computing the standard deviation across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics with numeric or distribution values. The `value_type` - // of the output is `DOUBLE`. - REDUCE_STDDEV = 5; - - // Reduce by computing the number of data points across time series - // for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of numeric, Boolean, distribution, and string - // `value_type`. The `value_type` of the output is `INT64`. - REDUCE_COUNT = 6; - - // Reduce by computing the number of `True`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_TRUE = 7; - - // Reduce by computing the number of `False`-valued data points across time - // series for each alignment period. This reducer is valid for `DELTA` and - // `GAUGE` metrics of Boolean `value_type`. The `value_type` of the output - // is `INT64`. - REDUCE_COUNT_FALSE = 15; - - // Reduce by computing the ratio of the number of `True`-valued data points - // to the total number of data points for each alignment period. This - // reducer is valid for `DELTA` and `GAUGE` metrics of Boolean `value_type`. - // The output value is in the range [0.0, 1.0] and has `value_type` - // `DOUBLE`. - REDUCE_FRACTION_TRUE = 8; - - // Reduce by computing the [99th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_99 = 9; - - // Reduce by computing the [95th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_95 = 10; - - // Reduce by computing the [50th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_50 = 11; - - // Reduce by computing the [5th - // percentile](https://en.wikipedia.org/wiki/Percentile) of data points - // across time series for each alignment period. This reducer is valid for - // `GAUGE` and `DELTA` metrics of numeric and distribution type. The value - // of the output is `DOUBLE`. - REDUCE_PERCENTILE_05 = 12; - } - - // The `alignment_period` specifies a time interval, in seconds, that is used - // to divide the data in all the - // [time series][google.monitoring.v3.TimeSeries] into consistent blocks of - // time. This will be done before the per-series aligner can be applied to - // the data. - // - // The value must be at least 60 seconds. If a per-series aligner other than - // `ALIGN_NONE` is specified, this field is required or an error is returned. - // If no per-series aligner is specified, or the aligner `ALIGN_NONE` is - // specified, then this field is ignored. - google.protobuf.Duration alignment_period = 1; - - // An `Aligner` describes how to bring the data points in a single - // time series into temporal alignment. Except for `ALIGN_NONE`, all - // alignments cause all the data points in an `alignment_period` to be - // mathematically grouped together, resulting in a single data point for - // each `alignment_period` with end timestamp at the end of the period. - // - // Not all alignment operations may be applied to all time series. The valid - // choices depend on the `metric_kind` and `value_type` of the original time - // series. Alignment can change the `metric_kind` or the `value_type` of - // the time series. - // - // Time series data must be aligned in order to perform cross-time - // series reduction. If `cross_series_reducer` is specified, then - // `per_series_aligner` must be specified and not equal to `ALIGN_NONE` - // and `alignment_period` must be specified; otherwise, an error is - // returned. - Aligner per_series_aligner = 2; - - // The reduction operation to be used to combine time series into a single - // time series, where the value of each data point in the resulting series is - // a function of all the already aligned values in the input time series. - // - // Not all reducer operations can be applied to all time series. The valid - // choices depend on the `metric_kind` and the `value_type` of the original - // time series. Reduction can yield a time series with a different - // `metric_kind` or `value_type` than the input time series. - // - // Time series data must first be aligned (see `per_series_aligner`) in order - // to perform cross-time series reduction. If `cross_series_reducer` is - // specified, then `per_series_aligner` must be specified, and must not be - // `ALIGN_NONE`. An `alignment_period` must also be specified; otherwise, an - // error is returned. - Reducer cross_series_reducer = 4; - - // The set of fields to preserve when `cross_series_reducer` is - // specified. The `group_by_fields` determine how the time series are - // partitioned into subsets prior to applying the aggregation - // operation. Each subset contains time series that have the same - // value for each of the grouping fields. Each individual time - // series is a member of exactly one subset. The - // `cross_series_reducer` is applied to each subset of time series. - // It is not possible to reduce across different resource types, so - // this field implicitly contains `resource.type`. Fields not - // specified in `group_by_fields` are aggregated away. If - // `group_by_fields` is not specified and all the time series have - // the same resource type, then the time series are aggregated into - // a single output time series. If `cross_series_reducer` is not - // defined, this field is ignored. - repeated string group_by_fields = 5; -} - -// Specifies an ordering relationship on two arguments, called `left` and -// `right`. -enum ComparisonType { - // No ordering relationship is specified. - COMPARISON_UNSPECIFIED = 0; - - // True if the left argument is greater than the right argument. - COMPARISON_GT = 1; - - // True if the left argument is greater than or equal to the right argument. - COMPARISON_GE = 2; - - // True if the left argument is less than the right argument. - COMPARISON_LT = 3; - - // True if the left argument is less than or equal to the right argument. - COMPARISON_LE = 4; - - // True if the left argument is equal to the right argument. - COMPARISON_EQ = 5; - - // True if the left argument is not equal to the right argument. - COMPARISON_NE = 6; -} - -// The tier of service for a Workspace. Please see the -// [service tiers -// documentation](https://cloud.google.com/monitoring/workspaces/tiers) for more -// details. -enum ServiceTier { - option deprecated = true; - - // An invalid sentinel value, used to indicate that a tier has not - // been provided explicitly. - SERVICE_TIER_UNSPECIFIED = 0; - - // The Stackdriver Basic tier, a free tier of service that provides basic - // features, a moderate allotment of logs, and access to built-in metrics. - // A number of features are not available in this tier. For more details, - // see [the service tiers - // documentation](https://cloud.google.com/monitoring/workspaces/tiers). - SERVICE_TIER_BASIC = 1; - - // The Stackdriver Premium tier, a higher, more expensive tier of service - // that provides access to all Stackdriver features, lets you use Stackdriver - // with AWS accounts, and has a larger allotments for logs and metrics. For - // more details, see [the service tiers - // documentation](https://cloud.google.com/monitoring/workspaces/tiers). - SERVICE_TIER_PREMIUM = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/dropped_labels.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/dropped_labels.proto.baseline deleted file mode 100644 index 977f1a3775b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/dropped_labels.proto.baseline +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "DroppedLabelsProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A set of (label, value) pairs which were dropped during aggregation, attached -// to google.api.Distribution.Exemplars in google.api.Distribution values during -// aggregation. -// -// These values are used in combination with the label values that remain on the -// aggregated Distribution timeseries to construct the full label set for the -// exemplar values. The resulting full label set may be used to identify the -// specific task/job/instance (for example) which may be contributing to a -// long-tail, while allowing the storage savings of only storing aggregated -// distribution values for a large group. -// -// Note that there are no guarantees on ordering of the labels from -// exemplar-to-exemplar and from distribution-to-distribution in the same -// stream, and there may be duplicates. It is up to clients to resolve any -// ambiguities. -message DroppedLabels { - // Map from label to its value, for all labels dropped in any aggregation. - map label = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group.proto.baseline deleted file mode 100644 index 988365251959..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group.proto.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "GroupProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The description of a dynamic collection of monitored resources. Each group -// has a filter that is matched against monitored resources and their associated -// metadata. If a group's filter matches an available monitored resource, then -// that resource is a member of that group. Groups can contain any number of -// monitored resources, and each monitored resource can be a member of any -// number of groups. -// -// Groups can be nested in parent-child hierarchies. The `parentName` field -// identifies an optional parent for each group. If a group has a parent, then -// the only monitored resources available to be matched by the group's filter -// are the resources contained in the parent group. In other words, a group -// contains the monitored resources that match its filter and the filters of all -// the group's ancestors. A group without a parent can contain any monitored -// resource. -// -// For example, consider an infrastructure running a set of instances with two -// user-defined tags: `"environment"` and `"role"`. A parent group has a filter, -// `environment="production"`. A child of that parent group has a filter, -// `role="transcoder"`. The parent group contains all instances in the -// production environment, regardless of their roles. The child group contains -// instances that have the transcoder role *and* are in the production -// environment. -// -// The monitored resources contained in a group can change at any moment, -// depending on what resources exist and what filters are associated with the -// group and its ancestors. -message Group { - option (google.api.resource) = { - type: "monitoring.googleapis.com/Group" - pattern: "projects/{project}/groups/{group}" - pattern: "organizations/{organization}/groups/{group}" - pattern: "folders/{folder}/groups/{group}" - pattern: "*" - }; - - // Output only. The name of this group. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - // When creating a group, this field is ignored and a new name is created - // consisting of the project specified in the call to `CreateGroup` - // and a unique `{group_id}` that is generated automatically. - string name = 1; - - // A user-assigned name for this group, used only for display purposes. - string display_name = 2; - - // The name of the group's parent, if it has one. - // The format is `"projects/{project_id_or_number}/groups/{group_id}"`. - // For groups with no parent, `parentName` is the empty string, `""`. - string parent_name = 3; - - // The filter used to determine which monitored resources belong to this - // group. - string filter = 5; - - // If true, the members of this group are considered to be a cluster. - // The system can perform additional analysis on groups that are clusters. - bool is_cluster = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group_service.proto.baseline deleted file mode 100644 index 553d6a049c07..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/group_service.proto.baseline +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/group.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "GroupServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Group API lets you inspect and manage your -// [groups](#google.monitoring.v3.Group). -// -// A group is a named filter that is used to identify -// a collection of monitored resources. Groups are typically used to -// mirror the physical and/or logical topology of the environment. -// Because group membership is computed dynamically, monitored -// resources that are started in the future are automatically placed -// in matching groups. By using a group to name monitored resources in, -// for example, an alert policy, the target of that alert policy is -// updated automatically as monitored resources are added and removed -// from the infrastructure. -service GroupService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing groups. - rpc ListGroups(ListGroupsRequest) returns (ListGroupsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/groups" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single group. - rpc GetGroup(GetGroupRequest) returns (Group) { - option (google.api.http) = { - get: "/v3/{name=projects/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new group. - rpc CreateGroup(CreateGroupRequest) returns (Group) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/groups" - body: "group" - }; - option (google.api.method_signature) = "name,group"; - } - - // Updates an existing group. - // You can change any group attributes except `name`. - rpc UpdateGroup(UpdateGroupRequest) returns (Group) { - option (google.api.http) = { - put: "/v3/{group.name=projects/*/groups/*}" - body: "group" - }; - option (google.api.method_signature) = "group"; - } - - // Deletes an existing group. - rpc DeleteGroup(DeleteGroupRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/groups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists the monitored resources that are members of a group. - rpc ListGroupMembers(ListGroupMembersRequest) returns (ListGroupMembersResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*/groups/*}/members" - }; - option (google.api.method_signature) = "name"; - } -} - -// The `ListGroup` request. -message ListGroupsRequest { - // Required. The project whose groups are to be listed. The format is - // `"projects/{project_id_or_number}"`. - string name = 7 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Group" - } - ]; - - // An optional filter consisting of a single group name. The filters limit - // the groups returned based on their parent-child relationship with the - // specified group. If no filter is specified, all groups are returned. - oneof filter { - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns groups whose `parentName` field contains the group - // name. If no groups have this parent, the results are empty. - string children_of_group = 2 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns groups that are ancestors of the specified group. - // The groups are returned in order, starting with the immediate parent and - // ending with the most distant ancestor. If the specified group has no - // immediate parent, the results are empty. - string ancestors_of_group = 3 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - - // A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - // Returns the descendants of the specified group. This is a superset of - // the results returned by the `childrenOfGroup` filter, and includes - // children-of-children, and so forth. - string descendants_of_group = 4 [(google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - }]; - } - - // A positive number that is the maximum number of results to return. - int32 page_size = 5; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 6; -} - -// The `ListGroups` response. -message ListGroupsResponse { - // The groups that match the specified filters. - repeated Group group = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetGroup` request. -message GetGroupRequest { - // Required. The group to retrieve. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; -} - -// The `CreateGroup` request. -message CreateGroupRequest { - // Required. The project in which to create the group. The format is - // `"projects/{project_id_or_number}"`. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Group" - } - ]; - - // Required. A group definition. It is an error to define the `name` field because - // the system assigns the name. - Group group = 2 [(google.api.field_behavior) = REQUIRED]; - - // If true, validate this request but do not create the group. - bool validate_only = 3; -} - -// The `UpdateGroup` request. -message UpdateGroupRequest { - // Required. The new definition of the group. All fields of the existing group, - // excepting `name`, are replaced with the corresponding fields of this group. - Group group = 2 [(google.api.field_behavior) = REQUIRED]; - - // If true, validate this request but do not update the existing group. - bool validate_only = 3; -} - -// The `DeleteGroup` request. The default behavior is to be able to delete a -// single group without any descendants. -message DeleteGroupRequest { - // Required. The group to delete. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; - - // If this field is true, then the request means to delete a group with all - // its descendants. Otherwise, the request means to delete a group only when - // it has no descendants. The default value is false. - bool recursive = 4; -} - -// The `ListGroupMembers` request. -message ListGroupMembersRequest { - // Required. The group whose members are listed. The format is - // `"projects/{project_id_or_number}/groups/{group_id}"`. - string name = 7 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Group" - } - ]; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; - - // An optional [list filter](/monitoring/api/learn_more#filtering) describing - // the members to be returned. The filter may reference the type, labels, and - // metadata of monitored resources that comprise the group. - // For example, to return only resources representing Compute Engine VM - // instances, use this filter: - // - // resource.type = "gce_instance" - string filter = 5; - - // An optional time interval for which results should be returned. Only - // members that were part of the group during the specified interval are - // included in the response. If no interval is provided then the group - // membership over the last minute is returned. - TimeInterval interval = 6; -} - -// The `ListGroupMembers` response. -message ListGroupMembersResponse { - // A set of monitored resources in the group. - repeated google.api.MonitoredResource members = 1; - - // If there are more results than have been returned, then this field is - // set to a non-empty value. To see the additional results, use that value as - // `pageToken` in the next call to this method. - string next_page_token = 2; - - // The total number of elements matching this request. - int32 total_size = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric.proto.baseline deleted file mode 100644 index 320779d589e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric.proto.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/monitoring/v3/common.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MetricProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A single data point in a time series. -message Point { - // The time interval to which the data point applies. For `GAUGE` metrics, - // the start time is optional, but if it is supplied, it must equal the - // end time. For `DELTA` metrics, the start - // and end time should specify a non-zero interval, with subsequent points - // specifying contiguous and non-overlapping intervals. For `CUMULATIVE` - // metrics, the start and end time should specify a non-zero interval, with - // subsequent points specifying the same start time and increasing end times, - // until an event resets the cumulative value to zero and sets a new start - // time for the following points. - TimeInterval interval = 1; - - // The value of the data point. - TypedValue value = 2; -} - -// A collection of data points that describes the time-varying values -// of a metric. A time series is identified by a combination of a -// fully-specified monitored resource and a fully-specified metric. -// This type is used for both listing and creating time series. -message TimeSeries { - // The associated metric. A fully-specified metric used to identify the time - // series. - google.api.Metric metric = 1; - - // The associated monitored resource. Custom metrics can use only certain - // monitored resource types in their time series data. - google.api.MonitoredResource resource = 2; - - // Output only. The associated monitored resource metadata. When reading a - // a timeseries, this field will include metadata labels that are explicitly - // named in the reduction. When creating a timeseries, this field is ignored. - google.api.MonitoredResourceMetadata metadata = 7; - - // The metric kind of the time series. When listing time series, this metric - // kind might be different from the metric kind of the associated metric if - // this time series is an alignment or reduction of other time series. - // - // When creating a time series, this field is optional. If present, it must be - // the same as the metric kind of the associated metric. If the associated - // metric's descriptor must be auto-created, then this field specifies the - // metric kind of the new descriptor and must be either `GAUGE` (the default) - // or `CUMULATIVE`. - google.api.MetricDescriptor.MetricKind metric_kind = 3; - - // The value type of the time series. When listing time series, this value - // type might be different from the value type of the associated metric if - // this time series is an alignment or reduction of other time series. - // - // When creating a time series, this field is optional. If present, it must be - // the same as the type of the data in the `points` field. - google.api.MetricDescriptor.ValueType value_type = 4; - - // The data points of this time series. When listing time series, points are - // returned in reverse time order. - // - // When creating a time series, this field must contain exactly one point and - // the point's type must be the same as the value type of the associated - // metric. If the associated metric's descriptor must be auto-created, then - // the value type of the descriptor is determined by the point's type, which - // must be `BOOL`, `INT64`, `DOUBLE`, or `DISTRIBUTION`. - repeated Point points = 5; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric_service.proto.baseline deleted file mode 100644 index e87d11219c3b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/metric_service.proto.baseline +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/metric.proto"; -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/monitoring/v3/metric.proto"; -import "google/protobuf/empty.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MetricServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; -option (google.api.resource_definition) = { - type: "monitoring.googleapis.com/MetricDescriptor" - pattern: "projects/{project}/metricDescriptors/{metric_descriptor=**}" - pattern: "organizations/{organization}/metricDescriptors/{metric_descriptor=**}" - pattern: "folders/{folder}/metricDescriptors/{metric_descriptor=**}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN -}; -option (google.api.resource_definition) = { - type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - pattern: "projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN -}; - -// Manages metric descriptors, monitored resource descriptors, and -// time series data. -service MetricService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read," - "https://www.googleapis.com/auth/monitoring.write"; - - // Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. - rpc ListMonitoredResourceDescriptors(ListMonitoredResourceDescriptorsRequest) returns (ListMonitoredResourceDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/monitoredResourceDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single monitored resource descriptor. This method does not require a Stackdriver account. - rpc GetMonitoredResourceDescriptor(GetMonitoredResourceDescriptorRequest) returns (google.api.MonitoredResourceDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/monitoredResourceDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists metric descriptors that match a filter. This method does not require a Stackdriver account. - rpc ListMetricDescriptors(ListMetricDescriptorsRequest) returns (ListMetricDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/metricDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single metric descriptor. This method does not require a Stackdriver account. - rpc GetMetricDescriptor(GetMetricDescriptorRequest) returns (google.api.MetricDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/metricDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new metric descriptor. - // User-created metric descriptors define - // [custom metrics](/monitoring/custom-metrics). - rpc CreateMetricDescriptor(CreateMetricDescriptorRequest) returns (google.api.MetricDescriptor) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/metricDescriptors" - body: "metric_descriptor" - }; - option (google.api.method_signature) = "name,metric_descriptor"; - } - - // Deletes a metric descriptor. Only user-created - // [custom metrics](/monitoring/custom-metrics) can be deleted. - rpc DeleteMetricDescriptor(DeleteMetricDescriptorRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/metricDescriptors/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists time series that match a filter. This method does not require a Stackdriver account. - rpc ListTimeSeries(ListTimeSeriesRequest) returns (ListTimeSeriesResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/timeSeries" - }; - option (google.api.method_signature) = "name,filter,interval,view"; - } - - // Creates or adds data to one or more time series. - // The response is empty if all time series in the request were written. - // If any time series could not be written, a corresponding failure message is - // included in the error response. - rpc CreateTimeSeries(CreateTimeSeriesRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/timeSeries" - body: "*" - }; - option (google.api.method_signature) = "name,time_series"; - } -} - -// The `ListMonitoredResourceDescriptors` request. -message ListMonitoredResourceDescriptorsRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - } - ]; - - // An optional [filter](/monitoring/api/v3/filters) describing - // the descriptors to be returned. The filter can reference - // the descriptor's type and labels. For example, the - // following filter returns only Google Compute Engine descriptors - // that have an `id` label: - // - // resource.type = starts_with("gce_") AND resource.label:id - string filter = 2; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListMonitoredResourceDescriptors` response. -message ListMonitoredResourceDescriptorsResponse { - // The monitored resource descriptors that are available to this project - // and that match `filter`, if present. - repeated google.api.MonitoredResourceDescriptor resource_descriptors = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetMonitoredResourceDescriptor` request. -message GetMonitoredResourceDescriptorRequest { - // Required. The monitored resource descriptor to get. The format is - // `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - // The `{resource_type}` is a predefined type, such as - // `cloudsql_database`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MonitoredResourceDescriptor" - } - ]; -} - -// The `ListMetricDescriptors` request. -message ListMetricDescriptorsRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; - - // If this field is empty, all custom and - // system-defined metric descriptors are returned. - // Otherwise, the [filter](/monitoring/api/v3/filters) - // specifies which metric descriptors are to be - // returned. For example, the following filter matches all - // [custom metrics](/monitoring/custom-metrics): - // - // metric.type = starts_with("custom.googleapis.com/") - string filter = 2; - - // A positive number that is the maximum number of results to return. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListMetricDescriptors` response. -message ListMetricDescriptorsResponse { - // The metric descriptors that are available to the project - // and that match the value of `filter`, if present. - repeated google.api.MetricDescriptor metric_descriptors = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `GetMetricDescriptor` request. -message GetMetricDescriptorRequest { - // Required. The metric descriptor on which to execute the request. The format is - // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - // An example value of `{metric_id}` is - // `"compute.googleapis.com/instance/disk/read_bytes_count"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; -} - -// The `CreateMetricDescriptor` request. -message CreateMetricDescriptorRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; - - // Required. The new [custom metric](/monitoring/custom-metrics) - // descriptor. - google.api.MetricDescriptor metric_descriptor = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `DeleteMetricDescriptor` request. -message DeleteMetricDescriptorRequest { - // Required. The metric descriptor on which to execute the request. The format is - // `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - // An example of `{metric_id}` is: - // `"custom.googleapis.com/my_test_metric"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/MetricDescriptor" - } - ]; -} - -// The `ListTimeSeries` request. -message ListTimeSeriesRequest { - // Controls which fields are returned by `ListTimeSeries`. - enum TimeSeriesView { - // Returns the identity of the metric(s), the time series, - // and the time series data. - FULL = 0; - - // Returns the identity of the metric and the time series resource, - // but not the time series data. - HEADERS = 1; - } - - // Required. The project on which to execute the request. The format is - // "projects/{project_id_or_number}". - string name = 10 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/TimeSeries" - } - ]; - - // Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - // series should be returned. The filter must specify a single metric type, - // and can additionally specify metric labels and other information. For - // example: - // - // metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - // metric.labels.instance_name = "my-instance-name" - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The time interval for which results should be returned. Only time series - // that contain data points in the specified interval are included - // in the response. - TimeInterval interval = 4 [(google.api.field_behavior) = REQUIRED]; - - // Specifies the alignment of data points in individual time series as - // well as how to combine the retrieved time series across specified labels. - // - // By default (if no `aggregation` is explicitly specified), the raw time - // series data is returned. - Aggregation aggregation = 5; - - // Unsupported: must be left blank. The points in each time series are - // currently returned in reverse time order (most recent to oldest). - string order_by = 6; - - // Required. Specifies which information is returned about the time series. - TimeSeriesView view = 7 [(google.api.field_behavior) = REQUIRED]; - - // A positive number that is the maximum number of results to return. If - // `page_size` is empty or more than 100,000 results, the effective - // `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - // maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - // the maximum number of `TimeSeries` returned. - int32 page_size = 8; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 9; -} - -// The `ListTimeSeries` response. -message ListTimeSeriesResponse { - // One or more time series that match the filter included in the request. - repeated TimeSeries time_series = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; - - // Query execution errors that may have caused the time series data returned - // to be incomplete. - repeated google.rpc.Status execution_errors = 3; -} - -// The `CreateTimeSeries` request. -message CreateTimeSeriesRequest { - // Required. The project on which to execute the request. The format is - // `"projects/{project_id_or_number}"`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/TimeSeries" - } - ]; - - // Required. The new data to be added to a list of time series. - // Adds at most one data point to each of several time series. The new data - // point must be more recent than any other point in its time series. Each - // `TimeSeries` value must fully specify a unique time series by supplying - // all label values for the metric and the monitored resource. - // - // The maximum number of `TimeSeries` objects per `Create` request is 200. - repeated TimeSeries time_series = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// DEPRECATED. Used to hold per-time-series error status. -message CreateTimeSeriesError { - // DEPRECATED. Time series ID that resulted in the `status` error. - TimeSeries time_series = 1 [deprecated = true]; - - // DEPRECATED. The status of the requested write operation for `time_series`. - google.rpc.Status status = 2 [deprecated = true]; -} - -// Summary of the result of a failed request to write data to a time series. -message CreateTimeSeriesSummary { - // Detailed information about an error category. - message Error { - // The status of the requested write operation. - google.rpc.Status status = 1; - - // The number of points that couldn't be written because of `status`. - int32 point_count = 2; - } - - // The number of points in the request. - int32 total_point_count = 1; - - // The number of points that were successfully written. - int32 success_point_count = 2; - - // The number of points that failed to be written. Order is not guaranteed. - repeated Error errors = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/mutation_record.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/mutation_record.proto.baseline deleted file mode 100644 index b79e58d042f5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/mutation_record.proto.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "MutationRecordProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// Describes a change made to a configuration. -message MutationRecord { - // When the change occurred. - google.protobuf.Timestamp mutate_time = 1; - - // The email address of the user making the change. - string mutated_by = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification.proto.baseline deleted file mode 100644 index 855e3c96df4b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification.proto.baseline +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/label.proto"; -import "google/api/launch_stage.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/common.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "NotificationProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A description of a notification channel. The descriptor includes -// the properties of the channel and the set of labels or fields that -// must be specified to configure channels of a given type. -message NotificationChannelDescriptor { - option (google.api.resource) = { - type: "monitoring.googleapis.com/NotificationChannelDescriptor" - pattern: "projects/{project}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "folders/{folder}/notificationChannelDescriptors/{channel_descriptor}" - pattern: "*" - }; - - // The full REST resource name for this descriptor. The syntax is: - // - // projects/[PROJECT_ID]/notificationChannelDescriptors/[TYPE] - // - // In the above, `[TYPE]` is the value of the `type` field. - string name = 6; - - // The type of notification channel, such as "email", "sms", etc. - // Notification channel types are globally unique. - string type = 1; - - // A human-readable name for the notification channel type. This - // form of the name is suitable for a user interface. - string display_name = 2; - - // A human-readable description of the notification channel - // type. The description may include a description of the properties - // of the channel and pointers to external documentation. - string description = 3; - - // The set of labels that must be defined to identify a particular - // channel of the corresponding type. Each label includes a - // description for how that field should be populated. - repeated google.api.LabelDescriptor labels = 4; - - // The tiers that support this notification channel; the project service tier - // must be one of the supported_tiers. - repeated ServiceTier supported_tiers = 5 [deprecated = true]; - - // The product launch stage for channels of this type. - google.api.LaunchStage launch_stage = 7; -} - -// A `NotificationChannel` is a medium through which an alert is -// delivered when a policy violation is detected. Examples of channels -// include email, SMS, and third-party messaging applications. Fields -// containing sensitive information like authentication tokens or -// contact info are only partially populated on retrieval. -message NotificationChannel { - option (google.api.resource) = { - type: "monitoring.googleapis.com/NotificationChannel" - pattern: "projects/{project}/notificationChannels/{notification_channel}" - pattern: "organizations/{organization}/notificationChannels/{notification_channel}" - pattern: "folders/{folder}/notificationChannels/{notification_channel}" - pattern: "*" - }; - - // Indicates whether the channel has been verified or not. It is illegal - // to specify this field in a - // [`CreateNotificationChannel`][google.monitoring.v3.NotificationChannelService.CreateNotificationChannel] - // or an - // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] - // operation. - enum VerificationStatus { - // Sentinel value used to indicate that the state is unknown, omitted, or - // is not applicable (as in the case of channels that neither support - // nor require verification in order to function). - VERIFICATION_STATUS_UNSPECIFIED = 0; - - // The channel has yet to be verified and requires verification to function. - // Note that this state also applies to the case where the verification - // process has been initiated by sending a verification code but where - // the verification code has not been submitted to complete the process. - UNVERIFIED = 1; - - // It has been proven that notifications can be received on this - // notification channel and that someone on the project has access - // to messages that are delivered to that channel. - VERIFIED = 2; - } - - // The type of the notification channel. This field matches the - // value of the [NotificationChannelDescriptor.type][google.monitoring.v3.NotificationChannelDescriptor.type] field. - string type = 1; - - // The full REST resource name for this channel. The syntax is: - // - // projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID] - // - // The `[CHANNEL_ID]` is automatically assigned by the server on creation. - string name = 6; - - // An optional human-readable name for this notification channel. It is - // recommended that you specify a non-empty and unique name in order to - // make it easier to identify the channels in your project, though this is - // not enforced. The display name is limited to 512 Unicode characters. - string display_name = 3; - - // An optional human-readable description of this notification channel. This - // description may provide additional details, beyond the display - // name, for the channel. This may not exceed 1024 Unicode characters. - string description = 4; - - // Configuration fields that define the channel and its behavior. The - // permissible and required labels are specified in the - // [NotificationChannelDescriptor.labels][google.monitoring.v3.NotificationChannelDescriptor.labels] of the - // `NotificationChannelDescriptor` corresponding to the `type` field. - map labels = 5; - - // User-supplied key/value data that does not need to conform to - // the corresponding `NotificationChannelDescriptor`'s schema, unlike - // the `labels` field. This field is intended to be used for organizing - // and identifying the `NotificationChannel` objects. - // - // The field can contain up to 64 entries. Each key and value is limited to - // 63 Unicode characters or 128 bytes, whichever is smaller. Labels and - // values can contain only lowercase letters, numerals, underscores, and - // dashes. Keys must begin with a letter. - map user_labels = 8; - - // Indicates whether this channel has been verified or not. On a - // [`ListNotificationChannels`][google.monitoring.v3.NotificationChannelService.ListNotificationChannels] - // or - // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] - // operation, this field is expected to be populated. - // - // If the value is `UNVERIFIED`, then it indicates that the channel is - // non-functioning (it both requires verification and lacks verification); - // otherwise, it is assumed that the channel works. - // - // If the channel is neither `VERIFIED` nor `UNVERIFIED`, it implies that - // the channel is of a type that does not require verification or that - // this specific channel has been exempted from verification because it was - // created prior to verification being required for channels of this type. - // - // This field cannot be modified using a standard - // [`UpdateNotificationChannel`][google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel] - // operation. To change the value of this field, you must call - // [`VerifyNotificationChannel`][google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel]. - VerificationStatus verification_status = 9; - - // Whether notifications are forwarded to the described channel. This makes - // it possible to disable delivery of notifications to a particular channel - // without removing the channel from all alerting policies that reference - // the channel. This is a more convenient approach when the change is - // temporary and you want to receive notifications from the same set - // of alerting policies on the channel at some point in the future. - google.protobuf.BoolValue enabled = 11; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification_service.proto.baseline deleted file mode 100644 index 061f652973b5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/notification_service.proto.baseline +++ /dev/null @@ -1,400 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/notification.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "NotificationServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Notification Channel API provides access to configuration that -// controls how messages related to incidents are sent. -service NotificationChannelService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the descriptors for supported channel types. The use of descriptors - // makes it possible for new channel types to be dynamically added. - rpc ListNotificationChannelDescriptors(ListNotificationChannelDescriptorsRequest) returns (ListNotificationChannelDescriptorsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/notificationChannelDescriptors" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single channel descriptor. The descriptor indicates which fields - // are expected / permitted for a notification channel of the given type. - rpc GetNotificationChannelDescriptor(GetNotificationChannelDescriptorRequest) returns (NotificationChannelDescriptor) { - option (google.api.http) = { - get: "/v3/{name=projects/*/notificationChannelDescriptors/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists the notification channels that have been created for the project. - rpc ListNotificationChannels(ListNotificationChannelsRequest) returns (ListNotificationChannelsResponse) { - option (google.api.http) = { - get: "/v3/{name=projects/*}/notificationChannels" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a single notification channel. The channel includes the relevant - // configuration details with which the channel was created. However, the - // response may truncate or omit passwords, API keys, or other private key - // matter and thus the response may not be 100% identical to the information - // that was supplied in the call to the create method. - rpc GetNotificationChannel(GetNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - get: "/v3/{name=projects/*/notificationChannels/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new notification channel, representing a single notification - // endpoint such as an email address, SMS number, or PagerDuty service. - rpc CreateNotificationChannel(CreateNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - post: "/v3/{name=projects/*}/notificationChannels" - body: "notification_channel" - }; - option (google.api.method_signature) = "name,notification_channel"; - } - - // Updates a notification channel. Fields not specified in the field mask - // remain unchanged. - rpc UpdateNotificationChannel(UpdateNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - patch: "/v3/{notification_channel.name=projects/*/notificationChannels/*}" - body: "notification_channel" - }; - option (google.api.method_signature) = "update_mask,notification_channel"; - } - - // Deletes a notification channel. - rpc DeleteNotificationChannel(DeleteNotificationChannelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/notificationChannels/*}" - }; - option (google.api.method_signature) = "name,force"; - } - - // Causes a verification code to be delivered to the channel. The code - // can then be supplied in `VerifyNotificationChannel` to verify the channel. - rpc SendNotificationChannelVerificationCode(SendNotificationChannelVerificationCodeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:sendVerificationCode" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Requests a verification code for an already verified channel that can then - // be used in a call to VerifyNotificationChannel() on a different channel - // with an equivalent identity in the same or in a different project. This - // makes it possible to copy a channel between projects without requiring - // manual reverification of the channel. If the channel is not in the - // verified state, this method will fail (in other words, this may only be - // used if the SendNotificationChannelVerificationCode and - // VerifyNotificationChannel paths have already been used to put the given - // channel into the verified state). - // - // There is no guarantee that the verification codes returned by this method - // will be of a similar structure or form as the ones that are delivered - // to the channel via SendNotificationChannelVerificationCode; while - // VerifyNotificationChannel() will recognize both the codes delivered via - // SendNotificationChannelVerificationCode() and returned from - // GetNotificationChannelVerificationCode(), it is typically the case that - // the verification codes delivered via - // SendNotificationChannelVerificationCode() will be shorter and also - // have a shorter expiration (e.g. codes such as "G-123456") whereas - // GetVerificationCode() will typically return a much longer, websafe base - // 64 encoded string that has a longer expiration time. - rpc GetNotificationChannelVerificationCode(GetNotificationChannelVerificationCodeRequest) returns (GetNotificationChannelVerificationCodeResponse) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:getVerificationCode" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Verifies a `NotificationChannel` by proving receipt of the code - // delivered to the channel as a result of calling - // `SendNotificationChannelVerificationCode`. - rpc VerifyNotificationChannel(VerifyNotificationChannelRequest) returns (NotificationChannel) { - option (google.api.http) = { - post: "/v3/{name=projects/*/notificationChannels/*}:verify" - body: "*" - }; - option (google.api.method_signature) = "name,code"; - } -} - -// The `ListNotificationChannelDescriptors` request. -message ListNotificationChannelDescriptorsRequest { - // Required. The REST resource name of the parent from which to retrieve - // the notification channel descriptors. The expected syntax is: - // - // projects/[PROJECT_ID] - // - // Note that this names the parent container in which to look for the - // descriptors; to retrieve a single descriptor by name, use the - // [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] - // operation, instead. - string name = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannelDescriptor" - } - ]; - - // The maximum number of results to return in a single response. If - // not set to a positive number, a reasonable value will be chosen by the - // service. - int32 page_size = 2; - - // If non-empty, `page_token` must contain a value returned as the - // `next_page_token` in a previous response to request the next set - // of results. - string page_token = 3; -} - -// The `ListNotificationChannelDescriptors` response. -message ListNotificationChannelDescriptorsResponse { - // The monitored resource descriptors supported for the specified - // project, optionally filtered. - repeated NotificationChannelDescriptor channel_descriptors = 1; - - // If not empty, indicates that there may be more results that match - // the request. Use the value in the `page_token` field in a - // subsequent request to fetch the next set of results. If empty, - // all results have been returned. - string next_page_token = 2; -} - -// The `GetNotificationChannelDescriptor` response. -message GetNotificationChannelDescriptorRequest { - // Required. The channel type for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannelDescriptor" - } - ]; -} - -// The `CreateNotificationChannel` request. -message CreateNotificationChannelRequest { - // Required. The project on which to execute the request. The format is: - // - // projects/[PROJECT_ID] - // - // Note that this names the container into which the channel will be - // written. This does not name the newly created channel. The resulting - // channel's name will have a normalized version of this field as a prefix, - // but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // Required. The definition of the `NotificationChannel` to create. - NotificationChannel notification_channel = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `ListNotificationChannels` request. -message ListNotificationChannelsRequest { - // Required. The project on which to execute the request. The format is - // `projects/[PROJECT_ID]`. That is, this names the container - // in which to look for the notification channels; it does not name a - // specific channel. To query a specific channel by REST resource name, use - // the - // [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] - // operation. - string name = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // If provided, this field specifies the criteria that must be met by - // notification channels to be included in the response. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string filter = 6; - - // A comma-separated list of fields by which to sort the result. Supports - // the same set of fields as in `filter`. Entries can be prefixed with - // a minus sign to sort in descending rather than ascending order. - // - // For more details, see [sorting and - // filtering](/monitoring/api/v3/sorting-and-filtering). - string order_by = 7; - - // The maximum number of results to return in a single response. If - // not set to a positive number, a reasonable value will be chosen by the - // service. - int32 page_size = 3; - - // If non-empty, `page_token` must contain a value returned as the - // `next_page_token` in a previous response to request the next set - // of results. - string page_token = 4; -} - -// The `ListNotificationChannels` response. -message ListNotificationChannelsResponse { - // The notification channels defined for the specified project. - repeated NotificationChannel notification_channels = 3; - - // If not empty, indicates that there may be more results that match - // the request. Use the value in the `page_token` field in a - // subsequent request to fetch the next set of results. If empty, - // all results have been returned. - string next_page_token = 2; -} - -// The `GetNotificationChannel` request. -message GetNotificationChannelRequest { - // Required. The channel for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; -} - -// The `UpdateNotificationChannel` request. -message UpdateNotificationChannelRequest { - // The fields to update. - google.protobuf.FieldMask update_mask = 2; - - // Required. A description of the changes to be applied to the specified - // notification channel. The description must provide a definition for - // fields to be updated; the names of these fields should also be - // included in the `update_mask`. - NotificationChannel notification_channel = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The `DeleteNotificationChannel` request. -message DeleteNotificationChannelRequest { - // Required. The channel for which to execute the request. The format is - // `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - string name = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // If true, the notification channel will be deleted regardless of its - // use in alert policies (the policies will be updated to remove the - // channel). If false, channels that are still referenced by an existing - // alerting policy will fail to be deleted in a delete operation. - bool force = 5; -} - -// The `SendNotificationChannelVerificationCode` request. -message SendNotificationChannelVerificationCodeRequest { - // Required. The notification channel to which to send a verification code. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; -} - -// The `GetNotificationChannelVerificationCode` request. -message GetNotificationChannelVerificationCodeRequest { - // Required. The notification channel for which a verification code is to be generated - // and retrieved. This must name a channel that is already verified; if - // the specified channel is not verified, the request will fail. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // The desired expiration time. If specified, the API will guarantee that - // the returned code will not be valid after the specified timestamp; - // however, the API cannot guarantee that the returned code will be - // valid for at least as long as the requested time (the API puts an upper - // bound on the amount of time for which a code may be valid). If omitted, - // a default expiration will be used, which may be less than the max - // permissible expiration (so specifying an expiration may extend the - // code's lifetime over omitting an expiration, even though the API does - // impose an upper limit on the maximum expiration that is permitted). - google.protobuf.Timestamp expire_time = 2; -} - -// The `GetNotificationChannelVerificationCode` request. -message GetNotificationChannelVerificationCodeResponse { - // The verification code, which may be used to verify other channels - // that have an equivalent identity (i.e. other channels of the same - // type with the same fingerprint such as other email channels with - // the same email address or other sms channels with the same number). - string code = 1; - - // The expiration time associated with the code that was returned. If - // an expiration was provided in the request, this is the minimum of the - // requested expiration in the request and the max permitted expiration. - google.protobuf.Timestamp expire_time = 2; -} - -// The `VerifyNotificationChannel` request. -message VerifyNotificationChannelRequest { - // Required. The notification channel to verify. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/NotificationChannel" - } - ]; - - // Required. The verification code that was delivered to the channel as - // a result of invoking the `SendNotificationChannelVerificationCode` API - // method or that was retrieved from a verified channel via - // `GetNotificationChannelVerificationCode`. For example, one might have - // "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - // guaranteed that the code is valid UTF-8; one should not - // make any assumptions regarding the structure or format of the code). - string code = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service.proto.baseline deleted file mode 100644 index 1600f4e92c9d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service.proto.baseline +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/type/calendar_period.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMonitoringProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// A `Service` is a discrete, autonomous, and network-accessible unit, designed -// to solve an individual concern -// ([Wikipedia](https://en.wikipedia.org/wiki/Service-orientation)). In -// Stackdriver Monitoring, a `Service` acts as the root resource under which -// operational aspects of the service are accessible. -message Service { - option (google.api.resource) = { - type: "monitoring.googleapis.com/Service" - pattern: "projects/{project}/services/{service}" - pattern: "organizations/{organization}/services/{service}" - pattern: "folders/{folder}/services/{service}" - pattern: "*" - }; - - // Custom view of service telemetry. Currently a place-holder pending final - // design. - message Custom { - - } - - // App Engine service. Learn more at https://cloud.google.com/appengine. - message AppEngine { - // The ID of the App Engine module underlying this service. Corresponds to - // the `module_id` resource label in the `gae_app` monitored resource: - // https://cloud.google.com/monitoring/api/resources#tag_gae_app - string module_id = 1; - } - - // Cloud Endpoints service. Learn more at https://cloud.google.com/endpoints. - message CloudEndpoints { - // The name of the Cloud Endpoints service underlying this service. - // Corresponds to the `service` resource label in the `api` monitored - // resource: https://cloud.google.com/monitoring/api/resources#tag_api - string service = 1; - } - - // Istio service. Learn more at http://istio.io. - message ClusterIstio { - // The location of the Kubernetes cluster in which this Istio service is - // defined. Corresponds to the `location` resource label in `k8s_cluster` - // resources. - string location = 1; - - // The name of the Kubernetes cluster in which this Istio service is - // defined. Corresponds to the `cluster_name` resource label in - // `k8s_cluster` resources. - string cluster_name = 2; - - // The namespace of the Istio service underlying this service. Corresponds - // to the `destination_service_namespace` metric label in Istio metrics. - string service_namespace = 3; - - // The name of the Istio service underlying this service. Corresponds to the - // `destination_service_name` metric label in Istio metrics. - string service_name = 4; - } - - // Configuration for how to query telemetry on a Service. - message Telemetry { - // The full name of the resource that defines this service. Formatted as - // described in https://cloud.google.com/apis/design/resource_names. - string resource_name = 1; - } - - // Resource name for this Service. Of the form - // `projects/{project_id}/services/{service_id}`. - string name = 1; - - // Name used for UI elements listing this Service. - string display_name = 2; - - // REQUIRED. Service-identifying atoms specifying the underlying service. - oneof identifier { - // Custom service type. - Custom custom = 6; - - // Type used for App Engine services. - AppEngine app_engine = 7; - - // Type used for Cloud Endpoints services. - CloudEndpoints cloud_endpoints = 8; - - // Type used for Istio services that live in a Kubernetes cluster. - ClusterIstio cluster_istio = 9; - } - - // Configuration for how to query telemetry on a Service. - Telemetry telemetry = 13; -} - -// A Service-Level Objective (SLO) describes a level of desired good service. It -// consists of a service-level indicator (SLI), a performance goal, and a period -// over which the objective is to be evaluated against that goal. The SLO can -// use SLIs defined in a number of different manners. Typical SLOs might include -// "99% of requests in each rolling week have latency below 200 milliseconds" or -// "99.5% of requests in each calendar month return successfully." -message ServiceLevelObjective { - option (google.api.resource) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - pattern: "projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}" - pattern: "*" - history: ORIGINALLY_SINGLE_PATTERN - }; - - // `ServiceLevelObjective.View` determines what form of - // `ServiceLevelObjective` is returned from `GetServiceLevelObjective`, - // `ListServiceLevelObjectives`, and `ListServiceLevelObjectiveVersions` RPCs. - enum View { - // Same as FULL. - VIEW_UNSPECIFIED = 0; - - // Return the embedded `ServiceLevelIndicator` in the form in which it was - // defined. If it was defined using a `BasicSli`, return that `BasicSli`. - FULL = 2; - - // For `ServiceLevelIndicator`s using `BasicSli` articulation, instead - // return the `ServiceLevelIndicator` with its mode of computation fully - // spelled out as a `RequestBasedSli`. For `ServiceLevelIndicator`s using - // `RequestBasedSli` or `WindowsBasedSli`, return the - // `ServiceLevelIndicator` as it was provided. - EXPLICIT = 1; - } - - // Resource name for this `ServiceLevelObjective`. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1; - - // Name used for UI elements listing this SLO. - string display_name = 11; - - // The definition of good service, used to measure and calculate the quality - // of the `Service`'s performance with respect to a single aspect of service - // quality. - ServiceLevelIndicator service_level_indicator = 3; - - // The fraction of service that must be good in order for this objective to be - // met. `0 < goal <= 0.999`. - double goal = 4; - - // The time period over which the objective will be evaluated. - oneof period { - // A rolling time period, semantically "in the past ``". - // Must be an integer multiple of 1 day no larger than 30 days. - google.protobuf.Duration rolling_period = 5; - - // A calendar period, semantically "since the start of the current - // ``". At this time, only `DAY`, `WEEK`, `FORTNIGHT`, and - // `MONTH` are supported. - google.type.CalendarPeriod calendar_period = 6; - } -} - -// A Service-Level Indicator (SLI) describes the "performance" of a service. For -// some services, the SLI is well-defined. In such cases, the SLI can be -// described easily by referencing the well-known SLI and providing the needed -// parameters. Alternatively, a "custom" SLI can be defined with a query to the -// underlying metric store. An SLI is defined to be `good_service / -// total_service` over any queried time interval. The value of performance -// always falls into the range `0 <= performance <= 1`. A custom SLI describes -// how to compute this ratio, whether this is by dividing values from a pair of -// time series, cutting a `Distribution` into good and bad counts, or counting -// time windows in which the service complies with a criterion. For separation -// of concerns, a single Service-Level Indicator measures performance for only -// one aspect of service quality, such as fraction of successful queries or -// fast-enough queries. -message ServiceLevelIndicator { - // Service level indicators can be grouped by whether the "unit" of service - // being measured is based on counts of good requests or on counts of good - // time windows - oneof type { - // Basic SLI on a well-known service type. - BasicSli basic_sli = 4; - - // Request-based SLIs - RequestBasedSli request_based = 1; - - // Windows-based SLIs - WindowsBasedSli windows_based = 2; - } -} - -// An SLI measuring performance on a well-known service type. Performance will -// be computed on the basis of pre-defined metrics. The type of the -// `service_resource` determines the metrics to use and the -// `service_resource.labels` and `metric_labels` are used to construct a -// monitoring filter to filter that metric down to just the data relevant to -// this service. -message BasicSli { - // Future parameters for the availability SLI. - message AvailabilityCriteria { - - } - - // Parameters for a latency threshold SLI. - message LatencyCriteria { - // Good service is defined to be the count of requests made to this service - // that return in no more than `threshold`. - google.protobuf.Duration threshold = 3; - } - - // OPTIONAL: The set of RPCs to which this SLI is relevant. Telemetry from - // other methods will not be used to calculate performance for this SLI. If - // omitted, this SLI applies to all the Service's methods. For service types - // that don't support breaking down by method, setting this field will result - // in an error. - repeated string method = 7; - - // OPTIONAL: The set of locations to which this SLI is relevant. Telemetry - // from other locations will not be used to calculate performance for this - // SLI. If omitted, this SLI applies to all locations in which the Service has - // activity. For service types that don't support breaking down by location, - // setting this field will result in an error. - repeated string location = 8; - - // OPTIONAL: The set of API versions to which this SLI is relevant. Telemetry - // from other API versions will not be used to calculate performance for this - // SLI. If omitted, this SLI applies to all API versions. For service types - // that don't support breaking down by version, setting this field will result - // in an error. - repeated string version = 9; - - // This SLI can be evaluated on the basis of availability or latency. - oneof sli_criteria { - // Good service is defined to be the count of requests made to this service - // that return successfully. - AvailabilityCriteria availability = 2; - - // Good service is defined to be the count of requests made to this service - // that are fast enough with respect to `latency.threshold`. - LatencyCriteria latency = 3; - } -} - -// Range of numerical values, inclusive of `min` and exclusive of `max`. If the -// open range "< range.max" is desired, set `range.min = -infinity`. If the open -// range ">= range.min" is desired, set `range.max = infinity`. -message Range { - // Range minimum. - double min = 1; - - // Range maximum. - double max = 2; -} - -// Service Level Indicators for which atomic units of service are counted -// directly. -message RequestBasedSli { - // The means to compute a ratio of `good_service` to `total_service`. - oneof method { - // `good_total_ratio` is used when the ratio of `good_service` to - // `total_service` is computed from two `TimeSeries`. - TimeSeriesRatio good_total_ratio = 1; - - // `distribution_cut` is used when `good_service` is a count of values - // aggregated in a `Distribution` that fall into a good range. The - // `total_service` is the total count of all values aggregated in the - // `Distribution`. - DistributionCut distribution_cut = 3; - } -} - -// A `TimeSeriesRatio` specifies two `TimeSeries` to use for computing the -// `good_service / total_service` ratio. The specified `TimeSeries` must have -// `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = -// DELTA` or `MetricKind = CUMULATIVE`. The `TimeSeriesRatio` must specify -// exactly two of good, bad, and total, and the relationship `good_service + -// bad_service = total_service` will be assumed. -message TimeSeriesRatio { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying good service provided. Must have - // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = - // DELTA` or `MetricKind = CUMULATIVE`. - string good_service_filter = 4; - - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying bad service, either demanded service - // that was not provided or demanded service that was of inadequate quality. - // Must have `ValueType = DOUBLE` or `ValueType = INT64` and must have - // `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. - string bad_service_filter = 5; - - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` quantifying total demanded service. Must have - // `ValueType = DOUBLE` or `ValueType = INT64` and must have `MetricKind = - // DELTA` or `MetricKind = CUMULATIVE`. - string total_service_filter = 6; -} - -// A `DistributionCut` defines a `TimeSeries` and thresholds used for measuring -// good service and total service. The `TimeSeries` must have `ValueType = -// DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. The -// computed `good_service` will be the count of values x in the `Distribution` -// such that `range.min <= x < range.max`. -message DistributionCut { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` aggregating values. Must have `ValueType = - // DISTRIBUTION` and `MetricKind = DELTA` or `MetricKind = CUMULATIVE`. - string distribution_filter = 4; - - // Range of values considered "good." For a one-sided range, set one bound to - // an infinite value. - Range range = 5; -} - -// A `WindowsBasedSli` defines `good_service` as the count of time windows for -// which the provided service was of good quality. Criteria for determining -// if service was good are embedded in the `window_criterion`. -message WindowsBasedSli { - // A `PerformanceThreshold` is used when each window is good when that window - // has a sufficiently high `performance`. - message PerformanceThreshold { - // The means, either a request-based SLI or a basic SLI, by which to compute - // performance over a window. - oneof type { - // `RequestBasedSli` to evaluate to judge window quality. - RequestBasedSli performance = 1; - - // `BasicSli` to evaluate to judge window quality. - BasicSli basic_sli_performance = 3; - } - - // If window `performance >= threshold`, the window is counted as good. - double threshold = 2; - } - - // A `MetricRange` is used when each window is good when the value x of a - // single `TimeSeries` satisfies `range.min <= x < range.max`. The provided - // `TimeSeries` must have `ValueType = INT64` or `ValueType = DOUBLE` and - // `MetricKind = GAUGE`. - message MetricRange { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying the `TimeSeries` to use for evaluating window quality. - string time_series = 1; - - // Range of values considered "good." For a one-sided range, set one bound - // to an infinite value. - Range range = 4; - } - - // The criterion to use for evaluating window goodness. - oneof window_criterion { - // A [monitoring filter](https://cloud.google.com/monitoring/api/v3/filters) - // specifying a `TimeSeries` with `ValueType = BOOL`. The window is good if - // any `true` values appear in the window. - string good_bad_metric_filter = 5; - - // A window is good if its `performance` is high enough. - PerformanceThreshold good_total_ratio_threshold = 2; - - // A window is good if the metric's value is in a good range, averaged - // across returned streams. - MetricRange metric_mean_in_range = 6; - - // A window is good if the metric's value is in a good range, summed across - // returned streams. - MetricRange metric_sum_in_range = 7; - } - - // Duration over which window quality is evaluated. Must be an integer - // fraction of a day and at least `60s`. - google.protobuf.Duration window_period = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service_service.proto.baseline deleted file mode 100644 index d592f241db7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/service_service.proto.baseline +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/service.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "ServiceMonitoringServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for -// managing and querying aspects of a workspace's services. These include the -// `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy -// of categorized Health Metrics. -service ServiceMonitoringService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Create a `Service`. - rpc CreateService(CreateServiceRequest) returns (Service) { - option (google.api.http) = { - post: "/v3/{parent=*/*}/services" - body: "service" - }; - option (google.api.method_signature) = "parent,service"; - } - - // Get the named `Service`. - rpc GetService(GetServiceRequest) returns (Service) { - option (google.api.http) = { - get: "/v3/{name=*/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List `Service`s for this workspace. - rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { - option (google.api.http) = { - get: "/v3/{parent=*/*}/services" - }; - option (google.api.method_signature) = "parent"; - } - - // Update this `Service`. - rpc UpdateService(UpdateServiceRequest) returns (Service) { - option (google.api.http) = { - patch: "/v3/{service.name=*/*/services/*}" - body: "service" - }; - option (google.api.method_signature) = "service"; - } - - // Soft delete this `Service`. - rpc DeleteService(DeleteServiceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=*/*/services/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Create a `ServiceLevelObjective` for the given `Service`. - rpc CreateServiceLevelObjective(CreateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - post: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" - body: "service_level_objective" - }; - option (google.api.method_signature) = "parent,service_level_objective"; - } - - // Get a `ServiceLevelObjective` by name. - rpc GetServiceLevelObjective(GetServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - get: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List the `ServiceLevelObjective`s for the given `Service`. - rpc ListServiceLevelObjectives(ListServiceLevelObjectivesRequest) returns (ListServiceLevelObjectivesResponse) { - option (google.api.http) = { - get: "/v3/{parent=*/*/services/*}/serviceLevelObjectives" - }; - option (google.api.method_signature) = "parent"; - } - - // Update the given `ServiceLevelObjective`. - rpc UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest) returns (ServiceLevelObjective) { - option (google.api.http) = { - patch: "/v3/{service_level_objective.name=*/*/services/*/serviceLevelObjectives/*}" - body: "service_level_objective" - }; - option (google.api.method_signature) = "service_level_objective"; - } - - // Delete the given `ServiceLevelObjective`. - rpc DeleteServiceLevelObjective(DeleteServiceLevelObjectiveRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=*/*/services/*/serviceLevelObjectives/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// The `CreateService` request. -message CreateServiceRequest { - // Required. Resource name of the parent workspace. - // Of the form `projects/{project_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Service" - } - ]; - - // Optional. The Service id to use for this Service. If omitted, an id will be - // generated instead. Must match the pattern [a-z0-9\-]+ - string service_id = 3; - - // Required. The `Service` to create. - Service service = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `GetService` request. -message GetServiceRequest { - // Required. Resource name of the `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; -} - -// The `ListServices` request. -message ListServicesRequest { - // Required. Resource name of the parent `Workspace`. - // Of the form `projects/{project_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/Service" - } - ]; - - // A filter specifying what `Service`s to return. The filter currently - // supports the following fields: - // - // - `identifier_case` - // - `app_engine.module_id` - // - `cloud_endpoints.service` - // - `cluster_istio.location` - // - `cluster_istio.cluster_name` - // - `cluster_istio.service_namespace` - // - `cluster_istio.service_name` - // - // `identifier_case` refers to which option in the identifier oneof is - // populated. For example, the filter `identifier_case = "CUSTOM"` would match - // all services with a value for the `custom` field. Valid options are - // "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - string filter = 2; - - // A non-negative number that is the maximum number of results to return. - // When 0, use default page size. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; -} - -// The `ListServices` response. -message ListServicesResponse { - // The `Service`s matching the specified filter. - repeated Service services = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `UpdateService` request. -message UpdateServiceRequest { - // Required. The `Service` to draw updates from. - // The given `name` specifies the resource to update. - Service service = 1 [(google.api.field_behavior) = REQUIRED]; - - // A set of field paths defining which fields to use for the update. - google.protobuf.FieldMask update_mask = 2; -} - -// The `DeleteService` request. -message DeleteServiceRequest { - // Required. Resource name of the `Service` to delete. - // Of the form `projects/{project_id}/services/{service_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; -} - -// The `CreateServiceLevelObjective` request. -message CreateServiceLevelObjectiveRequest { - // Required. Resource name of the parent `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; - - // Optional. The ServiceLevelObjective id to use for this - // ServiceLevelObjective. If omitted, an id will be generated instead. Must - // match the pattern [a-z0-9\-]+ - string service_level_objective_id = 3; - - // Required. The `ServiceLevelObjective` to create. - // The provided `name` will be respected if no `ServiceLevelObjective` exists - // with this name. - ServiceLevelObjective service_level_objective = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The `GetServiceLevelObjective` request. -message GetServiceLevelObjectiveRequest { - // Required. Resource name of the `ServiceLevelObjective` to get. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - } - ]; - - // View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - ServiceLevelObjective.View view = 2; -} - -// The `ListServiceLevelObjectives` request. -message ListServiceLevelObjectivesRequest { - // Required. Resource name of the parent `Service`. - // Of the form `projects/{project_id}/services/{service_id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/Service" - } - ]; - - // A filter specifying what `ServiceLevelObjective`s to return. - string filter = 2; - - // A non-negative number that is the maximum number of results to return. - // When 0, use default page size. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return additional results from the previous method call. - string page_token = 4; - - // View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - // `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - // `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - // `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - ServiceLevelObjective.View view = 5; -} - -// The `ListServiceLevelObjectives` response. -message ListServiceLevelObjectivesResponse { - // The `ServiceLevelObjective`s matching the specified filter. - repeated ServiceLevelObjective service_level_objectives = 1; - - // If there are more results than have been returned, then this field is set - // to a non-empty value. To see the additional results, - // use that value as `pageToken` in the next call to this method. - string next_page_token = 2; -} - -// The `UpdateServiceLevelObjective` request. -message UpdateServiceLevelObjectiveRequest { - // Required. The `ServiceLevelObjective` to draw updates from. - // The given `name` specifies the resource to update. - ServiceLevelObjective service_level_objective = 1 [(google.api.field_behavior) = REQUIRED]; - - // A set of field paths defining which fields to use for the update. - google.protobuf.FieldMask update_mask = 2; -} - -// The `DeleteServiceLevelObjective` request. -message DeleteServiceLevelObjectiveRequest { - // Required. Resource name of the `ServiceLevelObjective` to delete. - // Of the form - // `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/ServiceLevelObjective" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/span_context.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/span_context.proto.baseline deleted file mode 100644 index 220d6f7bafff..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/span_context.proto.baseline +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "SpanContextProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The context of a span, attached to google.api.Distribution.Exemplars -// in google.api.Distribution values during aggregation. -// -// It contains the name of a span with format: -// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID] -message SpanContext { - // The resource name of the span in the following format: - // - // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID] - // - // [TRACE_ID] is a unique identifier for a trace within a project; - // it is a 32-character hexadecimal encoding of a 16-byte array. - // - // [SPAN_ID] is a unique identifier for a span within a trace; it - // is a 16-character hexadecimal encoding of an 8-byte array. - string span_name = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime.proto.baseline deleted file mode 100644 index 443090450c40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime.proto.baseline +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/monitored_resource.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "UptimeProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The regions from which an Uptime check can be run. -enum UptimeCheckRegion { - // Default value if no region is specified. Will result in Uptime checks - // running from all regions. - REGION_UNSPECIFIED = 0; - - // Allows checks to run from locations within the United States of America. - USA = 1; - - // Allows checks to run from locations within the continent of Europe. - EUROPE = 2; - - // Allows checks to run from locations within the continent of South - // America. - SOUTH_AMERICA = 3; - - // Allows checks to run from locations within the Asia Pacific area (ex: - // Singapore). - ASIA_PACIFIC = 4; -} - -// An internal checker allows Uptime checks to run on private/internal GCP -// resources. -message InternalChecker { - option deprecated = true; - - // Operational states for an internal checker. - enum State { - // An internal checker should never be in the unspecified state. - UNSPECIFIED = 0; - - // The checker is being created, provisioned, and configured. A checker in - // this state can be returned by `ListInternalCheckers` or - // `GetInternalChecker`, as well as by examining the [long running - // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) - // that created it. - CREATING = 1; - - // The checker is running and available for use. A checker in this state - // can be returned by `ListInternalCheckers` or `GetInternalChecker` as - // well as by examining the [long running - // Operation](https://cloud.google.com/apis/design/design_patterns#long_running_operations) - // that created it. - // If a checker is being torn down, it is neither visible nor usable, so - // there is no "deleting" or "down" state. - RUNNING = 2; - } - - // A unique resource name for this InternalChecker. The format is: - // - // `projects/[PROJECT_ID]/internalCheckers/[INTERNAL_CHECKER_ID]`. - // - // `[PROJECT_ID]` is the Stackdriver Workspace project for the - // Uptime check config associated with the internal checker. - string name = 1; - - // The checker's human-readable name. The display name - // should be unique within a Stackdriver Workspace in order to make it easier - // to identify; however, uniqueness is not enforced. - string display_name = 2; - - // The [GCP VPC network](https://cloud.google.com/vpc/docs/vpc) where the - // internal resource lives (ex: "default"). - string network = 3; - - // The GCP zone the Uptime check should egress from. Only respected for - // internal Uptime checks, where internal_network is specified. - string gcp_zone = 4; - - // The GCP project ID where the internal checker lives. Not necessary - // the same as the Workspace project. - string peer_project_id = 6; - - // The current operational state of the internal checker. - State state = 7; -} - -// This message configures which resources and services to monitor for -// availability. -message UptimeCheckConfig { - option (google.api.resource) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - pattern: "projects/{project}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "folders/{folder}/uptimeCheckConfigs/{uptime_check_config}" - pattern: "*" - }; - - // The resource submessage for group checks. It can be used instead of a - // monitored resource, when multiple resources are being monitored. - message ResourceGroup { - // The group of resources being monitored. Should be only the `[GROUP_ID]`, - // and not the full-path `projects/[PROJECT_ID]/groups/[GROUP_ID]`. - string group_id = 1; - - // The resource type of the group members. - GroupResourceType resource_type = 2; - } - - // Information involved in an HTTP/HTTPS Uptime check request. - message HttpCheck { - // The authentication parameters to provide to the specified resource or - // URL that requires a username and password. Currently, only - // [Basic HTTP authentication](https://tools.ietf.org/html/rfc7617) is - // supported in Uptime checks. - message BasicAuthentication { - // The username to use when authenticating with the HTTP server. - string username = 1; - - // The password to use when authenticating with the HTTP server. - string password = 2; - } - - // If `true`, use HTTPS instead of HTTP to run the check. - bool use_ssl = 1; - - // Optional (defaults to "/"). The path to the page against which to run - // the check. Will be combined with the `host` (specified within the - // `monitored_resource`) and `port` to construct the full URL. If the - // provided path does not begin with "/", a "/" will be prepended - // automatically. - string path = 2; - - // Optional (defaults to 80 when `use_ssl` is `false`, and 443 when - // `use_ssl` is `true`). The TCP port on the HTTP server against which to - // run the check. Will be combined with host (specified within the - // `monitored_resource`) and `path` to construct the full URL. - int32 port = 3; - - // The authentication information. Optional when creating an HTTP check; - // defaults to empty. - BasicAuthentication auth_info = 4; - - // Boolean specifiying whether to encrypt the header information. - // Encryption should be specified for any headers related to authentication - // that you do not wish to be seen when retrieving the configuration. The - // server will be responsible for encrypting the headers. - // On Get/List calls, if `mask_headers` is set to `true` then the headers - // will be obscured with `******.` - bool mask_headers = 5; - - // The list of headers to send as part of the Uptime check request. - // If two headers have the same key and different values, they should - // be entered as a single header, with the value being a comma-separated - // list of all the desired values as described at - // https://www.w3.org/Protocols/rfc2616/rfc2616.txt (page 31). - // Entering two separate headers with the same key in a Create call will - // cause the first to be overwritten by the second. - // The maximum number of headers allowed is 100. - map headers = 6; - - // Boolean specifying whether to include SSL certificate validation as a - // part of the Uptime check. Only applies to checks where - // `monitored_resource` is set to `uptime_url`. If `use_ssl` is `false`, - // setting `validate_ssl` to `true` has no effect. - bool validate_ssl = 7; - } - - // Information required for a TCP Uptime check request. - message TcpCheck { - // The TCP port on the server against which to run the check. Will be - // combined with host (specified within the `monitored_resource`) to - // construct the full URL. Required. - int32 port = 1; - } - - // Optional. Used to perform content matching. This allows matching based on - // substrings and regular expressions, together with their negations. Only the - // first 4 MB of an HTTP or HTTPS check's response (and the first - // 1 MB of a TCP check's response) are examined for purposes of content - // matching. - message ContentMatcher { - // Options to perform content matching. - enum ContentMatcherOption { - // No content matcher type specified (maintained for backward - // compatibility, but deprecated for future use). - // Treated as `CONTAINS_STRING`. - CONTENT_MATCHER_OPTION_UNSPECIFIED = 0; - - // Selects substring matching. The match succeeds if the output contains - // the `content` string. This is the default value for checks without - // a `matcher` option, or where the value of `matcher` is - // `CONTENT_MATCHER_OPTION_UNSPECIFIED`. - CONTAINS_STRING = 1; - - // Selects negation of substring matching. The match succeeds if the - // output does _NOT_ contain the `content` string. - NOT_CONTAINS_STRING = 2; - - // Selects regular-expression matching. The match succeeds of the output - // matches the regular expression specified in the `content` string. - MATCHES_REGEX = 3; - - // Selects negation of regular-expression matching. The match succeeds if - // the output does _NOT_ match the regular expression specified in the - // `content` string. - NOT_MATCHES_REGEX = 4; - } - - // String or regex content to match. Maximum 1024 bytes. An empty `content` - // string indicates no content matching is to be performed. - string content = 1; - - // The type of content matcher that will be applied to the server output, - // compared to the `content` string when the check is run. - ContentMatcherOption matcher = 2; - } - - // A unique resource name for this Uptime check configuration. The format is: - // - // `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - // - // This field should be omitted when creating the Uptime check configuration; - // on create, the resource name is assigned by the server and included in the - // response. - string name = 1; - - // A human-friendly name for the Uptime check configuration. The display name - // should be unique within a Stackdriver Workspace in order to make it easier - // to identify; however, uniqueness is not enforced. Required. - string display_name = 2; - - // The resource the check is checking. Required. - oneof resource { - // The [monitored - // resource](https://cloud.google.com/monitoring/api/resources) associated - // with the configuration. - // The following monitored resource types are supported for Uptime checks: - // `uptime_url`, - // `gce_instance`, - // `gae_app`, - // `aws_ec2_instance`, - // `aws_elb_load_balancer` - google.api.MonitoredResource monitored_resource = 3; - - // The group resource associated with the configuration. - ResourceGroup resource_group = 4; - } - - // The type of Uptime check request. - oneof check_request_type { - // Contains information needed to make an HTTP or HTTPS check. - HttpCheck http_check = 5; - - // Contains information needed to make a TCP check. - TcpCheck tcp_check = 6; - } - - // How often, in seconds, the Uptime check is performed. - // Currently, the only supported values are `60s` (1 minute), `300s` - // (5 minutes), `600s` (10 minutes), and `900s` (15 minutes). Optional, - // defaults to `60s`. - google.protobuf.Duration period = 7; - - // The maximum amount of time to wait for the request to complete (must be - // between 1 and 60 seconds). Required. - google.protobuf.Duration timeout = 8; - - // The content that is expected to appear in the data returned by the target - // server against which the check is run. Currently, only the first entry - // in the `content_matchers` list is supported, and additional entries will - // be ignored. This field is optional and should only be specified if a - // content match is required as part of the/ Uptime check. - repeated ContentMatcher content_matchers = 9; - - // The list of regions from which the check will be run. - // Some regions contain one location, and others contain more than one. - // If this field is specified, enough regions must be provided to include a - // minimum of 3 locations. Not specifying this field will result in Uptime - // checks running from all available regions. - repeated UptimeCheckRegion selected_regions = 10; - - // If this is `true`, then checks are made only from the 'internal_checkers'. - // If it is `false`, then checks are made only from the 'selected_regions'. - // It is an error to provide 'selected_regions' when is_internal is `true`, - // or to provide 'internal_checkers' when is_internal is `false`. - bool is_internal = 15 [deprecated = true]; - - // The internal checkers that this check will egress from. If `is_internal` is - // `true` and this list is empty, the check will egress from all the - // InternalCheckers configured for the project that owns this - // `UptimeCheckConfig`. - repeated InternalChecker internal_checkers = 14 [deprecated = true]; -} - -// The supported resource types that can be used as values of -// `group_resource.resource_type`. -// `INSTANCE` includes `gce_instance` and `aws_ec2_instance` resource types. -// The resource types `gae_app` and `uptime_url` are not valid here because -// group checks on App Engine modules and URLs are not allowed. -enum GroupResourceType { - // Default value (not valid). - RESOURCE_TYPE_UNSPECIFIED = 0; - - // A group of instances from Google Cloud Platform (GCP) or - // Amazon Web Services (AWS). - INSTANCE = 1; - - // A group of Amazon ELB load balancers. - AWS_ELB_LOAD_BALANCER = 2; -} - -// Contains the region, location, and list of IP -// addresses where checkers in the location run from. -message UptimeCheckIp { - // A broad region category in which the IP address is located. - UptimeCheckRegion region = 1; - - // A more specific location within the region that typically encodes - // a particular city/town/metro (and its containing state/province or country) - // within the broader umbrella region category. - string location = 2; - - // The IP address from which the Uptime check originates. This is a fully - // specified IP address (not an IP address range). Most IP addresses, as of - // this publication, are in IPv4 format; however, one should not rely on the - // IP addresses being in IPv4 format indefinitely, and should support - // interpreting this field in either IPv4 or IPv6 format. - string ip_address = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime_service.proto.baseline deleted file mode 100644 index b4c2fc47ac10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/protos/google/monitoring/v3/uptime_service.proto.baseline +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.monitoring.v3; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/monitoring/v3/uptime.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Monitoring.V3"; -option go_package = "google.golang.org/genproto/googleapis/monitoring/v3;monitoring"; -option java_multiple_files = true; -option java_outer_classname = "UptimeServiceProto"; -option java_package = "com.google.monitoring.v3"; -option php_namespace = "Google\\Cloud\\Monitoring\\V3"; - -// The UptimeCheckService API is used to manage (list, create, delete, edit) -// Uptime check configurations in the Stackdriver Monitoring product. An Uptime -// check is a piece of configuration that determines which resources and -// services to monitor for availability. These configurations can also be -// configured interactively by navigating to the [Cloud Console] -// (http://console.cloud.google.com), selecting the appropriate project, -// clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, -// and then clicking on "Uptime". -service UptimeCheckService { - option (google.api.default_host) = "monitoring.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/monitoring," - "https://www.googleapis.com/auth/monitoring.read"; - - // Lists the existing valid Uptime check configurations for the project - // (leaving out any invalid configurations). - rpc ListUptimeCheckConfigs(ListUptimeCheckConfigsRequest) returns (ListUptimeCheckConfigsResponse) { - option (google.api.http) = { - get: "/v3/{parent=projects/*}/uptimeCheckConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a single Uptime check configuration. - rpc GetUptimeCheckConfig(GetUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - get: "/v3/{name=projects/*/uptimeCheckConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Uptime check configuration. - rpc CreateUptimeCheckConfig(CreateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - post: "/v3/{parent=projects/*}/uptimeCheckConfigs" - body: "uptime_check_config" - }; - option (google.api.method_signature) = "parent,uptime_check_config"; - } - - // Updates an Uptime check configuration. You can either replace the entire - // configuration with a new one or replace only certain fields in the current - // configuration by specifying the fields to be updated via `updateMask`. - // Returns the updated configuration. - rpc UpdateUptimeCheckConfig(UpdateUptimeCheckConfigRequest) returns (UptimeCheckConfig) { - option (google.api.http) = { - patch: "/v3/{uptime_check_config.name=projects/*/uptimeCheckConfigs/*}" - body: "uptime_check_config" - }; - option (google.api.method_signature) = "uptime_check_config"; - } - - // Deletes an Uptime check configuration. Note that this method will fail - // if the Uptime check configuration is referenced by an alert policy or - // other dependent configs that would be rendered invalid by the deletion. - rpc DeleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v3/{name=projects/*/uptimeCheckConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Returns the list of IP addresses that checkers run from - rpc ListUptimeCheckIps(ListUptimeCheckIpsRequest) returns (ListUptimeCheckIpsResponse) { - option (google.api.http) = { - get: "/v3/uptimeCheckIps" - }; - } -} - -// The protocol for the `ListUptimeCheckConfigs` request. -message ListUptimeCheckConfigsRequest { - // Required. The project whose Uptime check configurations are listed. The format - // is `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; - - // The maximum number of results to return in a single response. The server - // may further constrain the maximum number of results returned in a single - // page. If the page_size is <=0, the server will decide the number of results - // to be returned. - int32 page_size = 3; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - string page_token = 4; -} - -// The protocol for the `ListUptimeCheckConfigs` response. -message ListUptimeCheckConfigsResponse { - // The returned Uptime check configurations. - repeated UptimeCheckConfig uptime_check_configs = 1; - - // This field represents the pagination token to retrieve the next page of - // results. If the value is empty, it means no further results for the - // request. To retrieve the next page of results, the value of the - // next_page_token is passed to the subsequent List method call (in the - // request message's page_token field). - string next_page_token = 2; - - // The total number of Uptime check configurations for the project, - // irrespective of any pagination. - int32 total_size = 3; -} - -// The protocol for the `GetUptimeCheckConfig` request. -message GetUptimeCheckConfigRequest { - // Required. The Uptime check configuration to retrieve. The format - // is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; -} - -// The protocol for the `CreateUptimeCheckConfig` request. -message CreateUptimeCheckConfigRequest { - // Required. The project in which to create the Uptime check. The format - // is `projects/[PROJECT_ID]`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; - - // Required. The new Uptime check configuration. - UptimeCheckConfig uptime_check_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `UpdateUptimeCheckConfig` request. -message UpdateUptimeCheckConfigRequest { - // Optional. If present, only the listed fields in the current Uptime check - // configuration are updated with values from the new configuration. If this - // field is empty, then the current configuration is completely replaced with - // the new configuration. - google.protobuf.FieldMask update_mask = 2; - - // Required. If an `updateMask` has been specified, this field gives - // the values for the set of fields mentioned in the `updateMask`. If an - // `updateMask` has not been given, this Uptime check configuration replaces - // the current configuration. If a field is mentioned in `updateMask` but - // the corresonding field is omitted in this partial Uptime check - // configuration, it has the effect of deleting/clearing the field from the - // configuration on the server. - // - // The following fields can be updated: `display_name`, - // `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - // `selected_regions`. - UptimeCheckConfig uptime_check_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The protocol for the `DeleteUptimeCheckConfig` request. -message DeleteUptimeCheckConfigRequest { - // Required. The Uptime check configuration to delete. The format - // is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "monitoring.googleapis.com/UptimeCheckConfig" - } - ]; -} - -// The protocol for the `ListUptimeCheckIps` request. -message ListUptimeCheckIpsRequest { - // The maximum number of results to return in a single response. The server - // may further constrain the maximum number of results returned in a single - // page. If the page_size is <=0, the server will decide the number of results - // to be returned. - // NOTE: this field is not yet implemented - int32 page_size = 2; - - // If this field is not empty then it must contain the `nextPageToken` value - // returned by a previous call to this method. Using this field causes the - // method to return more results from the previous method call. - // NOTE: this field is not yet implemented - string page_token = 3; -} - -// The protocol for the `ListUptimeCheckIps` response. -message ListUptimeCheckIpsResponse { - // The returned list of IP addresses (including region and location) that the - // checkers run from. - repeated UptimeCheckIp uptime_check_ips = 1; - - // This field represents the pagination token to retrieve the next page of - // results. If the value is empty, it means no further results for the - // request. To retrieve the next page of results, the value of the - // next_page_token is passed to the subsequent List method call (in the - // request message's page_token field). - // NOTE: this field is not yet implemented - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline deleted file mode 100644 index 968d29928eae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.create_alert_policy.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, alertPolicy) { - // [START monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the alerting policy. The format is - * `projects/[PROJECT_ID]`. - * Note that this field names the parent container in which the alerting - * policy will be written, not the name of the created policy. The alerting - * policy that is returned will have a name that contains a normalized - * representation of this name as a prefix but adds a suffix of the form - * `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - */ - // const name = 'abc123' - /** - * Required. The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including - * a new ALERT_POLICY_ID value. - */ - // const alertPolicy = {} - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callCreateAlertPolicy() { - // Construct request - const request = { - name, - alertPolicy, - }; - - // Run request - const response = await monitoringClient.createAlertPolicy(request); - console.log(response); - } - - callCreateAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline deleted file mode 100644 index d009d518ca10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.delete_alert_policy.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The alerting policy to delete. The format is: - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * For more information, see AlertPolicy google.monitoring.v3.AlertPolicy. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callDeleteAlertPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteAlertPolicy(request); - console.log(response); - } - - callDeleteAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline deleted file mode 100644 index 1297eabd1db1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.get_alert_policy.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The alerting policy to retrieve. The format is - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callGetAlertPolicy() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getAlertPolicy(request); - console.log(response); - } - - callGetAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline deleted file mode 100644 index 5afbf8d77956..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.list_alert_policies.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose alert policies are to be listed. The format is - * projects/[PROJECT_ID] - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * GetAlertPolicy google.monitoring.v3.AlertPolicyService.GetAlertPolicy - * operation, instead. - */ - // const name = 'abc123' - /** - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const orderBy = 'abc123' - /** - * The maximum number of results to return in a single response. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callListAlertPolicies() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listAlertPoliciesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAlertPolicies(); - // [END monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline deleted file mode 100644 index 6e7751d303f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/alert_policy_service.update_alert_policy.js.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(alertPolicy) { - // [START monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. A list of alerting policy field names. If this field is not - * empty, each listed field in the existing alerting policy is set to the - * value of the corresponding field in the supplied policy (`alert_policy`), - * or to the field's default value if the field is not in the supplied - * alerting policy. Fields not listed retain their previous value. - * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, - * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - * If this field is empty, then the supplied alerting policy replaces the - * existing policy. It is the same as deleting the existing policy and - * adding the supplied policy, except for the following: - * + The new policy will have the same `[ALERT_POLICY_ID]` as the former - * policy. This gives you continuity with the former policy in your - * notifications and incidents. - * + Conditions in the new policy will keep their former `[CONDITION_ID]` if - * the supplied condition includes the `name` field with that - * `[CONDITION_ID]`. If the supplied condition omits the `name` field, - * then a new `[CONDITION_ID]` is created. - */ - // const updateMask = {} - /** - * Required. The updated alerting policy or the updated values for the - * fields listed in `update_mask`. - * If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - */ - // const alertPolicy = {} - - // Imports the Monitoring library - const {AlertPolicyServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new AlertPolicyServiceClient(); - - async function callUpdateAlertPolicy() { - // Construct request - const request = { - alertPolicy, - }; - - // Run request - const response = await monitoringClient.updateAlertPolicy(request); - console.log(response); - } - - callUpdateAlertPolicy(); - // [END monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.create_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.create_group.js.baseline deleted file mode 100644 index 018024ccc3ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.create_group.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, group) { - // [START monitoring_v3_generated_GroupService_CreateGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the group. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. A group definition. It is an error to define the `name` field because - * the system assigns the name. - */ - // const group = {} - /** - * If true, validate this request but do not create the group. - */ - // const validateOnly = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callCreateGroup() { - // Construct request - const request = { - name, - group, - }; - - // Run request - const response = await monitoringClient.createGroup(request); - console.log(response); - } - - callCreateGroup(); - // [END monitoring_v3_generated_GroupService_CreateGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.delete_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.delete_group.js.baseline deleted file mode 100644 index d4b3ac2b4b9a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.delete_group.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_DeleteGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group to delete. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - /** - * If this field is true, then the request means to delete a group with all - * its descendants. Otherwise, the request means to delete a group only when - * it has no descendants. The default value is false. - */ - // const recursive = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callDeleteGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteGroup(request); - console.log(response); - } - - callDeleteGroup(); - // [END monitoring_v3_generated_GroupService_DeleteGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.get_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.get_group.js.baseline deleted file mode 100644 index 93e2d085beba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.get_group.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_GetGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group to retrieve. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callGetGroup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getGroup(request); - console.log(response); - } - - callGetGroup(); - // [END monitoring_v3_generated_GroupService_GetGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_group_members.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_group_members.js.baseline deleted file mode 100644 index fd1fa12bd0a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_group_members.js.baseline +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_ListGroupMembers_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - */ - // const name = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - /** - * An optional list filter (/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * resource.type = "gce_instance" - */ - // const filter = 'abc123' - /** - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - */ - // const interval = {} - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callListGroupMembers() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listGroupMembersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGroupMembers(); - // [END monitoring_v3_generated_GroupService_ListGroupMembers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_groups.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_groups.js.baseline deleted file mode 100644 index 34ab326150ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.list_groups.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_GroupService_ListGroups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - */ - // const childrenOfGroup = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - */ - // const ancestorsOfGroup = 'abc123' - /** - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - */ - // const descendantsOfGroup = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callListGroups() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listGroupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGroups(); - // [END monitoring_v3_generated_GroupService_ListGroups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.update_group.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.update_group.js.baseline deleted file mode 100644 index a701decff0df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/group_service.update_group.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(group) { - // [START monitoring_v3_generated_GroupService_UpdateGroup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new definition of the group. All fields of the existing group, - * excepting `name`, are replaced with the corresponding fields of this group. - */ - // const group = {} - /** - * If true, validate this request but do not update the existing group. - */ - // const validateOnly = true - - // Imports the Monitoring library - const {GroupServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new GroupServiceClient(); - - async function callUpdateGroup() { - // Construct request - const request = { - group, - }; - - // Run request - const response = await monitoringClient.updateGroup(request); - console.log(response); - } - - callUpdateGroup(); - // [END monitoring_v3_generated_GroupService_UpdateGroup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline deleted file mode 100644 index 03781ba1ca9a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_metric_descriptor.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, metricDescriptor) { - // [START monitoring_v3_generated_MetricService_CreateMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. The new custom metric (/monitoring/custom-metrics) - * descriptor. - */ - // const metricDescriptor = {} - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callCreateMetricDescriptor() { - // Construct request - const request = { - name, - metricDescriptor, - }; - - // Run request - const response = await monitoringClient.createMetricDescriptor(request); - console.log(response); - } - - callCreateMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_CreateMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_time_series.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_time_series.js.baseline deleted file mode 100644 index 29142c6a304b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.create_time_series.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, timeSeries) { - // [START monitoring_v3_generated_MetricService_CreateTimeSeries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * The maximum number of `TimeSeries` objects per `Create` request is 200. - */ - // const timeSeries = [1,2,3,4] - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callCreateTimeSeries() { - // Construct request - const request = { - name, - timeSeries, - }; - - // Run request - const response = await monitoringClient.createTimeSeries(request); - console.log(response); - } - - callCreateTimeSeries(); - // [END monitoring_v3_generated_MetricService_CreateTimeSeries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline deleted file mode 100644 index 1c32361086a8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.delete_metric_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example of `{metric_id}` is: - * `"custom.googleapis.com/my_test_metric"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callDeleteMetricDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteMetricDescriptor(request); - console.log(response); - } - - callDeleteMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline deleted file mode 100644 index 71365551c9db..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_metric_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_GetMetricDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example value of `{metric_id}` is - * `"compute.googleapis.com/instance/disk/read_bytes_count"`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callGetMetricDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getMetricDescriptor(request); - console.log(response); - } - - callGetMetricDescriptor(); - // [END monitoring_v3_generated_MetricService_GetMetricDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline deleted file mode 100644 index ada4b561d4c8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.get_monitored_resource_descriptor.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The monitored resource descriptor to get. The format is - * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - * The `{resource_type}` is a predefined type, such as - * `cloudsql_database`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callGetMonitoredResourceDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getMonitoredResourceDescriptor(request); - console.log(response); - } - - callGetMonitoredResourceDescriptor(); - // [END monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline deleted file mode 100644 index 7b9f15d2c987..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_metric_descriptors.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_ListMetricDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the filter (/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * custom metrics (/monitoring/custom-metrics): - * metric.type = starts_with("custom.googleapis.com/") - */ - // const filter = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListMetricDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listMetricDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMetricDescriptors(); - // [END monitoring_v3_generated_MetricService_ListMetricDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline deleted file mode 100644 index 1b59c28ec72e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_monitored_resource_descriptors.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - */ - // const name = 'abc123' - /** - * An optional filter (/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * resource.type = starts_with("gce_") AND resource.label:id - */ - // const filter = 'abc123' - /** - * A positive number that is the maximum number of results to return. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListMonitoredResourceDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listMonitoredResourceDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListMonitoredResourceDescriptors(); - // [END monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_time_series.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_time_series.js.baseline deleted file mode 100644 index d81ebe219e8c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/metric_service.list_time_series.js.baseline +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, filter, interval, view) { - // [START monitoring_v3_generated_MetricService_ListTimeSeries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - */ - // const name = 'abc123' - /** - * Required. A monitoring filter (/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - */ - // const filter = 'abc123' - /** - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - */ - // const interval = {} - /** - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - */ - // const aggregation = {} - /** - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - */ - // const orderBy = 'abc123' - /** - * Required. Specifies which information is returned about the time series. - */ - // const view = {} - /** - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {MetricServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new MetricServiceClient(); - - async function callListTimeSeries() { - // Construct request - const request = { - name, - filter, - interval, - view, - }; - - // Run request - const iterable = monitoringClient.listTimeSeriesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTimeSeries(); - // [END monitoring_v3_generated_MetricService_ListTimeSeries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline deleted file mode 100644 index 0eec81e81373..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.create_notification_channel.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, notificationChannel) { - // [START monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is: - * projects/[PROJECT_ID] - * Note that this names the container into which the channel will be - * written. This does not name the newly created channel. The resulting - * channel's name will have a normalized version of this field as a prefix, - * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - */ - // const name = 'abc123' - /** - * Required. The definition of the `NotificationChannel` to create. - */ - // const notificationChannel = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callCreateNotificationChannel() { - // Construct request - const request = { - name, - notificationChannel, - }; - - // Run request - const response = await monitoringClient.createNotificationChannel(request); - console.log(response); - } - - callCreateNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline deleted file mode 100644 index e3f28ec17171..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.delete_notification_channel.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - */ - // const name = 'abc123' - /** - * If true, the notification channel will be deleted regardless of its - * use in alert policies (the policies will be updated to remove the - * channel). If false, channels that are still referenced by an existing - * alerting policy will fail to be deleted in a delete operation. - */ - // const force = true - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callDeleteNotificationChannel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteNotificationChannel(request); - console.log(response); - } - - callDeleteNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline deleted file mode 100644 index 4c6ad2f00b7e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannel(request); - console.log(response); - } - - callGetNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline deleted file mode 100644 index 3915845d984d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The channel type for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannelDescriptor() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannelDescriptor(request); - console.log(response); - } - - callGetNotificationChannelDescriptor(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline deleted file mode 100644 index 1b0b8eaff172..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel for which a verification code is to be generated - * and retrieved. This must name a channel that is already verified; if - * the specified channel is not verified, the request will fail. - */ - // const name = 'abc123' - /** - * The desired expiration time. If specified, the API will guarantee that - * the returned code will not be valid after the specified timestamp; - * however, the API cannot guarantee that the returned code will be - * valid for at least as long as the requested time (the API puts an upper - * bound on the amount of time for which a code may be valid). If omitted, - * a default expiration will be used, which may be less than the max - * permissible expiration (so specifying an expiration may extend the - * code's lifetime over omitting an expiration, even though the API does - * impose an upper limit on the maximum expiration that is permitted). - */ - // const expireTime = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callGetNotificationChannelVerificationCode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getNotificationChannelVerificationCode(request); - console.log(response); - } - - callGetNotificationChannelVerificationCode(); - // [END monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline deleted file mode 100644 index 6d7b91df73a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * projects/[PROJECT_ID] - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * GetNotificationChannelDescriptor google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor - * operation, instead. - */ - // const name = 'abc123' - /** - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - */ - // const pageSize = 1234 - /** - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callListNotificationChannelDescriptors() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listNotificationChannelDescriptorsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationChannelDescriptors(); - // [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline deleted file mode 100644 index f91fe89b8611..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.list_notification_channels.js.baseline +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * `GetNotificationChannel` google.monitoring.v3.NotificationChannelService.GetNotificationChannel - * operation. - */ - // const name = 'abc123' - /** - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const filter = 'abc123' - /** - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * For more details, see sorting and - * filtering (/monitoring/api/v3/sorting-and-filtering). - */ - // const orderBy = 'abc123' - /** - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - */ - // const pageSize = 1234 - /** - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callListNotificationChannels() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = monitoringClient.listNotificationChannelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListNotificationChannels(); - // [END monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline deleted file mode 100644 index 69a0e42fe127..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel to which to send a verification code. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callSendNotificationChannelVerificationCode() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.sendNotificationChannelVerificationCode(request); - console.log(response); - } - - callSendNotificationChannelVerificationCode(); - // [END monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline deleted file mode 100644 index 9e890f9ce89c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.update_notification_channel.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(notificationChannel) { - // [START monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The fields to update. - */ - // const updateMask = {} - /** - * Required. A description of the changes to be applied to the specified - * notification channel. The description must provide a definition for - * fields to be updated; the names of these fields should also be - * included in the `update_mask`. - */ - // const notificationChannel = {} - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callUpdateNotificationChannel() { - // Construct request - const request = { - notificationChannel, - }; - - // Run request - const response = await monitoringClient.updateNotificationChannel(request); - console.log(response); - } - - callUpdateNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline deleted file mode 100644 index 5b9d2b438b78..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/notification_channel_service.verify_notification_channel.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, code) { - // [START monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The notification channel to verify. - */ - // const name = 'abc123' - /** - * Required. The verification code that was delivered to the channel as - * a result of invoking the `SendNotificationChannelVerificationCode` API - * method or that was retrieved from a verified channel via - * `GetNotificationChannelVerificationCode`. For example, one might have - * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - * guaranteed that the code is valid UTF-8; one should not - * make any assumptions regarding the structure or format of the code). - */ - // const code = 'abc123' - - // Imports the Monitoring library - const {NotificationChannelServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new NotificationChannelServiceClient(); - - async function callVerifyNotificationChannel() { - // Construct request - const request = { - name, - code, - }; - - // Run request - const response = await monitoringClient.verifyNotificationChannel(request); - console.log(response); - } - - callVerifyNotificationChannel(); - // [END monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service.js.baseline deleted file mode 100644 index e7cc9887a64e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, service) { - // [START monitoring_v3_generated_ServiceMonitoringService_CreateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent workspace. - * Of the form `projects/{project_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The Service id to use for this Service. If omitted, an id will be - * generated instead. Must match the pattern [a-z0-9\-]+ - */ - // const serviceId = 'abc123' - /** - * Required. The `Service` to create. - */ - // const service = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callCreateService() { - // Construct request - const request = { - parent, - service, - }; - - // Run request - const response = await monitoringClient.createService(request); - console.log(response); - } - - callCreateService(); - // [END monitoring_v3_generated_ServiceMonitoringService_CreateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline deleted file mode 100644 index d6c0ce3c8d83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.create_service_level_objective.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, serviceLevelObjective) { - // [START monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * Optional. The ServiceLevelObjective id to use for this - * ServiceLevelObjective. If omitted, an id will be generated instead. Must - * match the pattern [a-z0-9\-]+ - */ - // const serviceLevelObjectiveId = 'abc123' - /** - * Required. The `ServiceLevelObjective` to create. - * The provided `name` will be respected if no `ServiceLevelObjective` exists - * with this name. - */ - // const serviceLevelObjective = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callCreateServiceLevelObjective() { - // Construct request - const request = { - parent, - serviceLevelObjective, - }; - - // Run request - const response = await monitoringClient.createServiceLevelObjective(request); - console.log(response); - } - - callCreateServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service.js.baseline deleted file mode 100644 index ee75d6b2ab86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_DeleteService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `Service` to delete. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callDeleteService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteService(request); - console.log(response); - } - - callDeleteService(); - // [END monitoring_v3_generated_ServiceMonitoringService_DeleteService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline deleted file mode 100644 index 639c28ba7242..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.delete_service_level_objective.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `ServiceLevelObjective` to delete. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callDeleteServiceLevelObjective() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteServiceLevelObjective(request); - console.log(response); - } - - callDeleteServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service.js.baseline deleted file mode 100644 index e850c90c900d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_GetService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callGetService() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getService(request); - console.log(response); - } - - callGetService(); - // [END monitoring_v3_generated_ServiceMonitoringService_GetService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline deleted file mode 100644 index b1f23ada2b34..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.get_service_level_objective.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the `ServiceLevelObjective` to get. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - */ - // const name = 'abc123' - /** - * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - */ - // const view = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callGetServiceLevelObjective() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getServiceLevelObjective(request); - console.log(response); - } - - callGetServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline deleted file mode 100644 index 63f1f07a3fe8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_service_level_objectives.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - */ - // const parent = 'abc123' - /** - * A filter specifying what `ServiceLevelObjective`s to return. - */ - // const filter = 'abc123' - /** - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - /** - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - */ - // const view = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callListServiceLevelObjectives() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listServiceLevelObjectivesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServiceLevelObjectives(); - // [END monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_services.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_services.js.baseline deleted file mode 100644 index f1bd1aa6cc67..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.list_services.js.baseline +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_ServiceMonitoringService_ListServices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - */ - // const parent = 'abc123' - /** - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - */ - // const filter = 'abc123' - /** - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callListServices() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listServicesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServices(); - // [END monitoring_v3_generated_ServiceMonitoringService_ListServices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service.js.baseline deleted file mode 100644 index fb791fe8b7b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(service) { - // [START monitoring_v3_generated_ServiceMonitoringService_UpdateService_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `Service` to draw updates from. - * The given `name` specifies the resource to update. - */ - // const service = {} - /** - * A set of field paths defining which fields to use for the update. - */ - // const updateMask = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callUpdateService() { - // Construct request - const request = { - service, - }; - - // Run request - const response = await monitoringClient.updateService(request); - console.log(response); - } - - callUpdateService(); - // [END monitoring_v3_generated_ServiceMonitoringService_UpdateService_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline deleted file mode 100644 index 580c78bda9b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/service_monitoring_service.update_service_level_objective.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(serviceLevelObjective) { - // [START monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The `ServiceLevelObjective` to draw updates from. - * The given `name` specifies the resource to update. - */ - // const serviceLevelObjective = {} - /** - * A set of field paths defining which fields to use for the update. - */ - // const updateMask = {} - - // Imports the Monitoring library - const {ServiceMonitoringServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new ServiceMonitoringServiceClient(); - - async function callUpdateServiceLevelObjective() { - // Construct request - const request = { - serviceLevelObjective, - }; - - // Run request - const response = await monitoringClient.updateServiceLevelObjective(request); - console.log(response); - } - - callUpdateServiceLevelObjective(); - // [END monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline deleted file mode 100644 index fbb0677640e3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/snippet_metadata_google.monitoring.v3.json.baseline +++ /dev/null @@ -1,2071 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-monitoring", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.monitoring.v3", - "version": "v3" - } - ] - }, - "snippets": [ - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async", - "title": "monitoring listAlertPolicies Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing alerting policies for the project.", - "canonical": true, - "file": "alert_policy_service.list_alert_policies.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListAlertPolicies", - "fullName": "google.monitoring.v3.AlertPolicyService.ListAlertPolicies", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListAlertPoliciesResponse", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "ListAlertPolicies", - "fullName": "google.monitoring.v3.AlertPolicyService.ListAlertPolicies", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async", - "title": "monitoring getAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets a single alerting policy.", - "canonical": true, - "file": "alert_policy_service.get_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.GetAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "GetAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.GetAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async", - "title": "monitoring createAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Creates a new alerting policy.", - "canonical": true, - "file": "alert_policy_service.create_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.CreateAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "alert_policy", - "type": ".google.monitoring.v3.AlertPolicy" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "CreateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.CreateAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async", - "title": "monitoring deleteAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Deletes an alerting policy.", - "canonical": true, - "file": "alert_policy_service.delete_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.DeleteAlertPolicy", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "DeleteAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.DeleteAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async", - "title": "monitoring updateAlertPolicy Sample", - "origin": "API_DEFINITION", - "description": " Updates an alerting policy. You can either replace the entire policy with a new one or replace only certain fields in the current alerting policy by specifying the fields to be updated via `updateMask`. Returns the updated alerting policy.", - "canonical": true, - "file": "alert_policy_service.update_alert_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "alert_policy", - "type": ".google.monitoring.v3.AlertPolicy" - } - ], - "resultType": ".google.monitoring.v3.AlertPolicy", - "client": { - "shortName": "AlertPolicyServiceClient", - "fullName": "google.monitoring.v3.AlertPolicyServiceClient" - }, - "method": { - "shortName": "UpdateAlertPolicy", - "fullName": "google.monitoring.v3.AlertPolicyService.UpdateAlertPolicy", - "service": { - "shortName": "AlertPolicyService", - "fullName": "google.monitoring.v3.AlertPolicyService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_ListGroups_async", - "title": "monitoring listGroups Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing groups.", - "canonical": true, - "file": "group_service.list_groups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGroups", - "fullName": "google.monitoring.v3.GroupService.ListGroups", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "children_of_group", - "type": "TYPE_STRING" - }, - { - "name": "ancestors_of_group", - "type": "TYPE_STRING" - }, - { - "name": "descendants_of_group", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListGroupsResponse", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "ListGroups", - "fullName": "google.monitoring.v3.GroupService.ListGroups", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_GetGroup_async", - "title": "monitoring getGroup Sample", - "origin": "API_DEFINITION", - "description": " Gets a single group.", - "canonical": true, - "file": "group_service.get_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGroup", - "fullName": "google.monitoring.v3.GroupService.GetGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "GetGroup", - "fullName": "google.monitoring.v3.GroupService.GetGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_CreateGroup_async", - "title": "monitoring createGroup Sample", - "origin": "API_DEFINITION", - "description": " Creates a new group.", - "canonical": true, - "file": "group_service.create_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGroup", - "fullName": "google.monitoring.v3.GroupService.CreateGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "group", - "type": ".google.monitoring.v3.Group" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "CreateGroup", - "fullName": "google.monitoring.v3.GroupService.CreateGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_UpdateGroup_async", - "title": "monitoring updateGroup Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing group. You can change any group attributes except `name`.", - "canonical": true, - "file": "group_service.update_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGroup", - "fullName": "google.monitoring.v3.GroupService.UpdateGroup", - "async": true, - "parameters": [ - { - "name": "group", - "type": ".google.monitoring.v3.Group" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.monitoring.v3.Group", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "UpdateGroup", - "fullName": "google.monitoring.v3.GroupService.UpdateGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_DeleteGroup_async", - "title": "monitoring deleteGroup Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing group.", - "canonical": true, - "file": "group_service.delete_group.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGroup", - "fullName": "google.monitoring.v3.GroupService.DeleteGroup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "recursive", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "DeleteGroup", - "fullName": "google.monitoring.v3.GroupService.DeleteGroup", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_GroupService_ListGroupMembers_async", - "title": "monitoring listGroupMembers Sample", - "origin": "API_DEFINITION", - "description": " Lists the monitored resources that are members of a group.", - "canonical": true, - "file": "group_service.list_group_members.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGroupMembers", - "fullName": "google.monitoring.v3.GroupService.ListGroupMembers", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "interval", - "type": ".google.monitoring.v3.TimeInterval" - } - ], - "resultType": ".google.monitoring.v3.ListGroupMembersResponse", - "client": { - "shortName": "GroupServiceClient", - "fullName": "google.monitoring.v3.GroupServiceClient" - }, - "method": { - "shortName": "ListGroupMembers", - "fullName": "google.monitoring.v3.GroupService.ListGroupMembers", - "service": { - "shortName": "GroupService", - "fullName": "google.monitoring.v3.GroupService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async", - "title": "monitoring listMonitoredResourceDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_monitored_resource_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListMonitoredResourceDescriptorsResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListMonitoredResourceDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMonitoredResourceDescriptors", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async", - "title": "monitoring getMonitoredResourceDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single monitored resource descriptor. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.get_monitored_resource_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMonitoredResourceDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.MonitoredResourceDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "GetMonitoredResourceDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMonitoredResourceDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListMetricDescriptors_async", - "title": "monitoring listMetricDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists metric descriptors that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_metric_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMetricDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMetricDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListMetricDescriptorsResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListMetricDescriptors", - "fullName": "google.monitoring.v3.MetricService.ListMetricDescriptors", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_GetMetricDescriptor_async", - "title": "monitoring getMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single metric descriptor. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.get_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.MetricDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "GetMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.GetMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_CreateMetricDescriptor_async", - "title": "monitoring createMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Creates a new metric descriptor. User-created metric descriptors define [custom metrics](/monitoring/custom-metrics).", - "canonical": true, - "file": "metric_service.create_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.CreateMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "metric_descriptor", - "type": ".google.api.MetricDescriptor" - } - ], - "resultType": ".google.api.MetricDescriptor", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "CreateMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.CreateMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async", - "title": "monitoring deleteMetricDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can be deleted.", - "canonical": true, - "file": "metric_service.delete_metric_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.DeleteMetricDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "DeleteMetricDescriptor", - "fullName": "google.monitoring.v3.MetricService.DeleteMetricDescriptor", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_ListTimeSeries_async", - "title": "monitoring listTimeSeries Sample", - "origin": "API_DEFINITION", - "description": " Lists time series that match a filter. This method does not require a Stackdriver account.", - "canonical": true, - "file": "metric_service.list_time_series.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 104, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTimeSeries", - "fullName": "google.monitoring.v3.MetricService.ListTimeSeries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "interval", - "type": ".google.monitoring.v3.TimeInterval" - }, - { - "name": "aggregation", - "type": ".google.monitoring.v3.Aggregation" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListTimeSeriesResponse", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "ListTimeSeries", - "fullName": "google.monitoring.v3.MetricService.ListTimeSeries", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_MetricService_CreateTimeSeries_async", - "title": "monitoring createTimeSeries Sample", - "origin": "API_DEFINITION", - "description": " Creates or adds data to one or more time series. The response is empty if all time series in the request were written. If any time series could not be written, a corresponding failure message is included in the error response.", - "canonical": true, - "file": "metric_service.create_time_series.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTimeSeries", - "fullName": "google.monitoring.v3.MetricService.CreateTimeSeries", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "time_series", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MetricServiceClient", - "fullName": "google.monitoring.v3.MetricServiceClient" - }, - "method": { - "shortName": "CreateTimeSeries", - "fullName": "google.monitoring.v3.MetricService.CreateTimeSeries", - "service": { - "shortName": "MetricService", - "fullName": "google.monitoring.v3.MetricService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async", - "title": "monitoring listNotificationChannelDescriptors Sample", - "origin": "API_DEFINITION", - "description": " Lists the descriptors for supported channel types. The use of descriptors makes it possible for new channel types to be dynamically added.", - "canonical": true, - "file": "notification_channel_service.list_notification_channel_descriptors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationChannelDescriptors", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptors", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListNotificationChannelDescriptorsResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "ListNotificationChannelDescriptors", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannelDescriptors", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async", - "title": "monitoring getNotificationChannelDescriptor Sample", - "origin": "API_DEFINITION", - "description": " Gets a single channel descriptor. The descriptor indicates which fields are expected / permitted for a notification channel of the given type.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel_descriptor.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannelDescriptor", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannelDescriptor", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannelDescriptor", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async", - "title": "monitoring listNotificationChannels Sample", - "origin": "API_DEFINITION", - "description": " Lists the notification channels that have been created for the project.", - "canonical": true, - "file": "notification_channel_service.list_notification_channels.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListNotificationChannels", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannels", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListNotificationChannelsResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "ListNotificationChannels", - "fullName": "google.monitoring.v3.NotificationChannelService.ListNotificationChannels", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async", - "title": "monitoring getNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Gets a single notification channel. The channel includes the relevant configuration details with which the channel was created. However, the response may truncate or omit passwords, API keys, or other private key matter and thus the response may not be 100% identical to the information that was supplied in the call to the create method.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async", - "title": "monitoring createNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Creates a new notification channel, representing a single notification endpoint such as an email address, SMS number, or PagerDuty service.", - "canonical": true, - "file": "notification_channel_service.create_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.CreateNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "notification_channel", - "type": ".google.monitoring.v3.NotificationChannel" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "CreateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.CreateNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async", - "title": "monitoring updateNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Updates a notification channel. Fields not specified in the field mask remain unchanged.", - "canonical": true, - "file": "notification_channel_service.update_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "notification_channel", - "type": ".google.monitoring.v3.NotificationChannel" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "UpdateNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.UpdateNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async", - "title": "monitoring deleteNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Deletes a notification channel.", - "canonical": true, - "file": "notification_channel_service.delete_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.DeleteNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "DeleteNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.DeleteNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async", - "title": "monitoring sendNotificationChannelVerificationCode Sample", - "origin": "API_DEFINITION", - "description": " Causes a verification code to be delivered to the channel. The code can then be supplied in `VerifyNotificationChannel` to verify the channel.", - "canonical": true, - "file": "notification_channel_service.send_notification_channel_verification_code.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SendNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "SendNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.SendNotificationChannelVerificationCode", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async", - "title": "monitoring getNotificationChannelVerificationCode Sample", - "origin": "API_DEFINITION", - "description": " Requests a verification code for an already verified channel that can then be used in a call to VerifyNotificationChannel() on a different channel with an equivalent identity in the same or in a different project. This makes it possible to copy a channel between projects without requiring manual reverification of the channel. If the channel is not in the verified state, this method will fail (in other words, this may only be used if the SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been used to put the given channel into the verified state). There is no guarantee that the verification codes returned by this method will be of a similar structure or form as the ones that are delivered to the channel via SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both the codes delivered via SendNotificationChannelVerificationCode() and returned from GetNotificationChannelVerificationCode(), it is typically the case that the verification codes delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter expiration (e.g. codes such as \"G-123456\") whereas GetVerificationCode() will typically return a much longer, websafe base 64 encoded string that has a longer expiration time.", - "canonical": true, - "file": "notification_channel_service.get_notification_channel_verification_code.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCode", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "expire_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.monitoring.v3.GetNotificationChannelVerificationCodeResponse", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "GetNotificationChannelVerificationCode", - "fullName": "google.monitoring.v3.NotificationChannelService.GetNotificationChannelVerificationCode", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async", - "title": "monitoring verifyNotificationChannel Sample", - "origin": "API_DEFINITION", - "description": " Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a result of calling `SendNotificationChannelVerificationCode`.", - "canonical": true, - "file": "notification_channel_service.verify_notification_channel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "VerifyNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.NotificationChannel", - "client": { - "shortName": "NotificationChannelServiceClient", - "fullName": "google.monitoring.v3.NotificationChannelServiceClient" - }, - "method": { - "shortName": "VerifyNotificationChannel", - "fullName": "google.monitoring.v3.NotificationChannelService.VerifyNotificationChannel", - "service": { - "shortName": "NotificationChannelService", - "fullName": "google.monitoring.v3.NotificationChannelService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_CreateService_async", - "title": "monitoring createService Sample", - "origin": "API_DEFINITION", - "description": " Create a `Service`.", - "canonical": true, - "file": "service_monitoring_service.create_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateService", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_id", - "type": "TYPE_STRING" - }, - { - "name": "service", - "type": ".google.monitoring.v3.Service" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "CreateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_GetService_async", - "title": "monitoring getService Sample", - "origin": "API_DEFINITION", - "description": " Get the named `Service`.", - "canonical": true, - "file": "service_monitoring_service.get_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "GetService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_ListServices_async", - "title": "monitoring listServices Sample", - "origin": "API_DEFINITION", - "description": " List `Service`s for this workspace.", - "canonical": true, - "file": "service_monitoring_service.list_services.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServices", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServices", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListServicesResponse", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "ListServices", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServices", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_UpdateService_async", - "title": "monitoring updateService Sample", - "origin": "API_DEFINITION", - "description": " Update this `Service`.", - "canonical": true, - "file": "service_monitoring_service.update_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateService", - "async": true, - "parameters": [ - { - "name": "service", - "type": ".google.monitoring.v3.Service" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.monitoring.v3.Service", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "UpdateService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_DeleteService_async", - "title": "monitoring deleteService Sample", - "origin": "API_DEFINITION", - "description": " Soft delete this `Service`.", - "canonical": true, - "file": "service_monitoring_service.delete_service.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteService", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "DeleteService", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteService", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async", - "title": "monitoring createServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Create a `ServiceLevelObjective` for the given `Service`.", - "canonical": true, - "file": "service_monitoring_service.create_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "service_level_objective_id", - "type": "TYPE_STRING" - }, - { - "name": "service_level_objective", - "type": ".google.monitoring.v3.ServiceLevelObjective" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "CreateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.CreateServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async", - "title": "monitoring getServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Get a `ServiceLevelObjective` by name.", - "canonical": true, - "file": "service_monitoring_service.get_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ServiceLevelObjective.View" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "GetServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.GetServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async", - "title": "monitoring listServiceLevelObjectives Sample", - "origin": "API_DEFINITION", - "description": " List the `ServiceLevelObjective`s for the given `Service`.", - "canonical": true, - "file": "service_monitoring_service.list_service_level_objectives.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServiceLevelObjectives", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectives", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.monitoring.v3.ServiceLevelObjective.View" - } - ], - "resultType": ".google.monitoring.v3.ListServiceLevelObjectivesResponse", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "ListServiceLevelObjectives", - "fullName": "google.monitoring.v3.ServiceMonitoringService.ListServiceLevelObjectives", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async", - "title": "monitoring updateServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Update the given `ServiceLevelObjective`.", - "canonical": true, - "file": "service_monitoring_service.update_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "service_level_objective", - "type": ".google.monitoring.v3.ServiceLevelObjective" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.monitoring.v3.ServiceLevelObjective", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "UpdateServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.UpdateServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async", - "title": "monitoring deleteServiceLevelObjective Sample", - "origin": "API_DEFINITION", - "description": " Delete the given `ServiceLevelObjective`.", - "canonical": true, - "file": "service_monitoring_service.delete_service_level_objective.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjective", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServiceMonitoringServiceClient", - "fullName": "google.monitoring.v3.ServiceMonitoringServiceClient" - }, - "method": { - "shortName": "DeleteServiceLevelObjective", - "fullName": "google.monitoring.v3.ServiceMonitoringService.DeleteServiceLevelObjective", - "service": { - "shortName": "ServiceMonitoringService", - "fullName": "google.monitoring.v3.ServiceMonitoringService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async", - "title": "monitoring listUptimeCheckConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists the existing valid Uptime check configurations for the project (leaving out any invalid configurations).", - "canonical": true, - "file": "uptime_check_service.list_uptime_check_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUptimeCheckConfigs", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListUptimeCheckConfigsResponse", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "ListUptimeCheckConfigs", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckConfigs", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async", - "title": "monitoring getUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a single Uptime check configuration.", - "canonical": true, - "file": "uptime_check_service.get_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "GetUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.GetUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async", - "title": "monitoring createUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Uptime check configuration.", - "canonical": true, - "file": "uptime_check_service.create_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "uptime_check_config", - "type": ".google.monitoring.v3.UptimeCheckConfig" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "CreateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.CreateUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async", - "title": "monitoring updateUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates an Uptime check configuration. You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via `updateMask`. Returns the updated configuration.", - "canonical": true, - "file": "uptime_check_service.update_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 69, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "uptime_check_config", - "type": ".google.monitoring.v3.UptimeCheckConfig" - } - ], - "resultType": ".google.monitoring.v3.UptimeCheckConfig", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "UpdateUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.UpdateUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async", - "title": "monitoring deleteUptimeCheckConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes an Uptime check configuration. Note that this method will fail if the Uptime check configuration is referenced by an alert policy or other dependent configs that would be rendered invalid by the deletion.", - "canonical": true, - "file": "uptime_check_service.delete_uptime_check_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "DeleteUptimeCheckConfig", - "fullName": "google.monitoring.v3.UptimeCheckService.DeleteUptimeCheckConfig", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - }, - { - "regionTag": "monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async", - "title": "monitoring listUptimeCheckIps Sample", - "origin": "API_DEFINITION", - "description": " Returns the list of IP addresses that checkers run from", - "canonical": true, - "file": "uptime_check_service.list_uptime_check_ips.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListUptimeCheckIps", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckIps", - "async": true, - "parameters": [ - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.monitoring.v3.ListUptimeCheckIpsResponse", - "client": { - "shortName": "UptimeCheckServiceClient", - "fullName": "google.monitoring.v3.UptimeCheckServiceClient" - }, - "method": { - "shortName": "ListUptimeCheckIps", - "fullName": "google.monitoring.v3.UptimeCheckService.ListUptimeCheckIps", - "service": { - "shortName": "UptimeCheckService", - "fullName": "google.monitoring.v3.UptimeCheckService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline deleted file mode 100644 index 71bedd61471f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.create_uptime_check_config.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, uptimeCheckConfig) { - // [START monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project in which to create the Uptime check. The format - * is `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * Required. The new Uptime check configuration. - */ - // const uptimeCheckConfig = {} - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callCreateUptimeCheckConfig() { - // Construct request - const request = { - parent, - uptimeCheckConfig, - }; - - // Run request - const response = await monitoringClient.createUptimeCheckConfig(request); - console.log(response); - } - - callCreateUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline deleted file mode 100644 index b48481e88b2c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.delete_uptime_check_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Uptime check configuration to delete. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callDeleteUptimeCheckConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.deleteUptimeCheckConfig(request); - console.log(response); - } - - callDeleteUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline deleted file mode 100644 index b1632faa65f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.get_uptime_check_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Uptime check configuration to retrieve. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. - */ - // const name = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callGetUptimeCheckConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await monitoringClient.getUptimeCheckConfig(request); - console.log(response); - } - - callGetUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline deleted file mode 100644 index 3df2513ed779..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_configs.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - */ - // const parent = 'abc123' - /** - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callListUptimeCheckConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = monitoringClient.listUptimeCheckConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUptimeCheckConfigs(); - // [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline deleted file mode 100644 index a81284fc33b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.list_uptime_check_ips.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - */ - // const pageSize = 1234 - /** - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - */ - // const pageToken = 'abc123' - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callListUptimeCheckIps() { - // Construct request - const request = { - }; - - // Run request - const iterable = monitoringClient.listUptimeCheckIpsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListUptimeCheckIps(); - // [END monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline deleted file mode 100644 index 8825be1c264d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/samples/generated/v3/uptime_check_service.update_uptime_check_config.js.baseline +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(uptimeCheckConfig) { - // [START monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. If present, only the listed fields in the current Uptime check - * configuration are updated with values from the new configuration. If this - * field is empty, then the current configuration is completely replaced with - * the new configuration. - */ - // const updateMask = {} - /** - * Required. If an `updateMask` has been specified, this field gives - * the values for the set of fields mentioned in the `updateMask`. If an - * `updateMask` has not been given, this Uptime check configuration replaces - * the current configuration. If a field is mentioned in `updateMask` but - * the corresonding field is omitted in this partial Uptime check - * configuration, it has the effect of deleting/clearing the field from the - * configuration on the server. - * The following fields can be updated: `display_name`, - * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - * `selected_regions`. - */ - // const uptimeCheckConfig = {} - - // Imports the Monitoring library - const {UptimeCheckServiceClient} = require('monitoring').v3; - - // Instantiates a client - const monitoringClient = new UptimeCheckServiceClient(); - - async function callUpdateUptimeCheckConfig() { - // Construct request - const request = { - uptimeCheckConfig, - }; - - // Run request - const response = await monitoringClient.updateUptimeCheckConfig(request); - console.log(response); - } - - callUpdateUptimeCheckConfig(); - // [END monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/index.ts.baseline deleted file mode 100644 index 73b0d989f697..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/index.ts.baseline +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2026 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. ** - -import * as v3 from './v3'; -const AlertPolicyServiceClient = v3.AlertPolicyServiceClient; -type AlertPolicyServiceClient = v3.AlertPolicyServiceClient; -const GroupServiceClient = v3.GroupServiceClient; -type GroupServiceClient = v3.GroupServiceClient; -const MetricServiceClient = v3.MetricServiceClient; -type MetricServiceClient = v3.MetricServiceClient; -const NotificationChannelServiceClient = v3.NotificationChannelServiceClient; -type NotificationChannelServiceClient = v3.NotificationChannelServiceClient; -const ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; -type ServiceMonitoringServiceClient = v3.ServiceMonitoringServiceClient; -const UptimeCheckServiceClient = v3.UptimeCheckServiceClient; -type UptimeCheckServiceClient = v3.UptimeCheckServiceClient; -export {v3, AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient}; -export default {v3, AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client.ts.baseline deleted file mode 100644 index 4d2292783aea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client.ts.baseline +++ /dev/null @@ -1,2059 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/alert_policy_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './alert_policy_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The AlertPolicyService API is used to manage (list, create, delete, - * edit) alert policies in Stackdriver Monitoring. An alerting policy is - * a description of the conditions under which some aspect of your - * system is considered to be "unhealthy" and the ways to notify - * people or services about this state. In addition to using this API, alert - * policies can also be managed through - * [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), - * which can be reached by clicking the "Monitoring" tab in - * [Cloud Console](https://console.cloud.google.com/). - * @class - * @memberof v3 - */ -export class AlertPolicyServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - alertPolicyServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AlertPolicyServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 AlertPolicyServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AlertPolicyServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listAlertPolicies: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'alertPolicies') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.AlertPolicyService', gapicConfig as gax.ClientConfig, - 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.alertPolicyServiceStub) { - return this.alertPolicyServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.AlertPolicyService. - this.alertPolicyServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.AlertPolicyService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.AlertPolicyService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const alertPolicyServiceStubMethods = - ['listAlertPolicies', 'getAlertPolicy', 'createAlertPolicy', 'deleteAlertPolicy', 'updateAlertPolicy']; - for (const methodName of alertPolicyServiceStubMethods) { - const callPromise = this.alertPolicyServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.alertPolicyServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to retrieve. The format is - * - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.get_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_GetAlertPolicy_async - */ - getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>; - getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAlertPolicy( - request: protos.google.monitoring.v3.IGetAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - getAlertPolicy( - request?: protos.google.monitoring.v3.IGetAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IGetAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project in which to create the alerting policy. The format is - * `projects/[PROJECT_ID]`. - * - * Note that this field names the parent container in which the alerting - * policy will be written, not the name of the created policy. The alerting - * policy that is returned will have a name that contains a normalized - * representation of this name as a prefix but adds a suffix of the form - * `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The requested alerting policy. You should omit the `name` field in this - * policy. The name will be returned in the new policy, including - * a new [ALERT_POLICY_ID] value. - * @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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.create_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_CreateAlertPolicy_async - */ - createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>; - createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAlertPolicy( - request: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - createAlertPolicy( - request?: protos.google.monitoring.v3.ICreateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.ICreateAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('createAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The alerting policy to delete. The format is: - * - * projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] - * - * For more information, see {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.delete_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_DeleteAlertPolicy_async - */ - deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>; - deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAlertPolicy( - request: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - deleteAlertPolicy( - request?: protos.google.monitoring.v3.IDeleteAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an alerting policy. You can either replace the entire policy with - * a new one or replace only certain fields in the current alerting policy by - * specifying the fields to be updated via `updateMask`. Returns the - * updated alerting policy. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. A list of alerting policy field names. If this field is not - * empty, each listed field in the existing alerting policy is set to the - * value of the corresponding field in the supplied policy (`alert_policy`), - * or to the field's default value if the field is not in the supplied - * alerting policy. Fields not listed retain their previous value. - * - * Examples of valid field masks include `display_name`, `documentation`, - * `documentation.content`, `documentation.mime_type`, `user_labels`, - * `user_label.nameofkey`, `enabled`, `conditions`, `combiner`, etc. - * - * If this field is empty, then the supplied alerting policy replaces the - * existing policy. It is the same as deleting the existing policy and - * adding the supplied policy, except for the following: - * - * + The new policy will have the same `[ALERT_POLICY_ID]` as the former - * policy. This gives you continuity with the former policy in your - * notifications and incidents. - * + Conditions in the new policy will keep their former `[CONDITION_ID]` if - * the supplied condition includes the `name` field with that - * `[CONDITION_ID]`. If the supplied condition omits the `name` field, - * then a new `[CONDITION_ID]` is created. - * @param {google.monitoring.v3.AlertPolicy} request.alertPolicy - * Required. The updated alerting policy or the updated values for the - * fields listed in `update_mask`. - * If `update_mask` is not empty, any fields in this policy that are - * not in `update_mask` are ignored. - * @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 {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/alert_policy_service.update_alert_policy.js - * region_tag:monitoring_v3_generated_AlertPolicyService_UpdateAlertPolicy_async - */ - updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>; - updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAlertPolicy( - request: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - callback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): void; - updateAlertPolicy( - request?: protos.google.monitoring.v3.IUpdateAlertPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'alert_policy.name': request.alertPolicy!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAlertPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAlertPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateAlertPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IAlertPolicy, - protos.google.monitoring.v3.IUpdateAlertPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAlertPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing alerting policies for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.AlertPolicy|AlertPolicy}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listAlertPoliciesAsync()` - * 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. - */ - listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>; - listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; - listAlertPolicies( - request: protos.google.monitoring.v3.IListAlertPoliciesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): void; - listAlertPolicies( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>): - Promise<[ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListAlertPoliciesRequest, - protos.google.monitoring.v3.IListAlertPoliciesResponse|null|undefined, - protos.google.monitoring.v3.IAlertPolicy>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listAlertPolicies values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listAlertPolicies request %j', request); - return this.innerApiCalls - .listAlertPolicies(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IAlertPolicy[], - protos.google.monitoring.v3.IListAlertPoliciesRequest|null, - protos.google.monitoring.v3.IListAlertPoliciesResponse - ]) => { - this._log.info('listAlertPolicies values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listAlertPolicies`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.AlertPolicy|AlertPolicy} 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 `listAlertPoliciesAsync()` - * 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. - */ - listAlertPoliciesStream( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listAlertPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listAlertPolicies stream %j', request); - return this.descriptors.page.listAlertPolicies.createStream( - this.innerApiCalls.listAlertPolicies as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAlertPolicies`, 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.name - * Required. The project whose alert policies are to be listed. The format is - * - * projects/[PROJECT_ID] - * - * Note that this field names the parent container in which the alerting - * policies to be listed are stored. To retrieve a single alerting policy - * by name, use the - * {@link protos.google.monitoring.v3.AlertPolicyService.GetAlertPolicy|GetAlertPolicy} - * operation, instead. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * alert policies to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of field references as the `filter` field. Entries can be - * prefixed with a minus sign to sort by the field in descending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.AlertPolicy|AlertPolicy}. 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 include:samples/generated/v3/alert_policy_service.list_alert_policies.js - * region_tag:monitoring_v3_generated_AlertPolicyService_ListAlertPolicies_async - */ - listAlertPoliciesAsync( - request?: protos.google.monitoring.v3.IListAlertPoliciesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listAlertPolicies']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listAlertPolicies iterate %j', request); - return this.descriptors.page.listAlertPolicies.asyncIterate( - this.innerApiCalls['listAlertPolicies'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.alertPolicyServiceStub && !this._terminated) { - return this.alertPolicyServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client_config.json.baseline deleted file mode 100644 index 5c3935f3cf30..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.AlertPolicyService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListAlertPolicies": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateAlertPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/alert_policy_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client.ts.baseline deleted file mode 100644 index 0d118b5941c2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client.ts.baseline +++ /dev/null @@ -1,2259 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/group_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './group_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Group API lets you inspect and manage your - * [groups](#google.monitoring.v3.Group). - * - * A group is a named filter that is used to identify - * a collection of monitored resources. Groups are typically used to - * mirror the physical and/or logical topology of the environment. - * Because group membership is computed dynamically, monitored - * resources that are started in the future are automatically placed - * in matching groups. By using a group to name monitored resources in, - * for example, an alert policy, the target of that alert policy is - * updated automatically as monitored resources are added and removed - * from the infrastructure. - * @class - * @memberof v3 - */ -export class GroupServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - groupServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GroupServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 GroupServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GroupServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listGroups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'group'), - listGroupMembers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'members') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.GroupService', gapicConfig as gax.ClientConfig, - 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.groupServiceStub) { - return this.groupServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.GroupService. - this.groupServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.GroupService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.GroupService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const groupServiceStubMethods = - ['listGroups', 'getGroup', 'createGroup', 'updateGroup', 'deleteGroup', 'listGroupMembers']; - for (const methodName of groupServiceStubMethods) { - const callPromise = this.groupServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.groupServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to retrieve. The format is - * `"projects/{project_id_or_number}/groups/{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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.get_group.js - * region_tag:monitoring_v3_generated_GroupService_GetGroup_async - */ - getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>; - getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request: protos.google.monitoring.v3.IGetGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): void; - getGroup( - request?: protos.google.monitoring.v3.IGetGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGroup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IGetGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project in which to create the group. The format is - * `"projects/{project_id_or_number}"`. - * @param {google.monitoring.v3.Group} request.group - * Required. A group definition. It is an error to define the `name` field because - * the system assigns the name. - * @param {boolean} request.validateOnly - * If true, validate this request but do not create the 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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.create_group.js - * region_tag:monitoring_v3_generated_GroupService_CreateGroup_async - */ - createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>; - createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; - createGroup( - request: protos.google.monitoring.v3.ICreateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): void; - createGroup( - request?: protos.google.monitoring.v3.ICreateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createGroup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.ICreateGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('createGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an existing group. - * You can change any group attributes except `name`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Group} request.group - * Required. The new definition of the group. All fields of the existing group, - * excepting `name`, are replaced with the corresponding fields of this group. - * @param {boolean} request.validateOnly - * If true, validate this request but do not update the existing 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 {@link protos.google.monitoring.v3.Group|Group}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.update_group.js - * region_tag:monitoring_v3_generated_GroupService_UpdateGroup_async - */ - updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>; - updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; - updateGroup( - request: protos.google.monitoring.v3.IUpdateGroupRequest, - callback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): void; - updateGroup( - request?: protos.google.monitoring.v3.IUpdateGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'group.name': request.group!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGroup request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGroup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGroup, - protos.google.monitoring.v3.IUpdateGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an existing group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group to delete. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {boolean} request.recursive - * If this field is true, then the request means to delete a group with all - * its descendants. Otherwise, the request means to delete a group only when - * it has no descendants. The default value is false. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/group_service.delete_group.js - * region_tag:monitoring_v3_generated_GroupService_DeleteGroup_async - */ - deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>; - deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request: protos.google.monitoring.v3.IDeleteGroupRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): void; - deleteGroup( - request?: protos.google.monitoring.v3.IDeleteGroupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteGroup request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteGroup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteGroup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteGroupRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteGroup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing groups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.Group|Group}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupsAsync()` - * 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. - */ - listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>; - listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; - listGroups( - request: protos.google.monitoring.v3.IListGroupsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): void; - listGroups( - request?: protos.google.monitoring.v3.IListGroupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>): - Promise<[ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupsRequest, - protos.google.monitoring.v3.IListGroupsResponse|null|undefined, - protos.google.monitoring.v3.IGroup>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGroups values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listGroups request %j', request); - return this.innerApiCalls - .listGroups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IGroup[], - protos.google.monitoring.v3.IListGroupsRequest|null, - protos.google.monitoring.v3.IListGroupsResponse - ]) => { - this._log.info('listGroups values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGroups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Group|Group} 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 `listGroupsAsync()` - * 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. - */ - listGroupsStream( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroups stream %j', request); - return this.descriptors.page.listGroups.createStream( - this.innerApiCalls.listGroups as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGroups`, 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.name - * Required. The project whose groups are to be listed. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.childrenOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups whose `parentName` field contains the group - * name. If no groups have this parent, the results are empty. - * @param {string} request.ancestorsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns groups that are ancestors of the specified group. - * The groups are returned in order, starting with the immediate parent and - * ending with the most distant ancestor. If the specified group has no - * immediate parent, the results are empty. - * @param {string} request.descendantsOfGroup - * A group name: `"projects/{project_id_or_number}/groups/{group_id}"`. - * Returns the descendants of the specified group. This is a superset of - * the results returned by the `childrenOfGroup` filter, and includes - * children-of-children, and so forth. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Group|Group}. 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 include:samples/generated/v3/group_service.list_groups.js - * region_tag:monitoring_v3_generated_GroupService_ListGroups_async - */ - listGroupsAsync( - request?: protos.google.monitoring.v3.IListGroupsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroups iterate %j', request); - return this.descriptors.page.listGroups.asyncIterate( - this.innerApiCalls['listGroups'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the monitored resources that are members of a group. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute 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 Array of {@link protos.google.api.MonitoredResource|MonitoredResource}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGroupMembersAsync()` - * 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. - */ - listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>; - listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; - listGroupMembers( - request: protos.google.monitoring.v3.IListGroupMembersRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): void; - listGroupMembers( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>): - Promise<[ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListGroupMembersRequest, - protos.google.monitoring.v3.IListGroupMembersResponse|null|undefined, - protos.google.api.IMonitoredResource>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGroupMembers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listGroupMembers request %j', request); - return this.innerApiCalls - .listGroupMembers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResource[], - protos.google.monitoring.v3.IListGroupMembersRequest|null, - protos.google.monitoring.v3.IListGroupMembersResponse - ]) => { - this._log.info('listGroupMembers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGroupMembers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute 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 {@link protos.google.api.MonitoredResource|MonitoredResource} 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 `listGroupMembersAsync()` - * 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. - */ - listGroupMembersStream( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroupMembers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroupMembers stream %j', request); - return this.descriptors.page.listGroupMembers.createStream( - this.innerApiCalls.listGroupMembers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGroupMembers`, 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.name - * Required. The group whose members are listed. The format is - * `"projects/{project_id_or_number}/groups/{group_id}"`. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {string} request.filter - * An optional [list filter](/monitoring/api/learn_more#filtering) describing - * the members to be returned. The filter may reference the type, labels, and - * metadata of monitored resources that comprise the group. - * For example, to return only resources representing Compute Engine VM - * instances, use this filter: - * - * resource.type = "gce_instance" - * @param {google.monitoring.v3.TimeInterval} request.interval - * An optional time interval for which results should be returned. Only - * members that were part of the group during the specified interval are - * included in the response. If no interval is provided then the group - * membership over the last minute is returned. - * @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.api.MonitoredResource|MonitoredResource}. 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 include:samples/generated/v3/group_service.list_group_members.js - * region_tag:monitoring_v3_generated_GroupService_ListGroupMembers_async - */ - listGroupMembersAsync( - request?: protos.google.monitoring.v3.IListGroupMembersRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listGroupMembers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGroupMembers iterate %j', request); - return this.descriptors.page.listGroupMembers.asyncIterate( - this.innerApiCalls['listGroupMembers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.groupServiceStub && !this._terminated) { - return this.groupServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client_config.json.baseline deleted file mode 100644 index e63f2afe355b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.GroupService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListGroups": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGroup": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGroupMembers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/group_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/index.ts.baseline deleted file mode 100644 index aecf31897ee2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {AlertPolicyServiceClient} from './alert_policy_service_client'; -export {GroupServiceClient} from './group_service_client'; -export {MetricServiceClient} from './metric_service_client'; -export {NotificationChannelServiceClient} from './notification_channel_service_client'; -export {ServiceMonitoringServiceClient} from './service_monitoring_service_client'; -export {UptimeCheckServiceClient} from './uptime_check_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client.ts.baseline deleted file mode 100644 index ada6e2431f51..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client.ts.baseline +++ /dev/null @@ -1,2840 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/metric_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './metric_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Manages metric descriptors, monitored resource descriptors, and - * time series data. - * @class - * @memberof v3 - */ -export class MetricServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - metricServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MetricServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 MetricServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MetricServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/metricDescriptors/{metric_descriptor=**}' - ), - folderMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/metricDescriptors/{metric_descriptor=**}' - ), - organizationMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectMetricDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/metricDescriptors/{metric_descriptor=**}' - ), - projectMonitoredResourceDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/monitoredResourceDescriptors/{monitored_resource_descriptor}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listMonitoredResourceDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), - listMetricDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metricDescriptors'), - listTimeSeries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'timeSeries') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.MetricService', gapicConfig as gax.ClientConfig, - 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.metricServiceStub) { - return this.metricServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.MetricService. - this.metricServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.MetricService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.MetricService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const metricServiceStubMethods = - ['listMonitoredResourceDescriptors', 'getMonitoredResourceDescriptor', 'listMetricDescriptors', 'getMetricDescriptor', 'createMetricDescriptor', 'deleteMetricDescriptor', 'listTimeSeries', 'createTimeSeries']; - for (const methodName of metricServiceStubMethods) { - const callPromise = this.metricServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.metricServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read', - 'https://www.googleapis.com/auth/monitoring.write' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single monitored resource descriptor. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The monitored resource descriptor to get. The format is - * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. - * The `{resource_type}` is a predefined type, such as - * `cloudsql_database`. - * @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 {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_monitored_resource_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMonitoredResourceDescriptor_async - */ - getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>; - getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMonitoredResourceDescriptor( - request: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - callback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMonitoredResourceDescriptor( - request?: protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getMonitoredResourceDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getMonitoredResourceDescriptor response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getMonitoredResourceDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMonitoredResourceDescriptor, - protos.google.monitoring.v3.IGetMonitoredResourceDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMonitoredResourceDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a single metric descriptor. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example value of `{metric_id}` is - * `"compute.googleapis.com/instance/disk/read_bytes_count"`. - * @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 {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.get_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_GetMetricDescriptor_async - */ - getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>; - getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMetricDescriptor( - request: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getMetricDescriptor( - request?: protos.google.monitoring.v3.IGetMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.IGetMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new metric descriptor. - * User-created metric descriptors define - * [custom metrics](/monitoring/custom-metrics). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {google.api.MetricDescriptor} request.metricDescriptor - * Required. The new [custom metric](/monitoring/custom-metrics) - * descriptor. - * @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 {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_CreateMetricDescriptor_async - */ - createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>; - createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - createMetricDescriptor( - request: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - callback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - createMetricDescriptor( - request?: protos.google.monitoring.v3.ICreateMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IMetricDescriptor, - protos.google.monitoring.v3.ICreateMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('createMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a metric descriptor. Only user-created - * [custom metrics](/monitoring/custom-metrics) can be deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The metric descriptor on which to execute the request. The format is - * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. - * An example of `{metric_id}` is: - * `"custom.googleapis.com/my_test_metric"`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.delete_metric_descriptor.js - * region_tag:monitoring_v3_generated_MetricService_DeleteMetricDescriptor_async - */ - deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>; - deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - deleteMetricDescriptor( - request: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): void; - deleteMetricDescriptor( - request?: protos.google.monitoring.v3.IDeleteMetricDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteMetricDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteMetricDescriptor response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteMetricDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteMetricDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteMetricDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates or adds data to one or more time series. - * The response is empty if all time series in the request were written. - * If any time series could not be written, a corresponding failure message is - * included in the error response. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {number[]} request.timeSeries - * Required. The new data to be added to a list of time series. - * Adds at most one data point to each of several time series. The new data - * point must be more recent than any other point in its time series. Each - * `TimeSeries` value must fully specify a unique time series by supplying - * all label values for the metric and the monitored resource. - * - * The maximum number of `TimeSeries` objects per `Create` request is 200. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/metric_service.create_time_series.js - * region_tag:monitoring_v3_generated_MetricService_CreateTimeSeries_async - */ - createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>; - createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; - createTimeSeries( - request: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): void; - createTimeSeries( - request?: protos.google.monitoring.v3.ICreateTimeSeriesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createTimeSeries request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createTimeSeries response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createTimeSeries(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ICreateTimeSeriesRequest|undefined, - {}|undefined - ]) => { - this._log.info('createTimeSeries response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists monitored resource descriptors that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>; - listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): void; - listMonitoredResourceDescriptors( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>): - Promise<[ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse|null|undefined, - protos.google.api.IMonitoredResourceDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMonitoredResourceDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listMonitoredResourceDescriptors request %j', request); - return this.innerApiCalls - .listMonitoredResourceDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMonitoredResourceDescriptor[], - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest|null, - protos.google.monitoring.v3.IListMonitoredResourceDescriptorsResponse - ]) => { - this._log.info('listMonitoredResourceDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} 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 `listMonitoredResourceDescriptorsAsync()` - * 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. - */ - listMonitoredResourceDescriptorsStream( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors stream %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.createStream( - this.innerApiCalls.listMonitoredResourceDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMonitoredResourceDescriptors`, 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.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * An optional [filter](/monitoring/api/v3/filters) describing - * the descriptors to be returned. The filter can reference - * the descriptor's type and labels. For example, the - * following filter returns only Google Compute Engine descriptors - * that have an `id` label: - * - * resource.type = starts_with("gce_") AND resource.label:id - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. 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 include:samples/generated/v3/metric_service.list_monitored_resource_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMonitoredResourceDescriptors_async - */ - listMonitoredResourceDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMonitoredResourceDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMonitoredResourceDescriptors iterate %j', request); - return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate( - this.innerApiCalls['listMonitoredResourceDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists metric descriptors that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.api.MetricDescriptor|MetricDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listMetricDescriptorsAsync()` - * 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. - */ - listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>; - listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; - listMetricDescriptors( - request: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): void; - listMetricDescriptors( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>): - Promise<[ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListMetricDescriptorsRequest, - protos.google.monitoring.v3.IListMetricDescriptorsResponse|null|undefined, - protos.google.api.IMetricDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listMetricDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listMetricDescriptors request %j', request); - return this.innerApiCalls - .listMetricDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.api.IMetricDescriptor[], - protos.google.monitoring.v3.IListMetricDescriptorsRequest|null, - protos.google.monitoring.v3.IListMetricDescriptorsResponse - ]) => { - this._log.info('listMetricDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listMetricDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MetricDescriptor|MetricDescriptor} 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 `listMetricDescriptorsAsync()` - * 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. - */ - listMetricDescriptorsStream( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMetricDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMetricDescriptors stream %j', request); - return this.descriptors.page.listMetricDescriptors.createStream( - this.innerApiCalls.listMetricDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listMetricDescriptors`, 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.name - * Required. The project on which to execute the request. The format is - * `"projects/{project_id_or_number}"`. - * @param {string} request.filter - * If this field is empty, all custom and - * system-defined metric descriptors are returned. - * Otherwise, the [filter](/monitoring/api/v3/filters) - * specifies which metric descriptors are to be - * returned. For example, the following filter matches all - * [custom metrics](/monitoring/custom-metrics): - * - * metric.type = starts_with("custom.googleapis.com/") - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.api.MetricDescriptor|MetricDescriptor}. 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 include:samples/generated/v3/metric_service.list_metric_descriptors.js - * region_tag:monitoring_v3_generated_MetricService_ListMetricDescriptors_async - */ - listMetricDescriptorsAsync( - request?: protos.google.monitoring.v3.IListMetricDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listMetricDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listMetricDescriptors iterate %j', request); - return this.descriptors.page.listMetricDescriptors.asyncIterate( - this.innerApiCalls['listMetricDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists time series that match a filter. This method does not require a Stackdriver account. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.TimeSeries|TimeSeries}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTimeSeriesAsync()` - * 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. - */ - listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>; - listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; - listTimeSeries( - request: protos.google.monitoring.v3.IListTimeSeriesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): void; - listTimeSeries( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>): - Promise<[ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListTimeSeriesRequest, - protos.google.monitoring.v3.IListTimeSeriesResponse|null|undefined, - protos.google.monitoring.v3.ITimeSeries>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTimeSeries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTimeSeries request %j', request); - return this.innerApiCalls - .listTimeSeries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.ITimeSeries[], - protos.google.monitoring.v3.IListTimeSeriesRequest|null, - protos.google.monitoring.v3.IListTimeSeriesResponse - ]) => { - this._log.info('listTimeSeries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTimeSeries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.TimeSeries|TimeSeries} 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 `listTimeSeriesAsync()` - * 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. - */ - listTimeSeriesStream( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listTimeSeries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTimeSeries stream %j', request); - return this.descriptors.page.listTimeSeries.createStream( - this.innerApiCalls.listTimeSeries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTimeSeries`, 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.name - * Required. The project on which to execute the request. The format is - * "projects/{project_id_or_number}". - * @param {string} request.filter - * Required. A [monitoring filter](/monitoring/api/v3/filters) that specifies which time - * series should be returned. The filter must specify a single metric type, - * and can additionally specify metric labels and other information. For - * example: - * - * metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND - * metric.labels.instance_name = "my-instance-name" - * @param {google.monitoring.v3.TimeInterval} request.interval - * Required. The time interval for which results should be returned. Only time series - * that contain data points in the specified interval are included - * in the response. - * @param {google.monitoring.v3.Aggregation} request.aggregation - * Specifies the alignment of data points in individual time series as - * well as how to combine the retrieved time series across specified labels. - * - * By default (if no `aggregation` is explicitly specified), the raw time - * series data is returned. - * @param {string} request.orderBy - * Unsupported: must be left blank. The points in each time series are - * currently returned in reverse time order (most recent to oldest). - * @param {google.monitoring.v3.ListTimeSeriesRequest.TimeSeriesView} request.view - * Required. Specifies which information is returned about the time series. - * @param {number} request.pageSize - * A positive number that is the maximum number of results to return. If - * `page_size` is empty or more than 100,000 results, the effective - * `page_size` is 100,000 results. If `view` is set to `FULL`, this is the - * maximum number of `Points` returned. If `view` is set to `HEADERS`, this is - * the maximum number of `TimeSeries` returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.TimeSeries|TimeSeries}. 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 include:samples/generated/v3/metric_service.list_time_series.js - * region_tag:monitoring_v3_generated_MetricService_ListTimeSeries_async - */ - listTimeSeriesAsync( - request?: protos.google.monitoring.v3.IListTimeSeriesRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listTimeSeries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTimeSeries iterate %j', request); - return this.descriptors.page.listTimeSeries.asyncIterate( - this.innerApiCalls['listTimeSeries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderMetricDescriptor resource name string. - * - * @param {string} folder - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - folderMetricDescriptorPath(folder:string,metricDescriptor:string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.render({ - folder: folder, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the folder from FolderMetricDescriptor resource. - * - * @param {string} folderMetricDescriptorName - * A fully-qualified path representing folder_metric_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).folder; - } - - /** - * Parse the metric_descriptor from FolderMetricDescriptor resource. - * - * @param {string} folderMetricDescriptorName - * A fully-qualified path representing folder_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromFolderMetricDescriptorName(folderMetricDescriptorName: string) { - return this.pathTemplates.folderMetricDescriptorPathTemplate.match(folderMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified folderMonitoredResourceDescriptor resource name string. - * - * @param {string} folder - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - folderMonitoredResourceDescriptorPath(folder:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render({ - folder: folder, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the folder from FolderMonitoredResourceDescriptor resource. - * - * @param {string} folderMonitoredResourceDescriptorName - * A fully-qualified path representing folder_monitored_resource_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).folder; - } - - /** - * Parse the monitored_resource_descriptor from FolderMonitoredResourceDescriptor resource. - * - * @param {string} folderMonitoredResourceDescriptorName - * A fully-qualified path representing folder_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(folderMonitoredResourceDescriptorName: string) { - return this.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match(folderMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationMetricDescriptor resource name string. - * - * @param {string} organization - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - organizationMetricDescriptorPath(organization:string,metricDescriptor:string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.render({ - organization: organization, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the organization from OrganizationMetricDescriptor resource. - * - * @param {string} organizationMetricDescriptorName - * A fully-qualified path representing organization_metric_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).organization; - } - - /** - * Parse the metric_descriptor from OrganizationMetricDescriptor resource. - * - * @param {string} organizationMetricDescriptorName - * A fully-qualified path representing organization_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromOrganizationMetricDescriptorName(organizationMetricDescriptorName: string) { - return this.pathTemplates.organizationMetricDescriptorPathTemplate.match(organizationMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified organizationMonitoredResourceDescriptor resource name string. - * - * @param {string} organization - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - organizationMonitoredResourceDescriptorPath(organization:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render({ - organization: organization, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the organization from OrganizationMonitoredResourceDescriptor resource. - * - * @param {string} organizationMonitoredResourceDescriptorName - * A fully-qualified path representing organization_monitored_resource_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).organization; - } - - /** - * Parse the monitored_resource_descriptor from OrganizationMonitoredResourceDescriptor resource. - * - * @param {string} organizationMonitoredResourceDescriptorName - * A fully-qualified path representing organization_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(organizationMonitoredResourceDescriptorName: string) { - return this.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match(organizationMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectMetricDescriptor resource name string. - * - * @param {string} project - * @param {string} metric_descriptor - * @returns {string} Resource name string. - */ - projectMetricDescriptorPath(project:string,metricDescriptor:string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.render({ - project: project, - metric_descriptor: metricDescriptor, - }); - } - - /** - * Parse the project from ProjectMetricDescriptor resource. - * - * @param {string} projectMetricDescriptorName - * A fully-qualified path representing project_metric_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).project; - } - - /** - * Parse the metric_descriptor from ProjectMetricDescriptor resource. - * - * @param {string} projectMetricDescriptorName - * A fully-qualified path representing project_metric_descriptor resource. - * @returns {string} A string representing the metric_descriptor. - */ - matchMetricDescriptorFromProjectMetricDescriptorName(projectMetricDescriptorName: string) { - return this.pathTemplates.projectMetricDescriptorPathTemplate.match(projectMetricDescriptorName).metric_descriptor; - } - - /** - * Return a fully-qualified projectMonitoredResourceDescriptor resource name string. - * - * @param {string} project - * @param {string} monitored_resource_descriptor - * @returns {string} Resource name string. - */ - projectMonitoredResourceDescriptorPath(project:string,monitoredResourceDescriptor:string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render({ - project: project, - monitored_resource_descriptor: monitoredResourceDescriptor, - }); - } - - /** - * Parse the project from ProjectMonitoredResourceDescriptor resource. - * - * @param {string} projectMonitoredResourceDescriptorName - * A fully-qualified path representing project_monitored_resource_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).project; - } - - /** - * Parse the monitored_resource_descriptor from ProjectMonitoredResourceDescriptor resource. - * - * @param {string} projectMonitoredResourceDescriptorName - * A fully-qualified path representing project_monitored_resource_descriptor resource. - * @returns {string} A string representing the monitored_resource_descriptor. - */ - matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(projectMonitoredResourceDescriptorName: string) { - return this.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match(projectMonitoredResourceDescriptorName).monitored_resource_descriptor; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.metricServiceStub && !this._terminated) { - return this.metricServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client_config.json.baseline deleted file mode 100644 index c1826e96c804..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.MetricService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMonitoredResourceDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetMonitoredResourceDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListMetricDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMetricDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTimeSeries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTimeSeries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/metric_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client.ts.baseline deleted file mode 100644 index 09b5f8ce54ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client.ts.baseline +++ /dev/null @@ -1,2685 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/notification_channel_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './notification_channel_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Notification Channel API provides access to configuration that - * controls how messages related to incidents are sent. - * @class - * @memberof v3 - */ -export class NotificationChannelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - notificationChannelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of NotificationChannelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 NotificationChannelServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NotificationChannelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listNotificationChannelDescriptors: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'channelDescriptors'), - listNotificationChannels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'notificationChannels') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.NotificationChannelService', gapicConfig as gax.ClientConfig, - 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.notificationChannelServiceStub) { - return this.notificationChannelServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.NotificationChannelService. - this.notificationChannelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.NotificationChannelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.NotificationChannelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const notificationChannelServiceStubMethods = - ['listNotificationChannelDescriptors', 'getNotificationChannelDescriptor', 'listNotificationChannels', 'getNotificationChannel', 'createNotificationChannel', 'updateNotificationChannel', 'deleteNotificationChannel', 'sendNotificationChannelVerificationCode', 'getNotificationChannelVerificationCode', 'verifyNotificationChannel']; - for (const methodName of notificationChannelServiceStubMethods) { - const callPromise = this.notificationChannelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.notificationChannelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single channel descriptor. The descriptor indicates which fields - * are expected / permitted for a notification channel of the given type. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel type for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. - * @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 {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_descriptor.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelDescriptor_async - */ - getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>; - getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelDescriptor( - request: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelDescriptor( - request?: protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannelDescriptor request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelDescriptor response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getNotificationChannelDescriptor(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor, - protos.google.monitoring.v3.IGetNotificationChannelDescriptorRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannelDescriptor response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a single notification channel. The channel includes the relevant - * configuration details with which the channel was created. However, the - * response may truncate or omit passwords, API keys, or other private key - * matter and thus the response may not be 100% identical to the information - * that was supplied in the call to the create method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannel_async - */ - getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>; - getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannel( - request: protos.google.monitoring.v3.IGetNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannel( - request?: protos.google.monitoring.v3.IGetNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IGetNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new notification channel, representing a single notification - * endpoint such as an email address, SMS number, or PagerDuty service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is: - * - * projects/[PROJECT_ID] - * - * Note that this names the container into which the channel will be - * written. This does not name the newly created channel. The resulting - * channel's name will have a normalized version of this field as a prefix, - * but will add `/notificationChannels/[CHANNEL_ID]` to identify the channel. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. The definition of the `NotificationChannel` 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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.create_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_CreateNotificationChannel_async - */ - createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>; - createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - createNotificationChannel( - request: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - createNotificationChannel( - request?: protos.google.monitoring.v3.ICreateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.ICreateNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('createNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a notification channel. Fields not specified in the field mask - * remain unchanged. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * The fields to update. - * @param {google.monitoring.v3.NotificationChannel} request.notificationChannel - * Required. A description of the changes to be applied to the specified - * notification channel. The description must provide a definition for - * fields to be updated; the names of these fields should also be - * included in the `update_mask`. - * @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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.update_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_UpdateNotificationChannel_async - */ - updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>; - updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationChannel( - request: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - updateNotificationChannel( - request?: protos.google.monitoring.v3.IUpdateNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'notification_channel.name': request.notificationChannel!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IUpdateNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a notification channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The channel for which to execute the request. The format is - * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. - * @param {boolean} request.force - * If true, the notification channel will be deleted regardless of its - * use in alert policies (the policies will be updated to remove the - * channel). If false, channels that are still referenced by an existing - * alerting policy will fail to be deleted in a delete operation. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.delete_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_DeleteNotificationChannel_async - */ - deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>; - deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationChannel( - request: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - deleteNotificationChannel( - request?: protos.google.monitoring.v3.IDeleteNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Causes a verification code to be delivered to the channel. The code - * can then be supplied in `VerifyNotificationChannel` to verify the channel. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to which to send a verification code. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.send_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_SendNotificationChannelVerificationCode_async - */ - sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; - sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - sendNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - sendNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('sendNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('sendNotificationChannelVerificationCode response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.sendNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.ISendNotificationChannelVerificationCodeRequest|undefined, - {}|undefined - ]) => { - this._log.info('sendNotificationChannelVerificationCode response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Requests a verification code for an already verified channel that can then - * be used in a call to VerifyNotificationChannel() on a different channel - * with an equivalent identity in the same or in a different project. This - * makes it possible to copy a channel between projects without requiring - * manual reverification of the channel. If the channel is not in the - * verified state, this method will fail (in other words, this may only be - * used if the SendNotificationChannelVerificationCode and - * VerifyNotificationChannel paths have already been used to put the given - * channel into the verified state). - * - * There is no guarantee that the verification codes returned by this method - * will be of a similar structure or form as the ones that are delivered - * to the channel via SendNotificationChannelVerificationCode; while - * VerifyNotificationChannel() will recognize both the codes delivered via - * SendNotificationChannelVerificationCode() and returned from - * GetNotificationChannelVerificationCode(), it is typically the case that - * the verification codes delivered via - * SendNotificationChannelVerificationCode() will be shorter and also - * have a shorter expiration (e.g. codes such as "G-123456") whereas - * GetVerificationCode() will typically return a much longer, websafe base - * 64 encoded string that has a longer expiration time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel for which a verification code is to be generated - * and retrieved. This must name a channel that is already verified; if - * the specified channel is not verified, the request will fail. - * @param {google.protobuf.Timestamp} request.expireTime - * The desired expiration time. If specified, the API will guarantee that - * the returned code will not be valid after the specified timestamp; - * however, the API cannot guarantee that the returned code will be - * valid for at least as long as the requested time (the API puts an upper - * bound on the amount of time for which a code may be valid). If omitted, - * a default expiration will be used, which may be less than the max - * permissible expiration (so specifying an expiration may extend the - * code's lifetime over omitting an expiration, even though the API does - * impose an upper limit on the maximum expiration that is permitted). - * @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 {@link protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse|GetNotificationChannelVerificationCodeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.get_notification_channel_verification_code.js - * region_tag:monitoring_v3_generated_NotificationChannelService_GetNotificationChannelVerificationCode_async - */ - getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>; - getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelVerificationCode( - request: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - callback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): void; - getNotificationChannelVerificationCode( - request?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getNotificationChannelVerificationCode request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getNotificationChannelVerificationCode response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getNotificationChannelVerificationCode(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse, - protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getNotificationChannelVerificationCode response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Verifies a `NotificationChannel` by proving receipt of the code - * delivered to the channel as a result of calling - * `SendNotificationChannelVerificationCode`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The notification channel to verify. - * @param {string} request.code - * Required. The verification code that was delivered to the channel as - * a result of invoking the `SendNotificationChannelVerificationCode` API - * method or that was retrieved from a verified channel via - * `GetNotificationChannelVerificationCode`. For example, one might have - * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only - * guaranteed that the code is valid UTF-8; one should not - * make any assumptions regarding the structure or format of the code). - * @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 {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/notification_channel_service.verify_notification_channel.js - * region_tag:monitoring_v3_generated_NotificationChannelService_VerifyNotificationChannel_async - */ - verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>; - verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - verifyNotificationChannel( - request: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - callback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): void; - verifyNotificationChannel( - request?: protos.google.monitoring.v3.IVerifyNotificationChannelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyNotificationChannel request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyNotificationChannel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.verifyNotificationChannel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.INotificationChannel, - protos.google.monitoring.v3.IVerifyNotificationChannelRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyNotificationChannel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the descriptors for supported channel types. The use of descriptors - * makes it possible for new channel types to be dynamically added. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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 Array of {@link protos.google.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelDescriptorsAsync()` - * 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. - */ - listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>; - listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; - listNotificationChannelDescriptors( - request: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): void; - listNotificationChannelDescriptors( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>): - Promise<[ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannelDescriptor>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listNotificationChannelDescriptors values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listNotificationChannelDescriptors request %j', request); - return this.innerApiCalls - .listNotificationChannelDescriptors(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannelDescriptor[], - protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelDescriptorsResponse - ]) => { - this._log.info('listNotificationChannelDescriptors values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listNotificationChannelDescriptors`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor} 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 `listNotificationChannelDescriptorsAsync()` - * 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. - */ - listNotificationChannelDescriptorsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannelDescriptors stream %j', request); - return this.descriptors.page.listNotificationChannelDescriptors.createStream( - this.innerApiCalls.listNotificationChannelDescriptors as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationChannelDescriptors`, 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.name - * Required. The REST resource name of the parent from which to retrieve - * the notification channel descriptors. The expected syntax is: - * - * projects/[PROJECT_ID] - * - * Note that this names the parent container in which to look for the - * descriptors; to retrieve a single descriptor by name, use the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor|GetNotificationChannelDescriptor} - * operation, instead. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannelDescriptor|NotificationChannelDescriptor}. 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 include:samples/generated/v3/notification_channel_service.list_notification_channel_descriptors.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannelDescriptors_async - */ - listNotificationChannelDescriptorsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelDescriptorsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannelDescriptors']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannelDescriptors iterate %j', request); - return this.descriptors.page.listNotificationChannelDescriptors.asyncIterate( - this.innerApiCalls['listNotificationChannelDescriptors'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the notification channels that have been created for the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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 Array of {@link protos.google.monitoring.v3.NotificationChannel|NotificationChannel}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listNotificationChannelsAsync()` - * 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. - */ - listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>; - listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; - listNotificationChannels( - request: protos.google.monitoring.v3.IListNotificationChannelsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): void; - listNotificationChannels( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>): - Promise<[ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListNotificationChannelsRequest, - protos.google.monitoring.v3.IListNotificationChannelsResponse|null|undefined, - protos.google.monitoring.v3.INotificationChannel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listNotificationChannels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listNotificationChannels request %j', request); - return this.innerApiCalls - .listNotificationChannels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.INotificationChannel[], - protos.google.monitoring.v3.IListNotificationChannelsRequest|null, - protos.google.monitoring.v3.IListNotificationChannelsResponse - ]) => { - this._log.info('listNotificationChannels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listNotificationChannels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannel|NotificationChannel} 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 `listNotificationChannelsAsync()` - * 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. - */ - listNotificationChannelsStream( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - Transform{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannels stream %j', request); - return this.descriptors.page.listNotificationChannels.createStream( - this.innerApiCalls.listNotificationChannels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listNotificationChannels`, 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.name - * Required. The project on which to execute the request. The format is - * `projects/[PROJECT_ID]`. That is, this names the container - * in which to look for the notification channels; it does not name a - * specific channel. To query a specific channel by REST resource name, use - * the - * {@link protos.google.monitoring.v3.NotificationChannelService.GetNotificationChannel|`GetNotificationChannel`} - * operation. - * @param {string} request.filter - * If provided, this field specifies the criteria that must be met by - * notification channels to be included in the response. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {string} request.orderBy - * A comma-separated list of fields by which to sort the result. Supports - * the same set of fields as in `filter`. Entries can be prefixed with - * a minus sign to sort in descending rather than ascending order. - * - * For more details, see [sorting and - * filtering](/monitoring/api/v3/sorting-and-filtering). - * @param {number} request.pageSize - * The maximum number of results to return in a single response. If - * not set to a positive number, a reasonable value will be chosen by the - * service. - * @param {string} request.pageToken - * If non-empty, `page_token` must contain a value returned as the - * `next_page_token` in a previous response to request the next set - * of results. - * @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.monitoring.v3.NotificationChannel|NotificationChannel}. 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 include:samples/generated/v3/notification_channel_service.list_notification_channels.js - * region_tag:monitoring_v3_generated_NotificationChannelService_ListNotificationChannels_async - */ - listNotificationChannelsAsync( - request?: protos.google.monitoring.v3.IListNotificationChannelsRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['listNotificationChannels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listNotificationChannels iterate %j', request); - return this.descriptors.page.listNotificationChannels.asyncIterate( - this.innerApiCalls['listNotificationChannels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.notificationChannelServiceStub && !this._terminated) { - return this.notificationChannelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client_config.json.baseline deleted file mode 100644 index 781b3f0a6e26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.NotificationChannelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListNotificationChannelDescriptors": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannelDescriptor": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListNotificationChannels": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendNotificationChannelVerificationCode": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetNotificationChannelVerificationCode": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyNotificationChannel": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/notification_channel_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client.ts.baseline deleted file mode 100644 index db1e2e3c8065..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client.ts.baseline +++ /dev/null @@ -1,2634 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/service_monitoring_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './service_monitoring_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The Stackdriver Monitoring Service-Oriented Monitoring API has endpoints for - * managing and querying aspects of a workspace's services. These include the - * `Service`'s monitored resources, its Service-Level Objectives, and a taxonomy - * of categorized Health Metrics. - * @class - * @memberof v3 - */ -export class ServiceMonitoringServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - serviceMonitoringServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServiceMonitoringServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ServiceMonitoringServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServiceMonitoringServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listServices: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'services'), - listServiceLevelObjectives: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'serviceLevelObjectives') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.ServiceMonitoringService', gapicConfig as gax.ClientConfig, - 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.serviceMonitoringServiceStub) { - return this.serviceMonitoringServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.ServiceMonitoringService. - this.serviceMonitoringServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.ServiceMonitoringService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.ServiceMonitoringService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const serviceMonitoringServiceStubMethods = - ['createService', 'getService', 'listServices', 'updateService', 'deleteService', 'createServiceLevelObjective', 'getServiceLevelObjective', 'listServiceLevelObjectives', 'updateServiceLevelObjective', 'deleteServiceLevelObjective']; - for (const methodName of serviceMonitoringServiceStubMethods) { - const callPromise = this.serviceMonitoringServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.serviceMonitoringServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Create a `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent workspace. - * Of the form `projects/{project_id}`. - * @param {string} request.serviceId - * Optional. The Service id to use for this Service. If omitted, an id will be - * generated instead. Must match the pattern [a-z0-9\-]+ - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` 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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateService_async - */ - createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>; - createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; - createService( - request: protos.google.monitoring.v3.ICreateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): void; - createService( - request?: protos.google.monitoring.v3.ICreateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createService response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.ICreateServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('createService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get the named `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service`. - * Of the form `projects/{project_id}/services/{service_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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetService_async - */ - getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>; - getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request: protos.google.monitoring.v3.IGetServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): void; - getService( - request?: protos.google.monitoring.v3.IGetServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getService response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IGetServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.Service} request.service - * Required. The `Service` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @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 {@link protos.google.monitoring.v3.Service|Service}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateService_async - */ - updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>; - updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; - updateService( - request: protos.google.monitoring.v3.IUpdateServiceRequest, - callback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): void; - updateService( - request?: protos.google.monitoring.v3.IUpdateServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service.name': request.service!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateService request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateService response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IService, - protos.google.monitoring.v3.IUpdateServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Soft delete this `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `Service` to delete. - * Of the form `projects/{project_id}/services/{service_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteService_async - */ - deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>; - deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; - deleteService( - request: protos.google.monitoring.v3.IDeleteServiceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): void; - deleteService( - request?: protos.google.monitoring.v3.IDeleteServiceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteService request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteService response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteService(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteService response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Create a `ServiceLevelObjective` for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.serviceLevelObjectiveId - * Optional. The ServiceLevelObjective id to use for this - * ServiceLevelObjective. If omitted, an id will be generated instead. Must - * match the pattern [a-z0-9\-]+ - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to create. - * The provided `name` will be respected if no `ServiceLevelObjective` exists - * with this name. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.create_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_CreateServiceLevelObjective_async - */ - createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - createServiceLevelObjective( - request: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - createServiceLevelObjective( - request?: protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.ICreateServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('createServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get a `ServiceLevelObjective` by name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to get. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective` to return. If `DEFAULT`, return the - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.get_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_GetServiceLevelObjective_async - */ - getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - getServiceLevelObjective( - request: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - getServiceLevelObjective( - request?: protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IGetServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.monitoring.v3.ServiceLevelObjective} request.serviceLevelObjective - * Required. The `ServiceLevelObjective` to draw updates from. - * The given `name` specifies the resource to update. - * @param {google.protobuf.FieldMask} request.updateMask - * A set of field paths defining which fields to use for the update. - * @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 {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.update_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_UpdateServiceLevelObjective_async - */ - updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - updateServiceLevelObjective( - request: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - callback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - updateServiceLevelObjective( - request?: protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'service_level_objective.name': request.serviceLevelObjective!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IServiceLevelObjective, - protos.google.monitoring.v3.IUpdateServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete the given `ServiceLevelObjective`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Resource name of the `ServiceLevelObjective` to delete. - * Of the form - * `projects/{project_id}/services/{service_id}/serviceLevelObjectives/{slo_name}`. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/service_monitoring_service.delete_service_level_objective.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_DeleteServiceLevelObjective_async - */ - deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>; - deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - deleteServiceLevelObjective( - request: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): void; - deleteServiceLevelObjective( - request?: protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteServiceLevelObjective request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteServiceLevelObjective response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteServiceLevelObjective(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteServiceLevelObjectiveRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteServiceLevelObjective response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * List `Service`s for this workspace. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.Service|Service}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServicesAsync()` - * 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. - */ - listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>; - listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; - listServices( - request: protos.google.monitoring.v3.IListServicesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): void; - listServices( - request?: protos.google.monitoring.v3.IListServicesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>): - Promise<[ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServicesRequest, - protos.google.monitoring.v3.IListServicesResponse|null|undefined, - protos.google.monitoring.v3.IService>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServices values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listServices request %j', request); - return this.innerApiCalls - .listServices(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IService[], - protos.google.monitoring.v3.IListServicesRequest|null, - protos.google.monitoring.v3.IListServicesResponse - ]) => { - this._log.info('listServices values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServices`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Service|Service} 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 `listServicesAsync()` - * 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. - */ - listServicesStream( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServices stream %j', request); - return this.descriptors.page.listServices.createStream( - this.innerApiCalls.listServices as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServices`, 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. Resource name of the parent `Workspace`. - * Of the form `projects/{project_id}`. - * @param {string} request.filter - * A filter specifying what `Service`s to return. The filter currently - * supports the following fields: - * - * - `identifier_case` - * - `app_engine.module_id` - * - `cloud_endpoints.service` - * - `cluster_istio.location` - * - `cluster_istio.cluster_name` - * - `cluster_istio.service_namespace` - * - `cluster_istio.service_name` - * - * `identifier_case` refers to which option in the identifier oneof is - * populated. For example, the filter `identifier_case = "CUSTOM"` would match - * all services with a value for the `custom` field. Valid options are - * "CUSTOM", "APP_ENGINE", "CLOUD_ENDPOINTS", and "CLUSTER_ISTIO". - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @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.monitoring.v3.Service|Service}. 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 include:samples/generated/v3/service_monitoring_service.list_services.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServices_async - */ - listServicesAsync( - request?: protos.google.monitoring.v3.IListServicesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServices']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServices iterate %j', request); - return this.descriptors.page.listServices.asyncIterate( - this.innerApiCalls['listServices'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the `ServiceLevelObjective`s for the given `Service`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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 Array of {@link protos.google.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServiceLevelObjectivesAsync()` - * 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. - */ - listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>; - listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; - listServiceLevelObjectives( - request: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): void; - listServiceLevelObjectives( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>): - Promise<[ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse|null|undefined, - protos.google.monitoring.v3.IServiceLevelObjective>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServiceLevelObjectives values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listServiceLevelObjectives request %j', request); - return this.innerApiCalls - .listServiceLevelObjectives(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IServiceLevelObjective[], - protos.google.monitoring.v3.IListServiceLevelObjectivesRequest|null, - protos.google.monitoring.v3.IListServiceLevelObjectivesResponse - ]) => { - this._log.info('listServiceLevelObjectives values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServiceLevelObjectives`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective} 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 `listServiceLevelObjectivesAsync()` - * 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. - */ - listServiceLevelObjectivesStream( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServiceLevelObjectives']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServiceLevelObjectives stream %j', request); - return this.descriptors.page.listServiceLevelObjectives.createStream( - this.innerApiCalls.listServiceLevelObjectives as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServiceLevelObjectives`, 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. Resource name of the parent `Service`. - * Of the form `projects/{project_id}/services/{service_id}`. - * @param {string} request.filter - * A filter specifying what `ServiceLevelObjective`s to return. - * @param {number} request.pageSize - * A non-negative number that is the maximum number of results to return. - * When 0, use default page size. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return additional results from the previous method call. - * @param {google.monitoring.v3.ServiceLevelObjective.View} request.view - * View of the `ServiceLevelObjective`s to return. If `DEFAULT`, return each - * `ServiceLevelObjective` as originally defined. If `EXPLICIT` and the - * `ServiceLevelObjective` is defined in terms of a `BasicSli`, replace the - * `BasicSli` with a `RequestBasedSli` spelling out how the SLI is computed. - * @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.monitoring.v3.ServiceLevelObjective|ServiceLevelObjective}. 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 include:samples/generated/v3/service_monitoring_service.list_service_level_objectives.js - * region_tag:monitoring_v3_generated_ServiceMonitoringService_ListServiceLevelObjectives_async - */ - listServiceLevelObjectivesAsync( - request?: protos.google.monitoring.v3.IListServiceLevelObjectivesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServiceLevelObjectives']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServiceLevelObjectives iterate %j', request); - return this.descriptors.page.listServiceLevelObjectives.asyncIterate( - this.innerApiCalls['listServiceLevelObjectives'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.serviceMonitoringServiceStub && !this._terminated) { - return this.serviceMonitoringServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client_config.json.baseline deleted file mode 100644 index fe621866841d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.ServiceMonitoringService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServices": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteService": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServiceLevelObjectives": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteServiceLevelObjective": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/service_monitoring_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client.ts.baseline deleted file mode 100644 index 2b817761223a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client.ts.baseline +++ /dev/null @@ -1,2181 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3/uptime_check_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './uptime_check_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * The UptimeCheckService API is used to manage (list, create, delete, edit) - * Uptime check configurations in the Stackdriver Monitoring product. An Uptime - * check is a piece of configuration that determines which resources and - * services to monitor for availability. These configurations can also be - * configured interactively by navigating to the [Cloud Console] - * (http://console.cloud.google.com), selecting the appropriate project, - * clicking on "Monitoring" on the left-hand side to navigate to Stackdriver, - * and then clicking on "Uptime". - * @class - * @memberof v3 - */ -export class UptimeCheckServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('monitoring'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - uptimeCheckServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of UptimeCheckServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 UptimeCheckServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof UptimeCheckServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'monitoring.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - folderAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}' - ), - folderAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - folderChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannelDescriptors/{channel_descriptor}' - ), - folderGroupPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/groups/{group}' - ), - folderNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/notificationChannels/{notification_channel}' - ), - folderServicePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}' - ), - folderServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - folderUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'folders/{folder}/uptimeCheckConfigs/{uptime_check_config}' - ), - organizationAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}' - ), - organizationAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - organizationChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannelDescriptors/{channel_descriptor}' - ), - organizationGroupPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/groups/{group}' - ), - organizationNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/notificationChannels/{notification_channel}' - ), - organizationServicePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}' - ), - organizationServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - organizationUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'organizations/{organization}/uptimeCheckConfigs/{uptime_check_config}' - ), - projectAlertPolicyPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}' - ), - projectAlertPolicyConditionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertPolicies/{alert_policy}/conditions/{condition}' - ), - projectChannelDescriptorPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannelDescriptors/{channel_descriptor}' - ), - projectGroupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/groups/{group}' - ), - projectNotificationChannelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/notificationChannels/{notification_channel}' - ), - projectServicePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}' - ), - projectServiceServiceLevelObjectivePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/services/{service}/serviceLevelObjectives/{service_level_objective}' - ), - projectUptimeCheckConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/uptimeCheckConfigs/{uptime_check_config}' - ), - }; - - // 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 = { - listUptimeCheckConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckConfigs'), - listUptimeCheckIps: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'uptimeCheckIps') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.monitoring.v3.UptimeCheckService', gapicConfig as gax.ClientConfig, - 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.uptimeCheckServiceStub) { - return this.uptimeCheckServiceStub; - } - - // Put together the "service stub" for - // google.monitoring.v3.UptimeCheckService. - this.uptimeCheckServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.monitoring.v3.UptimeCheckService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.monitoring.v3.UptimeCheckService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const uptimeCheckServiceStubMethods = - ['listUptimeCheckConfigs', 'getUptimeCheckConfig', 'createUptimeCheckConfig', 'updateUptimeCheckConfig', 'deleteUptimeCheckConfig', 'listUptimeCheckIps']; - for (const methodName of uptimeCheckServiceStubMethods) { - const callPromise = this.uptimeCheckServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.uptimeCheckServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'monitoring.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/monitoring', - 'https://www.googleapis.com/auth/monitoring.read' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a single Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to retrieve. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.get_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_GetUptimeCheckConfig_async - */ - getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - getUptimeCheckConfig( - request: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - getUptimeCheckConfig( - request?: protos.google.monitoring.v3.IGetUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IGetUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a new Uptime check configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project in which to create the Uptime check. The format - * is `projects/[PROJECT_ID]`. - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. The new Uptime check configuration. - * @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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.create_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_CreateUptimeCheckConfig_async - */ - createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - createUptimeCheckConfig( - request: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - createUptimeCheckConfig( - request?: protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.ICreateUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates an Uptime check configuration. You can either replace the entire - * configuration with a new one or replace only certain fields in the current - * configuration by specifying the fields to be updated via `updateMask`. - * Returns the updated configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Optional. If present, only the listed fields in the current Uptime check - * configuration are updated with values from the new configuration. If this - * field is empty, then the current configuration is completely replaced with - * the new configuration. - * @param {google.monitoring.v3.UptimeCheckConfig} request.uptimeCheckConfig - * Required. If an `updateMask` has been specified, this field gives - * the values for the set of fields mentioned in the `updateMask`. If an - * `updateMask` has not been given, this Uptime check configuration replaces - * the current configuration. If a field is mentioned in `updateMask` but - * the corresonding field is omitted in this partial Uptime check - * configuration, it has the effect of deleting/clearing the field from the - * configuration on the server. - * - * The following fields can be updated: `display_name`, - * `http_check`, `tcp_check`, `timeout`, `content_matchers`, and - * `selected_regions`. - * @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 {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.update_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_UpdateUptimeCheckConfig_async - */ - updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - updateUptimeCheckConfig( - request: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - callback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - updateUptimeCheckConfig( - request?: protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'uptime_check_config.name': request.uptimeCheckConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.monitoring.v3.IUptimeCheckConfig, - protos.google.monitoring.v3.IUpdateUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an Uptime check configuration. Note that this method will fail - * if the Uptime check configuration is referenced by an alert policy or - * other dependent configs that would be rendered invalid by the deletion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The Uptime check configuration to delete. The format - * is `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3/uptime_check_service.delete_uptime_check_config.js - * region_tag:monitoring_v3_generated_UptimeCheckService_DeleteUptimeCheckConfig_async - */ - deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>; - deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteUptimeCheckConfig( - request: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteUptimeCheckConfig( - request?: protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUptimeCheckConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUptimeCheckConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteUptimeCheckConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.monitoring.v3.IDeleteUptimeCheckConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteUptimeCheckConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the existing valid Uptime check configurations for the project - * (leaving out any invalid configurations). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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 Array of {@link protos.google.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckConfigsAsync()` - * 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. - */ - listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>; - listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; - listUptimeCheckConfigs( - request: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): void; - listUptimeCheckConfigs( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckConfig>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUptimeCheckConfigs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listUptimeCheckConfigs request %j', request); - return this.innerApiCalls - .listUptimeCheckConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckConfig[], - protos.google.monitoring.v3.IListUptimeCheckConfigsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckConfigsResponse - ]) => { - this._log.info('listUptimeCheckConfigs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUptimeCheckConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig} 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 `listUptimeCheckConfigsAsync()` - * 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. - */ - listUptimeCheckConfigsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckConfigs stream %j', request); - return this.descriptors.page.listUptimeCheckConfigs.createStream( - this.innerApiCalls.listUptimeCheckConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUptimeCheckConfigs`, 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. The project whose Uptime check configurations are listed. The format - * is `projects/[PROJECT_ID]`. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * @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.monitoring.v3.UptimeCheckConfig|UptimeCheckConfig}. 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 include:samples/generated/v3/uptime_check_service.list_uptime_check_configs.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckConfigs_async - */ - listUptimeCheckConfigsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckConfigsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listUptimeCheckConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckConfigs iterate %j', request); - return this.descriptors.page.listUptimeCheckConfigs.asyncIterate( - this.innerApiCalls['listUptimeCheckConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Returns the list of IP addresses that checkers run from - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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 Array of {@link protos.google.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUptimeCheckIpsAsync()` - * 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. - */ - listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>; - listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; - listUptimeCheckIps( - request: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - callback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): void; - listUptimeCheckIps( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>, - callback?: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>): - Promise<[ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse|null|undefined, - protos.google.monitoring.v3.IUptimeCheckIp>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUptimeCheckIps values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listUptimeCheckIps request %j', request); - return this.innerApiCalls - .listUptimeCheckIps(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.monitoring.v3.IUptimeCheckIp[], - protos.google.monitoring.v3.IListUptimeCheckIpsRequest|null, - protos.google.monitoring.v3.IListUptimeCheckIpsResponse - ]) => { - this._log.info('listUptimeCheckIps values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUptimeCheckIps`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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.monitoring.v3.UptimeCheckIp|UptimeCheckIp} 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 `listUptimeCheckIpsAsync()` - * 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. - */ - listUptimeCheckIpsStream( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUptimeCheckIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckIps stream %j', request); - return this.descriptors.page.listUptimeCheckIps.createStream( - this.innerApiCalls.listUptimeCheckIps as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUptimeCheckIps`, 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 {number} request.pageSize - * The maximum number of results to return in a single response. The server - * may further constrain the maximum number of results returned in a single - * page. If the page_size is <=0, the server will decide the number of results - * to be returned. - * NOTE: this field is not yet implemented - * @param {string} request.pageToken - * If this field is not empty then it must contain the `nextPageToken` value - * returned by a previous call to this method. Using this field causes the - * method to return more results from the previous method call. - * NOTE: this field is not yet implemented - * @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.monitoring.v3.UptimeCheckIp|UptimeCheckIp}. 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 include:samples/generated/v3/uptime_check_service.list_uptime_check_ips.js - * region_tag:monitoring_v3_generated_UptimeCheckService_ListUptimeCheckIps_async - */ - listUptimeCheckIpsAsync( - request?: protos.google.monitoring.v3.IListUptimeCheckIpsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUptimeCheckIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUptimeCheckIps iterate %j', request); - return this.descriptors.page.listUptimeCheckIps.asyncIterate( - this.innerApiCalls['listUptimeCheckIps'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified folderAlertPolicy resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - folderAlertPolicyPath(folder:string,alertPolicy:string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the folder from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicy resource. - * - * @param {string} folderAlertPolicyName - * A fully-qualified path representing folder_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyName(folderAlertPolicyName: string) { - return this.pathTemplates.folderAlertPolicyPathTemplate.match(folderAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified folderAlertPolicyCondition resource name string. - * - * @param {string} folder - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - folderAlertPolicyConditionPath(folder:string,alertPolicy:string,condition:string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.render({ - folder: folder, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the folder from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).folder; - } - - /** - * Parse the alert_policy from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from FolderAlertPolicyCondition resource. - * - * @param {string} folderAlertPolicyConditionName - * A fully-qualified path representing folder_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromFolderAlertPolicyConditionName(folderAlertPolicyConditionName: string) { - return this.pathTemplates.folderAlertPolicyConditionPathTemplate.match(folderAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified folderChannelDescriptor resource name string. - * - * @param {string} folder - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - folderChannelDescriptorPath(folder:string,channelDescriptor:string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.render({ - folder: folder, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the folder from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).folder; - } - - /** - * Parse the channel_descriptor from FolderChannelDescriptor resource. - * - * @param {string} folderChannelDescriptorName - * A fully-qualified path representing folder_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromFolderChannelDescriptorName(folderChannelDescriptorName: string) { - return this.pathTemplates.folderChannelDescriptorPathTemplate.match(folderChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified folderGroup resource name string. - * - * @param {string} folder - * @param {string} group - * @returns {string} Resource name string. - */ - folderGroupPath(folder:string,group:string) { - return this.pathTemplates.folderGroupPathTemplate.render({ - folder: folder, - group: group, - }); - } - - /** - * Parse the folder from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).folder; - } - - /** - * Parse the group from FolderGroup resource. - * - * @param {string} folderGroupName - * A fully-qualified path representing folder_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromFolderGroupName(folderGroupName: string) { - return this.pathTemplates.folderGroupPathTemplate.match(folderGroupName).group; - } - - /** - * Return a fully-qualified folderNotificationChannel resource name string. - * - * @param {string} folder - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - folderNotificationChannelPath(folder:string,notificationChannel:string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.render({ - folder: folder, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the folder from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).folder; - } - - /** - * Parse the notification_channel from FolderNotificationChannel resource. - * - * @param {string} folderNotificationChannelName - * A fully-qualified path representing folder_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromFolderNotificationChannelName(folderNotificationChannelName: string) { - return this.pathTemplates.folderNotificationChannelPathTemplate.match(folderNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified folderService resource name string. - * - * @param {string} folder - * @param {string} service - * @returns {string} Resource name string. - */ - folderServicePath(folder:string,service:string) { - return this.pathTemplates.folderServicePathTemplate.render({ - folder: folder, - service: service, - }); - } - - /** - * Parse the folder from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).folder; - } - - /** - * Parse the service from FolderService resource. - * - * @param {string} folderServiceName - * A fully-qualified path representing folder_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceName(folderServiceName: string) { - return this.pathTemplates.folderServicePathTemplate.match(folderServiceName).service; - } - - /** - * Return a fully-qualified folderServiceServiceLevelObjective resource name string. - * - * @param {string} folder - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - folderServiceServiceLevelObjectivePath(folder:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render({ - folder: folder, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the folder from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).folder; - } - - /** - * Parse the service from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from FolderServiceServiceLevelObjective resource. - * - * @param {string} folderServiceServiceLevelObjectiveName - * A fully-qualified path representing folder_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(folderServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match(folderServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified folderUptimeCheckConfig resource name string. - * - * @param {string} folder - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - folderUptimeCheckConfigPath(folder:string,uptimeCheckConfig:string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.render({ - folder: folder, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the folder from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the folder. - */ - matchFolderFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).folder; - } - - /** - * Parse the uptime_check_config from FolderUptimeCheckConfig resource. - * - * @param {string} folderUptimeCheckConfigName - * A fully-qualified path representing folder_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromFolderUptimeCheckConfigName(folderUptimeCheckConfigName: string) { - return this.pathTemplates.folderUptimeCheckConfigPathTemplate.match(folderUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified organizationAlertPolicy resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - organizationAlertPolicyPath(organization:string,alertPolicy:string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicy resource. - * - * @param {string} organizationAlertPolicyName - * A fully-qualified path representing organization_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyName(organizationAlertPolicyName: string) { - return this.pathTemplates.organizationAlertPolicyPathTemplate.match(organizationAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified organizationAlertPolicyCondition resource name string. - * - * @param {string} organization - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - organizationAlertPolicyConditionPath(organization:string,alertPolicy:string,condition:string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.render({ - organization: organization, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the organization from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).organization; - } - - /** - * Parse the alert_policy from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from OrganizationAlertPolicyCondition resource. - * - * @param {string} organizationAlertPolicyConditionName - * A fully-qualified path representing organization_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromOrganizationAlertPolicyConditionName(organizationAlertPolicyConditionName: string) { - return this.pathTemplates.organizationAlertPolicyConditionPathTemplate.match(organizationAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified organizationChannelDescriptor resource name string. - * - * @param {string} organization - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - organizationChannelDescriptorPath(organization:string,channelDescriptor:string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.render({ - organization: organization, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the organization from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).organization; - } - - /** - * Parse the channel_descriptor from OrganizationChannelDescriptor resource. - * - * @param {string} organizationChannelDescriptorName - * A fully-qualified path representing organization_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromOrganizationChannelDescriptorName(organizationChannelDescriptorName: string) { - return this.pathTemplates.organizationChannelDescriptorPathTemplate.match(organizationChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified organizationGroup resource name string. - * - * @param {string} organization - * @param {string} group - * @returns {string} Resource name string. - */ - organizationGroupPath(organization:string,group:string) { - return this.pathTemplates.organizationGroupPathTemplate.render({ - organization: organization, - group: group, - }); - } - - /** - * Parse the organization from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).organization; - } - - /** - * Parse the group from OrganizationGroup resource. - * - * @param {string} organizationGroupName - * A fully-qualified path representing organization_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromOrganizationGroupName(organizationGroupName: string) { - return this.pathTemplates.organizationGroupPathTemplate.match(organizationGroupName).group; - } - - /** - * Return a fully-qualified organizationNotificationChannel resource name string. - * - * @param {string} organization - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - organizationNotificationChannelPath(organization:string,notificationChannel:string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.render({ - organization: organization, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the organization from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).organization; - } - - /** - * Parse the notification_channel from OrganizationNotificationChannel resource. - * - * @param {string} organizationNotificationChannelName - * A fully-qualified path representing organization_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromOrganizationNotificationChannelName(organizationNotificationChannelName: string) { - return this.pathTemplates.organizationNotificationChannelPathTemplate.match(organizationNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified organizationService resource name string. - * - * @param {string} organization - * @param {string} service - * @returns {string} Resource name string. - */ - organizationServicePath(organization:string,service:string) { - return this.pathTemplates.organizationServicePathTemplate.render({ - organization: organization, - service: service, - }); - } - - /** - * Parse the organization from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).organization; - } - - /** - * Parse the service from OrganizationService resource. - * - * @param {string} organizationServiceName - * A fully-qualified path representing organization_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceName(organizationServiceName: string) { - return this.pathTemplates.organizationServicePathTemplate.match(organizationServiceName).service; - } - - /** - * Return a fully-qualified organizationServiceServiceLevelObjective resource name string. - * - * @param {string} organization - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - organizationServiceServiceLevelObjectivePath(organization:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render({ - organization: organization, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the organization from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).organization; - } - - /** - * Parse the service from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from OrganizationServiceServiceLevelObjective resource. - * - * @param {string} organizationServiceServiceLevelObjectiveName - * A fully-qualified path representing organization_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(organizationServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match(organizationServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified organizationUptimeCheckConfig resource name string. - * - * @param {string} organization - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - organizationUptimeCheckConfigPath(organization:string,uptimeCheckConfig:string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.render({ - organization: organization, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the organization from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the organization. - */ - matchOrganizationFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).organization; - } - - /** - * Parse the uptime_check_config from OrganizationUptimeCheckConfig resource. - * - * @param {string} organizationUptimeCheckConfigName - * A fully-qualified path representing organization_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(organizationUptimeCheckConfigName: string) { - return this.pathTemplates.organizationUptimeCheckConfigPathTemplate.match(organizationUptimeCheckConfigName).uptime_check_config; - } - - /** - * Return a fully-qualified projectAlertPolicy resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @returns {string} Resource name string. - */ - projectAlertPolicyPath(project:string,alertPolicy:string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - }); - } - - /** - * Parse the project from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicy resource. - * - * @param {string} projectAlertPolicyName - * A fully-qualified path representing project_alert_policy resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyName(projectAlertPolicyName: string) { - return this.pathTemplates.projectAlertPolicyPathTemplate.match(projectAlertPolicyName).alert_policy; - } - - /** - * Return a fully-qualified projectAlertPolicyCondition resource name string. - * - * @param {string} project - * @param {string} alert_policy - * @param {string} condition - * @returns {string} Resource name string. - */ - projectAlertPolicyConditionPath(project:string,alertPolicy:string,condition:string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.render({ - project: project, - alert_policy: alertPolicy, - condition: condition, - }); - } - - /** - * Parse the project from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).project; - } - - /** - * Parse the alert_policy from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the alert_policy. - */ - matchAlertPolicyFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).alert_policy; - } - - /** - * Parse the condition from ProjectAlertPolicyCondition resource. - * - * @param {string} projectAlertPolicyConditionName - * A fully-qualified path representing project_alert_policy_condition resource. - * @returns {string} A string representing the condition. - */ - matchConditionFromProjectAlertPolicyConditionName(projectAlertPolicyConditionName: string) { - return this.pathTemplates.projectAlertPolicyConditionPathTemplate.match(projectAlertPolicyConditionName).condition; - } - - /** - * Return a fully-qualified projectChannelDescriptor resource name string. - * - * @param {string} project - * @param {string} channel_descriptor - * @returns {string} Resource name string. - */ - projectChannelDescriptorPath(project:string,channelDescriptor:string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.render({ - project: project, - channel_descriptor: channelDescriptor, - }); - } - - /** - * Parse the project from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).project; - } - - /** - * Parse the channel_descriptor from ProjectChannelDescriptor resource. - * - * @param {string} projectChannelDescriptorName - * A fully-qualified path representing project_channel_descriptor resource. - * @returns {string} A string representing the channel_descriptor. - */ - matchChannelDescriptorFromProjectChannelDescriptorName(projectChannelDescriptorName: string) { - return this.pathTemplates.projectChannelDescriptorPathTemplate.match(projectChannelDescriptorName).channel_descriptor; - } - - /** - * Return a fully-qualified projectGroup resource name string. - * - * @param {string} project - * @param {string} group - * @returns {string} Resource name string. - */ - projectGroupPath(project:string,group:string) { - return this.pathTemplates.projectGroupPathTemplate.render({ - project: project, - group: group, - }); - } - - /** - * Parse the project from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).project; - } - - /** - * Parse the group from ProjectGroup resource. - * - * @param {string} projectGroupName - * A fully-qualified path representing project_group resource. - * @returns {string} A string representing the group. - */ - matchGroupFromProjectGroupName(projectGroupName: string) { - return this.pathTemplates.projectGroupPathTemplate.match(projectGroupName).group; - } - - /** - * Return a fully-qualified projectNotificationChannel resource name string. - * - * @param {string} project - * @param {string} notification_channel - * @returns {string} Resource name string. - */ - projectNotificationChannelPath(project:string,notificationChannel:string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.render({ - project: project, - notification_channel: notificationChannel, - }); - } - - /** - * Parse the project from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).project; - } - - /** - * Parse the notification_channel from ProjectNotificationChannel resource. - * - * @param {string} projectNotificationChannelName - * A fully-qualified path representing project_notification_channel resource. - * @returns {string} A string representing the notification_channel. - */ - matchNotificationChannelFromProjectNotificationChannelName(projectNotificationChannelName: string) { - return this.pathTemplates.projectNotificationChannelPathTemplate.match(projectNotificationChannelName).notification_channel; - } - - /** - * Return a fully-qualified projectService resource name string. - * - * @param {string} project - * @param {string} service - * @returns {string} Resource name string. - */ - projectServicePath(project:string,service:string) { - return this.pathTemplates.projectServicePathTemplate.render({ - project: project, - service: service, - }); - } - - /** - * Parse the project from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).project; - } - - /** - * Parse the service from ProjectService resource. - * - * @param {string} projectServiceName - * A fully-qualified path representing project_service resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceName(projectServiceName: string) { - return this.pathTemplates.projectServicePathTemplate.match(projectServiceName).service; - } - - /** - * Return a fully-qualified projectServiceServiceLevelObjective resource name string. - * - * @param {string} project - * @param {string} service - * @param {string} service_level_objective - * @returns {string} Resource name string. - */ - projectServiceServiceLevelObjectivePath(project:string,service:string,serviceLevelObjective:string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render({ - project: project, - service: service, - service_level_objective: serviceLevelObjective, - }); - } - - /** - * Parse the project from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).project; - } - - /** - * Parse the service from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service. - */ - matchServiceFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service; - } - - /** - * Parse the service_level_objective from ProjectServiceServiceLevelObjective resource. - * - * @param {string} projectServiceServiceLevelObjectiveName - * A fully-qualified path representing project_service_service_level_objective resource. - * @returns {string} A string representing the service_level_objective. - */ - matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(projectServiceServiceLevelObjectiveName: string) { - return this.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match(projectServiceServiceLevelObjectiveName).service_level_objective; - } - - /** - * Return a fully-qualified projectUptimeCheckConfig resource name string. - * - * @param {string} project - * @param {string} uptime_check_config - * @returns {string} Resource name string. - */ - projectUptimeCheckConfigPath(project:string,uptimeCheckConfig:string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.render({ - project: project, - uptime_check_config: uptimeCheckConfig, - }); - } - - /** - * Parse the project from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).project; - } - - /** - * Parse the uptime_check_config from ProjectUptimeCheckConfig resource. - * - * @param {string} projectUptimeCheckConfigName - * A fully-qualified path representing project_uptime_check_config resource. - * @returns {string} A string representing the uptime_check_config. - */ - matchUptimeCheckConfigFromProjectUptimeCheckConfigName(projectUptimeCheckConfigName: string) { - return this.pathTemplates.projectUptimeCheckConfigPathTemplate.match(projectUptimeCheckConfigName).uptime_check_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.uptimeCheckServiceStub && !this._terminated) { - return this.uptimeCheckServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client_config.json.baseline deleted file mode 100644 index 0e638c2dfbdb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_client_config.json.baseline +++ /dev/null @@ -1,50 +0,0 @@ -{ - "interfaces": { - "google.monitoring.v3.UptimeCheckService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListUptimeCheckConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUptimeCheckConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUptimeCheckIps": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_proto_list.json.baseline deleted file mode 100644 index 0534dc6a0354..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/src/v3/uptime_check_service_proto_list.json.baseline +++ /dev/null @@ -1,18 +0,0 @@ -[ - "../../protos/google/monitoring/v3/alert.proto", - "../../protos/google/monitoring/v3/alert_service.proto", - "../../protos/google/monitoring/v3/common.proto", - "../../protos/google/monitoring/v3/dropped_labels.proto", - "../../protos/google/monitoring/v3/group.proto", - "../../protos/google/monitoring/v3/group_service.proto", - "../../protos/google/monitoring/v3/metric.proto", - "../../protos/google/monitoring/v3/metric_service.proto", - "../../protos/google/monitoring/v3/mutation_record.proto", - "../../protos/google/monitoring/v3/notification.proto", - "../../protos/google/monitoring/v3/notification_service.proto", - "../../protos/google/monitoring/v3/service.proto", - "../../protos/google/monitoring/v3/service_service.proto", - "../../protos/google/monitoring/v3/span_context.proto", - "../../protos/google/monitoring/v3/uptime.proto", - "../../protos/google/monitoring/v3/uptime_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index fa12b2a66c60..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const monitoring = require('monitoring'); - -function main() { - const alertPolicyServiceClient = new monitoring.AlertPolicyServiceClient(); - const groupServiceClient = new monitoring.GroupServiceClient(); - const metricServiceClient = new monitoring.MetricServiceClient(); - const notificationChannelServiceClient = new monitoring.NotificationChannelServiceClient(); - const serviceMonitoringServiceClient = new monitoring.ServiceMonitoringServiceClient(); - const uptimeCheckServiceClient = new monitoring.UptimeCheckServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 561e2a128649..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - -import {AlertPolicyServiceClient, GroupServiceClient, MetricServiceClient, NotificationChannelServiceClient, ServiceMonitoringServiceClient, UptimeCheckServiceClient} from 'monitoring'; - -// check that the client class type name can be used -function doStuffWithAlertPolicyServiceClient(client: AlertPolicyServiceClient) { - client.close(); -} -function doStuffWithGroupServiceClient(client: GroupServiceClient) { - client.close(); -} -function doStuffWithMetricServiceClient(client: MetricServiceClient) { - client.close(); -} -function doStuffWithNotificationChannelServiceClient(client: NotificationChannelServiceClient) { - client.close(); -} -function doStuffWithServiceMonitoringServiceClient(client: ServiceMonitoringServiceClient) { - client.close(); -} -function doStuffWithUptimeCheckServiceClient(client: UptimeCheckServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const alertPolicyServiceClient = new AlertPolicyServiceClient(); - doStuffWithAlertPolicyServiceClient(alertPolicyServiceClient); - // check that the client instance can be created - const groupServiceClient = new GroupServiceClient(); - doStuffWithGroupServiceClient(groupServiceClient); - // check that the client instance can be created - const metricServiceClient = new MetricServiceClient(); - doStuffWithMetricServiceClient(metricServiceClient); - // check that the client instance can be created - const notificationChannelServiceClient = new NotificationChannelServiceClient(); - doStuffWithNotificationChannelServiceClient(notificationChannelServiceClient); - // check that the client instance can be created - const serviceMonitoringServiceClient = new ServiceMonitoringServiceClient(); - doStuffWithServiceMonitoringServiceClient(serviceMonitoringServiceClient); - // check that the client instance can be created - const uptimeCheckServiceClient = new UptimeCheckServiceClient(); - doStuffWithUptimeCheckServiceClient(uptimeCheckServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_alert_policy_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_alert_policy_service_v3.ts.baseline deleted file mode 100644 index ed8e28969ee3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_alert_policy_service_v3.ts.baseline +++ /dev/null @@ -1,1905 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as alertpolicyserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.AlertPolicyServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = alertpolicyserviceModule.v3.AlertPolicyServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = alertpolicyserviceModule.v3.AlertPolicyServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new alertpolicyserviceModule.v3.AlertPolicyServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = alertpolicyserviceModule.v3.AlertPolicyServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - await client.initialize(); - assert(client.alertPolicyServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.alertPolicyServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.alertPolicyServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getAlertPolicy', () => { - it('invokes getAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.getAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAlertPolicy(request), expectedError); - }); - }); - - describe('createAlertPolicy', () => { - it('invokes createAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.createAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.createAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createAlertPolicy(request), expectedError); - }); - }); - - describe('deleteAlertPolicy', () => { - it('invokes deleteAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAlertPolicy( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteAlertPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteAlertPolicyRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteAlertPolicy(request), expectedError); - }); - }); - - describe('updateAlertPolicy', () => { - it('invokes updateAlertPolicy without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.updateAlertPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.AlertPolicy() - ); - client.innerApiCalls.updateAlertPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAlertPolicy( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedHeaderRequestParams = `alert_policy.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAlertPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertPolicy with closed client', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateAlertPolicyRequest() - ); - request.alertPolicy ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateAlertPolicyRequest', ['alertPolicy', 'name']); - request.alertPolicy.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAlertPolicy(request), expectedError); - }); - }); - - describe('listAlertPolicies', () => { - it('invokes listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCall(expectedResponse); - const [response] = await client.listAlertPolicies(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPolicies without error using callback', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.innerApiCalls.listAlertPolicies = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAlertPolicies( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IAlertPolicy[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listAlertPolicies = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAlertPolicies(request), expectedError); - const actualRequest = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listAlertPolicies as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listAlertPoliciesStream without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listAlertPoliciesStream with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAlertPoliciesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.AlertPolicy[] = []; - stream.on('data', (response: protos.google.monitoring.v3.AlertPolicy) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAlertPolicies, request)); - assert( - (client.descriptors.page.listAlertPolicies.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAlertPolicies without error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - generateSampleMessage(new protos.google.monitoring.v3.AlertPolicy()), - ]; - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - const iterable = client.listAlertPoliciesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listAlertPolicies with error', async () => { - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListAlertPoliciesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListAlertPoliciesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listAlertPolicies.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAlertPoliciesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IAlertPolicy[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listAlertPolicies.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new alertpolicyserviceModule.v3.AlertPolicyServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_group_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_group_service_v3.ts.baseline deleted file mode 100644 index cafd10a8379b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_group_service_v3.ts.baseline +++ /dev/null @@ -1,2150 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as groupserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.GroupServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = groupserviceModule.v3.GroupServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = groupserviceModule.v3.GroupServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new groupserviceModule.v3.GroupServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new groupserviceModule.v3.GroupServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = groupserviceModule.v3.GroupServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new groupserviceModule.v3.GroupServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - await client.initialize(); - assert(client.groupServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.groupServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.groupServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getGroup', () => { - it('invokes getGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCall(expectedResponse); - const [response] = await client.getGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.getGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGroup(request), expectedError); - }); - }); - - describe('createGroup', () => { - it('invokes createGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCall(expectedResponse); - const [response] = await client.createGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.createGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createGroup(request), expectedError); - }); - }); - - describe('updateGroup', () => { - it('invokes updateGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCall(expectedResponse); - const [response] = await client.updateGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Group() - ); - client.innerApiCalls.updateGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGroup( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedHeaderRequestParams = `group.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateGroupRequest() - ); - request.group ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateGroupRequest', ['group', 'name']); - request.group.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGroup(request), expectedError); - }); - }); - - describe('deleteGroup', () => { - it('invokes deleteGroup without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteGroup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteGroup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGroup( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGroup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteGroup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGroup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGroup with closed client', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteGroupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteGroupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteGroup(request), expectedError); - }); - }); - - describe('listGroups', () => { - it('invokes listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCall(expectedResponse); - const [response] = await client.listGroups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.innerApiCalls.listGroups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroups( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGroup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroups(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupsStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGroupsStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Group[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Group) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroups, request)); - assert( - (client.descriptors.page.listGroups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - generateSampleMessage(new protos.google.monitoring.v3.Group()), - ]; - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IGroup[] = []; - const iterable = client.listGroupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroups with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IGroup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listGroupMembers', () => { - it('invokes listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCall(expectedResponse); - const [response] = await client.listGroupMembers(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers without error using callback', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.innerApiCalls.listGroupMembers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGroupMembers( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResource[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGroupMembers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGroupMembers(request), expectedError); - const actualRequest = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGroupMembers as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGroupMembersStream without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGroupMembersStream with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGroupMembersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResource[] = []; - stream.on('data', (response: protos.google.api.MonitoredResource) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGroupMembers, request)); - assert( - (client.descriptors.page.listGroupMembers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroupMembers without error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - generateSampleMessage(new protos.google.api.MonitoredResource()), - ]; - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResource[] = []; - const iterable = client.listGroupMembersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGroupMembers with error', async () => { - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListGroupMembersRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListGroupMembersRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGroupMembers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGroupMembersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResource[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGroupMembers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new groupserviceModule.v3.GroupServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_metric_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_metric_service_v3.ts.baseline deleted file mode 100644 index 931858146bc4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_metric_service_v3.ts.baseline +++ /dev/null @@ -1,2727 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as metricserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.MetricServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = metricserviceModule.v3.MetricServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = metricserviceModule.v3.MetricServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new metricserviceModule.v3.MetricServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new metricserviceModule.v3.MetricServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = metricserviceModule.v3.MetricServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new metricserviceModule.v3.MetricServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - await client.initialize(); - assert(client.metricServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.metricServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.metricServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getMonitoredResourceDescriptor', () => { - it('invokes getMonitoredResourceDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMonitoredResourceDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MonitoredResourceDescriptor() - ); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMonitoredResourceDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMonitoredResourceDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMonitoredResourceDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMonitoredResourceDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMonitoredResourceDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMonitoredResourceDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMonitoredResourceDescriptor(request), expectedError); - }); - }); - - describe('getMetricDescriptor', () => { - it('invokes getMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.getMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getMetricDescriptor(request), expectedError); - }); - }); - - describe('createMetricDescriptor', () => { - it('invokes createMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.createMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.MetricDescriptor() - ); - client.innerApiCalls.createMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createMetricDescriptor(request), expectedError); - }); - }); - - describe('deleteMetricDescriptor', () => { - it('invokes deleteMetricDescriptor without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMetricDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMetricDescriptor( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMetricDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMetricDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMetricDescriptor with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteMetricDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteMetricDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteMetricDescriptor(request), expectedError); - }); - }); - - describe('createTimeSeries', () => { - it('invokes createTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.createTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTimeSeries( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTimeSeries with closed client', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createTimeSeries(request), expectedError); - }); - }); - - describe('listMonitoredResourceDescriptors', () => { - it('invokes listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMonitoredResourceDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMonitoredResourceDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMonitoredResourceDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMonitoredResourceDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMonitoredResourceDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMonitoredResourceDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMonitoredResourceDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMonitoredResourceDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMonitoredResourceDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MonitoredResourceDescriptor[] = []; - stream.on('data', (response: protos.google.api.MonitoredResourceDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMonitoredResourceDescriptors, request)); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMonitoredResourceDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - generateSampleMessage(new protos.google.api.MonitoredResourceDescriptor()), - ]; - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMonitoredResourceDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMonitoredResourceDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMonitoredResourceDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMonitoredResourceDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listMetricDescriptors', () => { - it('invokes listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listMetricDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptors without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.innerApiCalls.listMetricDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMetricDescriptors( - request, - (err?: Error|null, result?: protos.google.api.IMetricDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMetricDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMetricDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMetricDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMetricDescriptorsStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listMetricDescriptorsStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listMetricDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.api.MetricDescriptor[] = []; - stream.on('data', (response: protos.google.api.MetricDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listMetricDescriptors, request)); - assert( - (client.descriptors.page.listMetricDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetricDescriptors without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - generateSampleMessage(new protos.google.api.MetricDescriptor()), - ]; - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.api.IMetricDescriptor[] = []; - const iterable = client.listMetricDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listMetricDescriptors with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListMetricDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListMetricDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listMetricDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listMetricDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.api.IMetricDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listMetricDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTimeSeries', () => { - it('invokes listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCall(expectedResponse); - const [response] = await client.listTimeSeries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeries without error using callback', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.innerApiCalls.listTimeSeries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTimeSeries( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.ITimeSeries[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTimeSeries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTimeSeries(request), expectedError); - const actualRequest = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTimeSeries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTimeSeriesStream without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTimeSeriesStream with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTimeSeriesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.TimeSeries[] = []; - stream.on('data', (response: protos.google.monitoring.v3.TimeSeries) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTimeSeries, request)); - assert( - (client.descriptors.page.listTimeSeries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTimeSeries without error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - generateSampleMessage(new protos.google.monitoring.v3.TimeSeries()), - ]; - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - const iterable = client.listTimeSeriesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTimeSeries with error', async () => { - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListTimeSeriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListTimeSeriesRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTimeSeries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTimeSeriesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.ITimeSeries[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTimeSeries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMetricDescriptor', async () => { - const fakePath = "/rendered/path/folderMetricDescriptor"; - const expectedParameters = { - folder: "folderValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMetricDescriptorPath', () => { - const result = client.folderMetricDescriptorPath("folderValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMetricDescriptorName', () => { - const result = client.matchFolderFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromFolderMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromFolderMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.folderMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/folderMonitoredResourceDescriptor"; - const expectedParameters = { - folder: "folderValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderMonitoredResourceDescriptorPath', () => { - const result = client.folderMonitoredResourceDescriptorPath("folderValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchFolderFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromFolderMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.folderMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMetricDescriptor', async () => { - const fakePath = "/rendered/path/organizationMetricDescriptor"; - const expectedParameters = { - organization: "organizationValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMetricDescriptorPath', () => { - const result = client.organizationMetricDescriptorPath("organizationValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMetricDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromOrganizationMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromOrganizationMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.organizationMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/organizationMonitoredResourceDescriptor"; - const expectedParameters = { - organization: "organizationValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationMonitoredResourceDescriptorPath', () => { - const result = client.organizationMonitoredResourceDescriptorPath("organizationValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromOrganizationMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.organizationMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMetricDescriptor', async () => { - const fakePath = "/rendered/path/projectMetricDescriptor"; - const expectedParameters = { - project: "projectValue", - metric_descriptor: "metricDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectMetricDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMetricDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMetricDescriptorPath', () => { - const result = client.projectMetricDescriptorPath("projectValue", "metricDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMetricDescriptorName', () => { - const result = client.matchProjectFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMetricDescriptorFromProjectMetricDescriptorName', () => { - const result = client.matchMetricDescriptorFromProjectMetricDescriptorName(fakePath); - assert.strictEqual(result, "metricDescriptorValue"); - assert((client.pathTemplates.projectMetricDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectMonitoredResourceDescriptor', async () => { - const fakePath = "/rendered/path/projectMonitoredResourceDescriptor"; - const expectedParameters = { - project: "projectValue", - monitored_resource_descriptor: "monitoredResourceDescriptorValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectMonitoredResourceDescriptorPath', () => { - const result = client.projectMonitoredResourceDescriptorPath("projectValue", "monitoredResourceDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchProjectFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName', () => { - const result = client.matchMonitoredResourceDescriptorFromProjectMonitoredResourceDescriptorName(fakePath); - assert.strictEqual(result, "monitoredResourceDescriptorValue"); - assert((client.pathTemplates.projectMonitoredResourceDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new metricserviceModule.v3.MetricServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_notification_channel_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_notification_channel_service_v3.ts.baseline deleted file mode 100644 index 774957e9ee8d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_notification_channel_service_v3.ts.baseline +++ /dev/null @@ -1,2582 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as notificationchannelserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.NotificationChannelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = notificationchannelserviceModule.v3.NotificationChannelServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = notificationchannelserviceModule.v3.NotificationChannelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new notificationchannelserviceModule.v3.NotificationChannelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = notificationchannelserviceModule.v3.NotificationChannelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - await client.initialize(); - assert(client.notificationChannelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.notificationChannelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.notificationChannelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getNotificationChannelDescriptor', () => { - it('invokes getNotificationChannelDescriptor without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelDescriptor(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannelDescriptor() - ); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelDescriptor( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelDescriptor = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelDescriptor as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelDescriptor with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelDescriptorRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelDescriptorRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelDescriptor(request), expectedError); - }); - }); - - describe('getNotificationChannel', () => { - it('invokes getNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.getNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannel(request), expectedError); - }); - }); - - describe('createNotificationChannel', () => { - it('invokes createNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.createNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.createNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createNotificationChannel(request), expectedError); - }); - }); - - describe('updateNotificationChannel', () => { - it('invokes updateNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.updateNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.updateNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedHeaderRequestParams = `notification_channel.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateNotificationChannelRequest() - ); - request.notificationChannel ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateNotificationChannelRequest', ['notificationChannel', 'name']); - request.notificationChannel.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateNotificationChannel(request), expectedError); - }); - }); - - describe('deleteNotificationChannel', () => { - it('invokes deleteNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteNotificationChannel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteNotificationChannel(request), expectedError); - }); - }); - - describe('sendNotificationChannelVerificationCode', () => { - it('invokes sendNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.sendNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.sendNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.sendNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.sendNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes sendNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.sendNotificationChannelVerificationCode(request), expectedError); - }); - }); - - describe('getNotificationChannelVerificationCode', () => { - it('invokes getNotificationChannelVerificationCode without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(expectedResponse); - const [response] = await client.getNotificationChannelVerificationCode(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse() - ); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getNotificationChannelVerificationCode( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IGetNotificationChannelVerificationCodeResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getNotificationChannelVerificationCode = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - const actualRequest = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getNotificationChannelVerificationCode as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getNotificationChannelVerificationCode with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getNotificationChannelVerificationCode(request), expectedError); - }); - }); - - describe('verifyNotificationChannel', () => { - it('invokes verifyNotificationChannel without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(expectedResponse); - const [response] = await client.verifyNotificationChannel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.NotificationChannel() - ); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyNotificationChannel( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyNotificationChannel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyNotificationChannel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyNotificationChannel with closed client', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.VerifyNotificationChannelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.VerifyNotificationChannelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyNotificationChannel(request), expectedError); - }); - }); - - describe('listNotificationChannelDescriptors', () => { - it('invokes listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannelDescriptors(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptors without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannelDescriptors( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannelDescriptor[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannelDescriptors = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannelDescriptors(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannelDescriptors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelDescriptorsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationChannelDescriptorsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelDescriptorsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannelDescriptor[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannelDescriptor) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannelDescriptors, request)); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannelDescriptors without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannelDescriptor()), - ]; - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - const iterable = client.listNotificationChannelDescriptorsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannelDescriptors with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelDescriptorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelDescriptorsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannelDescriptors.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelDescriptorsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannelDescriptor[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannelDescriptors.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listNotificationChannels', () => { - it('invokes listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCall(expectedResponse); - const [response] = await client.listNotificationChannels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels without error using callback', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.innerApiCalls.listNotificationChannels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listNotificationChannels( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.INotificationChannel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listNotificationChannels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listNotificationChannels(request), expectedError); - const actualRequest = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listNotificationChannels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listNotificationChannelsStream without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listNotificationChannelsStream with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listNotificationChannelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.NotificationChannel[] = []; - stream.on('data', (response: protos.google.monitoring.v3.NotificationChannel) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listNotificationChannels, request)); - assert( - (client.descriptors.page.listNotificationChannels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannels without error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - generateSampleMessage(new protos.google.monitoring.v3.NotificationChannel()), - ]; - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - const iterable = client.listNotificationChannelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listNotificationChannels with error', async () => { - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListNotificationChannelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListNotificationChannelsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listNotificationChannels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listNotificationChannelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.INotificationChannel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listNotificationChannels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new notificationchannelserviceModule.v3.NotificationChannelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_service_monitoring_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_service_monitoring_service_v3.ts.baseline deleted file mode 100644 index 27437ecc6284..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_service_monitoring_service_v3.ts.baseline +++ /dev/null @@ -1,2586 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as servicemonitoringserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.ServiceMonitoringServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - await client.initialize(); - assert(client.serviceMonitoringServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.serviceMonitoringServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.serviceMonitoringServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createService', () => { - it('invokes createService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCall(expectedResponse); - const [response] = await client.createService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.createService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createService(request), expectedError); - const actualRequest = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createService(request), expectedError); - }); - }); - - describe('getService', () => { - it('invokes getService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCall(expectedResponse); - const [response] = await client.getService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.getService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getService(request), expectedError); - const actualRequest = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getService(request), expectedError); - }); - }); - - describe('updateService', () => { - it('invokes updateService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCall(expectedResponse); - const [response] = await client.updateService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.Service() - ); - client.innerApiCalls.updateService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateService( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedHeaderRequestParams = `service.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateService(request), expectedError); - const actualRequest = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceRequest() - ); - request.service ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceRequest', ['service', 'name']); - request.service.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateService(request), expectedError); - }); - }); - - describe('deleteService', () => { - it('invokes deleteService without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCall(expectedResponse); - const [response] = await client.deleteService(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteService = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteService( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteService = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteService(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteService as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteService with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteService(request), expectedError); - }); - }); - - describe('createServiceLevelObjective', () => { - it('invokes createServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.createServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateServiceLevelObjectiveRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServiceLevelObjective(request), expectedError); - }); - }); - - describe('getServiceLevelObjective', () => { - it('invokes getServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.getServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServiceLevelObjective(request), expectedError); - }); - }); - - describe('updateServiceLevelObjective', () => { - it('invokes updateServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.updateServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.ServiceLevelObjective() - ); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedHeaderRequestParams = `service_level_objective.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateServiceLevelObjectiveRequest() - ); - request.serviceLevelObjective ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateServiceLevelObjectiveRequest', ['serviceLevelObjective', 'name']); - request.serviceLevelObjective.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateServiceLevelObjective(request), expectedError); - }); - }); - - describe('deleteServiceLevelObjective', () => { - it('invokes deleteServiceLevelObjective without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(expectedResponse); - const [response] = await client.deleteServiceLevelObjective(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServiceLevelObjective( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServiceLevelObjective = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServiceLevelObjective as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServiceLevelObjective with closed client', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteServiceLevelObjectiveRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteServiceLevelObjectiveRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteServiceLevelObjective(request), expectedError); - }); - }); - - describe('listServices', () => { - it('invokes listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCall(expectedResponse); - const [response] = await client.listServices(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.innerApiCalls.listServices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServices( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IService[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServices(request), expectedError); - const actualRequest = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServices as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServicesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServicesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServicesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.Service[] = []; - stream.on('data', (response: protos.google.monitoring.v3.Service) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServices, request)); - assert( - (client.descriptors.page.listServices.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - generateSampleMessage(new protos.google.monitoring.v3.Service()), - ]; - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IService[] = []; - const iterable = client.listServicesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServices with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServicesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServicesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServices.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServicesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IService[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServices.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listServiceLevelObjectives', () => { - it('invokes listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(expectedResponse); - const [response] = await client.listServiceLevelObjectives(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives without error using callback', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServiceLevelObjectives( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IServiceLevelObjective[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServiceLevelObjectives = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServiceLevelObjectives(request), expectedError); - const actualRequest = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServiceLevelObjectives as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServiceLevelObjectivesStream without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServiceLevelObjectivesStream with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServiceLevelObjectivesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.ServiceLevelObjective[] = []; - stream.on('data', (response: protos.google.monitoring.v3.ServiceLevelObjective) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServiceLevelObjectives, request)); - assert( - (client.descriptors.page.listServiceLevelObjectives.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServiceLevelObjectives without error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - generateSampleMessage(new protos.google.monitoring.v3.ServiceLevelObjective()), - ]; - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - const iterable = client.listServiceLevelObjectivesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServiceLevelObjectives with error', async () => { - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListServiceLevelObjectivesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListServiceLevelObjectivesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServiceLevelObjectives.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServiceLevelObjectivesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IServiceLevelObjective[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServiceLevelObjectives.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new servicemonitoringserviceModule.v3.ServiceMonitoringServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_uptime_check_service_v3.ts.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_uptime_check_service_v3.ts.baseline deleted file mode 100644 index 4893feec487c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/test/gapic_uptime_check_service_v3.ts.baseline +++ /dev/null @@ -1,2080 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as uptimecheckserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3.UptimeCheckServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = uptimecheckserviceModule.v3.UptimeCheckServiceClient.servicePath; - assert.strictEqual(servicePath, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = uptimecheckserviceModule.v3.UptimeCheckServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'monitoring.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'monitoring.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new uptimecheckserviceModule.v3.UptimeCheckServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = uptimecheckserviceModule.v3.UptimeCheckServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - await client.initialize(); - assert(client.uptimeCheckServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.uptimeCheckServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.uptimeCheckServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getUptimeCheckConfig', () => { - it('invokes getUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.GetUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.GetUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUptimeCheckConfig(request), expectedError); - }); - }); - - describe('createUptimeCheckConfig', () => { - it('invokes createUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.CreateUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.CreateUptimeCheckConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUptimeCheckConfig(request), expectedError); - }); - }); - - describe('updateUptimeCheckConfig', () => { - it('invokes updateUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.monitoring.v3.UptimeCheckConfig() - ); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedHeaderRequestParams = `uptime_check_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.UpdateUptimeCheckConfigRequest() - ); - request.uptimeCheckConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.UpdateUptimeCheckConfigRequest', ['uptimeCheckConfig', 'name']); - request.uptimeCheckConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUptimeCheckConfig(request), expectedError); - }); - }); - - describe('deleteUptimeCheckConfig', () => { - it('invokes deleteUptimeCheckConfig without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUptimeCheckConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUptimeCheckConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUptimeCheckConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUptimeCheckConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUptimeCheckConfig with closed client', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.DeleteUptimeCheckConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.DeleteUptimeCheckConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUptimeCheckConfig(request), expectedError); - }); - }); - - describe('listUptimeCheckConfigs', () => { - it('invokes listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigs without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckConfigs( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listUptimeCheckConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listUptimeCheckConfigsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listUptimeCheckConfigsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckConfig[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckConfigs, request)); - assert( - (client.descriptors.page.listUptimeCheckConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUptimeCheckConfigs without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckConfig()), - ]; - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - const iterable = client.listUptimeCheckConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listUptimeCheckConfigs with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.monitoring.v3.ListUptimeCheckConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listUptimeCheckConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listUptimeCheckIps', () => { - it('invokes listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(expectedResponse); - const [response] = await client.listUptimeCheckIps(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps without error using callback', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.innerApiCalls.listUptimeCheckIps = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUptimeCheckIps( - request, - (err?: Error|null, result?: protos.google.monitoring.v3.IUptimeCheckIp[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUptimeCheckIps = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUptimeCheckIps(request), expectedError); - }); - - it('invokes listUptimeCheckIpsStream without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); - - it('invokes listUptimeCheckIpsStream with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUptimeCheckIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.monitoring.v3.UptimeCheckIp[] = []; - stream.on('data', (response: protos.google.monitoring.v3.UptimeCheckIp) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUptimeCheckIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUptimeCheckIps, request)); - }); - - it('uses async iteration with listUptimeCheckIps without error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - generateSampleMessage(new protos.google.monitoring.v3.UptimeCheckIp()), - ]; - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - const iterable = client.listUptimeCheckIpsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUptimeCheckIps with error', async () => { - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.monitoring.v3.ListUptimeCheckIpsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUptimeCheckIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUptimeCheckIpsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.monitoring.v3.IUptimeCheckIp[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUptimeCheckIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('folderAlertPolicy', async () => { - const fakePath = "/rendered/path/folderAlertPolicy"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyPath', () => { - const result = client.folderAlertPolicyPath("folderValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyName', () => { - const result = client.matchFolderFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/folderAlertPolicyCondition"; - const expectedParameters = { - folder: "folderValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderAlertPolicyConditionPath', () => { - const result = client.folderAlertPolicyConditionPath("folderValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderAlertPolicyConditionName', () => { - const result = client.matchFolderFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromFolderAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromFolderAlertPolicyConditionName', () => { - const result = client.matchConditionFromFolderAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.folderAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderChannelDescriptor', async () => { - const fakePath = "/rendered/path/folderChannelDescriptor"; - const expectedParameters = { - folder: "folderValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderChannelDescriptorPath', () => { - const result = client.folderChannelDescriptorPath("folderValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderChannelDescriptorName', () => { - const result = client.matchFolderFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromFolderChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromFolderChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.folderChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderGroup', async () => { - const fakePath = "/rendered/path/folderGroup"; - const expectedParameters = { - folder: "folderValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderGroupPath', () => { - const result = client.folderGroupPath("folderValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderGroupName', () => { - const result = client.matchFolderFromFolderGroupName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromFolderGroupName', () => { - const result = client.matchGroupFromFolderGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.folderGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderNotificationChannel', async () => { - const fakePath = "/rendered/path/folderNotificationChannel"; - const expectedParameters = { - folder: "folderValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderNotificationChannelPath', () => { - const result = client.folderNotificationChannelPath("folderValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderNotificationChannelName', () => { - const result = client.matchFolderFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromFolderNotificationChannelName', () => { - const result = client.matchNotificationChannelFromFolderNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.folderNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderService', async () => { - const fakePath = "/rendered/path/folderService"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServicePath', () => { - const result = client.folderServicePath("folderValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceName', () => { - const result = client.matchFolderFromFolderServiceName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceName', () => { - const result = client.matchServiceFromFolderServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/folderServiceServiceLevelObjective"; - const expectedParameters = { - folder: "folderValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderServiceServiceLevelObjectivePath', () => { - const result = client.folderServiceServiceLevelObjectivePath("folderValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchFolderFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromFolderServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.folderServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('folderUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/folderUptimeCheckConfig"; - const expectedParameters = { - folder: "folderValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.folderUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('folderUptimeCheckConfigPath', () => { - const result = client.folderUptimeCheckConfigPath("folderValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchFolderFromFolderUptimeCheckConfigName', () => { - const result = client.matchFolderFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "folderValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromFolderUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromFolderUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.folderUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicy', async () => { - const fakePath = "/rendered/path/organizationAlertPolicy"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyPath', () => { - const result = client.organizationAlertPolicyPath("organizationValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/organizationAlertPolicyCondition"; - const expectedParameters = { - organization: "organizationValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationAlertPolicyConditionPath', () => { - const result = client.organizationAlertPolicyConditionPath("organizationValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchOrganizationFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromOrganizationAlertPolicyConditionName', () => { - const result = client.matchConditionFromOrganizationAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.organizationAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationChannelDescriptor', async () => { - const fakePath = "/rendered/path/organizationChannelDescriptor"; - const expectedParameters = { - organization: "organizationValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationChannelDescriptorPath', () => { - const result = client.organizationChannelDescriptorPath("organizationValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationChannelDescriptorName', () => { - const result = client.matchOrganizationFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromOrganizationChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromOrganizationChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.organizationChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationGroup', async () => { - const fakePath = "/rendered/path/organizationGroup"; - const expectedParameters = { - organization: "organizationValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationGroupPath', () => { - const result = client.organizationGroupPath("organizationValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationGroupName', () => { - const result = client.matchOrganizationFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromOrganizationGroupName', () => { - const result = client.matchGroupFromOrganizationGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.organizationGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationNotificationChannel', async () => { - const fakePath = "/rendered/path/organizationNotificationChannel"; - const expectedParameters = { - organization: "organizationValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationNotificationChannelPath', () => { - const result = client.organizationNotificationChannelPath("organizationValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationNotificationChannelName', () => { - const result = client.matchOrganizationFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromOrganizationNotificationChannelName', () => { - const result = client.matchNotificationChannelFromOrganizationNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.organizationNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationService', async () => { - const fakePath = "/rendered/path/organizationService"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServicePath', () => { - const result = client.organizationServicePath("organizationValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceName', () => { - const result = client.matchOrganizationFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceName', () => { - const result = client.matchServiceFromOrganizationServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/organizationServiceServiceLevelObjective"; - const expectedParameters = { - organization: "organizationValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationServiceServiceLevelObjectivePath', () => { - const result = client.organizationServiceServiceLevelObjectivePath("organizationValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchOrganizationFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromOrganizationServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.organizationServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('organizationUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/organizationUptimeCheckConfig"; - const expectedParameters = { - organization: "organizationValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('organizationUptimeCheckConfigPath', () => { - const result = client.organizationUptimeCheckConfigPath("organizationValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchOrganizationFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchOrganizationFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "organizationValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromOrganizationUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.organizationUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicy', async () => { - const fakePath = "/rendered/path/projectAlertPolicy"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyPath', () => { - const result = client.projectAlertPolicyPath("projectValue", "alertPolicyValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyName', () => { - const result = client.matchProjectFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectAlertPolicyCondition', async () => { - const fakePath = "/rendered/path/projectAlertPolicyCondition"; - const expectedParameters = { - project: "projectValue", - alert_policy: "alertPolicyValue", - condition: "conditionValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectAlertPolicyConditionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectAlertPolicyConditionPath', () => { - const result = client.projectAlertPolicyConditionPath("projectValue", "alertPolicyValue", "conditionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectAlertPolicyConditionName', () => { - const result = client.matchProjectFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAlertPolicyFromProjectAlertPolicyConditionName', () => { - const result = client.matchAlertPolicyFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "alertPolicyValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConditionFromProjectAlertPolicyConditionName', () => { - const result = client.matchConditionFromProjectAlertPolicyConditionName(fakePath); - assert.strictEqual(result, "conditionValue"); - assert((client.pathTemplates.projectAlertPolicyConditionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectChannelDescriptor', async () => { - const fakePath = "/rendered/path/projectChannelDescriptor"; - const expectedParameters = { - project: "projectValue", - channel_descriptor: "channelDescriptorValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectChannelDescriptorPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectChannelDescriptorPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectChannelDescriptorPath', () => { - const result = client.projectChannelDescriptorPath("projectValue", "channelDescriptorValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectChannelDescriptorName', () => { - const result = client.matchProjectFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchChannelDescriptorFromProjectChannelDescriptorName', () => { - const result = client.matchChannelDescriptorFromProjectChannelDescriptorName(fakePath); - assert.strictEqual(result, "channelDescriptorValue"); - assert((client.pathTemplates.projectChannelDescriptorPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectGroup', async () => { - const fakePath = "/rendered/path/projectGroup"; - const expectedParameters = { - project: "projectValue", - group: "groupValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectGroupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectGroupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectGroupPath', () => { - const result = client.projectGroupPath("projectValue", "groupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectGroupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectGroupName', () => { - const result = client.matchProjectFromProjectGroupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGroupFromProjectGroupName', () => { - const result = client.matchGroupFromProjectGroupName(fakePath); - assert.strictEqual(result, "groupValue"); - assert((client.pathTemplates.projectGroupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectNotificationChannel', async () => { - const fakePath = "/rendered/path/projectNotificationChannel"; - const expectedParameters = { - project: "projectValue", - notification_channel: "notificationChannelValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectNotificationChannelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectNotificationChannelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectNotificationChannelPath', () => { - const result = client.projectNotificationChannelPath("projectValue", "notificationChannelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectNotificationChannelName', () => { - const result = client.matchProjectFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNotificationChannelFromProjectNotificationChannelName', () => { - const result = client.matchNotificationChannelFromProjectNotificationChannelName(fakePath); - assert.strictEqual(result, "notificationChannelValue"); - assert((client.pathTemplates.projectNotificationChannelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectService', async () => { - const fakePath = "/rendered/path/projectService"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServicePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServicePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServicePath', () => { - const result = client.projectServicePath("projectValue", "serviceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServicePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceName', () => { - const result = client.matchProjectFromProjectServiceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceName', () => { - const result = client.matchServiceFromProjectServiceName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServicePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectServiceServiceLevelObjective', async () => { - const fakePath = "/rendered/path/projectServiceServiceLevelObjective"; - const expectedParameters = { - project: "projectValue", - service: "serviceValue", - service_level_objective: "serviceLevelObjectiveValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectServiceServiceLevelObjectivePath', () => { - const result = client.projectServiceServiceLevelObjectivePath("projectValue", "serviceValue", "serviceLevelObjectiveValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchProjectFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName', () => { - const result = client.matchServiceLevelObjectiveFromProjectServiceServiceLevelObjectiveName(fakePath); - assert.strictEqual(result, "serviceLevelObjectiveValue"); - assert((client.pathTemplates.projectServiceServiceLevelObjectivePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectUptimeCheckConfig', async () => { - const fakePath = "/rendered/path/projectUptimeCheckConfig"; - const expectedParameters = { - project: "projectValue", - uptime_check_config: "uptimeCheckConfigValue", - }; - const client = new uptimecheckserviceModule.v3.UptimeCheckServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectUptimeCheckConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectUptimeCheckConfigPath', () => { - const result = client.projectUptimeCheckConfigPath("projectValue", "uptimeCheckConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectUptimeCheckConfigName', () => { - const result = client.matchProjectFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchUptimeCheckConfigFromProjectUptimeCheckConfigName', () => { - const result = client.matchUptimeCheckConfigFromProjectUptimeCheckConfigName(fakePath); - assert.strictEqual(result, "uptimeCheckConfigValue"); - assert((client.pathTemplates.projectUptimeCheckConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/monitoring/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/monitoring/webpack.config.js.baseline deleted file mode 100644 index 7f81732c413d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/monitoring/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'monitoring', - filename: './monitoring.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.OwlBot.yaml.baseline deleted file mode 100644 index c85e0d905fb0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/naming/google-naming-nodejs - dest: /owl-bot-staging/google-naming - -api-name: naming \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 1f2617af5d4f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'naming', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/README.md.baseline deleted file mode 100644 index d95fa846b98d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Naming: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/naming.svg)](https://www.npmjs.org/package/naming) - -Naming client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Naming Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/naming/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Naming API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install naming -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install naming@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/index.ts.baseline deleted file mode 100644 index 98db848be491..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const NamingClient = v1beta1.NamingClient; -type NamingClient = v1beta1.NamingClient; -export {v1beta1, NamingClient}; -export default {v1beta1, NamingClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/gapic_metadata.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/gapic_metadata.json.baseline deleted file mode 100644 index 43ee96b6fb5f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/gapic_metadata.json.baseline +++ /dev/null @@ -1,157 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.naming.v1beta1", - "libraryPackage": "naming", - "services": { - "Naming": { - "clients": { - "grpc": { - "libraryClient": "NamingClient", - "rpcs": { - "PaginatedMethodStream": { - "methods": [ - "paginatedMethodStream" - ] - }, - "PaginatedMethodAsync": { - "methods": [ - "paginatedMethodAsync" - ] - }, - "CheckLongRunningProgress": { - "methods": [ - "checkLongRunningProgress" - ] - }, - "Initialize": { - "methods": [ - "initialize" - ] - }, - "ServicePath": { - "methods": [ - "servicePath" - ] - }, - "ApiEndpoint": { - "methods": [ - "apiEndpoint" - ] - }, - "Port": { - "methods": [ - "port" - ] - }, - "Scopes": { - "methods": [ - "scopes" - ] - }, - "getProjectId": { - "methods": [ - "getProjectId" - ] - }, - "getReservedWord": { - "methods": [ - "getReservedWord" - ] - }, - "createABCDESomething": { - "methods": [ - "createABCDESomething" - ] - }, - "LongRunning": { - "methods": [ - "longRunning" - ] - }, - "PaginatedMethod": { - "methods": [ - "paginatedMethod", - "paginatedMethodStream1", - "paginatedMethodAsync1" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "NamingClient", - "rpcs": { - "PaginatedMethodStream": { - "methods": [ - "paginatedMethodStream" - ] - }, - "PaginatedMethodAsync": { - "methods": [ - "paginatedMethodAsync" - ] - }, - "CheckLongRunningProgress": { - "methods": [ - "checkLongRunningProgress" - ] - }, - "Initialize": { - "methods": [ - "initialize" - ] - }, - "ServicePath": { - "methods": [ - "servicePath" - ] - }, - "ApiEndpoint": { - "methods": [ - "apiEndpoint" - ] - }, - "Port": { - "methods": [ - "port" - ] - }, - "Scopes": { - "methods": [ - "scopes" - ] - }, - "getProjectId": { - "methods": [ - "getProjectId" - ] - }, - "getReservedWord": { - "methods": [ - "getReservedWord" - ] - }, - "createABCDESomething": { - "methods": [ - "createABCDESomething" - ] - }, - "LongRunning": { - "methods": [ - "longRunning" - ] - }, - "PaginatedMethod": { - "methods": [ - "paginatedMethod", - "paginatedMethodStream1", - "paginatedMethodAsync1" - ] - } - } - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index 683bf07138b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {NamingClient} from './naming_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client.ts.baseline deleted file mode 100644 index 5020bf2e7fb8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client.ts.baseline +++ /dev/null @@ -1,1683 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as naming_client_config from './naming_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/naming_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'naming_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Fake service to test various possible naming problems. - * @class - * @memberof v1beta1 - */ -export class NamingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('naming'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - namingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of NamingClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 NamingClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NamingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port1; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes1; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 initialize1() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes1; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - projectExportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exports/{export}' - ), - projectPackagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/packages/{package}' - ), - }; - - // 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 = { - paginatedMethod: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'content') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const longRunningResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const longRunningMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - longRunning: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - longRunningResponse.decode.bind(longRunningResponse), - longRunningMetadata.decode.bind(longRunningMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.naming.v1beta1.Naming', gapicConfig as gax.ClientConfig, - 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 initialize1() 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. - */ - initialize1() { - // If the client stub promise is already initialized, return immediately. - if (this.namingStub) { - return this.namingStub; - } - - // Put together the "service stub" for - // google.naming.v1beta1.Naming. - this.namingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.naming.v1beta1.Naming') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.naming.v1beta1.Naming, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const namingStubMethods = - ['paginatedMethod', 'paginatedMethodStream', 'paginatedMethodAsync', 'longRunning', 'checkLongRunningProgress', 'initialize', 'servicePath', 'apiEndpoint', 'port', 'scopes', 'getProjectId', 'getReservedWord', 'createAbcdeSomething']; - for (const methodName of namingStubMethods) { - const callPromise = this.namingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.namingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint1 method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath1() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath1 is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath1, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint1 method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint1() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint1 is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint1() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port1() { - return 1234; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes1() { - return []; - } - - getProjectId1(): Promise; - getProjectId1(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId1(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.paginated_method_stream.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethodStream_async - */ - paginatedMethodStream( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - paginatedMethodStream( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodStream( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodStream( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethodStream request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('paginatedMethodStream response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.paginatedMethodStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('paginatedMethodStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.paginated_method_async.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async - */ - paginatedMethodAsync( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - paginatedMethodAsync( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodAsync( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodAsync( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethodAsync request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('paginatedMethodAsync response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.paginatedMethodAsync(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('paginatedMethodAsync response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.check_long_running_progress.js - * region_tag:localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async - */ - checkLongRunningProgress( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - checkLongRunningProgress( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - checkLongRunningProgress( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - checkLongRunningProgress( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('checkLongRunningProgress request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('checkLongRunningProgress response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.checkLongRunningProgress(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('checkLongRunningProgress response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Problem #3: RPCs that conflict with auto-generated methods - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.initialize.js - * region_tag:localhost_v1beta1_generated_Naming_Initialize_async - */ - initialize( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - initialize( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - initialize( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - initialize( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('initialize request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('initialize response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.initialize(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('initialize response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.service_path.js - * region_tag:localhost_v1beta1_generated_Naming_ServicePath_async - */ - servicePath( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - servicePath( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - servicePath( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - servicePath( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('servicePath request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('servicePath response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.servicePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('servicePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.api_endpoint.js - * region_tag:localhost_v1beta1_generated_Naming_ApiEndpoint_async - */ - apiEndpoint( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - apiEndpoint( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - apiEndpoint( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - apiEndpoint( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('apiEndpoint request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('apiEndpoint response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.apiEndpoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('apiEndpoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.port.js - * region_tag:localhost_v1beta1_generated_Naming_Port_async - */ - port( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - port( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - port( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - port( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('port request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('port response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.port(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('port response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.scopes.js - * region_tag:localhost_v1beta1_generated_Naming_Scopes_async - */ - scopes( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - scopes( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - scopes( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - scopes( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('scopes request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('scopes response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.scopes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('scopes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.get_project_id.js - * region_tag:localhost_v1beta1_generated_Naming_getProjectId_async - */ - getProjectId( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - getProjectId( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - getProjectId( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - getProjectId( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('getProjectId request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProjectId response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getProjectId(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('getProjectId response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.word - * @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 {@link protos.google.naming.v1beta1.ReservedWord|ReservedWord}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.get_reserved_word.js - * region_tag:localhost_v1beta1_generated_Naming_getReservedWord_async - */ - getReservedWord( - request?: protos.google.naming.v1beta1.IGetReservedWordRequest, - options?: CallOptions): - Promise<[ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, {}|undefined - ]>; - getReservedWord( - request: protos.google.naming.v1beta1.IGetReservedWordRequest, - options: CallOptions, - callback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): void; - getReservedWord( - request: protos.google.naming.v1beta1.IGetReservedWordRequest, - callback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): void; - getReservedWord( - request?: protos.google.naming.v1beta1.IGetReservedWordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('getReservedWord request %j', request); - const wrappedCallback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getReservedWord response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getReservedWord(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, {}|undefined - ]) => { - this._log.info('getReservedWord response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js - * region_tag:localhost_v1beta1_generated_Naming_createABCDESomething_async - */ - createABCDESomething( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - createABCDESomething( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - createABCDESomething( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - createABCDESomething( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('createABCDESomething request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createABCDESomething response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createAbcdeSomething(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]) => { - this._log.info('createABCDESomething response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Problem #2: long running method generates extra method check*Progress() - * - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.long_running.js - * region_tag:localhost_v1beta1_generated_Naming_LongRunning_async - */ - longRunning( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - longRunning( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - longRunning( - request: protos.google.protobuf.IEmpty, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - longRunning( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('longRunning response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('longRunning request %j', request); - return this.innerApiCalls.longRunning(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('longRunning response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `longRunning()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.long_running.js - * region_tag:localhost_v1beta1_generated_Naming_LongRunning_async - */ - async checkLongRunningProgress1(name: string): Promise>{ - this._log.info('longRunning long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.longRunning, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Problem #1: paginated method generates extra methods *Stream() and - * *Async(), which might conflict with unary methods with the same names. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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 Array of {@link protos.google.protobuf.Empty|Empty}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `paginatedMethodAsync1()` - * 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. - */ - paginatedMethod( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]>; - paginatedMethod( - request: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): void; - paginatedMethod( - request: protos.google.naming.v1beta1.IPaginatedMethodRequest, - callback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): void; - paginatedMethod( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>, - callback?: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): - Promise<[ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('paginatedMethod values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('paginatedMethod request %j', request); - return this.innerApiCalls - .paginatedMethod(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]) => { - this._log.info('paginatedMethod values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `paginatedMethod`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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.protobuf.Empty|Empty} 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 `paginatedMethodAsync1()` - * 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. - */ - paginatedMethodStream1( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['paginatedMethod']; - const callSettings = defaultCallSettings.merge(options); - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethod stream %j', request); - return this.descriptors.page.paginatedMethod.createStream( - this.innerApiCalls.paginatedMethod as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `paginatedMethod`, 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 {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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.protobuf.Empty|Empty}. 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 include:samples/generated/v1beta1/naming.paginated_method.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethod_async - */ - paginatedMethodAsync1( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['paginatedMethod']; - const callSettings = defaultCallSettings.merge(options); - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethod iterate %j', request); - return this.descriptors.page.paginatedMethod.asyncIterate( - this.innerApiCalls['paginatedMethod'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectExport resource name string. - * - * @param {string} project - * @param {string} exportParam - * @returns {string} Resource name string. - */ - projectExportPath(project:string,exportParam:string) { - return this.pathTemplates.projectExportPathTemplate.render({ - project: project, - export: exportParam, - }); - } - - /** - * Parse the project from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; - } - - /** - * Parse the export from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; - } - - /** - * Return a fully-qualified projectPackage resource name string. - * - * @param {string} project - * @param {string} packageParam - * @returns {string} Resource name string. - */ - projectPackagePath(project:string,packageParam:string) { - return this.pathTemplates.projectPackagePathTemplate.render({ - project: project, - package: packageParam, - }); - } - - /** - * Parse the project from ProjectPackage resource. - * - * @param {string} projectPackageName - * A fully-qualified path representing project_package resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectPackageName(projectPackageName: string) { - return this.pathTemplates.projectPackagePathTemplate.match(projectPackageName).project; - } - - /** - * Parse the package from ProjectPackage resource. - * - * @param {string} projectPackageName - * A fully-qualified path representing project_package resource. - * @returns {string} A string representing the package. - */ - matchPackageFromProjectPackageName(projectPackageName: string) { - return this.pathTemplates.projectPackagePathTemplate.match(projectPackageName).package; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.namingStub && !this._terminated) { - return this.namingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client_config.json.baseline deleted file mode 100644 index 2b2302872568..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_client_config.json.baseline +++ /dev/null @@ -1,78 +0,0 @@ -{ - "interfaces": { - "google.naming.v1beta1.Naming": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "PaginatedMethod": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PaginatedMethodStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PaginatedMethodAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "LongRunning": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CheckLongRunningProgress": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Initialize": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ServicePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApiEndpoint": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Port": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Scopes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "getProjectId": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "getReservedWord": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "createABCDESomething": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_proto_list.json.baseline deleted file mode 100644 index 892e01481968..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/src/v1beta1/naming_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/naming/v1beta1/naming.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 674179f33ad4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const naming = require('naming'); - -function main() { - const namingClient = new naming.NamingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 08cea732e5e2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as naming from 'naming'; - -function main() { - const namingClient = new naming.NamingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index e40defab01d2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {NamingClient} from 'naming'; - -// check that the client class type name can be used -function doStuffWithNamingClient(client: NamingClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const namingClient = new NamingClient(); - doStuffWithNamingClient(namingClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/test/gapic_naming_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/test/gapic_naming_v1beta1.ts.baseline deleted file mode 100644 index 559d526c38c8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/esm/test/gapic_naming_v1beta1.ts.baseline +++ /dev/null @@ -1,1438 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as namingModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.NamingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new namingModule.v1beta1.NamingClient(); - const apiEndpoint = client.apiEndpoint1; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new namingModule.v1beta1.NamingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath1 is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = namingModule.v1beta1.NamingClient.servicePath1; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint1 is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = namingModule.v1beta1.NamingClient.apiEndpoint1; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new namingModule.v1beta1.NamingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = namingModule.v1beta1.NamingClient.port1; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new namingModule.v1beta1.NamingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new namingModule.v1beta1.NamingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.namingStub, undefined); - await client.initialize1(); - assert(client.namingStub); - }); - - it('has close method for the initialized client', done => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize1().catch(err => {throw err}); - assert(client.namingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.namingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId1(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId1((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('paginatedMethodStream', () => { - it('invokes paginatedMethodStream without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodStream = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethodStream(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodStream without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethodStream( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodStream with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethodStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethodStream(request), expectedError); - }); - - it('invokes paginatedMethodStream with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.paginatedMethodStream(request), expectedError); - }); - }); - - describe('paginatedMethodAsync', () => { - it('invokes paginatedMethodAsync without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethodAsync(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodAsync without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethodAsync( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodAsync with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethodAsync(request), expectedError); - }); - - it('invokes paginatedMethodAsync with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.paginatedMethodAsync(request), expectedError); - }); - }); - - describe('checkLongRunningProgress', () => { - it('invokes checkLongRunningProgress without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCall(expectedResponse); - const [response] = await client.checkLongRunningProgress(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkLongRunningProgress without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkLongRunningProgress( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkLongRunningProgress with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkLongRunningProgress(request), expectedError); - }); - - it('invokes checkLongRunningProgress with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.checkLongRunningProgress(request), expectedError); - }); - }); - - describe('initialize', () => { - it('invokes initialize without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.initialize = stubSimpleCall(expectedResponse); - const [response] = await client.initialize(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes initialize without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.initialize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.initialize( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes initialize with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.initialize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.initialize(request), expectedError); - }); - - it('invokes initialize with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.initialize(request), expectedError); - }); - }); - - describe('servicePath', () => { - it('invokes servicePath without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.servicePath = stubSimpleCall(expectedResponse); - const [response] = await client.servicePath(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes servicePath without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.servicePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.servicePath( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes servicePath with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.servicePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.servicePath(request), expectedError); - }); - - it('invokes servicePath with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.servicePath(request), expectedError); - }); - }); - - describe('apiEndpoint', () => { - it('invokes apiEndpoint without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.apiEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.apiEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes apiEndpoint without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.apiEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.apiEndpoint( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes apiEndpoint with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.apiEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.apiEndpoint(request), expectedError); - }); - - it('invokes apiEndpoint with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.apiEndpoint(request), expectedError); - }); - }); - - describe('port', () => { - it('invokes port without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.port = stubSimpleCall(expectedResponse); - const [response] = await client.port(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes port without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.port = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.port( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes port with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.port = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.port(request), expectedError); - }); - - it('invokes port with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.port(request), expectedError); - }); - }); - - describe('scopes', () => { - it('invokes scopes without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.scopes = stubSimpleCall(expectedResponse); - const [response] = await client.scopes(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes scopes without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.scopes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.scopes( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes scopes with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.scopes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.scopes(request), expectedError); - }); - - it('invokes scopes with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.scopes(request), expectedError); - }); - }); - - describe('getProjectId', () => { - it('invokes getProjectId without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.getProjectId = stubSimpleCall(expectedResponse); - const [response] = await client.getProjectId(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getProjectId without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.getProjectId = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProjectId( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getProjectId with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectId = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProjectId(request), expectedError); - }); - - it('invokes getProjectId with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProjectId(request), expectedError); - }); - }); - - describe('getReservedWord', () => { - it('invokes getReservedWord without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.naming.v1beta1.ReservedWord() - ); - client.innerApiCalls.getReservedWord = stubSimpleCall(expectedResponse); - const [response] = await client.getReservedWord(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getReservedWord without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.naming.v1beta1.ReservedWord() - ); - client.innerApiCalls.getReservedWord = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReservedWord( - request, - (err?: Error|null, result?: protos.google.naming.v1beta1.IReservedWord|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getReservedWord with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getReservedWord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReservedWord(request), expectedError); - }); - - it('invokes getReservedWord with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getReservedWord(request), expectedError); - }); - }); - - describe('createABCDESomething', () => { - it('invokes createABCDESomething without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createAbcdeSomething = stubSimpleCall(expectedResponse); - const [response] = await client.createABCDESomething(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createABCDESomething without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createAbcdeSomething = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createABCDESomething( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createABCDESomething with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createAbcdeSomething = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createABCDESomething(request), expectedError); - }); - - it('invokes createABCDESomething with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createABCDESomething(request), expectedError); - }); - }); - - describe('longRunning', () => { - it('invokes longRunning without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.longRunning = stubLongRunningCall(expectedResponse); - const [operation] = await client.longRunning(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes longRunning without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.longRunning = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.longRunning( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes longRunning with call error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.longRunning = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.longRunning(request), expectedError); - }); - - it('invokes longRunning with LRO error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.longRunning = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.longRunning(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkLongRunningProgress1 without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkLongRunningProgress1(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkLongRunningProgress1 with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkLongRunningProgress1(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('paginatedMethod', () => { - it('invokes paginatedMethod without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.innerApiCalls.paginatedMethod = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethod(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethod without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.innerApiCalls.paginatedMethod = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethod( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethod with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethod = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethod(request), expectedError); - }); - - it('invokes paginatedMethodStream1 without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.descriptors.page.paginatedMethod.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.paginatedMethodStream1(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.protobuf.Empty[] = []; - stream.on('data', (response: protos.google.protobuf.Empty) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.paginatedMethod.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.paginatedMethod, request)); - }); - - it('invokes paginatedMethodStream1 with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.paginatedMethod.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.paginatedMethodStream1(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.protobuf.Empty[] = []; - stream.on('data', (response: protos.google.protobuf.Empty) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.paginatedMethod.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.paginatedMethod, request)); - }); - - it('uses async iteration with paginatedMethod without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.descriptors.page.paginatedMethod.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.protobuf.IEmpty[] = []; - const iterable = client.paginatedMethodAsync1(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.paginatedMethod.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with paginatedMethod with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.paginatedMethod.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.paginatedMethodAsync1(request); - await assert.rejects(async () => { - const responses: protos.google.protobuf.IEmpty[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.paginatedMethod.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('projectExport', () => { - const fakePath = "/rendered/path/projectExport"; - const expectedParameters = { - project: "projectValue", - export: "exportValue", - }; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize1().catch(err => {throw err}); - client.pathTemplates.projectExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExportPath', () => { - const result = client.projectExportPath("projectValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExportName', () => { - const result = client.matchProjectFromProjectExportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromProjectExportName', () => { - const result = client.matchExportFromProjectExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectPackage', () => { - const fakePath = "/rendered/path/projectPackage"; - const expectedParameters = { - project: "projectValue", - package: "packageValue", - }; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize1().catch(err => {throw err}); - client.pathTemplates.projectPackagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPackagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPackagePath', () => { - const result = client.projectPackagePath("projectValue", "packageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPackagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectPackageName', () => { - const result = client.matchProjectFromProjectPackageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromProjectPackageName', () => { - const result = client.matchPackageFromProjectPackageName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.projectPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json b/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json deleted file mode 100644 index cd6f9ad7dfb8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "naming", - "version": "0.1.0", - "description": "Naming client for Node.js", - "repository": "googleapis/nodejs-naming", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google naming", - "naming", - "naming" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/protos/google/naming/v1beta1/naming.proto.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/protos/google/naming/v1beta1/naming.proto.baseline deleted file mode 100644 index 55de1d72247d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/protos/google/naming/v1beta1/naming.proto.baseline +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.naming.v1beta1; - -// Fake service to test various possible naming problems. -service Naming { - // Fake default host since there is no actual server that implements this - // service. - option (google.api.default_host) = "localhost:1234"; - - // Problem #1: paginated method generates extra methods *Stream() and - // *Async(), which might conflict with unary methods with the same names. - rpc PaginatedMethod(PaginatedMethodRequest) returns (PaginatedMethodResponse) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethod" - body: "*" - }; - } - - rpc PaginatedMethodStream(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethodStream" - body: "*" - }; - } - - rpc PaginatedMethodAsync(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethodAsync" - body: "*" - }; - } - - // Problem #2: long running method generates extra method check*Progress() - rpc LongRunning(google.protobuf.Empty) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/naming:longRunning" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Empty" - }; - } - - rpc CheckLongRunningProgress(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:checkLongRunningProgress" - body: "*" - }; - } - - // Problem #3: RPCs that conflict with auto-generated methods - rpc Initialize(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:initialize" - body: "*" - }; - } - - rpc ServicePath(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:servicePath" - body: "*" - }; - } - - rpc ApiEndpoint(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:apiEndpoint" - body: "*" - }; - } - - rpc Port(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:port" - body: "*" - }; - } - - rpc Scopes(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:scopes" - body: "*" - }; - } - - rpc getProjectId(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:getProjectId" - body: "*" - }; - } - - rpc getReservedWord(GetReservedWordRequest) returns (ReservedWord) { - option (google.api.http) = { - post: "/v1beta1/naming:getReservedWord" - body: "*" - }; - } - - rpc createABCDESomething(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:createABCDESomething" - body: "*" - }; - } - -} - -message PaginatedMethodRequest { - google.protobuf.Empty content = 1 [(google.api.field_behavior) = REQUIRED]; - int32 page_size = 2; - string page_token = 3; -} - -message PaginatedMethodResponse { - repeated google.protobuf.Empty content = 1; - string next_page_token = 2; -} - -message GetReservedWordRequest { - string word = 1; -} - -message ReservedWord { - option (google.api.resource) = { - type: "naming.googleapis.com/ReservedWord" - pattern: "projects/{project}/packages/{package}", - pattern: "projects/{project}/exports/{export}", - }; - string name = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.api_endpoint.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.api_endpoint.js.baseline deleted file mode 100644 index 71f77cacf039..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.api_endpoint.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_ApiEndpoint_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callApiEndpoint() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.apiEndpoint(request); - console.log(response); - } - - callApiEndpoint(); - // [END localhost_v1beta1_generated_Naming_ApiEndpoint_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline deleted file mode 100644 index c1eb6565ccdd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callCheckLongRunningProgress() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.checkLongRunningProgress(request); - console.log(response); - } - - callCheckLongRunningProgress(); - // [END localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline deleted file mode 100644 index 6a38746bf5bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_createABCDESomething_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callCreateABCDESomething() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.createABCDESomething(request); - console.log(response); - } - - callCreateABCDESomething(); - // [END localhost_v1beta1_generated_Naming_createABCDESomething_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_project_id.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_project_id.js.baseline deleted file mode 100644 index 45285adf453e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_project_id.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_getProjectId_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callGetProjectId() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.getProjectId(request); - console.log(response); - } - - callGetProjectId(); - // [END localhost_v1beta1_generated_Naming_getProjectId_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_reserved_word.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_reserved_word.js.baseline deleted file mode 100644 index c564f7ced9e9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.get_reserved_word.js.baseline +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_getReservedWord_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const word = 'abc123' - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callGetReservedWord() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.getReservedWord(request); - console.log(response); - } - - callGetReservedWord(); - // [END localhost_v1beta1_generated_Naming_getReservedWord_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.initialize.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.initialize.js.baseline deleted file mode 100644 index 09e06b0bf0b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.initialize.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Initialize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callInitialize() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.initialize(request); - console.log(response); - } - - callInitialize(); - // [END localhost_v1beta1_generated_Naming_Initialize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.long_running.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.long_running.js.baseline deleted file mode 100644 index bd622f982445..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.long_running.js.baseline +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_LongRunning_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callLongRunning() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await namingClient.longRunning(request); - const [response] = await operation.promise(); - console.log(response); - } - - callLongRunning(); - // [END localhost_v1beta1_generated_Naming_LongRunning_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method.js.baseline deleted file mode 100644 index b231a1f26cde..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Naming_PaginatedMethod_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const content = {} - /** - */ - // const pageSize = 1234 - /** - */ - // const pageToken = 'abc123' - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethod() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = namingClient.paginatedMethodAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPaginatedMethod(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethod_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_async.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_async.js.baseline deleted file mode 100644 index 29484568aa4a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_async.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethodAsync() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.paginatedMethodAsync(request); - console.log(response); - } - - callPaginatedMethodAsync(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline deleted file mode 100644 index e1257d4c53d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_PaginatedMethodStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethodStream() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.paginatedMethodStream(request); - console.log(response); - } - - callPaginatedMethodStream(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethodStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.port.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.port.js.baseline deleted file mode 100644 index bd8d1e5c62ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.port.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Port_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPort() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.port(request); - console.log(response); - } - - callPort(); - // [END localhost_v1beta1_generated_Naming_Port_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.scopes.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.scopes.js.baseline deleted file mode 100644 index 6727ea0c2fd3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.scopes.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Scopes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callScopes() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.scopes(request); - console.log(response); - } - - callScopes(); - // [END localhost_v1beta1_generated_Naming_Scopes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.service_path.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.service_path.js.baseline deleted file mode 100644 index 3b3f029ddd1e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/naming.service_path.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_ServicePath_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callServicePath() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.servicePath(request); - console.log(response); - } - - callServicePath(); - // [END localhost_v1beta1_generated_Naming_ServicePath_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline deleted file mode 100644 index 4121760ec5b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline +++ /dev/null @@ -1,488 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-naming", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.naming.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethod_async", - "title": "Naming paginatedMethod Sample", - "origin": "API_DEFINITION", - "description": " Problem #1: paginated method generates extra methods *Stream() and *Async(), which might conflict with unary methods with the same names.", - "canonical": true, - "file": "naming.paginated_method.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethod", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethod", - "async": true, - "parameters": [ - { - "name": "content", - "type": ".google.protobuf.Empty" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.naming.v1beta1.PaginatedMethodResponse", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethod", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethod", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethodStream_async", - "title": "Naming paginatedMethodStream Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.paginated_method_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethodStream", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodStream", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethodStream", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodStream", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async", - "title": "Naming paginatedMethodAsync Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.paginated_method_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethodAsync", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodAsync", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethodAsync", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodAsync", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_LongRunning_async", - "title": "Naming longRunning Sample", - "origin": "API_DEFINITION", - "description": " Problem #2: long running method generates extra method check*Progress()", - "canonical": true, - "file": "naming.long_running.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 49, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "LongRunning", - "fullName": "google.naming.v1beta1.Naming.LongRunning", - "async": true, - "parameters": [], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "LongRunning", - "fullName": "google.naming.v1beta1.Naming.LongRunning", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async", - "title": "Naming checkLongRunningProgress Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.check_long_running_progress.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckLongRunningProgress", - "fullName": "google.naming.v1beta1.Naming.CheckLongRunningProgress", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "CheckLongRunningProgress", - "fullName": "google.naming.v1beta1.Naming.CheckLongRunningProgress", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Initialize_async", - "title": "Naming initialize Sample", - "origin": "API_DEFINITION", - "description": " Problem #3: RPCs that conflict with auto-generated methods", - "canonical": true, - "file": "naming.initialize.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Initialize", - "fullName": "google.naming.v1beta1.Naming.Initialize", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Initialize", - "fullName": "google.naming.v1beta1.Naming.Initialize", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_ServicePath_async", - "title": "Naming servicePath Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.service_path.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ServicePath", - "fullName": "google.naming.v1beta1.Naming.ServicePath", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "ServicePath", - "fullName": "google.naming.v1beta1.Naming.ServicePath", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_ApiEndpoint_async", - "title": "Naming apiEndpoint Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.api_endpoint.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApiEndpoint", - "fullName": "google.naming.v1beta1.Naming.ApiEndpoint", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "ApiEndpoint", - "fullName": "google.naming.v1beta1.Naming.ApiEndpoint", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Port_async", - "title": "Naming port Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.port.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Port", - "fullName": "google.naming.v1beta1.Naming.Port", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Port", - "fullName": "google.naming.v1beta1.Naming.Port", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Scopes_async", - "title": "Naming scopes Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.scopes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Scopes", - "fullName": "google.naming.v1beta1.Naming.Scopes", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Scopes", - "fullName": "google.naming.v1beta1.Naming.Scopes", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_getProjectId_async", - "title": "Naming getProjectId Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.get_project_id.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "getProjectId", - "fullName": "google.naming.v1beta1.Naming.getProjectId", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "GetProjectId", - "fullName": "google.naming.v1beta1.Naming.GetProjectId", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_getReservedWord_async", - "title": "Naming getReservedWord Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.get_reserved_word.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "getReservedWord", - "fullName": "google.naming.v1beta1.Naming.getReservedWord", - "async": true, - "parameters": [ - { - "name": "word", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.naming.v1beta1.ReservedWord", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "GetReservedWord", - "fullName": "google.naming.v1beta1.Naming.GetReservedWord", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_createABCDESomething_async", - "title": "Naming createABCDESomething Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.create_a_b_c_d_e_something.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "createABCDESomething", - "fullName": "google.naming.v1beta1.Naming.createABCDESomething", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "CreateABCDESomething", - "fullName": "google.naming.v1beta1.Naming.CreateABCDESomething", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/naming-esm/webpack.config.cjs.baseline deleted file mode 100644 index a7ec91bb4a58..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Naming', - filename: './naming.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.OwlBot.yaml.baseline deleted file mode 100644 index c85e0d905fb0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/naming/google-naming-nodejs - dest: /owl-bot-staging/google-naming - -api-name: naming \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.jsdoc.js.baseline deleted file mode 100644 index d0d764eb0c88..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'naming', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/naming/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/naming/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/naming/README.md.baseline deleted file mode 100644 index d95fa846b98d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Naming: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/naming.svg)](https://www.npmjs.org/package/naming) - -Naming client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Naming Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/naming/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Naming API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install naming -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install naming@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-naming diff --git a/core/generator/gapic-generator-typescript/baselines/naming/package.json b/core/generator/gapic-generator-typescript/baselines/naming/package.json deleted file mode 100644 index 6e82b91d416d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "naming", - "version": "0.1.0", - "description": "Naming client for Node.js", - "repository": "googleapis/nodejs-naming", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google naming", - "naming", - "naming" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming/protos/google/naming/v1beta1/naming.proto.baseline b/core/generator/gapic-generator-typescript/baselines/naming/protos/google/naming/v1beta1/naming.proto.baseline deleted file mode 100644 index 55de1d72247d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/protos/google/naming/v1beta1/naming.proto.baseline +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.naming.v1beta1; - -// Fake service to test various possible naming problems. -service Naming { - // Fake default host since there is no actual server that implements this - // service. - option (google.api.default_host) = "localhost:1234"; - - // Problem #1: paginated method generates extra methods *Stream() and - // *Async(), which might conflict with unary methods with the same names. - rpc PaginatedMethod(PaginatedMethodRequest) returns (PaginatedMethodResponse) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethod" - body: "*" - }; - } - - rpc PaginatedMethodStream(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethodStream" - body: "*" - }; - } - - rpc PaginatedMethodAsync(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:paginatedMethodAsync" - body: "*" - }; - } - - // Problem #2: long running method generates extra method check*Progress() - rpc LongRunning(google.protobuf.Empty) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/naming:longRunning" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Empty" - }; - } - - rpc CheckLongRunningProgress(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:checkLongRunningProgress" - body: "*" - }; - } - - // Problem #3: RPCs that conflict with auto-generated methods - rpc Initialize(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:initialize" - body: "*" - }; - } - - rpc ServicePath(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:servicePath" - body: "*" - }; - } - - rpc ApiEndpoint(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:apiEndpoint" - body: "*" - }; - } - - rpc Port(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:port" - body: "*" - }; - } - - rpc Scopes(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:scopes" - body: "*" - }; - } - - rpc getProjectId(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:getProjectId" - body: "*" - }; - } - - rpc getReservedWord(GetReservedWordRequest) returns (ReservedWord) { - option (google.api.http) = { - post: "/v1beta1/naming:getReservedWord" - body: "*" - }; - } - - rpc createABCDESomething(google.protobuf.Empty) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/naming:createABCDESomething" - body: "*" - }; - } - -} - -message PaginatedMethodRequest { - google.protobuf.Empty content = 1 [(google.api.field_behavior) = REQUIRED]; - int32 page_size = 2; - string page_token = 3; -} - -message PaginatedMethodResponse { - repeated google.protobuf.Empty content = 1; - string next_page_token = 2; -} - -message GetReservedWordRequest { - string word = 1; -} - -message ReservedWord { - option (google.api.resource) = { - type: "naming.googleapis.com/ReservedWord" - pattern: "projects/{project}/packages/{package}", - pattern: "projects/{project}/exports/{export}", - }; - string name = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.api_endpoint.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.api_endpoint.js.baseline deleted file mode 100644 index 71f77cacf039..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.api_endpoint.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_ApiEndpoint_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callApiEndpoint() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.apiEndpoint(request); - console.log(response); - } - - callApiEndpoint(); - // [END localhost_v1beta1_generated_Naming_ApiEndpoint_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline deleted file mode 100644 index c1eb6565ccdd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.check_long_running_progress.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callCheckLongRunningProgress() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.checkLongRunningProgress(request); - console.log(response); - } - - callCheckLongRunningProgress(); - // [END localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline deleted file mode 100644 index 6a38746bf5bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_createABCDESomething_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callCreateABCDESomething() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.createABCDESomething(request); - console.log(response); - } - - callCreateABCDESomething(); - // [END localhost_v1beta1_generated_Naming_createABCDESomething_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_project_id.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_project_id.js.baseline deleted file mode 100644 index 45285adf453e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_project_id.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_getProjectId_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callGetProjectId() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.getProjectId(request); - console.log(response); - } - - callGetProjectId(); - // [END localhost_v1beta1_generated_Naming_getProjectId_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_reserved_word.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_reserved_word.js.baseline deleted file mode 100644 index c564f7ced9e9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.get_reserved_word.js.baseline +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_getReservedWord_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const word = 'abc123' - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callGetReservedWord() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.getReservedWord(request); - console.log(response); - } - - callGetReservedWord(); - // [END localhost_v1beta1_generated_Naming_getReservedWord_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.initialize.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.initialize.js.baseline deleted file mode 100644 index 09e06b0bf0b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.initialize.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Initialize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callInitialize() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.initialize(request); - console.log(response); - } - - callInitialize(); - // [END localhost_v1beta1_generated_Naming_Initialize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.long_running.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.long_running.js.baseline deleted file mode 100644 index bd622f982445..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.long_running.js.baseline +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_LongRunning_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callLongRunning() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await namingClient.longRunning(request); - const [response] = await operation.promise(); - console.log(response); - } - - callLongRunning(); - // [END localhost_v1beta1_generated_Naming_LongRunning_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method.js.baseline deleted file mode 100644 index b231a1f26cde..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Naming_PaginatedMethod_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const content = {} - /** - */ - // const pageSize = 1234 - /** - */ - // const pageToken = 'abc123' - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethod() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = namingClient.paginatedMethodAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPaginatedMethod(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethod_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_async.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_async.js.baseline deleted file mode 100644 index 29484568aa4a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_async.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethodAsync() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.paginatedMethodAsync(request); - console.log(response); - } - - callPaginatedMethodAsync(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline deleted file mode 100644 index e1257d4c53d8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.paginated_method_stream.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_PaginatedMethodStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPaginatedMethodStream() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.paginatedMethodStream(request); - console.log(response); - } - - callPaginatedMethodStream(); - // [END localhost_v1beta1_generated_Naming_PaginatedMethodStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.port.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.port.js.baseline deleted file mode 100644 index bd8d1e5c62ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.port.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Port_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callPort() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.port(request); - console.log(response); - } - - callPort(); - // [END localhost_v1beta1_generated_Naming_Port_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.scopes.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.scopes.js.baseline deleted file mode 100644 index 6727ea0c2fd3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.scopes.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_Scopes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callScopes() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.scopes(request); - console.log(response); - } - - callScopes(); - // [END localhost_v1beta1_generated_Naming_Scopes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.service_path.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.service_path.js.baseline deleted file mode 100644 index 3b3f029ddd1e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/naming.service_path.js.baseline +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Naming_ServicePath_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - - // Imports the Naming library - const {NamingClient} = require('naming').v1beta1; - - // Instantiates a client - const namingClient = new NamingClient(); - - async function callServicePath() { - // Construct request - const request = { - }; - - // Run request - const response = await namingClient.servicePath(request); - console.log(response); - } - - callServicePath(); - // [END localhost_v1beta1_generated_Naming_ServicePath_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline deleted file mode 100644 index 4121760ec5b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/samples/generated/v1beta1/snippet_metadata_google.naming.v1beta1.json.baseline +++ /dev/null @@ -1,488 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-naming", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.naming.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethod_async", - "title": "Naming paginatedMethod Sample", - "origin": "API_DEFINITION", - "description": " Problem #1: paginated method generates extra methods *Stream() and *Async(), which might conflict with unary methods with the same names.", - "canonical": true, - "file": "naming.paginated_method.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethod", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethod", - "async": true, - "parameters": [ - { - "name": "content", - "type": ".google.protobuf.Empty" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.naming.v1beta1.PaginatedMethodResponse", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethod", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethod", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethodStream_async", - "title": "Naming paginatedMethodStream Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.paginated_method_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethodStream", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodStream", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethodStream", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodStream", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async", - "title": "Naming paginatedMethodAsync Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.paginated_method_async.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PaginatedMethodAsync", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodAsync", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "PaginatedMethodAsync", - "fullName": "google.naming.v1beta1.Naming.PaginatedMethodAsync", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_LongRunning_async", - "title": "Naming longRunning Sample", - "origin": "API_DEFINITION", - "description": " Problem #2: long running method generates extra method check*Progress()", - "canonical": true, - "file": "naming.long_running.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 49, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "LongRunning", - "fullName": "google.naming.v1beta1.Naming.LongRunning", - "async": true, - "parameters": [], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "LongRunning", - "fullName": "google.naming.v1beta1.Naming.LongRunning", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async", - "title": "Naming checkLongRunningProgress Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.check_long_running_progress.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CheckLongRunningProgress", - "fullName": "google.naming.v1beta1.Naming.CheckLongRunningProgress", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "CheckLongRunningProgress", - "fullName": "google.naming.v1beta1.Naming.CheckLongRunningProgress", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Initialize_async", - "title": "Naming initialize Sample", - "origin": "API_DEFINITION", - "description": " Problem #3: RPCs that conflict with auto-generated methods", - "canonical": true, - "file": "naming.initialize.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Initialize", - "fullName": "google.naming.v1beta1.Naming.Initialize", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Initialize", - "fullName": "google.naming.v1beta1.Naming.Initialize", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_ServicePath_async", - "title": "Naming servicePath Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.service_path.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ServicePath", - "fullName": "google.naming.v1beta1.Naming.ServicePath", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "ServicePath", - "fullName": "google.naming.v1beta1.Naming.ServicePath", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_ApiEndpoint_async", - "title": "Naming apiEndpoint Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.api_endpoint.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ApiEndpoint", - "fullName": "google.naming.v1beta1.Naming.ApiEndpoint", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "ApiEndpoint", - "fullName": "google.naming.v1beta1.Naming.ApiEndpoint", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Port_async", - "title": "Naming port Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.port.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Port", - "fullName": "google.naming.v1beta1.Naming.Port", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Port", - "fullName": "google.naming.v1beta1.Naming.Port", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_Scopes_async", - "title": "Naming scopes Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.scopes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Scopes", - "fullName": "google.naming.v1beta1.Naming.Scopes", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "Scopes", - "fullName": "google.naming.v1beta1.Naming.Scopes", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_getProjectId_async", - "title": "Naming getProjectId Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.get_project_id.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "getProjectId", - "fullName": "google.naming.v1beta1.Naming.getProjectId", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "GetProjectId", - "fullName": "google.naming.v1beta1.Naming.GetProjectId", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_getReservedWord_async", - "title": "Naming getReservedWord Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.get_reserved_word.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 51, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "getReservedWord", - "fullName": "google.naming.v1beta1.Naming.getReservedWord", - "async": true, - "parameters": [ - { - "name": "word", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.naming.v1beta1.ReservedWord", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "GetReservedWord", - "fullName": "google.naming.v1beta1.Naming.GetReservedWord", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Naming_createABCDESomething_async", - "title": "Naming createABCDESomething Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "naming.create_a_b_c_d_e_something.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 48, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "createABCDESomething", - "fullName": "google.naming.v1beta1.Naming.createABCDESomething", - "async": true, - "parameters": [], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "NamingClient", - "fullName": "google.naming.v1beta1.NamingClient" - }, - "method": { - "shortName": "CreateABCDESomething", - "fullName": "google.naming.v1beta1.Naming.CreateABCDESomething", - "service": { - "shortName": "Naming", - "fullName": "google.naming.v1beta1.Naming" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/index.ts.baseline deleted file mode 100644 index a801f1255dde..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const NamingClient = v1beta1.NamingClient; -type NamingClient = v1beta1.NamingClient; -export {v1beta1, NamingClient}; -export default {v1beta1, NamingClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/gapic_metadata.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/gapic_metadata.json.baseline deleted file mode 100644 index 43ee96b6fb5f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/gapic_metadata.json.baseline +++ /dev/null @@ -1,157 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.naming.v1beta1", - "libraryPackage": "naming", - "services": { - "Naming": { - "clients": { - "grpc": { - "libraryClient": "NamingClient", - "rpcs": { - "PaginatedMethodStream": { - "methods": [ - "paginatedMethodStream" - ] - }, - "PaginatedMethodAsync": { - "methods": [ - "paginatedMethodAsync" - ] - }, - "CheckLongRunningProgress": { - "methods": [ - "checkLongRunningProgress" - ] - }, - "Initialize": { - "methods": [ - "initialize" - ] - }, - "ServicePath": { - "methods": [ - "servicePath" - ] - }, - "ApiEndpoint": { - "methods": [ - "apiEndpoint" - ] - }, - "Port": { - "methods": [ - "port" - ] - }, - "Scopes": { - "methods": [ - "scopes" - ] - }, - "getProjectId": { - "methods": [ - "getProjectId" - ] - }, - "getReservedWord": { - "methods": [ - "getReservedWord" - ] - }, - "createABCDESomething": { - "methods": [ - "createABCDESomething" - ] - }, - "LongRunning": { - "methods": [ - "longRunning" - ] - }, - "PaginatedMethod": { - "methods": [ - "paginatedMethod", - "paginatedMethodStream1", - "paginatedMethodAsync1" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "NamingClient", - "rpcs": { - "PaginatedMethodStream": { - "methods": [ - "paginatedMethodStream" - ] - }, - "PaginatedMethodAsync": { - "methods": [ - "paginatedMethodAsync" - ] - }, - "CheckLongRunningProgress": { - "methods": [ - "checkLongRunningProgress" - ] - }, - "Initialize": { - "methods": [ - "initialize" - ] - }, - "ServicePath": { - "methods": [ - "servicePath" - ] - }, - "ApiEndpoint": { - "methods": [ - "apiEndpoint" - ] - }, - "Port": { - "methods": [ - "port" - ] - }, - "Scopes": { - "methods": [ - "scopes" - ] - }, - "getProjectId": { - "methods": [ - "getProjectId" - ] - }, - "getReservedWord": { - "methods": [ - "getReservedWord" - ] - }, - "createABCDESomething": { - "methods": [ - "createABCDESomething" - ] - }, - "LongRunning": { - "methods": [ - "longRunning" - ] - }, - "PaginatedMethod": { - "methods": [ - "paginatedMethod", - "paginatedMethodStream1", - "paginatedMethodAsync1" - ] - } - } - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/index.ts.baseline deleted file mode 100644 index 8f1ba3abce00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {NamingClient} from './naming_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client.ts.baseline deleted file mode 100644 index 1410bbf39684..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client.ts.baseline +++ /dev/null @@ -1,1674 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/naming_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './naming_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Fake service to test various possible naming problems. - * @class - * @memberof v1beta1 - */ -export class NamingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('naming'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - namingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of NamingClient. - * - * @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://cloud.google.com/docs/authentication/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 NamingClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof NamingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port1; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes1; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 initialize1() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes1; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - projectExportPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/exports/{export}' - ), - projectPackagePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/packages/{package}' - ), - }; - - // 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 = { - paginatedMethod: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'content') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const longRunningResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const longRunningMetadata = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - - this.descriptors.longrunning = { - longRunning: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - longRunningResponse.decode.bind(longRunningResponse), - longRunningMetadata.decode.bind(longRunningMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.naming.v1beta1.Naming', gapicConfig as gax.ClientConfig, - 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 initialize1() 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. - */ - initialize1() { - // If the client stub promise is already initialized, return immediately. - if (this.namingStub) { - return this.namingStub; - } - - // Put together the "service stub" for - // google.naming.v1beta1.Naming. - this.namingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.naming.v1beta1.Naming') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.naming.v1beta1.Naming, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const namingStubMethods = - ['paginatedMethod', 'paginatedMethodStream', 'paginatedMethodAsync', 'longRunning', 'checkLongRunningProgress', 'initialize', 'servicePath', 'apiEndpoint', 'port', 'scopes', 'getProjectId', 'getReservedWord', 'createAbcdeSomething']; - for (const methodName of namingStubMethods) { - const callPromise = this.namingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.namingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint1 method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath1() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath1 is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath1. - * @deprecated Use the apiEndpoint1 method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint1() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint1 is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint1() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port1() { - return 1234; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes1() { - return []; - } - - getProjectId1(): Promise; - getProjectId1(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId1(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.paginated_method_stream.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethodStream_async - */ - paginatedMethodStream( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - paginatedMethodStream( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodStream( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodStream( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethodStream request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('paginatedMethodStream response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.paginatedMethodStream(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('paginatedMethodStream response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.paginated_method_async.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethodAsync_async - */ - paginatedMethodAsync( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - paginatedMethodAsync( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodAsync( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - paginatedMethodAsync( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethodAsync request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('paginatedMethodAsync response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.paginatedMethodAsync(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('paginatedMethodAsync response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.check_long_running_progress.js - * region_tag:localhost_v1beta1_generated_Naming_CheckLongRunningProgress_async - */ - checkLongRunningProgress( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - checkLongRunningProgress( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - checkLongRunningProgress( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - checkLongRunningProgress( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('checkLongRunningProgress request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('checkLongRunningProgress response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.checkLongRunningProgress(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('checkLongRunningProgress response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Problem #3: RPCs that conflict with auto-generated methods - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.initialize.js - * region_tag:localhost_v1beta1_generated_Naming_Initialize_async - */ - initialize( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - initialize( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - initialize( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - initialize( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('initialize request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('initialize response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.initialize(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('initialize response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.service_path.js - * region_tag:localhost_v1beta1_generated_Naming_ServicePath_async - */ - servicePath( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - servicePath( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - servicePath( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - servicePath( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('servicePath request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('servicePath response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.servicePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('servicePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.api_endpoint.js - * region_tag:localhost_v1beta1_generated_Naming_ApiEndpoint_async - */ - apiEndpoint( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - apiEndpoint( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - apiEndpoint( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - apiEndpoint( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('apiEndpoint request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('apiEndpoint response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.apiEndpoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('apiEndpoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.port.js - * region_tag:localhost_v1beta1_generated_Naming_Port_async - */ - port( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - port( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - port( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - port( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('port request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('port response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.port(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('port response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.scopes.js - * region_tag:localhost_v1beta1_generated_Naming_Scopes_async - */ - scopes( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - scopes( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - scopes( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - scopes( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('scopes request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('scopes response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.scopes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('scopes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.get_project_id.js - * region_tag:localhost_v1beta1_generated_Naming_getProjectId_async - */ - getProjectId( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - getProjectId( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - getProjectId( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - getProjectId( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('getProjectId request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProjectId response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getProjectId(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('getProjectId response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.word - * @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 {@link protos.google.naming.v1beta1.ReservedWord|ReservedWord}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.get_reserved_word.js - * region_tag:localhost_v1beta1_generated_Naming_getReservedWord_async - */ - getReservedWord( - request?: protos.google.naming.v1beta1.IGetReservedWordRequest, - options?: CallOptions): - Promise<[ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, {}|undefined - ]>; - getReservedWord( - request: protos.google.naming.v1beta1.IGetReservedWordRequest, - options: CallOptions, - callback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): void; - getReservedWord( - request: protos.google.naming.v1beta1.IGetReservedWordRequest, - callback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): void; - getReservedWord( - request?: protos.google.naming.v1beta1.IGetReservedWordRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('getReservedWord request %j', request); - const wrappedCallback: Callback< - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getReservedWord response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getReservedWord(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.naming.v1beta1.IReservedWord, - protos.google.naming.v1beta1.IGetReservedWordRequest|undefined, - {}|undefined - ]) => { - this._log.info('getReservedWord response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.create_a_b_c_d_e_something.js - * region_tag:localhost_v1beta1_generated_Naming_createABCDESomething_async - */ - createABCDESomething( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>; - createABCDESomething( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - createABCDESomething( - request: protos.google.protobuf.IEmpty, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): void; - createABCDESomething( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - this._log.info('createABCDESomething request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createABCDESomething response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createAbcdeSomething(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.protobuf.IEmpty|undefined, - {}|undefined - ]) => { - this._log.info('createABCDESomething response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Problem #2: long running method generates extra method check*Progress() - * - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.long_running.js - * region_tag:localhost_v1beta1_generated_Naming_LongRunning_async - */ - longRunning( - request?: protos.google.protobuf.IEmpty, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - longRunning( - request: protos.google.protobuf.IEmpty, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - longRunning( - request: protos.google.protobuf.IEmpty, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - longRunning( - request?: protos.google.protobuf.IEmpty, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('longRunning response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('longRunning request %j', request); - return this.innerApiCalls.longRunning(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('longRunning response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `longRunning()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/naming.long_running.js - * region_tag:localhost_v1beta1_generated_Naming_LongRunning_async - */ - async checkLongRunningProgress1(name: string): Promise>{ - this._log.info('longRunning long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.longRunning, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Problem #1: paginated method generates extra methods *Stream() and - * *Async(), which might conflict with unary methods with the same names. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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 Array of {@link protos.google.protobuf.Empty|Empty}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `paginatedMethodAsync1()` - * 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. - */ - paginatedMethod( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]>; - paginatedMethod( - request: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): void; - paginatedMethod( - request: protos.google.naming.v1beta1.IPaginatedMethodRequest, - callback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): void; - paginatedMethod( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>, - callback?: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>): - Promise<[ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize1().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.naming.v1beta1.IPaginatedMethodRequest, - protos.google.naming.v1beta1.IPaginatedMethodResponse|null|undefined, - protos.google.protobuf.IEmpty>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('paginatedMethod values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('paginatedMethod request %j', request); - return this.innerApiCalls - .paginatedMethod(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.protobuf.IEmpty[], - protos.google.naming.v1beta1.IPaginatedMethodRequest|null, - protos.google.naming.v1beta1.IPaginatedMethodResponse - ]) => { - this._log.info('paginatedMethod values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `paginatedMethod`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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.protobuf.Empty|Empty} 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 `paginatedMethodAsync1()` - * 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. - */ - paginatedMethodStream1( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['paginatedMethod']; - const callSettings = defaultCallSettings.merge(options); - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethod stream %j', request); - return this.descriptors.page.paginatedMethod.createStream( - this.innerApiCalls.paginatedMethod as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `paginatedMethod`, 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 {google.protobuf.Empty} request.content - * @param {number} request.pageSize - * @param {string} request.pageToken - * @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.protobuf.Empty|Empty}. 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 include:samples/generated/v1beta1/naming.paginated_method.js - * region_tag:localhost_v1beta1_generated_Naming_PaginatedMethod_async - */ - paginatedMethodAsync1( - request?: protos.google.naming.v1beta1.IPaginatedMethodRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['paginatedMethod']; - const callSettings = defaultCallSettings.merge(options); - this.initialize1().catch(err => {throw err}); - this._log.info('paginatedMethod iterate %j', request); - return this.descriptors.page.paginatedMethod.asyncIterate( - this.innerApiCalls['paginatedMethod'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified projectExport resource name string. - * - * @param {string} project - * @param {string} exportParam - * @returns {string} Resource name string. - */ - projectExportPath(project:string,exportParam:string) { - return this.pathTemplates.projectExportPathTemplate.render({ - project: project, - export: exportParam, - }); - } - - /** - * Parse the project from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).project; - } - - /** - * Parse the export from ProjectExport resource. - * - * @param {string} projectExportName - * A fully-qualified path representing project_export resource. - * @returns {string} A string representing the export. - */ - matchExportFromProjectExportName(projectExportName: string) { - return this.pathTemplates.projectExportPathTemplate.match(projectExportName).export; - } - - /** - * Return a fully-qualified projectPackage resource name string. - * - * @param {string} project - * @param {string} packageParam - * @returns {string} Resource name string. - */ - projectPackagePath(project:string,packageParam:string) { - return this.pathTemplates.projectPackagePathTemplate.render({ - project: project, - package: packageParam, - }); - } - - /** - * Parse the project from ProjectPackage resource. - * - * @param {string} projectPackageName - * A fully-qualified path representing project_package resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectPackageName(projectPackageName: string) { - return this.pathTemplates.projectPackagePathTemplate.match(projectPackageName).project; - } - - /** - * Parse the package from ProjectPackage resource. - * - * @param {string} projectPackageName - * A fully-qualified path representing project_package resource. - * @returns {string} A string representing the package. - */ - matchPackageFromProjectPackageName(projectPackageName: string) { - return this.pathTemplates.projectPackagePathTemplate.match(projectPackageName).package; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.namingStub && !this._terminated) { - return this.namingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client_config.json.baseline deleted file mode 100644 index 2b2302872568..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_client_config.json.baseline +++ /dev/null @@ -1,78 +0,0 @@ -{ - "interfaces": { - "google.naming.v1beta1.Naming": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "PaginatedMethod": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PaginatedMethodStream": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PaginatedMethodAsync": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "LongRunning": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CheckLongRunningProgress": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Initialize": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ServicePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ApiEndpoint": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Port": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Scopes": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "getProjectId": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "getReservedWord": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "createABCDESomething": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_proto_list.json.baseline deleted file mode 100644 index 892e01481968..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/src/v1beta1/naming_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/naming/v1beta1/naming.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index cbfeb47d2170..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const naming = require('naming'); - -function main() { - const namingClient = new naming.NamingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index c8cd80a20a9a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {NamingClient} from 'naming'; - -// check that the client class type name can be used -function doStuffWithNamingClient(client: NamingClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const namingClient = new NamingClient(); - doStuffWithNamingClient(namingClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/test/gapic_naming_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/naming/test/gapic_naming_v1beta1.ts.baseline deleted file mode 100644 index 47d84bea6500..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/test/gapic_naming_v1beta1.ts.baseline +++ /dev/null @@ -1,1429 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as namingModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.NamingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new namingModule.v1beta1.NamingClient(); - const apiEndpoint = client.apiEndpoint1; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new namingModule.v1beta1.NamingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath1 is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = namingModule.v1beta1.NamingClient.servicePath1; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint1 is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = namingModule.v1beta1.NamingClient.apiEndpoint1; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new namingModule.v1beta1.NamingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = namingModule.v1beta1.NamingClient.port1; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new namingModule.v1beta1.NamingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new namingModule.v1beta1.NamingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.namingStub, undefined); - await client.initialize1(); - assert(client.namingStub); - }); - - it('has close method for the initialized client', done => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize1().catch(err => {throw err}); - assert(client.namingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.namingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId1(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId1((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('paginatedMethodStream', () => { - it('invokes paginatedMethodStream without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodStream = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethodStream(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodStream without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethodStream( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodStream with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethodStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethodStream(request), expectedError); - }); - - it('invokes paginatedMethodStream with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.paginatedMethodStream(request), expectedError); - }); - }); - - describe('paginatedMethodAsync', () => { - it('invokes paginatedMethodAsync without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethodAsync(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodAsync without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethodAsync( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethodAsync with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethodAsync = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethodAsync(request), expectedError); - }); - - it('invokes paginatedMethodAsync with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.paginatedMethodAsync(request), expectedError); - }); - }); - - describe('checkLongRunningProgress', () => { - it('invokes checkLongRunningProgress without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCall(expectedResponse); - const [response] = await client.checkLongRunningProgress(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkLongRunningProgress without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.checkLongRunningProgress( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes checkLongRunningProgress with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.checkLongRunningProgress = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkLongRunningProgress(request), expectedError); - }); - - it('invokes checkLongRunningProgress with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.checkLongRunningProgress(request), expectedError); - }); - }); - - describe('initialize', () => { - it('invokes initialize without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.initialize = stubSimpleCall(expectedResponse); - const [response] = await client.initialize(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes initialize without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.initialize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.initialize( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes initialize with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.initialize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.initialize(request), expectedError); - }); - - it('invokes initialize with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.initialize(request), expectedError); - }); - }); - - describe('servicePath', () => { - it('invokes servicePath without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.servicePath = stubSimpleCall(expectedResponse); - const [response] = await client.servicePath(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes servicePath without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.servicePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.servicePath( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes servicePath with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.servicePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.servicePath(request), expectedError); - }); - - it('invokes servicePath with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.servicePath(request), expectedError); - }); - }); - - describe('apiEndpoint', () => { - it('invokes apiEndpoint without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.apiEndpoint = stubSimpleCall(expectedResponse); - const [response] = await client.apiEndpoint(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes apiEndpoint without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.apiEndpoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.apiEndpoint( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes apiEndpoint with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.apiEndpoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.apiEndpoint(request), expectedError); - }); - - it('invokes apiEndpoint with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.apiEndpoint(request), expectedError); - }); - }); - - describe('port', () => { - it('invokes port without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.port = stubSimpleCall(expectedResponse); - const [response] = await client.port(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes port without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.port = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.port( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes port with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.port = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.port(request), expectedError); - }); - - it('invokes port with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.port(request), expectedError); - }); - }); - - describe('scopes', () => { - it('invokes scopes without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.scopes = stubSimpleCall(expectedResponse); - const [response] = await client.scopes(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes scopes without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.scopes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.scopes( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes scopes with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.scopes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.scopes(request), expectedError); - }); - - it('invokes scopes with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.scopes(request), expectedError); - }); - }); - - describe('getProjectId', () => { - it('invokes getProjectId without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.getProjectId = stubSimpleCall(expectedResponse); - const [response] = await client.getProjectId(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getProjectId without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.getProjectId = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProjectId( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getProjectId with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getProjectId = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProjectId(request), expectedError); - }); - - it('invokes getProjectId with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProjectId(request), expectedError); - }); - }); - - describe('getReservedWord', () => { - it('invokes getReservedWord without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.naming.v1beta1.ReservedWord() - ); - client.innerApiCalls.getReservedWord = stubSimpleCall(expectedResponse); - const [response] = await client.getReservedWord(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getReservedWord without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.naming.v1beta1.ReservedWord() - ); - client.innerApiCalls.getReservedWord = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getReservedWord( - request, - (err?: Error|null, result?: protos.google.naming.v1beta1.IReservedWord|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getReservedWord with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getReservedWord = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getReservedWord(request), expectedError); - }); - - it('invokes getReservedWord with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.GetReservedWordRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getReservedWord(request), expectedError); - }); - }); - - describe('createABCDESomething', () => { - it('invokes createABCDESomething without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createAbcdeSomething = stubSimpleCall(expectedResponse); - const [response] = await client.createABCDESomething(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createABCDESomething without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.createAbcdeSomething = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createABCDESomething( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createABCDESomething with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createAbcdeSomething = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createABCDESomething(request), expectedError); - }); - - it('invokes createABCDESomething with closed client', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createABCDESomething(request), expectedError); - }); - }); - - describe('longRunning', () => { - it('invokes longRunning without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.longRunning = stubLongRunningCall(expectedResponse); - const [operation] = await client.longRunning(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes longRunning without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.longRunning = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.longRunning( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes longRunning with call error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.longRunning = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.longRunning(request), expectedError); - }); - - it('invokes longRunning with LRO error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.longRunning = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.longRunning(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkLongRunningProgress1 without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkLongRunningProgress1(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkLongRunningProgress1 with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkLongRunningProgress1(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('paginatedMethod', () => { - it('invokes paginatedMethod without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.innerApiCalls.paginatedMethod = stubSimpleCall(expectedResponse); - const [response] = await client.paginatedMethod(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethod without error using callback', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.innerApiCalls.paginatedMethod = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.paginatedMethod( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes paginatedMethod with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.paginatedMethod = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.paginatedMethod(request), expectedError); - }); - - it('invokes paginatedMethodStream1 without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.descriptors.page.paginatedMethod.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.paginatedMethodStream1(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.protobuf.Empty[] = []; - stream.on('data', (response: protos.google.protobuf.Empty) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.paginatedMethod.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.paginatedMethod, request)); - }); - - it('invokes paginatedMethodStream1 with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.paginatedMethod.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.paginatedMethodStream1(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.protobuf.Empty[] = []; - stream.on('data', (response: protos.google.protobuf.Empty) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.paginatedMethod.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.paginatedMethod, request)); - }); - - it('uses async iteration with paginatedMethod without error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - generateSampleMessage(new protos.google.protobuf.Empty()), - ]; - client.descriptors.page.paginatedMethod.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.protobuf.IEmpty[] = []; - const iterable = client.paginatedMethodAsync1(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.paginatedMethod.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with paginatedMethod with error', async () => { - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - const request = generateSampleMessage( - new protos.google.naming.v1beta1.PaginatedMethodRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.paginatedMethod.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.paginatedMethodAsync1(request); - await assert.rejects(async () => { - const responses: protos.google.protobuf.IEmpty[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.paginatedMethod.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('projectExport', async () => { - const fakePath = "/rendered/path/projectExport"; - const expectedParameters = { - project: "projectValue", - export: "exportValue", - }; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - client.pathTemplates.projectExportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectExportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectExportPath', () => { - const result = client.projectExportPath("projectValue", "exportValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectExportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectExportName', () => { - const result = client.matchProjectFromProjectExportName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExportFromProjectExportName', () => { - const result = client.matchExportFromProjectExportName(fakePath); - assert.strictEqual(result, "exportValue"); - assert((client.pathTemplates.projectExportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('projectPackage', async () => { - const fakePath = "/rendered/path/projectPackage"; - const expectedParameters = { - project: "projectValue", - package: "packageValue", - }; - const client = new namingModule.v1beta1.NamingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize1(); - client.pathTemplates.projectPackagePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPackagePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPackagePath', () => { - const result = client.projectPackagePath("projectValue", "packageValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPackagePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectPackageName', () => { - const result = client.matchProjectFromProjectPackageName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPackageFromProjectPackageName', () => { - const result = client.matchPackageFromProjectPackageName(fakePath); - assert.strictEqual(result, "packageValue"); - assert((client.pathTemplates.projectPackagePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/naming/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/naming/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/naming/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/naming/webpack.config.js.baseline deleted file mode 100644 index a7ec91bb4a58..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/naming/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Naming', - filename: './naming.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/api.json.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/api.json.baseline deleted file mode 100644 index 22b35ea23025..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/api.json.baseline +++ /dev/null @@ -1,16327 +0,0 @@ -{ - "packageName": "google.pubsub.v1", - "publishName": "pubsub", - "naming": { - "name": "Pubsub", - "namespace": [ - "google" - ], - "version": "v1", - "productName": "Pubsub", - "protoPackage": "google.pubsub.v1", - "nameNotCapitalized": "pubsub", - "namePath": "google-pubsub", - "namePathWithDashes": "google/pubsub" - }, - "hostname": "pubsub.googleapis.com", - "port": "443", - "services": [ - { - "name": "Publisher", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Topic", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateTopic", - "inputType": ".google.pubsub.v1.Topic", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateTopic", - "inputType": ".google.pubsub.v1.UpdateTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.http": { - "patch": "/v1/{topic.name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PublishRequest", - "outputInterface": ".google.pubsub.v1.PublishResponse", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Publish", - "inputType": ".google.pubsub.v1.PublishRequest", - "outputType": ".google.pubsub.v1.PublishResponse", - "options": { - ".google.api.methodSignature": [ - "topic,messages" - ], - ".google.api.http": { - "post": "/v1/{topic=projects/*/topics/*}:publish", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Gets the configuration of a topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetTopic", - "inputType": ".google.pubsub.v1.GetTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "topics", - "pagingResponseType": ".google.pubsub.v1.Topic", - "inputInterface": ".google.pubsub.v1.ListTopicsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicsResponse", - "comments": [ - " Lists matching topics.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopics", - "inputType": ".google.pubsub.v1.ListTopicsRequest", - "outputType": ".google.pubsub.v1.ListTopicsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/topics", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSubscriptions", - "inputType": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSnapshots", - "inputType": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteTopicRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteTopic", - "inputType": ".google.pubsub.v1.DeleteTopicRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "delete": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.DetachSubscriptionResponse", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DetachSubscription", - "inputType": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputType": ".google.pubsub.v1.DetachSubscriptionResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:detach", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/pubsub.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Topic", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateTopic", - "inputType": ".google.pubsub.v1.Topic", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateTopic", - "inputType": ".google.pubsub.v1.UpdateTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.http": { - "patch": "/v1/{topic.name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PublishRequest", - "outputInterface": ".google.pubsub.v1.PublishResponse", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Publish", - "inputType": ".google.pubsub.v1.PublishRequest", - "outputType": ".google.pubsub.v1.PublishResponse", - "options": { - ".google.api.methodSignature": [ - "topic,messages" - ], - ".google.api.http": { - "post": "/v1/{topic=projects/*/topics/*}:publish", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Gets the configuration of a topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetTopic", - "inputType": ".google.pubsub.v1.GetTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteTopicRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteTopic", - "inputType": ".google.pubsub.v1.DeleteTopicRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "delete": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.DetachSubscriptionResponse", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DetachSubscription", - "inputType": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputType": ".google.pubsub.v1.DetachSubscriptionResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:detach", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "topics", - "pagingResponseType": ".google.pubsub.v1.Topic", - "inputInterface": ".google.pubsub.v1.ListTopicsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicsResponse", - "comments": [ - " Lists matching topics.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopics", - "inputType": ".google.pubsub.v1.ListTopicsRequest", - "outputType": ".google.pubsub.v1.ListTopicsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/topics", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSubscriptions", - "inputType": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSnapshots", - "inputType": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - }, - { - "name": "SchemaService", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Creates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSchema", - "inputType": ".google.pubsub.v1.CreateSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "parent,schema,schema_id" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas", - "body": "schema", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Gets a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSchema", - "inputType": ".google.pubsub.v1.GetSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "get": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "schemas", - "pagingResponseType": ".google.pubsub.v1.Schema", - "inputInterface": ".google.pubsub.v1.ListSchemasRequest", - "outputInterface": ".google.pubsub.v1.ListSchemasResponse", - "comments": [ - " Lists schemas in a project.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSchemas", - "inputType": ".google.pubsub.v1.ListSchemasRequest", - "outputType": ".google.pubsub.v1.ListSchemasResponse", - "options": { - ".google.api.methodSignature": [ - "parent" - ], - ".google.api.http": { - "get": "/v1/{parent=projects/*}/schemas", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSchemaRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSchema", - "inputType": ".google.pubsub.v1.DeleteSchemaRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "delete": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateSchemaRequest", - "outputInterface": ".google.pubsub.v1.ValidateSchemaResponse", - "comments": [ - " Validates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateSchema", - "inputType": ".google.pubsub.v1.ValidateSchemaRequest", - "outputType": ".google.pubsub.v1.ValidateSchemaResponse", - "options": { - ".google.api.methodSignature": [ - "parent,schema" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validate", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateMessageRequest", - "outputInterface": ".google.pubsub.v1.ValidateMessageResponse", - "comments": [ - " Validates a message against a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateMessage", - "inputType": ".google.pubsub.v1.ValidateMessageRequest", - "outputType": ".google.pubsub.v1.ValidateMessageResponse", - "options": { - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validateMessage", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/schema.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " Service for doing schema-related operations." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Creates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSchema", - "inputType": ".google.pubsub.v1.CreateSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "parent,schema,schema_id" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas", - "body": "schema", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Gets a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSchema", - "inputType": ".google.pubsub.v1.GetSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "get": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSchemaRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSchema", - "inputType": ".google.pubsub.v1.DeleteSchemaRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "delete": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateSchemaRequest", - "outputInterface": ".google.pubsub.v1.ValidateSchemaResponse", - "comments": [ - " Validates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateSchema", - "inputType": ".google.pubsub.v1.ValidateSchemaRequest", - "outputType": ".google.pubsub.v1.ValidateSchemaResponse", - "options": { - ".google.api.methodSignature": [ - "parent,schema" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validate", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateMessageRequest", - "outputInterface": ".google.pubsub.v1.ValidateMessageResponse", - "comments": [ - " Validates a message against a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateMessage", - "inputType": ".google.pubsub.v1.ValidateMessageRequest", - "outputType": ".google.pubsub.v1.ValidateMessageResponse", - "options": { - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validateMessage", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "schemas", - "pagingResponseType": ".google.pubsub.v1.Schema", - "inputInterface": ".google.pubsub.v1.ListSchemasRequest", - "outputInterface": ".google.pubsub.v1.ListSchemasResponse", - "comments": [ - " Lists schemas in a project.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSchemas", - "inputType": ".google.pubsub.v1.ListSchemasRequest", - "outputType": ".google.pubsub.v1.ListSchemasResponse", - "options": { - ".google.api.methodSignature": [ - "parent" - ], - ".google.api.http": { - "get": "/v1/{parent=projects/*}/schemas", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - }, - { - "name": "Subscriber", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Subscription", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSubscription", - "inputType": ".google.pubsub.v1.Subscription", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "name,topic,push_config,ack_deadline_seconds" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSubscription", - "inputType": ".google.pubsub.v1.GetSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "get": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSubscription", - "inputType": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.http": { - "patch": "/v1/{subscription.name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.pubsub.v1.Subscription", - "inputInterface": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListSubscriptionsResponse", - "comments": [ - " Lists matching subscriptions.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSubscriptions", - "inputType": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSubscription", - "inputType": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "delete": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyAckDeadline", - "inputType": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids,ack_deadline_seconds" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.AcknowledgeRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Acknowledge", - "inputType": ".google.pubsub.v1.AcknowledgeRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:acknowledge", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PullRequest", - "outputInterface": ".google.pubsub.v1.PullResponse", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Pull", - "inputType": ".google.pubsub.v1.PullRequest", - "outputType": ".google.pubsub.v1.PullResponse", - "options": { - ".google.api.methodSignature": [ - "subscription,return_immediately,max_messages" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:pull", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyPushConfig", - "inputType": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,push_config" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSnapshot", - "inputType": ".google.pubsub.v1.GetSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "get": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.pubsub.v1.Snapshot", - "inputInterface": ".google.pubsub.v1.ListSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListSnapshotsResponse", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSnapshots", - "inputType": ".google.pubsub.v1.ListSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSnapshot", - "inputType": ".google.pubsub.v1.CreateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "name,subscription" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSnapshot", - "inputType": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.http": { - "patch": "/v1/{snapshot.name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSnapshot", - "inputType": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "delete": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.SeekRequest", - "outputInterface": ".google.pubsub.v1.SeekResponse", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Seek", - "inputType": ".google.pubsub.v1.SeekRequest", - "outputType": ".google.pubsub.v1.SeekResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:seek", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/pubsub.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Subscription", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSubscription", - "inputType": ".google.pubsub.v1.Subscription", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "name,topic,push_config,ack_deadline_seconds" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSubscription", - "inputType": ".google.pubsub.v1.GetSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "get": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSubscription", - "inputType": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.http": { - "patch": "/v1/{subscription.name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSubscription", - "inputType": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "delete": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyAckDeadline", - "inputType": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids,ack_deadline_seconds" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.AcknowledgeRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Acknowledge", - "inputType": ".google.pubsub.v1.AcknowledgeRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:acknowledge", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PullRequest", - "outputInterface": ".google.pubsub.v1.PullResponse", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Pull", - "inputType": ".google.pubsub.v1.PullRequest", - "outputType": ".google.pubsub.v1.PullResponse", - "options": { - ".google.api.methodSignature": [ - "subscription,return_immediately,max_messages" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:pull", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyPushConfig", - "inputType": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,push_config" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSnapshot", - "inputType": ".google.pubsub.v1.GetSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "get": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSnapshot", - "inputType": ".google.pubsub.v1.CreateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "name,subscription" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSnapshot", - "inputType": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.http": { - "patch": "/v1/{snapshot.name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSnapshot", - "inputType": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "delete": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.SeekRequest", - "outputInterface": ".google.pubsub.v1.SeekResponse", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Seek", - "inputType": ".google.pubsub.v1.SeekRequest", - "outputType": ".google.pubsub.v1.SeekResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:seek", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [ - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - } - ], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [ - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - } - ], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.pubsub.v1.Subscription", - "inputInterface": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListSubscriptionsResponse", - "comments": [ - " Lists matching subscriptions.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSubscriptions", - "inputType": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.pubsub.v1.Snapshot", - "inputInterface": ".google.pubsub.v1.ListSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListSnapshotsResponse", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSnapshots", - "inputType": ".google.pubsub.v1.ListSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - } - ], - "diregapic": false, - "handwrittenLayer": false, - "legacyProtoLoad": false -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/iam_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/iam_policy.proto.baseline deleted file mode 100644 index 7072854e4c06..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/iam_policy.proto.baseline +++ /dev/null @@ -1,145 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.iam.v1; - -import "google/iam/v1/options.proto"; -import "google/iam/v1/policy.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "IamPolicyProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// ## API Overview -// -// Manages Identity and Access Management (IAM) policies. -// -// Any implementation of an API that offers access control features -// implements the google.iam.v1.IAMPolicy interface. -// -// ## Data model -// -// Access control is applied when a principal (user or service account), takes -// some action on a resource exposed by a service. Resources, identified by -// URI-like names, are the unit of access control specification. Service -// implementations can choose the granularity of access control and the -// supported permissions for their resources. -// For example one database service may allow access control to be -// specified only at the Table level, whereas another might allow access control -// to also be specified at the Column level. -// -// ## Policy Structure -// -// See google.iam.v1.Policy -// -// This is intentionally not a CRUD style API because access control policies -// are created and deleted implicitly with the resources to which they are -// attached. -service IAMPolicy { - option (google.api.default_host) = "iam-meta-api.googleapis.com"; - - // Sets the access control policy on the specified resource. Replaces any - // existing policy. - rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for a resource. - // Returns an empty policy if the resource exists and does not have a policy - // set. - rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:getIamPolicy" - body: "*" - }; - } - - // Returns permissions that a caller has on the specified resource. - // If the resource does not exist, this will return an empty set of - // permissions, not a NOT_FOUND error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=**}:testIamPermissions" - body: "*" - }; - } -} - -// Request message for `SetIamPolicy` method. -message SetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being specified. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // REQUIRED: The complete policy to be applied to the `resource`. The size of - // the policy is limited to a few 10s of KB. An empty policy is a - // valid policy but certain Cloud Platform services (such as Projects) - // might reject them. - Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `GetIamPolicy` method. -message GetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // OPTIONAL: A `GetPolicyOptions` object for specifying options to - // `GetIamPolicy`. This field is only used by Cloud IAM. - GetPolicyOptions options = 2; -} - -// Request message for `TestIamPermissions` method. -message TestIamPermissionsRequest { - // REQUIRED: The resource for which the policy detail is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1[ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // The set of permissions to check for the `resource`. Permissions with - // wildcards (such as '*' or 'storage.*') are not allowed. For more - // information see - // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for `TestIamPermissions` method. -message TestIamPermissionsResponse { - // A subset of `TestPermissionsRequest.permissions` that the caller is - // allowed. - repeated string permissions = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/options.proto.baseline deleted file mode 100644 index a4e17e588db4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/iam/v1/options.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.iam.v1; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "OptionsProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// Encapsulates settings provided to GetIamPolicy. -message GetPolicyOptions { - // Optional. The policy format version to be returned. - // - // Valid values are 0, 1, and 3. Requests specifying an invalid value will be - // rejected. - // - // Requests for policies with any conditional bindings must specify version 3. - // Policies without any conditional bindings may specify any valid value or - // leave the field unset. - int32 requested_policy_version = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/pubsub.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/pubsub.proto.baseline deleted file mode 100644 index 0da37dd7dad1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/pubsub.proto.baseline +++ /dev/null @@ -1,1314 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.pubsub.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/pubsub/v1/schema.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; -option java_multiple_files = true; -option java_outer_classname = "PubsubProto"; -option java_package = "com.google.pubsub.v1"; -option php_namespace = "Google\\Cloud\\PubSub\\V1"; -option ruby_package = "Google::Cloud::PubSub::V1"; - -// The service that an application uses to manipulate topics, and to send -// messages to a topic. -service Publisher { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates the given topic with the given name. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). - rpc CreateTopic(Topic) returns (Topic) { - option (google.api.http) = { - put: "/v1/{name=projects/*/topics/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an existing topic. Note that certain properties of a - // topic are not modifiable. - rpc UpdateTopic(UpdateTopicRequest) returns (Topic) { - option (google.api.http) = { - patch: "/v1/{topic.name=projects/*/topics/*}" - body: "*" - }; - } - - // Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic - // does not exist. - rpc Publish(PublishRequest) returns (PublishResponse) { - option (google.api.http) = { - post: "/v1/{topic=projects/*/topics/*}:publish" - body: "*" - }; - option (google.api.method_signature) = "topic,messages"; - } - - // Gets the configuration of a topic. - rpc GetTopic(GetTopicRequest) returns (Topic) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}" - }; - option (google.api.method_signature) = "topic"; - } - - // Lists matching topics. - rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/topics" - }; - option (google.api.method_signature) = "project"; - } - - // Lists the names of the attached subscriptions on this topic. - rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) - returns (ListTopicSubscriptionsResponse) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}/subscriptions" - }; - option (google.api.method_signature) = "topic"; - } - - // Lists the names of the snapshots on this topic. Snapshots are used in - // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - // which allow you to manage message acknowledgments in bulk. That is, you can - // set the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - rpc ListTopicSnapshots(ListTopicSnapshotsRequest) - returns (ListTopicSnapshotsResponse) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}/snapshots" - }; - option (google.api.method_signature) = "topic"; - } - - // Deletes the topic with the given name. Returns `NOT_FOUND` if the topic - // does not exist. After a topic is deleted, a new topic may be created with - // the same name; this is an entirely new topic with none of the old - // configuration or subscriptions. Existing subscriptions to this topic are - // not deleted, but their `topic` field is set to `_deleted-topic_`. - rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{topic=projects/*/topics/*}" - }; - option (google.api.method_signature) = "topic"; - } - - // Detaches a subscription from this topic. All messages retained in the - // subscription are dropped. Subsequent `Pull` and `StreamingPull` requests - // will return FAILED_PRECONDITION. If the subscription is a push - // subscription, pushes to the endpoint will stop. - rpc DetachSubscription(DetachSubscriptionRequest) - returns (DetachSubscriptionResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:detach" - }; - } -} - -// A policy constraining the storage of messages published to the topic. -message MessageStoragePolicy { - // A list of IDs of GCP regions where messages that are published to the topic - // may be persisted in storage. Messages published by publishers running in - // non-allowed GCP regions (or running outside of GCP altogether) will be - // routed for storage in one of the allowed regions. An empty list means that - // no regions are allowed, and is not a valid configuration. - repeated string allowed_persistence_regions = 1; -} - -// Settings for validating messages published against a schema. -message SchemaSettings { - // Required. The name of the schema that messages published should be - // validated against. Format is `projects/{project}/schemas/{schema}`. The - // value of this field will be `_deleted-schema_` if the schema has been - // deleted. - string schema = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // The encoding of messages validated against `schema`. - Encoding encoding = 2; -} - -// A topic resource. -message Topic { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" - pattern: "_deleted-topic_" - }; - - // Required. The name of the topic. It must have the format - // `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, - // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), - // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent - // signs (`%`). It must be between 3 and 255 characters in length, and it - // must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // See [Creating and managing labels] - // (https://cloud.google.com/pubsub/docs/labels). - map labels = 2; - - // Policy constraining the set of Google Cloud Platform regions where messages - // published to the topic may be stored. If not present, then no constraints - // are in effect. - MessageStoragePolicy message_storage_policy = 3; - - // The resource name of the Cloud KMS CryptoKey to be used to protect access - // to messages published on this topic. - // - // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string kms_key_name = 5; - - // Settings for validating messages published against a schema. - SchemaSettings schema_settings = 6; - - // Reserved for future use. This field is set only in responses from the - // server; it is ignored if it is set in any requests. - bool satisfies_pzs = 7; -} - -// A message that is published by publishers and consumed by subscribers. The -// message must contain either a non-empty data field or at least one attribute. -// Note that client libraries represent this object differently -// depending on the language. See the corresponding [client library -// documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for -// more information. See [quotas and limits] -// (https://cloud.google.com/pubsub/quotas) for more information about message -// limits. -message PubsubMessage { - // The message data field. If this field is empty, the message must contain - // at least one attribute. - bytes data = 1; - - // Attributes for this message. If this field is empty, the message must - // contain non-empty data. This can be used to filter messages on the - // subscription. - map attributes = 2; - - // ID of this message, assigned by the server when the message is published. - // Guaranteed to be unique within the topic. This value may be read by a - // subscriber that receives a `PubsubMessage` via a `Pull` call or a push - // delivery. It must not be populated by the publisher in a `Publish` call. - string message_id = 3; - - // The time at which the message was published, populated by the server when - // it receives the `Publish` call. It must not be populated by the - // publisher in a `Publish` call. - google.protobuf.Timestamp publish_time = 4; - - // If non-empty, identifies related messages for which publish order should be - // respected. If a `Subscription` has `enable_message_ordering` set to `true`, - // messages published with the same non-empty `ordering_key` value will be - // delivered to subscribers in the order in which they are received by the - // Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` - // must specify the same `ordering_key` value. - string ordering_key = 5; -} - -// Request for the GetTopic method. -message GetTopicRequest { - // Required. The name of the topic to get. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; -} - -// Request for the UpdateTopic method. -message UpdateTopicRequest { - // Required. The updated topic object. - Topic topic = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided topic to update. Must be - // specified and non-empty. Note that if `update_mask` contains - // "message_storage_policy" but the `message_storage_policy` is not set in - // the `topic` provided above, then the updated value is determined by the - // policy configured at the project or organization level. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the Publish method. -message PublishRequest { - // Required. The messages in the request will be published on this topic. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Required. The messages to publish. - repeated PubsubMessage messages = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `Publish` method. -message PublishResponse { - // The server-assigned ID of each published message, in the same order as - // the messages in the request. IDs are guaranteed to be unique within - // the topic. - repeated string message_ids = 1; -} - -// Request for the `ListTopics` method. -message ListTopicsRequest { - // Required. The name of the project in which to list topics. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of topics to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicsResponse`; indicates that this is - // a continuation of a prior `ListTopics` call, and that the system should - // return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopics` method. -message ListTopicsResponse { - // The resulting topics. - repeated Topic topics = 1; - - // If not empty, indicates that there may be more topics that match the - // request; this value should be passed in a new `ListTopicsRequest`. - string next_page_token = 2; -} - -// Request for the `ListTopicSubscriptions` method. -message ListTopicSubscriptionsRequest { - // Required. The name of the topic that subscriptions are attached to. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Maximum number of subscription names to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicSubscriptionsResponse`; indicates - // that this is a continuation of a prior `ListTopicSubscriptions` call, and - // that the system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopicSubscriptions` method. -message ListTopicSubscriptionsResponse { - // The names of subscriptions attached to the topic specified in the request. - repeated string subscriptions = 1 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - }]; - - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new - // `ListTopicSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; -} - -// Request for the `ListTopicSnapshots` method. -message ListTopicSnapshotsRequest { - // Required. The name of the topic that snapshots are attached to. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Maximum number of snapshot names to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicSnapshotsResponse`; indicates - // that this is a continuation of a prior `ListTopicSnapshots` call, and - // that the system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopicSnapshots` method. -message ListTopicSnapshotsResponse { - // The names of the snapshots that match the request. - repeated string snapshots = 1; - - // If not empty, indicates that there may be more snapshots that match - // the request; this value should be passed in a new - // `ListTopicSnapshotsRequest` to get more snapshots. - string next_page_token = 2; -} - -// Request for the `DeleteTopic` method. -message DeleteTopicRequest { - // Required. Name of the topic to delete. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; -} - -// Request for the DetachSubscription method. -message DetachSubscriptionRequest { - // Required. The subscription to detach. - // Format is `projects/{project}/subscriptions/{subscription}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Response for the DetachSubscription method. -// Reserved for future use. -message DetachSubscriptionResponse {} - -// The service that an application uses to manipulate subscriptions and to -// consume messages from a subscription via the `Pull` method or by -// establishing a bi-directional stream using the `StreamingPull` method. -service Subscriber { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates a subscription to a given topic. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). - // If the subscription already exists, returns `ALREADY_EXISTS`. - // If the corresponding topic doesn't exist, returns `NOT_FOUND`. - // - // If the name is not provided in the request, the server will assign a random - // name for this subscription on the same project as the topic, conforming - // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated - // name is populated in the returned Subscription object. Note that for REST - // API requests, you must specify a name in the request. - rpc CreateSubscription(Subscription) returns (Subscription) { - option (google.api.http) = { - put: "/v1/{name=projects/*/subscriptions/*}" - body: "*" - }; - option (google.api.method_signature) = - "name,topic,push_config,ack_deadline_seconds"; - } - - // Gets the configuration details of a subscription. - rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) { - option (google.api.http) = { - get: "/v1/{subscription=projects/*/subscriptions/*}" - }; - option (google.api.method_signature) = "subscription"; - } - - // Updates an existing subscription. Note that certain properties of a - // subscription, such as its topic, are not modifiable. - rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) { - option (google.api.http) = { - patch: "/v1/{subscription.name=projects/*/subscriptions/*}" - body: "*" - }; - } - - // Lists matching subscriptions. - rpc ListSubscriptions(ListSubscriptionsRequest) - returns (ListSubscriptionsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/subscriptions" - }; - option (google.api.method_signature) = "project"; - } - - // Deletes an existing subscription. All messages retained in the subscription - // are immediately dropped. Calls to `Pull` after deletion will return - // `NOT_FOUND`. After a subscription is deleted, a new one may be created with - // the same name, but the new one has no association with the old - // subscription or its topic unless the same topic is specified. - rpc DeleteSubscription(DeleteSubscriptionRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{subscription=projects/*/subscriptions/*}" - }; - option (google.api.method_signature) = "subscription"; - } - - // Modifies the ack deadline for a specific message. This method is useful - // to indicate that more time is needed to process a message by the - // subscriber, or to make the message available for redelivery if the - // processing was interrupted. Note that this does not modify the - // subscription-level `ackDeadlineSeconds` used for subsequent messages. - rpc ModifyAckDeadline(ModifyAckDeadlineRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline" - body: "*" - }; - option (google.api.method_signature) = - "subscription,ack_ids,ack_deadline_seconds"; - } - - // Acknowledges the messages associated with the `ack_ids` in the - // `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages - // from the subscription. - // - // Acknowledging a message whose ack deadline has expired may succeed, - // but such a message may be redelivered later. Acknowledging a message more - // than once will not result in an error. - rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:acknowledge" - body: "*" - }; - option (google.api.method_signature) = "subscription,ack_ids"; - } - - // Pulls messages from the server. The server may return `UNAVAILABLE` if - // there are too many concurrent pull requests pending for the given - // subscription. - rpc Pull(PullRequest) returns (PullResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:pull" - body: "*" - }; - option (google.api.method_signature) = - "subscription,return_immediately,max_messages"; - } - - // Establishes a stream with the server, which sends messages down to the - // client. The client streams acknowledgements and ack deadline modifications - // back to the server. The server will close the stream and return the status - // on any error. The server may close the stream with status `UNAVAILABLE` to - // reassign server-side resources, in which case, the client should - // re-establish the stream. Flow control can be achieved by configuring the - // underlying RPC channel. - rpc StreamingPull(stream StreamingPullRequest) - returns (stream StreamingPullResponse) {} - - // Modifies the `PushConfig` for a specified subscription. - // - // This may be used to change a push subscription to a pull one (signified by - // an empty `PushConfig`) or vice versa, or change the endpoint URL and other - // attributes of a push subscription. Messages will accumulate for delivery - // continuously through the call regardless of changes to the `PushConfig`. - rpc ModifyPushConfig(ModifyPushConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig" - body: "*" - }; - option (google.api.method_signature) = "subscription,push_config"; - } - - // Gets the configuration details of a snapshot. Snapshots are used in - // Seek - // operations, which allow you to manage message acknowledgments in bulk. That - // is, you can set the acknowledgment state of messages in an existing - // subscription to the state captured by a snapshot. - rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - get: "/v1/{snapshot=projects/*/snapshots/*}" - }; - option (google.api.method_signature) = "snapshot"; - } - - // Lists the existing snapshots. Snapshots are used in [Seek]( - // https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/snapshots" - }; - option (google.api.method_signature) = "project"; - } - - // Creates a snapshot from the requested subscription. Snapshots are used in - // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - // which allow you to manage message acknowledgments in bulk. That is, you can - // set the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - // If the snapshot already exists, returns `ALREADY_EXISTS`. - // If the requested subscription doesn't exist, returns `NOT_FOUND`. - // If the backlog in the subscription is too old -- and the resulting snapshot - // would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. - // See also the `Snapshot.expire_time` field. If the name is not provided in - // the request, the server will assign a random - // name for this snapshot on the same project as the subscription, conforming - // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The - // generated name is populated in the returned Snapshot object. Note that for - // REST API requests, you must specify a name in the request. - rpc CreateSnapshot(CreateSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - put: "/v1/{name=projects/*/snapshots/*}" - body: "*" - }; - option (google.api.method_signature) = "name,subscription"; - } - - // Updates an existing snapshot. Snapshots are used in - // Seek - // operations, which allow - // you to manage message acknowledgments in bulk. That is, you can set the - // acknowledgment state of messages in an existing subscription to the state - // captured by a snapshot. - rpc UpdateSnapshot(UpdateSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - patch: "/v1/{snapshot.name=projects/*/snapshots/*}" - body: "*" - }; - } - - // Removes an existing snapshot. Snapshots are used in [Seek] - // (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - // When the snapshot is deleted, all messages retained in the snapshot - // are immediately dropped. After a snapshot is deleted, a new one may be - // created with the same name, but the new one has no association with the old - // snapshot or its subscription, unless the same subscription is specified. - rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{snapshot=projects/*/snapshots/*}" - }; - option (google.api.method_signature) = "snapshot"; - } - - // Seeks an existing subscription to a point in time or to a given snapshot, - // whichever is provided in the request. Snapshots are used in [Seek] - // (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. Note that both the subscription and the - // snapshot must be on the same topic. - rpc Seek(SeekRequest) returns (SeekResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:seek" - body: "*" - }; - } -} - -// A subscription resource. -message Subscription { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Subscription" - pattern: "projects/{project}/subscriptions/{subscription}" - }; - - // Required. The name of the subscription. It must have the format - // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must - // start with a letter, and contain only letters (`[A-Za-z]`), numbers - // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), - // plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters - // in length, and it must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the topic from which this subscription is receiving - // messages. Format is `projects/{project}/topics/{topic}`. The value of this - // field will be `_deleted-topic_` if the topic has been deleted. - string topic = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // If push delivery is used with this subscription, this field is - // used to configure it. An empty `pushConfig` signifies that the subscriber - // will pull and ack messages using API methods. - PushConfig push_config = 4; - - // The approximate amount of time (on a best-effort basis) Pub/Sub waits for - // the subscriber to acknowledge receipt before resending the message. In the - // interval after the message is delivered and before it is acknowledged, it - // is considered to be outstanding. During that time period, the - // message will not be redelivered (on a best-effort basis). - // - // For pull subscriptions, this value is used as the initial value for the ack - // deadline. To override this value for a given message, call - // `ModifyAckDeadline` with the corresponding `ack_id` if using - // non-streaming pull or send the `ack_id` in a - // `StreamingModifyAckDeadlineRequest` if using streaming pull. - // The minimum custom deadline you can specify is 10 seconds. - // The maximum custom deadline you can specify is 600 seconds (10 minutes). - // If this parameter is 0, a default value of 10 seconds is used. - // - // For push delivery, this value is also used to set the request timeout for - // the call to the push endpoint. - // - // If the subscriber never acknowledges the message, the Pub/Sub - // system will eventually redeliver the message. - int32 ack_deadline_seconds = 5; - - // Indicates whether to retain acknowledged messages. If true, then - // messages are not expunged from the subscription's backlog, even if they are - // acknowledged, until they fall out of the `message_retention_duration` - // window. This must be true if you would like to [Seek to a timestamp] - // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time). - bool retain_acked_messages = 7; - - // How long to retain unacknowledged messages in the subscription's backlog, - // from the moment a message is published. - // If `retain_acked_messages` is true, then this also configures the retention - // of acknowledged messages, and thus configures how far back in time a `Seek` - // can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 - // minutes. - google.protobuf.Duration message_retention_duration = 8; - - // See Creating and - // managing labels. - map labels = 9; - - // If true, messages published with the same `ordering_key` in `PubsubMessage` - // will be delivered to the subscribers in the order in which they - // are received by the Pub/Sub system. Otherwise, they may be delivered in - // any order. - bool enable_message_ordering = 10; - - // A policy that specifies the conditions for this subscription's expiration. - // A subscription is considered active as long as any connected subscriber is - // successfully consuming messages from the subscription or is issuing - // operations on the subscription. If `expiration_policy` is not set, a - // *default policy* with `ttl` of 31 days will be used. The minimum allowed - // value for `expiration_policy.ttl` is 1 day. - ExpirationPolicy expiration_policy = 11; - - // An expression written in the Pub/Sub [filter - // language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - // then only `PubsubMessage`s whose `attributes` field matches the filter are - // delivered on this subscription. If empty, then no messages are filtered - // out. - string filter = 12; - - // A policy that specifies the conditions for dead lettering messages in - // this subscription. If dead_letter_policy is not set, dead lettering - // is disabled. - // - // The Cloud Pub/Sub service account associated with this subscriptions's - // parent project (i.e., - // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - // permission to Acknowledge() messages on this subscription. - DeadLetterPolicy dead_letter_policy = 13; - - // A policy that specifies how Pub/Sub retries message delivery for this - // subscription. - // - // If not set, the default retry policy is applied. This generally implies - // that messages will be retried as soon as possible for healthy subscribers. - // RetryPolicy will be triggered on NACKs or acknowledgement deadline - // exceeded events for a given message. - RetryPolicy retry_policy = 14; - - // Indicates whether the subscription is detached from its topic. Detached - // subscriptions don't receive messages from their topic and don't retain any - // backlog. `Pull` and `StreamingPull` requests will return - // FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - // the endpoint will not be made. - bool detached = 15; -} - -// A policy that specifies how Cloud Pub/Sub retries message delivery. -// -// Retry delay will be exponential based on provided minimum and maximum -// backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. -// -// RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded -// events for a given message. -// -// Retry Policy is implemented on a best effort basis. At times, the delay -// between consecutive deliveries may not match the configuration. That is, -// delay can be more or less than configured backoff. -message RetryPolicy { - // The minimum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 10 seconds. - google.protobuf.Duration minimum_backoff = 1; - - // The maximum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 600 seconds. - google.protobuf.Duration maximum_backoff = 2; -} - -// Dead lettering is done on a best effort basis. The same message might be -// dead lettered multiple times. -// -// If validation on any of the fields fails at subscription creation/updation, -// the create/update subscription request will fail. -message DeadLetterPolicy { - // The name of the topic to which dead letter messages should be published. - // Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service - // account associated with the enclosing subscription's parent project (i.e., - // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - // permission to Publish() to this topic. - // - // The operation will fail if the topic does not exist. - // Users should ensure that there is a subscription attached to this topic - // since messages published to a topic with no subscriptions are lost. - string dead_letter_topic = 1; - - // The maximum number of delivery attempts for any message. The value must be - // between 5 and 100. - // - // The number of delivery attempts is defined as 1 + (the sum of number of - // NACKs and number of times the acknowledgement deadline has been exceeded - // for the message). - // - // A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - // client libraries may automatically extend ack_deadlines. - // - // This field will be honored on a best effort basis. - // - // If this parameter is 0, a default value of 5 is used. - int32 max_delivery_attempts = 2; -} - -// A policy that specifies the conditions for resource expiration (i.e., -// automatic resource deletion). -message ExpirationPolicy { - // Specifies the "time-to-live" duration for an associated resource. The - // resource expires if it is not active for a period of `ttl`. The definition - // of "activity" depends on the type of the associated resource. The minimum - // and maximum allowed values for `ttl` depend on the type of the associated - // resource, as well. If `ttl` is not set, the associated resource never - // expires. - google.protobuf.Duration ttl = 1; -} - -// Configuration for a push delivery endpoint. -message PushConfig { - // Contains information needed for generating an - // [OpenID Connect - // token](https://developers.google.com/identity/protocols/OpenIDConnect). - message OidcToken { - // [Service account - // email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating the OIDC token. The caller (for - // CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must - // have the iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. The audience claim - // identifies the recipients that the JWT is intended for. The audience - // value is a single case-sensitive string. Having multiple values (array) - // for the audience field is not supported. More info about the OIDC JWT - // token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 - // Note: if not specified, the Push endpoint URL will be used. - string audience = 2; - } - - // A URL locating the endpoint to which messages should be pushed. - // For example, a Webhook endpoint might use `https://example.com/push`. - string push_endpoint = 1; - - // Endpoint configuration attributes that can be used to control different - // aspects of the message delivery. - // - // The only currently supported attribute is `x-goog-version`, which you can - // use to change the format of the pushed message. This attribute - // indicates the version of the data expected by the endpoint. This - // controls the shape of the pushed message (i.e., its fields and metadata). - // - // If not present during the `CreateSubscription` call, it will default to - // the version of the Pub/Sub API used to make such call. If not present in a - // `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - // calls will always return a valid version, even if the subscription was - // created without this attribute. - // - // The only supported values for the `x-goog-version` attribute are: - // - // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - // - // For example: - //
attributes { "x-goog-version": "v1" } 
- map attributes = 2; - - // An authentication method used by push endpoints to verify the source of - // push requests. This can be used with push endpoints that are private by - // default to allow requests only from the Cloud Pub/Sub system, for example. - // This field is optional and should be set only by users interested in - // authenticated push. - oneof authentication_method { - // If specified, Pub/Sub will generate and attach an OIDC JWT token as an - // `Authorization` header in the HTTP request for every pushed message. - OidcToken oidc_token = 3; - } -} - -// A message and its corresponding acknowledgment ID. -message ReceivedMessage { - // This ID can be used to acknowledge the received message. - string ack_id = 1; - - // The message. - PubsubMessage message = 2; - - // The approximate number of times that Cloud Pub/Sub has attempted to deliver - // the associated message to a subscriber. - // - // More precisely, this is 1 + (number of NACKs) + - // (number of ack_deadline exceeds) for this message. - // - // A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - // exceeds event is whenever a message is not acknowledged within - // ack_deadline. Note that ack_deadline is initially - // Subscription.ackDeadlineSeconds, but may get extended automatically by - // the client library. - // - // Upon the first delivery of a given message, `delivery_attempt` will have a - // value of 1. The value is calculated at best effort and is approximate. - // - // If a DeadLetterPolicy is not set on the subscription, this will be 0. - int32 delivery_attempt = 3; -} - -// Request for the GetSubscription method. -message GetSubscriptionRequest { - // Required. The name of the subscription to get. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Request for the UpdateSubscription method. -message UpdateSubscriptionRequest { - // Required. The updated subscription object. - Subscription subscription = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided subscription to update. - // Must be specified and non-empty. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `ListSubscriptions` method. -message ListSubscriptionsRequest { - // Required. The name of the project in which to list subscriptions. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of subscriptions to return. - int32 page_size = 2; - - // The value returned by the last `ListSubscriptionsResponse`; indicates that - // this is a continuation of a prior `ListSubscriptions` call, and that the - // system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListSubscriptions` method. -message ListSubscriptionsResponse { - // The subscriptions that match the request. - repeated Subscription subscriptions = 1; - - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new - // `ListSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; -} - -// Request for the DeleteSubscription method. -message DeleteSubscriptionRequest { - // Required. The subscription to delete. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Request for the ModifyPushConfig method. -message ModifyPushConfigRequest { - // Required. The name of the subscription. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. The push configuration for future deliveries. - // - // An empty `pushConfig` indicates that the Pub/Sub system should - // stop pushing messages from the given subscription and allow - // messages to be pulled and acknowledged - effectively pausing - // the subscription if `Pull` or `StreamingPull` is not called. - PushConfig push_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `Pull` method. -message PullRequest { - // Required. The subscription from which messages should be pulled. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Optional. If this field set to true, the system will respond immediately - // even if it there are no messages available to return in the `Pull` - // response. Otherwise, the system may wait (for a bounded amount of time) - // until at least one message is available, rather than returning no messages. - // Warning: setting this field to `true` is discouraged because it adversely - // impacts the performance of `Pull` operations. We recommend that users do - // not set this field. - bool return_immediately = 2 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - - // Required. The maximum number of messages to return for this request. Must - // be a positive integer. The Pub/Sub system may return fewer than the number - // specified. - int32 max_messages = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `Pull` method. -message PullResponse { - // Received Pub/Sub messages. The list will be empty if there are no more - // messages available in the backlog. For JSON, the response can be entirely - // empty. The Pub/Sub system may return fewer than the `maxMessages` requested - // even if there are more messages available in the backlog. - repeated ReceivedMessage received_messages = 1; -} - -// Request for the ModifyAckDeadline method. -message ModifyAckDeadlineRequest { - // Required. The name of the subscription. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. List of acknowledgment IDs. - repeated string ack_ids = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new ack deadline with respect to the time this request was - // sent to the Pub/Sub system. For example, if the value is 10, the new ack - // deadline will expire 10 seconds after the `ModifyAckDeadline` call was - // made. Specifying zero might immediately make the message available for - // delivery to another subscriber client. This typically results in an - // increase in the rate of message redeliveries (that is, duplicates). - // The minimum deadline you can specify is 0 seconds. - // The maximum deadline you can specify is 600 seconds (10 minutes). - int32 ack_deadline_seconds = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the Acknowledge method. -message AcknowledgeRequest { - // Required. The subscription whose message is being acknowledged. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. The acknowledgment ID for the messages being acknowledged that - // was returned by the Pub/Sub system in the `Pull` response. Must not be - // empty. - repeated string ack_ids = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `StreamingPull` streaming RPC method. This request is used to -// establish the initial stream as well as to stream acknowledgements and ack -// deadline modifications from the client to the server. -message StreamingPullRequest { - // Required. The subscription for which to initialize the new stream. This - // must be provided in the first request on the stream, and must not be set in - // subsequent requests from client to server. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // List of acknowledgement IDs for acknowledging previously received messages - // (received on this stream or a different stream). If an ack ID has expired, - // the corresponding message may be redelivered later. Acknowledging a message - // more than once will not result in an error. If the acknowledgement ID is - // malformed, the stream will be aborted with status `INVALID_ARGUMENT`. - repeated string ack_ids = 2; - - // The list of new ack deadlines for the IDs listed in - // `modify_deadline_ack_ids`. The size of this list must be the same as the - // size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - // with `INVALID_ARGUMENT`. Each element in this list is applied to the - // element in the same position in `modify_deadline_ack_ids`. The new ack - // deadline is with respect to the time this request was sent to the Pub/Sub - // system. Must be >= 0. For example, if the value is 10, the new ack deadline - // will expire 10 seconds after this request is received. If the value is 0, - // the message is immediately made available for another streaming or - // non-streaming pull request. If the value is < 0 (an error), the stream will - // be aborted with status `INVALID_ARGUMENT`. - repeated int32 modify_deadline_seconds = 3; - - // List of acknowledgement IDs whose deadline will be modified based on the - // corresponding element in `modify_deadline_seconds`. This field can be used - // to indicate that more time is needed to process a message by the - // subscriber, or to make the message available for redelivery if the - // processing was interrupted. - repeated string modify_deadline_ack_ids = 4; - - // Required. The ack deadline to use for the stream. This must be provided in - // the first request on the stream, but it can also be updated on subsequent - // requests from client to server. The minimum deadline you can specify is 10 - // seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - int32 stream_ack_deadline_seconds = 5 - [(google.api.field_behavior) = REQUIRED]; - - // A unique identifier that is used to distinguish client instances from each - // other. Only needs to be provided on the initial request. When a stream - // disconnects and reconnects for the same stream, the client_id should be set - // to the same value so that state associated with the old stream can be - // transferred to the new stream. The same client_id should not be used for - // different client instances. - string client_id = 6; - - // Flow control settings for the maximum number of outstanding messages. When - // there are `max_outstanding_messages` or more currently sent to the - // streaming pull client that have not yet been acked or nacked, the server - // stops sending more messages. The sending of messages resumes once the - // number of outstanding messages is less than this value. If the value is - // <= 0, there is no limit to the number of outstanding messages. This - // property can only be set on the initial StreamingPullRequest. If it is set - // on a subsequent request, the stream will be aborted with status - // `INVALID_ARGUMENT`. - int64 max_outstanding_messages = 7; - - // Flow control settings for the maximum number of outstanding bytes. When - // there are `max_outstanding_bytes` or more worth of messages currently sent - // to the streaming pull client that have not yet been acked or nacked, the - // server will stop sending more messages. The sending of messages resumes - // once the number of outstanding bytes is less than this value. If the value - // is <= 0, there is no limit to the number of outstanding bytes. This - // property can only be set on the initial StreamingPullRequest. If it is set - // on a subsequent request, the stream will be aborted with status - // `INVALID_ARGUMENT`. - int64 max_outstanding_bytes = 8; -} - -// Response for the `StreamingPull` method. This response is used to stream -// messages from the server to the client. -message StreamingPullResponse { - // Received Pub/Sub messages. This will not be empty. - repeated ReceivedMessage received_messages = 1; -} - -// Request for the `CreateSnapshot` method. -message CreateSnapshotRequest { - // Required. User-provided name for this snapshot. If the name is not provided - // in the request, the server will assign a random name for this snapshot on - // the same project as the subscription. Note that for REST API requests, you - // must specify a name. See the resource - // name rules. Format is `projects/{project}/snapshots/{snap}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; - - // Required. The subscription whose backlog the snapshot retains. - // Specifically, the created snapshot is guaranteed to retain: - // (a) The existing backlog on the subscription. More precisely, this is - // defined as the messages in the subscription's backlog that are - // unacknowledged upon the successful completion of the - // `CreateSnapshot` request; as well as: - // (b) Any messages published to the subscription's topic following the - // successful completion of the CreateSnapshot request. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // See Creating and - // managing labels. - map labels = 3; -} - -// Request for the UpdateSnapshot method. -message UpdateSnapshotRequest { - // Required. The updated snapshot object. - Snapshot snapshot = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided snapshot to update. - // Must be specified and non-empty. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// A snapshot resource. Snapshots are used in -// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) -// operations, which allow you to manage message acknowledgments in bulk. That -// is, you can set the acknowledgment state of messages in an existing -// subscription to the state captured by a snapshot. -message Snapshot { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Snapshot" - pattern: "projects/{project}/snapshots/{snapshot}" - }; - - // The name of the snapshot. - string name = 1; - - // The name of the topic from which this snapshot is retaining messages. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // The snapshot is guaranteed to exist up until this time. - // A newly-created snapshot expires no later than 7 days from the time of its - // creation. Its exact lifetime is determined at creation by the existing - // backlog in the source subscription. Specifically, the lifetime of the - // snapshot is `7 days - (age of oldest unacked message in the subscription)`. - // For example, consider a subscription whose oldest unacked message is 3 days - // old. If a snapshot is created from this subscription, the snapshot -- which - // will always capture this 3-day-old backlog as long as the snapshot - // exists -- will expire in 4 days. The service will refuse to create a - // snapshot that would expire in less than 1 hour after creation. - google.protobuf.Timestamp expire_time = 3; - - // See [Creating and managing labels] - // (https://cloud.google.com/pubsub/docs/labels). - map labels = 4; -} - -// Request for the GetSnapshot method. -message GetSnapshotRequest { - // Required. The name of the snapshot to get. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; -} - -// Request for the `ListSnapshots` method. -message ListSnapshotsRequest { - // Required. The name of the project in which to list snapshots. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of snapshots to return. - int32 page_size = 2; - - // The value returned by the last `ListSnapshotsResponse`; indicates that this - // is a continuation of a prior `ListSnapshots` call, and that the system - // should return the next page of data. - string page_token = 3; -} - -// Response for the `ListSnapshots` method. -message ListSnapshotsResponse { - // The resulting snapshots. - repeated Snapshot snapshots = 1; - - // If not empty, indicates that there may be more snapshot that match the - // request; this value should be passed in a new `ListSnapshotsRequest`. - string next_page_token = 2; -} - -// Request for the `DeleteSnapshot` method. -message DeleteSnapshotRequest { - // Required. The name of the snapshot to delete. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; -} - -// Request for the `Seek` method. -message SeekRequest { - // Required. The subscription to affect. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - oneof target { - // The time to seek to. - // Messages retained in the subscription that were published before this - // time are marked as acknowledged, and messages retained in the - // subscription that were published after this time are marked as - // unacknowledged. Note that this operation affects only those messages - // retained in the subscription (configured by the combination of - // `message_retention_duration` and `retain_acked_messages`). For example, - // if `time` corresponds to a point before the message retention - // window (or to a point before the system's notion of the subscription - // creation time), only retained messages will be marked as unacknowledged, - // and already-expunged messages will not be restored. - google.protobuf.Timestamp time = 2; - - // The snapshot to seek to. The snapshot's topic must be the same as that of - // the provided subscription. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 3 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Snapshot" - }]; - } -} - -// Response for the `Seek` method (this response is empty). -message SeekResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/schema.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/schema.proto.baseline deleted file mode 100644 index 1ace7ef3b0d7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump-esm/protos/google/pubsub/v1/schema.proto.baseline +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.pubsub.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; -option java_multiple_files = true; -option java_outer_classname = "SchemaProto"; -option java_package = "com.google.pubsub.v1"; -option php_namespace = "Google\\Cloud\\PubSub\\V1"; -option ruby_package = "Google::Cloud::PubSub::V1"; - -// Service for doing schema-related operations. -service SchemaService { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates a schema. - rpc CreateSchema(CreateSchemaRequest) returns (Schema) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas" - body: "schema" - }; - option (google.api.method_signature) = "parent,schema,schema_id"; - } - - // Gets a schema. - rpc GetSchema(GetSchemaRequest) returns (Schema) { - option (google.api.http) = { - get: "/v1/{name=projects/*/schemas/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists schemas in a project. - rpc ListSchemas(ListSchemasRequest) returns (ListSchemasResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/schemas" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a schema. - rpc DeleteSchema(DeleteSchemaRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/schemas/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Validates a schema. - rpc ValidateSchema(ValidateSchemaRequest) returns (ValidateSchemaResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas:validate" - body: "*" - }; - option (google.api.method_signature) = "parent,schema"; - } - - // Validates a message against a schema. - rpc ValidateMessage(ValidateMessageRequest) - returns (ValidateMessageResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas:validateMessage" - body: "*" - }; - } -} - -// A schema resource. -message Schema { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Schema" - pattern: "projects/{project}/schemas/{schema}" - }; - - // Possible schema definition types. - enum Type { - // Default value. This value is unused. - TYPE_UNSPECIFIED = 0; - - // A Protocol Buffer schema definition. - PROTOCOL_BUFFER = 1; - - // An Avro schema definition. - AVRO = 2; - } - - // Required. Name of the schema. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The type of the schema definition. - Type type = 2; - - // The definition of the schema. This should contain a string representing - // the full definition of the schema that is a valid schema definition of - // the type specified in `type`. - string definition = 3; -} - -// Request for the CreateSchema method. -message CreateSchemaRequest { - // Required. The name of the project in which to create the schema. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "pubsub.googleapis.com/Schema" - } - ]; - - // Required. The schema object to create. - // - // This schema's `name` parameter is ignored. The schema object returned - // by CreateSchema will have a `name` made using the given `parent` and - // `schema_id`. - Schema schema = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for the schema, which will become the final component of - // the schema's resource name. - // - // See https://cloud.google.com/pubsub/docs/admin#resource_names for resource - // name constraints. - string schema_id = 3; -} - -// View of Schema object fields to be returned by GetSchema and ListSchemas. -enum SchemaView { - // The default / unset value. - // The API will default to the BASIC view. - SCHEMA_VIEW_UNSPECIFIED = 0; - - // Include the name and type of the schema, but not the definition. - BASIC = 1; - - // Include all Schema object fields. - FULL = 2; -} - -// Request for the GetSchema method. -message GetSchemaRequest { - // Required. The name of the schema to get. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // The set of fields to return in the response. If not set, returns a Schema - // with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all - // fields. - SchemaView view = 2; -} - -// Request for the `ListSchemas` method. -message ListSchemasRequest { - // Required. The name of the project in which to list schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The set of Schema fields to return in the response. If not set, returns - // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - // retrieve all fields. - SchemaView view = 2; - - // Maximum number of schemas to return. - int32 page_size = 3; - - // The value returned by the last `ListSchemasResponse`; indicates that - // this is a continuation of a prior `ListSchemas` call, and that the - // system should return the next page of data. - string page_token = 4; -} - -// Response for the `ListSchemas` method. -message ListSchemasResponse { - // The resulting schemas. - repeated Schema schemas = 1; - - // If not empty, indicates that there may be more schemas that match the - // request; this value should be passed in a new `ListSchemasRequest`. - string next_page_token = 2; -} - -// Request for the `DeleteSchema` method. -message DeleteSchemaRequest { - // Required. Name of the schema to delete. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; -} - -// Request for the `ValidateSchema` method. -message ValidateSchemaRequest { - // Required. The name of the project in which to validate schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The schema object to validate. - Schema schema = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ValidateSchema` method. -message ValidateSchemaResponse {} - -// Request for the `ValidateMessage` method. -message ValidateMessageRequest { - // Required. The name of the project in which to validate schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - oneof schema_spec { - // Name of the schema against which to validate. - // - // Format is `projects/{project}/schemas/{schema}`. - string name = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // Ad-hoc schema against which to validate - Schema schema = 3; - } - - // Message to validate against the provided `schema_spec`. - bytes message = 4; - - // The encoding expected for messages - Encoding encoding = 5; -} - -// Response for the `ValidateMessage` method. -message ValidateMessageResponse {} - -// Possible encoding types for messages. -enum Encoding { - // Unspecified - ENCODING_UNSPECIFIED = 0; - - // JSON encoding - JSON = 1; - - // Binary encoding, as defined by the schema type. For some schema types, - // binary encoding may not be available. - BINARY = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/api.json.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/api.json.baseline deleted file mode 100644 index 22b35ea23025..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/api.json.baseline +++ /dev/null @@ -1,16327 +0,0 @@ -{ - "packageName": "google.pubsub.v1", - "publishName": "pubsub", - "naming": { - "name": "Pubsub", - "namespace": [ - "google" - ], - "version": "v1", - "productName": "Pubsub", - "protoPackage": "google.pubsub.v1", - "nameNotCapitalized": "pubsub", - "namePath": "google-pubsub", - "namePathWithDashes": "google/pubsub" - }, - "hostname": "pubsub.googleapis.com", - "port": "443", - "services": [ - { - "name": "Publisher", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Topic", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateTopic", - "inputType": ".google.pubsub.v1.Topic", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateTopic", - "inputType": ".google.pubsub.v1.UpdateTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.http": { - "patch": "/v1/{topic.name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PublishRequest", - "outputInterface": ".google.pubsub.v1.PublishResponse", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Publish", - "inputType": ".google.pubsub.v1.PublishRequest", - "outputType": ".google.pubsub.v1.PublishResponse", - "options": { - ".google.api.methodSignature": [ - "topic,messages" - ], - ".google.api.http": { - "post": "/v1/{topic=projects/*/topics/*}:publish", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Gets the configuration of a topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetTopic", - "inputType": ".google.pubsub.v1.GetTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "topics", - "pagingResponseType": ".google.pubsub.v1.Topic", - "inputInterface": ".google.pubsub.v1.ListTopicsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicsResponse", - "comments": [ - " Lists matching topics.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopics", - "inputType": ".google.pubsub.v1.ListTopicsRequest", - "outputType": ".google.pubsub.v1.ListTopicsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/topics", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSubscriptions", - "inputType": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSnapshots", - "inputType": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteTopicRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteTopic", - "inputType": ".google.pubsub.v1.DeleteTopicRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "delete": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.DetachSubscriptionResponse", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DetachSubscription", - "inputType": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputType": ".google.pubsub.v1.DetachSubscriptionResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:detach", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/pubsub.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Topic", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateTopic", - "inputType": ".google.pubsub.v1.Topic", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateTopic", - "inputType": ".google.pubsub.v1.UpdateTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.http": { - "patch": "/v1/{topic.name=projects/*/topics/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PublishRequest", - "outputInterface": ".google.pubsub.v1.PublishResponse", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Publish", - "inputType": ".google.pubsub.v1.PublishRequest", - "outputType": ".google.pubsub.v1.PublishResponse", - "options": { - ".google.api.methodSignature": [ - "topic,messages" - ], - ".google.api.http": { - "post": "/v1/{topic=projects/*/topics/*}:publish", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetTopicRequest", - "outputInterface": ".google.pubsub.v1.Topic", - "comments": [ - " Gets the configuration of a topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetTopic", - "inputType": ".google.pubsub.v1.GetTopicRequest", - "outputType": ".google.pubsub.v1.Topic", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteTopicRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteTopic", - "inputType": ".google.pubsub.v1.DeleteTopicRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "delete": "/v1/{topic=projects/*/topics/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.DetachSubscriptionResponse", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DetachSubscription", - "inputType": ".google.pubsub.v1.DetachSubscriptionRequest", - "outputType": ".google.pubsub.v1.DetachSubscriptionResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:detach", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "topics", - "pagingResponseType": ".google.pubsub.v1.Topic", - "inputInterface": ".google.pubsub.v1.ListTopicsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicsResponse", - "comments": [ - " Lists matching topics.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopics", - "inputType": ".google.pubsub.v1.ListTopicsRequest", - "outputType": ".google.pubsub.v1.ListTopicsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/topics", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSubscriptions", - "inputType": ".google.pubsub.v1.ListTopicSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListTopicSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.protobuf.FieldDescriptorProto.Type.TYPE_STRING", - "inputInterface": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListTopicSnapshots", - "inputType": ".google.pubsub.v1.ListTopicSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListTopicSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "topic" - ], - ".google.api.http": { - "get": "/v1/{topic=projects/*/topics/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "topic" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - }, - { - "name": "SchemaService", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Creates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSchema", - "inputType": ".google.pubsub.v1.CreateSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "parent,schema,schema_id" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas", - "body": "schema", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Gets a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSchema", - "inputType": ".google.pubsub.v1.GetSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "get": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "schemas", - "pagingResponseType": ".google.pubsub.v1.Schema", - "inputInterface": ".google.pubsub.v1.ListSchemasRequest", - "outputInterface": ".google.pubsub.v1.ListSchemasResponse", - "comments": [ - " Lists schemas in a project.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSchemas", - "inputType": ".google.pubsub.v1.ListSchemasRequest", - "outputType": ".google.pubsub.v1.ListSchemasResponse", - "options": { - ".google.api.methodSignature": [ - "parent" - ], - ".google.api.http": { - "get": "/v1/{parent=projects/*}/schemas", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSchemaRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSchema", - "inputType": ".google.pubsub.v1.DeleteSchemaRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "delete": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateSchemaRequest", - "outputInterface": ".google.pubsub.v1.ValidateSchemaResponse", - "comments": [ - " Validates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateSchema", - "inputType": ".google.pubsub.v1.ValidateSchemaRequest", - "outputType": ".google.pubsub.v1.ValidateSchemaResponse", - "options": { - ".google.api.methodSignature": [ - "parent,schema" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validate", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateMessageRequest", - "outputInterface": ".google.pubsub.v1.ValidateMessageResponse", - "comments": [ - " Validates a message against a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateMessage", - "inputType": ".google.pubsub.v1.ValidateMessageRequest", - "outputType": ".google.pubsub.v1.ValidateMessageResponse", - "options": { - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validateMessage", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/schema.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " Service for doing schema-related operations." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Creates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSchema", - "inputType": ".google.pubsub.v1.CreateSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "parent,schema,schema_id" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas", - "body": "schema", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSchemaRequest", - "outputInterface": ".google.pubsub.v1.Schema", - "comments": [ - " Gets a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSchema", - "inputType": ".google.pubsub.v1.GetSchemaRequest", - "outputType": ".google.pubsub.v1.Schema", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "get": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSchemaRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSchema", - "inputType": ".google.pubsub.v1.DeleteSchemaRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "name" - ], - ".google.api.http": { - "delete": "/v1/{name=projects/*/schemas/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateSchemaRequest", - "outputInterface": ".google.pubsub.v1.ValidateSchemaResponse", - "comments": [ - " Validates a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateSchema", - "inputType": ".google.pubsub.v1.ValidateSchemaRequest", - "outputType": ".google.pubsub.v1.ValidateSchemaResponse", - "options": { - ".google.api.methodSignature": [ - "parent,schema" - ], - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validate", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ValidateMessageRequest", - "outputInterface": ".google.pubsub.v1.ValidateMessageResponse", - "comments": [ - " Validates a message against a schema.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ValidateMessage", - "inputType": ".google.pubsub.v1.ValidateMessageRequest", - "outputType": ".google.pubsub.v1.ValidateMessageResponse", - "options": { - ".google.api.http": { - "post": "/v1/{parent=projects/*}/schemas:validateMessage", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "schemas", - "pagingResponseType": ".google.pubsub.v1.Schema", - "inputInterface": ".google.pubsub.v1.ListSchemasRequest", - "outputInterface": ".google.pubsub.v1.ListSchemasResponse", - "comments": [ - " Lists schemas in a project.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSchemas", - "inputType": ".google.pubsub.v1.ListSchemasRequest", - "outputType": ".google.pubsub.v1.ListSchemasResponse", - "options": { - ".google.api.methodSignature": [ - "parent" - ], - ".google.api.http": { - "get": "/v1/{parent=projects/*}/schemas", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "parent" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - }, - { - "name": "Subscriber", - "method": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Subscription", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSubscription", - "inputType": ".google.pubsub.v1.Subscription", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "name,topic,push_config,ack_deadline_seconds" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSubscription", - "inputType": ".google.pubsub.v1.GetSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "get": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSubscription", - "inputType": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.http": { - "patch": "/v1/{subscription.name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.pubsub.v1.Subscription", - "inputInterface": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListSubscriptionsResponse", - "comments": [ - " Lists matching subscriptions.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSubscriptions", - "inputType": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSubscription", - "inputType": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "delete": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyAckDeadline", - "inputType": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids,ack_deadline_seconds" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.AcknowledgeRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Acknowledge", - "inputType": ".google.pubsub.v1.AcknowledgeRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:acknowledge", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PullRequest", - "outputInterface": ".google.pubsub.v1.PullResponse", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Pull", - "inputType": ".google.pubsub.v1.PullRequest", - "outputType": ".google.pubsub.v1.PullResponse", - "options": { - ".google.api.methodSignature": [ - "subscription,return_immediately,max_messages" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:pull", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyPushConfig", - "inputType": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,push_config" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSnapshot", - "inputType": ".google.pubsub.v1.GetSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "get": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.pubsub.v1.Snapshot", - "inputInterface": ".google.pubsub.v1.ListSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListSnapshotsResponse", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSnapshots", - "inputType": ".google.pubsub.v1.ListSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSnapshot", - "inputType": ".google.pubsub.v1.CreateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "name,subscription" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSnapshot", - "inputType": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.http": { - "patch": "/v1/{snapshot.name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSnapshot", - "inputType": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "delete": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.SeekRequest", - "outputInterface": ".google.pubsub.v1.SeekResponse", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Seek", - "inputType": ".google.pubsub.v1.SeekRequest", - "outputType": ".google.pubsub.v1.SeekResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:seek", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "options": { - ".google.api.defaultHost": "pubsub.googleapis.com", - ".google.api.oauthScopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/pubsub" - }, - "packageName": "google.pubsub.v1", - "protoFile": "google/pubsub/v1/pubsub.proto", - "IAMPolicyMixin": 0, - "LocationMixin": 0, - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ], - "commentsMap": { - "comments": { - "Http:rules": { - "paramName": "rules", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of HTTP configuration rules that apply to individual API methods.", - "", - " **NOTE:** All service configuration rules follow \"last one wins\" order." - ] - }, - "Http:fully_decode_reserved_expansion": { - "paramName": "fully_decode_reserved_expansion", - "paramType": "TYPE_BOOL", - "comments": [ - " When set to true, URL path parameters will be fully URI-decoded except in", - " cases of single segment matches in reserved expansion, where \"%2F\" will be", - " left encoded.", - "", - " The default behavior is to not decode RFC 6570 reserved characters in multi", - " segment matches." - ] - }, - "HttpRule:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " Selects a method to which this rule applies.", - "", - " Refer to [selector][google.api.DocumentationRule.selector] for syntax", - " details." - ] - }, - "HttpRule:get": { - "paramName": "get", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP GET. Used for listing and getting information about", - " resources." - ] - }, - "HttpRule:put": { - "paramName": "put", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PUT. Used for replacing a resource." - ] - }, - "HttpRule:post": { - "paramName": "post", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP POST. Used for creating a resource or performing an action." - ] - }, - "HttpRule:delete": { - "paramName": "delete", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP DELETE. Used for deleting a resource." - ] - }, - "HttpRule:patch": { - "paramName": "patch", - "paramType": "TYPE_STRING", - "comments": [ - " Maps to HTTP PATCH. Used for updating a resource." - ] - }, - "HttpRule:custom": { - "paramName": "custom", - "paramType": ".google.api.CustomHttpPattern", - "comments": [ - " The custom pattern is used for specifying an HTTP method that is not", - " included in the `pattern` field, such as HEAD, or \"*\" to leave the", - " HTTP method unspecified for this rule. The wild-card rule is useful", - " for services that provide content to Web (HTML) clients." - ] - }, - "HttpRule:body": { - "paramName": "body", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the request field whose value is mapped to the HTTP request", - " body, or `*` for mapping all request fields not captured by the path", - " pattern to the HTTP body, or omitted for not having any HTTP request body.", - "", - " NOTE: the referred field must be present at the top-level of the request", - " message type." - ] - }, - "HttpRule:response_body": { - "paramName": "response_body", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The name of the response field whose value is mapped to the HTTP", - " response body. When omitted, the entire response message will be used", - " as the HTTP response body.", - "", - " NOTE: The referred field must be present at the top-level of the response", - " message type." - ] - }, - "HttpRule:additional_bindings": { - "paramName": "additional_bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Additional HTTP bindings for the selector. Nested bindings must", - " not contain an `additional_bindings` field themselves (that is,", - " the nesting may only be one level deep)." - ] - }, - "CustomHttpPattern:kind": { - "paramName": "kind", - "paramType": "TYPE_STRING", - "comments": [ - " The name of this custom HTTP verb." - ] - }, - "CustomHttpPattern:path": { - "paramName": "path", - "paramType": "TYPE_STRING", - "comments": [ - " The path matched by this custom verb." - ] - }, - "FileDescriptorSet:file": { - "paramName": "file", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:package": { - "paramName": "package", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FileDescriptorProto:dependency": { - "paramName": "dependency", - "paramType": "TYPE_STRING[]", - "comments": [ - " Names of files imported by this file." - ] - }, - "FileDescriptorProto:public_dependency": { - "paramName": "public_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the public imported files in the dependency list above." - ] - }, - "FileDescriptorProto:weak_dependency": { - "paramName": "weak_dependency", - "paramType": "TYPE_INT32[]", - "comments": [ - " Indexes of the weak imported files in the dependency list.", - " For Google-internal migration only. Do not use." - ] - }, - "FileDescriptorProto:message_type": { - "paramName": "message_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " All top-level definitions in this file." - ] - }, - "FileDescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:service": { - "paramName": "service", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FileDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FileOptions", - "comments": [] - }, - "FileDescriptorProto:source_code_info": { - "paramName": "source_code_info", - "paramType": ".google.protobuf.SourceCodeInfo", - "comments": [ - " This field contains optional information about the original source code.", - " You may safely remove this entire field without harming runtime", - " functionality of the descriptors -- the information is needed only by", - " development tools." - ] - }, - "FileDescriptorProto:syntax": { - "paramName": "syntax", - "paramType": "TYPE_STRING", - "comments": [ - " The syntax of the proto file.", - " The supported values are \"proto2\", \"proto3\", and \"editions\".", - "", - " If `edition` is present, this value must be \"editions\"." - ] - }, - "FileDescriptorProto:edition": { - "paramName": "edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The edition of the proto file." - ] - }, - "DescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "DescriptorProto:field": { - "paramName": "field", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension": { - "paramName": "extension", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:nested_type": { - "paramName": "nested_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:enum_type": { - "paramName": "enum_type", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:extension_range": { - "paramName": "extension_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:oneof_decl": { - "paramName": "oneof_decl", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MessageOptions", - "comments": [] - }, - "DescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "DescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved field names, which may not be used by fields in the same message.", - " A given name may only be reserved once." - ] - }, - "ExtensionRangeOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ExtensionRangeOptions:declaration": { - "paramName": "declaration", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " For external users: DO NOT USE. We are in the process of open sourcing", - " extension declaration and executing internal cleanups before it can be", - " used externally." - ] - }, - "ExtensionRangeOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ExtensionRangeOptions:verification": { - "paramName": "verification", - "paramType": ".google.protobuf.ExtensionRangeOptions.VerificationState", - "comments": [ - " The verification state of the range.", - " TODO: flip the default to DECLARATION once all empty ranges", - " are marked as UNVERIFIED." - ] - }, - "FieldDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FieldDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "FieldDescriptorProto:label": { - "paramName": "label", - "paramType": ".google.protobuf.FieldDescriptorProto.Label", - "comments": [] - }, - "FieldDescriptorProto:type": { - "paramName": "type", - "paramType": ".google.protobuf.FieldDescriptorProto.Type", - "comments": [ - " If type_name is set, this need not be set. If both this and type_name", - " are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP." - ] - }, - "FieldDescriptorProto:type_name": { - "paramName": "type_name", - "paramType": "TYPE_STRING", - "comments": [ - " For message and enum types, this is the name of the type. If the name", - " starts with a '.', it is fully-qualified. Otherwise, C++-like scoping", - " rules are used to find the type (i.e. first the nested types within this", - " message are searched, then within the parent, on up to the root", - " namespace)." - ] - }, - "FieldDescriptorProto:extendee": { - "paramName": "extendee", - "paramType": "TYPE_STRING", - "comments": [ - " For extensions, this is the name of the type being extended. It is", - " resolved in the same manner as type_name." - ] - }, - "FieldDescriptorProto:default_value": { - "paramName": "default_value", - "paramType": "TYPE_STRING", - "comments": [ - " For numeric types, contains the original text representation of the value.", - " For booleans, \"true\" or \"false\".", - " For strings, contains the default text contents (not escaped in any way).", - " For bytes, contains the C escaped value. All bytes >= 128 are escaped." - ] - }, - "FieldDescriptorProto:oneof_index": { - "paramName": "oneof_index", - "paramType": "TYPE_INT32", - "comments": [ - " If set, gives the index of a oneof in the containing type's oneof_decl", - " list. This field is a member of that oneof." - ] - }, - "FieldDescriptorProto:json_name": { - "paramName": "json_name", - "paramType": "TYPE_STRING", - "comments": [ - " JSON name of this field. The value is set by protocol compiler. If the", - " user has set a \"json_name\" option on this field, that option's value", - " will be used. Otherwise, it's deduced from the field's name by converting", - " it to camelCase." - ] - }, - "FieldDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.FieldOptions", - "comments": [] - }, - "FieldDescriptorProto:proto3_optional": { - "paramName": "proto3_optional", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, this is a proto3 \"optional\". When a proto3 field is optional, it", - " tracks presence regardless of field type.", - "", - " When proto3_optional is true, this field must belong to a oneof to signal", - " to old proto3 clients that presence is tracked for this field. This oneof", - " is known as a \"synthetic\" oneof, and this field must be its sole member", - " (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs", - " exist in the descriptor only, and do not generate any API. Synthetic oneofs", - " must be ordered after all \"real\" oneofs.", - "", - " For message fields, proto3_optional doesn't create any semantic change,", - " since non-repeated message fields always track presence. However it still", - " indicates the semantic detail of whether the user wrote \"optional\" or not.", - " This can be useful for round-tripping the .proto file. For consistency we", - " give message fields a synthetic oneof also, even though it is not required", - " to track presence. This is especially important because the parser can't", - " tell if a field is a message or an enum, so it must always create a", - " synthetic oneof.", - "", - " Proto2 optional fields do not set this flag, because they already indicate", - " optional with `LABEL_OPTIONAL`." - ] - }, - "OneofDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "OneofDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.OneofOptions", - "comments": [] - }, - "EnumDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumDescriptorProto:value": { - "paramName": "value", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "EnumDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumOptions", - "comments": [] - }, - "EnumDescriptorProto:reserved_range": { - "paramName": "reserved_range", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Range of reserved numeric values. Reserved numeric values may not be used", - " by enum values in the same enum declaration. Reserved ranges may not", - " overlap." - ] - }, - "EnumDescriptorProto:reserved_name": { - "paramName": "reserved_name", - "paramType": "TYPE_STRING[]", - "comments": [ - " Reserved enum value names, which may not be reused. A given name may only", - " be reserved once." - ] - }, - "EnumValueDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "EnumValueDescriptorProto:number": { - "paramName": "number", - "paramType": "TYPE_INT32", - "comments": [] - }, - "EnumValueDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.EnumValueOptions", - "comments": [] - }, - "ServiceDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "ServiceDescriptorProto:method": { - "paramName": "method", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "ServiceDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.ServiceOptions", - "comments": [] - }, - "MethodDescriptorProto:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:input_type": { - "paramName": "input_type", - "paramType": "TYPE_STRING", - "comments": [ - " Input and output type names. These are resolved in the same way as", - " FieldDescriptorProto.type_name, but must refer to a message type." - ] - }, - "MethodDescriptorProto:output_type": { - "paramName": "output_type", - "paramType": "TYPE_STRING", - "comments": [] - }, - "MethodDescriptorProto:options": { - "paramName": "options", - "paramType": ".google.protobuf.MethodOptions", - "comments": [] - }, - "MethodDescriptorProto:client_streaming": { - "paramName": "client_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if client streams multiple client messages" - ] - }, - "MethodDescriptorProto:server_streaming": { - "paramName": "server_streaming", - "paramType": "TYPE_BOOL", - "comments": [ - " Identifies if server streams multiple server messages" - ] - }, - "FileOptions:java_package": { - "paramName": "java_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Java package where classes generated from this .proto will be", - " placed. By default, the proto package is used, but this is often", - " inappropriate because proto packages do not normally start with backwards", - " domain names." - ] - }, - "FileOptions:java_outer_classname": { - "paramName": "java_outer_classname", - "paramType": "TYPE_STRING", - "comments": [ - " Controls the name of the wrapper Java class generated for the .proto file.", - " That class will always contain the .proto file's getDescriptor() method as", - " well as any top-level extensions defined in the .proto file.", - " If java_multiple_files is disabled, then all the other classes from the", - " .proto file will be nested inside the single wrapper outer class." - ] - }, - "FileOptions:java_multiple_files": { - "paramName": "java_multiple_files", - "paramType": "TYPE_BOOL", - "comments": [ - " If enabled, then the Java code generator will generate a separate .java", - " file for each top-level message, enum, and service defined in the .proto", - " file. Thus, these types will *not* be nested inside the wrapper class", - " named by java_outer_classname. However, the wrapper class will still be", - " generated to contain the file's getDescriptor() method as well as any", - " top-level extensions defined in the file." - ] - }, - "FileOptions:java_generate_equals_and_hash": { - "paramName": "java_generate_equals_and_hash", - "paramType": "TYPE_BOOL", - "comments": [ - " This option does nothing." - ] - }, - "FileOptions:java_string_check_utf8": { - "paramName": "java_string_check_utf8", - "paramType": "TYPE_BOOL", - "comments": [ - " A proto2 file can set this to true to opt in to UTF-8 checking for Java,", - " which will throw an exception if invalid UTF-8 is parsed from the wire or", - " assigned to a string field.", - "", - " TODO: clarify exactly what kinds of field types this option", - " applies to, and update these docs accordingly.", - "", - " Proto3 files already perform these checks. Setting the option explicitly to", - " false has no effect: it cannot be used to opt proto3 files out of UTF-8", - " checks." - ] - }, - "FileOptions:optimize_for": { - "paramName": "optimize_for", - "paramType": ".google.protobuf.FileOptions.OptimizeMode", - "comments": [] - }, - "FileOptions:go_package": { - "paramName": "go_package", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the Go package where structs generated from this .proto will be", - " placed. If omitted, the Go package will be derived from the following:", - " - The basename of the package import path, if provided.", - " - Otherwise, the package statement in the .proto file, if present.", - " - Otherwise, the basename of the .proto file, without extension." - ] - }, - "FileOptions:cc_generic_services": { - "paramName": "cc_generic_services", - "paramType": "TYPE_BOOL", - "comments": [ - " Should generic services be generated in each language? \"Generic\" services", - " are not specific to any particular RPC system. They are generated by the", - " main code generators in each language (without additional plugins).", - " Generic services were the only kind of service generation supported by", - " early versions of google.protobuf.", - "", - " Generic services are now considered deprecated in favor of using plugins", - " that generate code specific to your particular RPC system. Therefore,", - " these default to false. Old code which depends on generic services should", - " explicitly set them to true." - ] - }, - "FileOptions:java_generic_services": { - "paramName": "java_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:py_generic_services": { - "paramName": "py_generic_services", - "paramType": "TYPE_BOOL", - "comments": [] - }, - "FileOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this file deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for everything in the file, or it will be completely ignored; in the very", - " least, this is a formalization for deprecating files." - ] - }, - "FileOptions:cc_enable_arenas": { - "paramName": "cc_enable_arenas", - "paramType": "TYPE_BOOL", - "comments": [ - " Enables the use of arenas for the proto messages in this file. This applies", - " only to generated classes for C++." - ] - }, - "FileOptions:objc_class_prefix": { - "paramName": "objc_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the objective c class prefix which is prepended to all objective c", - " generated classes from this .proto. There is no default." - ] - }, - "FileOptions:csharp_namespace": { - "paramName": "csharp_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Namespace for generated classes; defaults to the package." - ] - }, - "FileOptions:swift_prefix": { - "paramName": "swift_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " By default Swift generators will take the proto package and CamelCase it", - " replacing '.' with underscore and use that to prefix the types/symbols", - " defined. When this options is provided, they will use this value instead", - " to prefix the types/symbols defined." - ] - }, - "FileOptions:php_class_prefix": { - "paramName": "php_class_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " Sets the php class prefix which is prepended to all php generated classes", - " from this .proto. Default is empty." - ] - }, - "FileOptions:php_namespace": { - "paramName": "php_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated classes. Default", - " is empty. When this option is empty, the package name will be used for", - " determining the namespace." - ] - }, - "FileOptions:php_metadata_namespace": { - "paramName": "php_metadata_namespace", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the namespace of php generated metadata classes.", - " Default is empty. When this option is empty, the proto file name will be", - " used for determining the namespace." - ] - }, - "FileOptions:ruby_package": { - "paramName": "ruby_package", - "paramType": "TYPE_STRING", - "comments": [ - " Use this option to change the package of ruby generated classes. Default", - " is empty. When this option is not set, the package name will be used for", - " determining the ruby package." - ] - }, - "FileOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FileOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here.", - " See the documentation for the \"Options\" section above." - ] - }, - "MessageOptions:message_set_wire_format": { - "paramName": "message_set_wire_format", - "paramType": "TYPE_BOOL", - "comments": [ - " Set true to use the old proto1 MessageSet wire format for extensions.", - " This is provided for backwards-compatibility with the MessageSet wire", - " format. You should not use this for any other reason: It's less", - " efficient, has fewer features, and is more complicated.", - "", - " The message must be defined exactly as follows:", - " message Foo {", - " option message_set_wire_format = true;", - " extensions 4 to max;", - " }", - " Note that the message cannot have any defined fields; MessageSets only", - " have extensions.", - "", - " All extensions of your type must be singular messages; e.g. they cannot", - " be int32s, enums, or repeated messages.", - "", - " Because this is an option, the above two restrictions are not enforced by", - " the protocol compiler." - ] - }, - "MessageOptions:no_standard_descriptor_accessor": { - "paramName": "no_standard_descriptor_accessor", - "paramType": "TYPE_BOOL", - "comments": [ - " Disables the generation of the standard \"descriptor()\" accessor, which can", - " conflict with a field of the same name. This is meant to make migration", - " from proto1 easier; new code should avoid fields named \"descriptor\"." - ] - }, - "MessageOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this message deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the message, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating messages." - ] - }, - "MessageOptions:map_entry": { - "paramName": "map_entry", - "paramType": "TYPE_BOOL", - "comments": [ - " Whether the message is an automatically generated map entry type for the", - " maps field.", - "", - " For maps fields:", - " map map_field = 1;", - " The parsed descriptor looks like:", - " message MapFieldEntry {", - " option map_entry = true;", - " optional KeyType key = 1;", - " optional ValueType value = 2;", - " }", - " repeated MapFieldEntry map_field = 1;", - "", - " Implementations may choose not to generate the map_entry=true message, but", - " use a native map in the target language to hold the keys and values.", - " The reflection APIs in such implementations still need to work as", - " if the field is a repeated message field.", - "", - " NOTE: Do not set the option in .proto files. Always use the maps syntax", - " instead. The option should only be implicitly set by the proto compiler", - " parser." - ] - }, - "MessageOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - "", - " This should only be used as a temporary measure against broken builds due", - " to the change in behavior for JSON field name conflicts.", - "", - " TODO This is legacy behavior we plan to remove once downstream", - " teams have had time to migrate." - ] - }, - "MessageOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MessageOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "FieldOptions:ctype": { - "paramName": "ctype", - "paramType": ".google.protobuf.FieldOptions.CType", - "comments": [ - " The ctype option instructs the C++ code generator to use a different", - " representation of the field than it normally would. See the specific", - " options below. This option is only implemented to support use of", - " [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of", - " type \"bytes\" in the open source release -- sorry, we'll try to include", - " other types in a future version!" - ] - }, - "FieldOptions:packed": { - "paramName": "packed", - "paramType": "TYPE_BOOL", - "comments": [ - " The packed option can be enabled for repeated primitive fields to enable", - " a more efficient representation on the wire. Rather than repeatedly", - " writing the tag and type for each element, the entire array is encoded as", - " a single length-delimited blob. In proto3, only explicit setting it to", - " false will avoid using packed encoding. This option is prohibited in", - " Editions, but the `repeated_field_encoding` feature can be used to control", - " the behavior." - ] - }, - "FieldOptions:jstype": { - "paramName": "jstype", - "paramType": ".google.protobuf.FieldOptions.JSType", - "comments": [ - " The jstype option determines the JavaScript type used for values of the", - " field. The option is permitted only for 64 bit integral and fixed types", - " (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING", - " is represented as JavaScript string, which avoids loss of precision that", - " can happen when a large value is converted to a floating point JavaScript.", - " Specifying JS_NUMBER for the jstype causes the generated JavaScript code to", - " use the JavaScript \"number\" type. The behavior of the default option", - " JS_NORMAL is implementation dependent.", - "", - " This option is an enum to permit additional types to be added, e.g.", - " goog.math.Integer." - ] - }, - "FieldOptions:lazy": { - "paramName": "lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " Should this field be parsed lazily? Lazy applies only to message-type", - " fields. It means that when the outer message is initially parsed, the", - " inner message's contents will not be parsed but instead stored in encoded", - " form. The inner message will actually be parsed when it is first accessed.", - "", - " This is only a hint. Implementations are free to choose whether to use", - " eager or lazy parsing regardless of the value of this option. However,", - " setting this option true suggests that the protocol author believes that", - " using lazy parsing on this field is worth the additional bookkeeping", - " overhead typically needed to implement it.", - "", - " This option does not affect the public interface of any generated code;", - " all method signatures remain the same. Furthermore, thread-safety of the", - " interface is not affected by this option; const methods remain safe to", - " call from multiple threads concurrently, while non-const methods continue", - " to require exclusive access.", - "", - " Note that lazy message fields are still eagerly verified to check", - " ill-formed wireformat or missing required fields. Calling IsInitialized()", - " on the outer message would fail if the inner message has missing required", - " fields. Failed verification would result in parsing failure (except when", - " uninitialized messages are acceptable)." - ] - }, - "FieldOptions:unverified_lazy": { - "paramName": "unverified_lazy", - "paramType": "TYPE_BOOL", - "comments": [ - " unverified_lazy does no correctness checks on the byte stream. This should", - " only be used where lazy with verification is prohibitive for performance", - " reasons." - ] - }, - "FieldOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this field deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for accessors, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating fields." - ] - }, - "FieldOptions:weak": { - "paramName": "weak", - "paramType": "TYPE_BOOL", - "comments": [ - " For Google-internal migration only. Do not use." - ] - }, - "FieldOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that the field value should not be printed out when using debug", - " formats, e.g. when the field contains sensitive credentials." - ] - }, - "FieldOptions:retention": { - "paramName": "retention", - "paramType": ".google.protobuf.FieldOptions.OptionRetention", - "comments": [] - }, - "FieldOptions:targets": { - "paramName": "targets", - "paramType": "TYPE_ENUM[]", - "comments": [] - }, - "FieldOptions:edition_defaults": { - "paramName": "edition_defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FieldOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "FieldOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "OneofOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "OneofOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumOptions:allow_alias": { - "paramName": "allow_alias", - "paramType": "TYPE_BOOL", - "comments": [ - " Set this option to true to allow mapping different tag names to the same", - " value." - ] - }, - "EnumOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum, or it will be completely ignored; in the very least, this", - " is a formalization for deprecating enums." - ] - }, - "EnumOptions:deprecated_legacy_json_field_conflicts": { - "paramName": "deprecated_legacy_json_field_conflicts", - "paramType": "TYPE_BOOL", - "comments": [ - " Enable the legacy handling of JSON field name conflicts. This lowercases", - " and strips underscored from the fields before comparison in proto3 only.", - " The new behavior takes `json_name` into account and applies to proto2 as", - " well.", - " TODO Remove this legacy behavior once downstream teams have", - " had time to migrate." - ] - }, - "EnumOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "EnumValueOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this enum value deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the enum value, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating enum values." - ] - }, - "EnumValueOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "EnumValueOptions:debug_redact": { - "paramName": "debug_redact", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicate that fields annotated with this enum value should not be printed", - " out when using debug formats, e.g. when the field contains sensitive", - " credentials." - ] - }, - "EnumValueOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "ServiceOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "ServiceOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this service deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the service, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating services." - ] - }, - "ServiceOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "MethodOptions:deprecated": { - "paramName": "deprecated", - "paramType": "TYPE_BOOL", - "comments": [ - " Is this method deprecated?", - " Depending on the target platform, this can emit Deprecated annotations", - " for the method, or it will be completely ignored; in the very least,", - " this is a formalization for deprecating methods." - ] - }, - "MethodOptions:idempotency_level": { - "paramName": "idempotency_level", - "paramType": ".google.protobuf.MethodOptions.IdempotencyLevel", - "comments": [] - }, - "MethodOptions:features": { - "paramName": "features", - "paramType": ".google.protobuf.FeatureSet", - "comments": [ - " Any features defined in the specific edition." - ] - }, - "MethodOptions:uninterpreted_option": { - "paramName": "uninterpreted_option", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The parser stores options it doesn't recognize here. See above." - ] - }, - "UninterpretedOption:name": { - "paramName": "name", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "UninterpretedOption:identifier_value": { - "paramName": "identifier_value", - "paramType": "TYPE_STRING", - "comments": [ - " The value of the uninterpreted option, in whatever type the tokenizer", - " identified it as during parsing. Exactly one of these should be set." - ] - }, - "UninterpretedOption:positive_int_value": { - "paramName": "positive_int_value", - "paramType": "TYPE_UINT64", - "comments": [] - }, - "UninterpretedOption:negative_int_value": { - "paramName": "negative_int_value", - "paramType": "TYPE_INT64", - "comments": [] - }, - "UninterpretedOption:double_value": { - "paramName": "double_value", - "paramType": "TYPE_DOUBLE", - "comments": [] - }, - "UninterpretedOption:string_value": { - "paramName": "string_value", - "paramType": "TYPE_BYTES", - "comments": [] - }, - "UninterpretedOption:aggregate_value": { - "paramName": "aggregate_value", - "paramType": "TYPE_STRING", - "comments": [] - }, - "FeatureSet:field_presence": { - "paramName": "field_presence", - "paramType": ".google.protobuf.FeatureSet.FieldPresence", - "comments": [] - }, - "FeatureSet:enum_type": { - "paramName": "enum_type", - "paramType": ".google.protobuf.FeatureSet.EnumType", - "comments": [] - }, - "FeatureSet:repeated_field_encoding": { - "paramName": "repeated_field_encoding", - "paramType": ".google.protobuf.FeatureSet.RepeatedFieldEncoding", - "comments": [] - }, - "FeatureSet:utf8_validation": { - "paramName": "utf8_validation", - "paramType": ".google.protobuf.FeatureSet.Utf8Validation", - "comments": [] - }, - "FeatureSet:message_encoding": { - "paramName": "message_encoding", - "paramType": ".google.protobuf.FeatureSet.MessageEncoding", - "comments": [] - }, - "FeatureSet:json_format": { - "paramName": "json_format", - "paramType": ".google.protobuf.FeatureSet.JsonFormat", - "comments": [] - }, - "FeatureSetDefaults:defaults": { - "paramName": "defaults", - "paramType": "TYPE_MESSAGE[]", - "comments": [] - }, - "FeatureSetDefaults:minimum_edition": { - "paramName": "minimum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The minimum supported edition (inclusive) when this was constructed.", - " Editions before this will not have defaults." - ] - }, - "FeatureSetDefaults:maximum_edition": { - "paramName": "maximum_edition", - "paramType": ".google.protobuf.Edition", - "comments": [ - " The maximum known edition (inclusive) when this was constructed. Editions", - " after this will not have reliable defaults." - ] - }, - "SourceCodeInfo:location": { - "paramName": "location", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A Location identifies a piece of source code in a .proto file which", - " corresponds to a particular definition. This information is intended", - " to be useful to IDEs, code indexers, documentation generators, and similar", - " tools.", - "", - " For example, say we have a file like:", - " message Foo {", - " optional string foo = 1;", - " }", - " Let's look at just the field definition:", - " optional string foo = 1;", - " ^ ^^ ^^ ^ ^^^", - " a bc de f ghi", - " We have the following locations:", - " span path represents", - " [a,i) [ 4, 0, 2, 0 ] The whole field definition.", - " [a,b) [ 4, 0, 2, 0, 4 ] The label (optional).", - " [c,d) [ 4, 0, 2, 0, 5 ] The type (string).", - " [e,f) [ 4, 0, 2, 0, 1 ] The name (foo).", - " [g,h) [ 4, 0, 2, 0, 3 ] The number (1).", - "", - " Notes:", - " - A location may refer to a repeated field itself (i.e. not to any", - " particular index within it). This is used whenever a set of elements are", - " logically enclosed in a single code segment. For example, an entire", - " extend block (possibly containing multiple extension definitions) will", - " have an outer location whose path refers to the \"extensions\" repeated", - " field without an index.", - " - Multiple locations may have the same path. This happens when a single", - " logical declaration is spread out across multiple places. The most", - " obvious example is the \"extend\" block again -- there may be multiple", - " extend blocks in the same scope, each of which will have the same path.", - " - A location's span is not always a subset of its parent's span. For", - " example, the \"extendee\" of an extension declaration appears at the", - " beginning of the \"extend\" block and is shared by all extensions within", - " the block.", - " - Just because a location's span is a subset of some other location's span", - " does not mean that it is a descendant. For example, a \"group\" defines", - " both a type and a field in a single declaration. Thus, the locations", - " corresponding to the type and field and their components will overlap.", - " - Code which tries to interpret locations should probably be designed to", - " ignore those that it doesn't understand, as more types of locations could", - " be recorded in the future." - ] - }, - "GeneratedCodeInfo:annotation": { - "paramName": "annotation", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " An Annotation connects some span of text in generated code to an element", - " of its generating .proto file." - ] - }, - "Duration:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Signed seconds of the span of time. Must be from -315,576,000,000", - " to +315,576,000,000 inclusive. Note: these bounds are computed from:", - " 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years" - ] - }, - "Duration:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Signed fractions of a second at nanosecond resolution of the span", - " of time. Durations less than one second are represented with a 0", - " `seconds` field and a positive or negative `nanos` field. For durations", - " of one second or more, a non-zero value for the `nanos` field must be", - " of the same sign as the `seconds` field. Must be from -999,999,999", - " to +999,999,999 inclusive." - ] - }, - "CommonLanguageSettings:reference_docs_uri": { - "paramName": "reference_docs_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to automatically generated reference documentation. Example:", - " https://cloud.google.com/nodejs/docs/reference/asset/latest" - ] - }, - "CommonLanguageSettings:destinations": { - "paramName": "destinations", - "paramType": "TYPE_ENUM[]", - "comments": [ - " The destination where API teams want this client library to be published." - ] - }, - "ClientLibrarySettings:version": { - "paramName": "version", - "paramType": "TYPE_STRING", - "comments": [ - " Version of the API to apply these settings to. This is the full protobuf", - " package for the API, ending in the version element.", - " Examples: \"google.cloud.speech.v1\" and \"google.spanner.admin.database.v1\"." - ] - }, - "ClientLibrarySettings:launch_stage": { - "paramName": "launch_stage", - "paramType": ".google.api.LaunchStage", - "comments": [ - " Launch stage of this version of the API." - ] - }, - "ClientLibrarySettings:rest_numeric_enums": { - "paramName": "rest_numeric_enums", - "paramType": "TYPE_BOOL", - "comments": [ - " When using transport=rest, the client request will encode enums as", - " numbers rather than strings." - ] - }, - "ClientLibrarySettings:java_settings": { - "paramName": "java_settings", - "paramType": ".google.api.JavaSettings", - "comments": [ - " Settings for legacy Java features, supported in the Service YAML." - ] - }, - "ClientLibrarySettings:cpp_settings": { - "paramName": "cpp_settings", - "paramType": ".google.api.CppSettings", - "comments": [ - " Settings for C++ client libraries." - ] - }, - "ClientLibrarySettings:php_settings": { - "paramName": "php_settings", - "paramType": ".google.api.PhpSettings", - "comments": [ - " Settings for PHP client libraries." - ] - }, - "ClientLibrarySettings:python_settings": { - "paramName": "python_settings", - "paramType": ".google.api.PythonSettings", - "comments": [ - " Settings for Python client libraries." - ] - }, - "ClientLibrarySettings:node_settings": { - "paramName": "node_settings", - "paramType": ".google.api.NodeSettings", - "comments": [ - " Settings for Node client libraries." - ] - }, - "ClientLibrarySettings:dotnet_settings": { - "paramName": "dotnet_settings", - "paramType": ".google.api.DotnetSettings", - "comments": [ - " Settings for .NET client libraries." - ] - }, - "ClientLibrarySettings:ruby_settings": { - "paramName": "ruby_settings", - "paramType": ".google.api.RubySettings", - "comments": [ - " Settings for Ruby client libraries." - ] - }, - "ClientLibrarySettings:go_settings": { - "paramName": "go_settings", - "paramType": ".google.api.GoSettings", - "comments": [ - " Settings for Go client libraries." - ] - }, - "Publishing:method_settings": { - "paramName": "method_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " A list of API method settings, e.g. the behavior for methods that use the", - " long-running operation pattern." - ] - }, - "Publishing:new_issue_uri": { - "paramName": "new_issue_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to a *public* URI where users can report issues. Example:", - " https://issuetracker.google.com/issues/new?component=190865&template=1161103" - ] - }, - "Publishing:documentation_uri": { - "paramName": "documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Link to product home page. Example:", - " https://cloud.google.com/asset-inventory/docs/overview" - ] - }, - "Publishing:api_short_name": { - "paramName": "api_short_name", - "paramType": "TYPE_STRING", - "comments": [ - " Used as a tracking tag when collecting data about the APIs developer", - " relations artifacts like docs, packages delivered to package managers,", - " etc. Example: \"speech\"." - ] - }, - "Publishing:github_label": { - "paramName": "github_label", - "paramType": "TYPE_STRING", - "comments": [ - " GitHub label to apply to issues and pull requests opened for this API." - ] - }, - "Publishing:codeowner_github_teams": { - "paramName": "codeowner_github_teams", - "paramType": "TYPE_STRING[]", - "comments": [ - " GitHub teams to be added to CODEOWNERS in the directory in GitHub", - " containing source code for the client libraries for this API." - ] - }, - "Publishing:doc_tag_prefix": { - "paramName": "doc_tag_prefix", - "paramType": "TYPE_STRING", - "comments": [ - " A prefix used in sample code when demarking regions to be included in", - " documentation." - ] - }, - "Publishing:organization": { - "paramName": "organization", - "paramType": ".google.api.ClientLibraryOrganization", - "comments": [ - " For whom the client library is being published." - ] - }, - "Publishing:library_settings": { - "paramName": "library_settings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Client library settings. If the same version string appears multiple", - " times in this list, then the last one wins. Settings from earlier", - " settings with the same version string are discarded." - ] - }, - "Publishing:proto_reference_documentation_uri": { - "paramName": "proto_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to proto reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rpc" - ] - }, - "Publishing:rest_reference_documentation_uri": { - "paramName": "rest_reference_documentation_uri", - "paramType": "TYPE_STRING", - "comments": [ - " Optional link to REST reference documentation. Example:", - " https://cloud.google.com/pubsub/lite/docs/reference/rest" - ] - }, - "JavaSettings:library_package": { - "paramName": "library_package", - "paramType": "TYPE_STRING", - "comments": [ - " The package name to use in Java. Clobbers the java_package option", - " set in the protobuf. This should be used **only** by APIs", - " who have already set the language_settings.java.package_name\" field", - " in gapic.yaml. API teams should use the protobuf java_package option", - " where possible.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " library_package: com.google.cloud.pubsub.v1" - ] - }, - "JavaSettings:service_class_names": { - "paramName": "service_class_names", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Configure the Java class name to use instead of the service's for its", - " corresponding generated GAPIC client. Keys are fully-qualified", - " service names as they appear in the protobuf (including the full", - " the language_settings.java.interface_names\" field in gapic.yaml. API", - " teams should otherwise use the service name as it appears in the", - " protobuf.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " java_settings:", - " service_class_names:", - " - google.pubsub.v1.Publisher: TopicAdmin", - " - google.pubsub.v1.Subscriber: SubscriptionAdmin" - ] - }, - "JavaSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "CppSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PhpSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "PythonSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "NodeSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "DotnetSettings:renamed_services": { - "paramName": "renamed_services", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from original service names to renamed versions.", - " This is used when the default generated types", - " would cause a naming conflict. (Neither name is", - " fully-qualified.)", - " Example: Subscriber to SubscriberServiceApi." - ] - }, - "DotnetSettings:renamed_resources": { - "paramName": "renamed_resources", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Map from full resource types to the effective short name", - " for the resource. This is used when otherwise resource", - " named from different services would cause naming collisions.", - " Example entry:", - " \"datalabeling.googleapis.com/Dataset\": \"DataLabelingDataset\"" - ] - }, - "DotnetSettings:ignored_resources": { - "paramName": "ignored_resources", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of full resource types to ignore during generation.", - " This is typically used for API-specific Location resources,", - " which should be handled by the generator as if they were actually", - " the common Location resources.", - " Example entry: \"documentai.googleapis.com/Location\"" - ] - }, - "DotnetSettings:forced_namespace_aliases": { - "paramName": "forced_namespace_aliases", - "paramType": "TYPE_STRING[]", - "comments": [ - " Namespaces which must be aliased in snippets due to", - " a known (but non-generator-predictable) naming collision" - ] - }, - "DotnetSettings:handwritten_signatures": { - "paramName": "handwritten_signatures", - "paramType": "TYPE_STRING[]", - "comments": [ - " Method signatures (in the form \"service.method(signature)\")", - " which are provided separately, so shouldn't be generated.", - " Snippets *calling* these methods are still generated, however." - ] - }, - "RubySettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "GoSettings:common": { - "paramName": "common", - "paramType": ".google.api.CommonLanguageSettings", - "comments": [ - " Some settings." - ] - }, - "MethodSettings:selector": { - "paramName": "selector", - "paramType": "TYPE_STRING", - "comments": [ - " The fully qualified name of the method, for which the options below apply.", - " This is used to find the method to apply the options." - ] - }, - "MethodSettings:long_running": { - "paramName": "long_running", - "paramType": ".google.api.MethodSettings.LongRunning", - "comments": [ - " Describes settings to use for long-running operations when generating", - " API methods for RPCs. Complements RPCs that use the annotations in", - " google/longrunning/operations.proto.", - "", - " Example of a YAML configuration::", - "", - " publishing:", - " method_settings:", - " - selector: google.cloud.speech.v2.Speech.BatchRecognize", - " long_running:", - " initial_poll_delay:", - " seconds: 60 # 1 minute", - " poll_delay_multiplier: 1.5", - " max_poll_delay:", - " seconds: 360 # 6 minutes", - " total_poll_timeout:", - " seconds: 54000 # 90 minutes" - ] - }, - "MethodSettings:auto_populated_fields": { - "paramName": "auto_populated_fields", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of top-level fields of the request message, that should be", - " automatically populated by the client libraries based on their", - " (google.api.field_info).format. Currently supported format: UUID4.", - "", - " Example of a YAML configuration:", - "", - " publishing:", - " method_settings:", - " - selector: google.example.v1.ExampleService.CreateExample", - " auto_populated_fields:", - " - request_id" - ] - }, - "ResourceDescriptor:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type. It must be in the format of", - " {service_name}/{resource_type_kind}. The `resource_type_kind` must be", - " singular and must not include version numbers.", - "", - " Example: `storage.googleapis.com/Bucket`", - "", - " The value of the resource_type_kind must follow the regular expression", - " /[A-Za-z][a-zA-Z0-9]+/. It should start with an upper case character and", - " should use PascalCase (UpperCamelCase). The maximum number of", - " characters allowed for the `resource_type_kind` is 100." - ] - }, - "ResourceDescriptor:pattern": { - "paramName": "pattern", - "paramType": "TYPE_STRING[]", - "comments": [ - " Optional. The relative resource name pattern associated with this resource", - " type. The DNS prefix of the full resource name shouldn't be specified here.", - "", - " The path pattern must follow the syntax, which aligns with HTTP binding", - " syntax:", - "", - " Template = Segment { \"/\" Segment } ;", - " Segment = LITERAL | Variable ;", - " Variable = \"{\" LITERAL \"}\" ;", - "", - " Examples:", - "", - " - \"projects/{project}/topics/{topic}\"", - " - \"projects/{project}/knowledgeBases/{knowledge_base}\"", - "", - " The components in braces correspond to the IDs for each resource in the", - " hierarchy. It is expected that, if multiple patterns are provided,", - " the same component name (e.g. \"project\") refers to IDs of the same", - " type of resource." - ] - }, - "ResourceDescriptor:name_field": { - "paramName": "name_field", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. The field on the resource that designates the resource name", - " field. If omitted, this is assumed to be \"name\"." - ] - }, - "ResourceDescriptor:history": { - "paramName": "history", - "paramType": ".google.api.ResourceDescriptor.History", - "comments": [ - " Optional. The historical or future-looking state of the resource pattern.", - "", - " Example:", - "", - " // The InspectTemplate message originally only supported resource", - " // names with organization, and project was added later.", - " message InspectTemplate {", - " option (google.api.resource) = {", - " type: \"dlp.googleapis.com/InspectTemplate\"", - " pattern:", - " \"organizations/{organization}/inspectTemplates/{inspect_template}\"", - " pattern: \"projects/{project}/inspectTemplates/{inspect_template}\"", - " history: ORIGINALLY_SINGLE_PATTERN", - " };", - " }" - ] - }, - "ResourceDescriptor:plural": { - "paramName": "plural", - "paramType": "TYPE_STRING", - "comments": [ - " The plural name used in the resource name and permission names, such as", - " 'projects' for the resource name of 'projects/{project}' and the permission", - " name of 'cloudresourcemanager.googleapis.com/projects.get'. It is the same", - " concept of the `plural` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - "", - " Note: The plural form is required even for singleton resources. See", - " https://aip.dev/156" - ] - }, - "ResourceDescriptor:singular": { - "paramName": "singular", - "paramType": "TYPE_STRING", - "comments": [ - " The same concept of the `singular` field in k8s CRD spec", - " https://kubernetes.io/docs/tasks/access-kubernetes-api/custom-resources/custom-resource-definitions/", - " Such as \"project\" for the `resourcemanager.googleapis.com/Project` type." - ] - }, - "ResourceDescriptor:style": { - "paramName": "style", - "paramType": "TYPE_ENUM[]", - "comments": [ - " Style flag(s) for this resource.", - " These indicate that a resource is expected to conform to a given", - " style. See the specific style flags for additional information." - ] - }, - "ResourceReference:type": { - "paramName": "type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type that the annotated field references.", - "", - " Example:", - "", - " message Subscription {", - " string topic = 2 [(google.api.resource_reference) = {", - " type: \"pubsub.googleapis.com/Topic\"", - " }];", - " }", - "", - " Occasionally, a field may reference an arbitrary resource. In this case,", - " APIs use the special value * in their resource reference.", - "", - " Example:", - "", - " message GetIamPolicyRequest {", - " string resource = 2 [(google.api.resource_reference) = {", - " type: \"*\"", - " }];", - " }" - ] - }, - "ResourceReference:child_type": { - "paramName": "child_type", - "paramType": "TYPE_STRING", - "comments": [ - " The resource type of a child collection that the annotated field", - " references. This is useful for annotating the `parent` field that", - " doesn't have a fixed resource type.", - "", - " Example:", - "", - " message ListLogEntriesRequest {", - " string parent = 1 [(google.api.resource_reference) = {", - " child_type: \"logging.googleapis.com/LogEntry\"", - " };", - " }" - ] - }, - "FieldMask:paths": { - "paramName": "paths", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of field mask paths." - ] - }, - "Timestamp:seconds": { - "paramName": "seconds", - "paramType": "TYPE_INT64", - "comments": [ - " Represents seconds of UTC time since Unix epoch", - " 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to", - " 9999-12-31T23:59:59Z inclusive." - ] - }, - "Timestamp:nanos": { - "paramName": "nanos", - "paramType": "TYPE_INT32", - "comments": [ - " Non-negative fractions of a second at nanosecond resolution. Negative", - " second values with fractions must still have non-negative nanos values", - " that count forward in time. Must be from 0 to 999,999,999", - " inclusive." - ] - }, - "SchemaService": { - "paramName": "", - "paramType": "", - "comments": [ - " Service for doing schema-related operations." - ] - }, - "SchemaService:CreateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a schema.", - "" - ] - }, - "SchemaService:GetSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets a schema.", - "" - ] - }, - "SchemaService:ListSchemas": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists schemas in a project.", - "" - ] - }, - "SchemaService:DeleteSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes a schema.", - "" - ] - }, - "SchemaService:ValidateSchema": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a schema.", - "" - ] - }, - "SchemaService:ValidateMessage": { - "paramName": "", - "paramType": "", - "comments": [ - " Validates a message against a schema.", - "" - ] - }, - "Schema:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "Schema:type": { - "paramName": "type", - "paramType": ".google.pubsub.v1.Schema.Type", - "comments": [ - " The type of the schema definition." - ] - }, - "Schema:definition": { - "paramName": "definition", - "paramType": "TYPE_STRING", - "comments": [ - " The definition of the schema. This should contain a string representing", - " the full definition of the schema that is a valid schema definition of", - " the type specified in `type`." - ] - }, - "CreateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to create the schema.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to create.", - "", - " This schema's `name` parameter is ignored. The schema object returned", - " by CreateSchema will have a `name` made using the given `parent` and", - " `schema_id`." - ], - "fieldBehavior": 2 - }, - "CreateSchemaRequest:schema_id": { - "paramName": "schema_id", - "paramType": "TYPE_STRING", - "comments": [ - " The ID to use for the schema, which will become the final component of", - " the schema's resource name.", - "", - " See https://cloud.google.com/pubsub/docs/admin#resource_names for resource", - " name constraints." - ] - }, - "GetSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema to get.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "GetSchemaRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of fields to return in the response. If not set, returns a Schema", - " with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all", - " fields." - ] - }, - "ListSchemasRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSchemasRequest:view": { - "paramName": "view", - "paramType": ".google.pubsub.v1.SchemaView", - "comments": [ - " The set of Schema fields to return in the response. If not set, returns", - " Schemas with `name` and `type`, but not `definition`. Set to `FULL` to", - " retrieve all fields." - ] - }, - "ListSchemasRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of schemas to return." - ] - }, - "ListSchemasRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSchemasResponse`; indicates that", - " this is a continuation of a prior `ListSchemas` call, and that the", - " system should return the next page of data." - ] - }, - "ListSchemasResponse:schemas": { - "paramName": "schemas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting schemas." - ] - }, - "ListSchemasResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more schemas that match the", - " request; this value should be passed in a new `ListSchemasRequest`." - ] - }, - "DeleteSchemaRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the schema to delete.", - " Format is `projects/{project}/schemas/{schema}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateSchemaRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Required. The schema object to validate." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:parent": { - "paramName": "parent", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to validate schemas.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ValidateMessageRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Name of the schema against which to validate.", - "", - " Format is `projects/{project}/schemas/{schema}`." - ] - }, - "ValidateMessageRequest:schema": { - "paramName": "schema", - "paramType": ".google.pubsub.v1.Schema", - "comments": [ - " Ad-hoc schema against which to validate" - ] - }, - "ValidateMessageRequest:message": { - "paramName": "message", - "paramType": "TYPE_BYTES", - "comments": [ - " Message to validate against the provided `schema_spec`." - ] - }, - "ValidateMessageRequest:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding expected for messages" - ] - }, - "Publisher": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate topics, and to send", - " messages to a topic." - ] - }, - "Publisher:CreateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates the given topic with the given name. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - "" - ] - }, - "Publisher:UpdateTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing topic. Note that certain properties of a", - " topic are not modifiable.", - "" - ] - }, - "Publisher:Publish": { - "paramName": "", - "paramType": "", - "comments": [ - " Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic", - " does not exist.", - "" - ] - }, - "Publisher:GetTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration of a topic.", - "" - ] - }, - "Publisher:ListTopics": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching topics.", - "" - ] - }, - "Publisher:ListTopicSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the attached subscriptions on this topic.", - "" - ] - }, - "Publisher:ListTopicSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the names of the snapshots on this topic. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Publisher:DeleteTopic": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes the topic with the given name. Returns `NOT_FOUND` if the topic", - " does not exist. After a topic is deleted, a new topic may be created with", - " the same name; this is an entirely new topic with none of the old", - " configuration or subscriptions. Existing subscriptions to this topic are", - " not deleted, but their `topic` field is set to `_deleted-topic_`.", - "" - ] - }, - "Publisher:DetachSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Detaches a subscription from this topic. All messages retained in the", - " subscription are dropped. Subsequent `Pull` and `StreamingPull` requests", - " will return FAILED_PRECONDITION. If the subscription is a push", - " subscription, pushes to the endpoint will stop.", - "" - ] - }, - "MessageStoragePolicy:allowed_persistence_regions": { - "paramName": "allowed_persistence_regions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A list of IDs of GCP regions where messages that are published to the topic", - " may be persisted in storage. Messages published by publishers running in", - " non-allowed GCP regions (or running outside of GCP altogether) will be", - " routed for storage in one of the allowed regions. An empty list means that", - " no regions are allowed, and is not a valid configuration." - ] - }, - "SchemaSettings:schema": { - "paramName": "schema", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the schema that messages published should be", - " validated against. Format is `projects/{project}/schemas/{schema}`. The", - " value of this field will be `_deleted-schema_` if the schema has been", - " deleted." - ], - "fieldBehavior": 2 - }, - "SchemaSettings:encoding": { - "paramName": "encoding", - "paramType": ".google.pubsub.v1.Encoding", - "comments": [ - " The encoding of messages validated against `schema`." - ] - }, - "Topic:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic. It must have the format", - " `\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,", - " and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),", - " underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent", - " signs (`%`). It must be between 3 and 255 characters in length, and it", - " must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Topic:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "Topic:message_storage_policy": { - "paramName": "message_storage_policy", - "paramType": ".google.pubsub.v1.MessageStoragePolicy", - "comments": [ - " Policy constraining the set of Google Cloud Platform regions where messages", - " published to the topic may be stored. If not present, then no constraints", - " are in effect." - ] - }, - "Topic:kms_key_name": { - "paramName": "kms_key_name", - "paramType": "TYPE_STRING", - "comments": [ - " The resource name of the Cloud KMS CryptoKey to be used to protect access", - " to messages published on this topic.", - "", - " The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`." - ] - }, - "Topic:schema_settings": { - "paramName": "schema_settings", - "paramType": ".google.pubsub.v1.SchemaSettings", - "comments": [ - " Settings for validating messages published against a schema." - ] - }, - "Topic:satisfies_pzs": { - "paramName": "satisfies_pzs", - "paramType": "TYPE_BOOL", - "comments": [ - " Reserved for future use. This field is set only in responses from the", - " server; it is ignored if it is set in any requests." - ] - }, - "PubsubMessage:data": { - "paramName": "data", - "paramType": "TYPE_BYTES", - "comments": [ - " The message data field. If this field is empty, the message must contain", - " at least one attribute." - ] - }, - "PubsubMessage:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Attributes for this message. If this field is empty, the message must", - " contain non-empty data. This can be used to filter messages on the", - " subscription." - ] - }, - "PubsubMessage:message_id": { - "paramName": "message_id", - "paramType": "TYPE_STRING", - "comments": [ - " ID of this message, assigned by the server when the message is published.", - " Guaranteed to be unique within the topic. This value may be read by a", - " subscriber that receives a `PubsubMessage` via a `Pull` call or a push", - " delivery. It must not be populated by the publisher in a `Publish` call." - ] - }, - "PubsubMessage:publish_time": { - "paramName": "publish_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time at which the message was published, populated by the server when", - " it receives the `Publish` call. It must not be populated by the", - " publisher in a `Publish` call." - ] - }, - "PubsubMessage:ordering_key": { - "paramName": "ordering_key", - "paramType": "TYPE_STRING", - "comments": [ - " If non-empty, identifies related messages for which publish order should be", - " respected. If a `Subscription` has `enable_message_ordering` set to `true`,", - " messages published with the same non-empty `ordering_key` value will be", - " delivered to subscribers in the order in which they are received by the", - " Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`", - " must specify the same `ordering_key` value." - ] - }, - "GetTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic to get.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:topic": { - "paramName": "topic", - "paramType": ".google.pubsub.v1.Topic", - "comments": [ - " Required. The updated topic object." - ], - "fieldBehavior": 2 - }, - "UpdateTopicRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided topic to update. Must be", - " specified and non-empty. Note that if `update_mask` contains", - " \"message_storage_policy\" but the `message_storage_policy` is not set in", - " the `topic` provided above, then the updated value is determined by the", - " policy configured at the project or organization level." - ], - "fieldBehavior": 2 - }, - "PublishRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The messages in the request will be published on this topic.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "PublishRequest:messages": { - "paramName": "messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Required. The messages to publish." - ], - "fieldBehavior": 2 - }, - "PublishResponse:message_ids": { - "paramName": "message_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " The server-assigned ID of each published message, in the same order as", - " the messages in the request. IDs are guaranteed to be unique within", - " the topic." - ] - }, - "ListTopicsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list topics.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListTopicsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of topics to return." - ] - }, - "ListTopicsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicsResponse`; indicates that this is", - " a continuation of a prior `ListTopics` call, and that the system should", - " return the next page of data." - ] - }, - "ListTopicsResponse:topics": { - "paramName": "topics", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting topics." - ] - }, - "ListTopicsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more topics that match the", - " request; this value should be passed in a new `ListTopicsRequest`." - ] - }, - "ListTopicSubscriptionsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that subscriptions are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscription names to return." - ] - }, - "ListTopicSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSubscriptionsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSubscriptions` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of subscriptions attached to the topic specified in the request." - ] - }, - "ListTopicSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListTopicSubscriptionsRequest` to get more subscriptions." - ] - }, - "ListTopicSnapshotsRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic that snapshots are attached to.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "ListTopicSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshot names to return." - ] - }, - "ListTopicSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListTopicSnapshotsResponse`; indicates", - " that this is a continuation of a prior `ListTopicSnapshots` call, and", - " that the system should return the next page of data." - ] - }, - "ListTopicSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_STRING[]", - "comments": [ - " The names of the snapshots that match the request." - ] - }, - "ListTopicSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshots that match", - " the request; this value should be passed in a new", - " `ListTopicSnapshotsRequest` to get more snapshots." - ] - }, - "DeleteTopicRequest:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. Name of the topic to delete.", - " Format is `projects/{project}/topics/{topic}`." - ], - "fieldBehavior": 2 - }, - "DetachSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to detach.", - " Format is `projects/{project}/subscriptions/{subscription}`." - ], - "fieldBehavior": 2 - }, - "Subscriber": { - "paramName": "", - "paramType": "", - "comments": [ - " The service that an application uses to manipulate subscriptions and to", - " consume messages from a subscription via the `Pull` method or by", - " establishing a bi-directional stream using the `StreamingPull` method." - ] - }, - "Subscriber:CreateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:GetSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ] - }, - "Subscriber:UpdateSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ] - }, - "Subscriber:ListSubscriptions": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists matching subscriptions.", - "" - ] - }, - "Subscriber:DeleteSubscription": { - "paramName": "", - "paramType": "", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ] - }, - "Subscriber:ModifyAckDeadline": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ] - }, - "Subscriber:Acknowledge": { - "paramName": "", - "paramType": "", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ] - }, - "Subscriber:Pull": { - "paramName": "", - "paramType": "", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ] - }, - "Subscriber:StreamingPull": { - "paramName": "", - "paramType": "", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ] - }, - "Subscriber:ModifyPushConfig": { - "paramName": "", - "paramType": "", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ] - }, - "Subscriber:GetSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ] - }, - "Subscriber:ListSnapshots": { - "paramName": "", - "paramType": "", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ] - }, - "Subscriber:CreateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ] - }, - "Subscriber:UpdateSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ] - }, - "Subscriber:DeleteSnapshot": { - "paramName": "", - "paramType": "", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ] - }, - "Subscriber:Seek": { - "paramName": "", - "paramType": "", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ] - }, - "Subscription:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - "Subscription:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - "Subscription:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - "Subscription:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - "Subscription:retain_acked_messages": { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - "Subscription:message_retention_duration": { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - "Subscription:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "Subscription:enable_message_ordering": { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - "Subscription:expiration_policy": { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - "Subscription:filter": { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - "Subscription:dead_letter_policy": { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - "Subscription:retry_policy": { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - "Subscription:detached": { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - }, - "RetryPolicy:minimum_backoff": { - "paramName": "minimum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The minimum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 10 seconds." - ] - }, - "RetryPolicy:maximum_backoff": { - "paramName": "maximum_backoff", - "paramType": ".google.protobuf.Duration", - "comments": [ - " The maximum delay between consecutive deliveries of a given message.", - " Value should be between 0 and 600 seconds. Defaults to 600 seconds." - ] - }, - "DeadLetterPolicy:dead_letter_topic": { - "paramName": "dead_letter_topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic to which dead letter messages should be published.", - " Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service", - " account associated with the enclosing subscription's parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Publish() to this topic.", - "", - " The operation will fail if the topic does not exist.", - " Users should ensure that there is a subscription attached to this topic", - " since messages published to a topic with no subscriptions are lost." - ] - }, - "DeadLetterPolicy:max_delivery_attempts": { - "paramName": "max_delivery_attempts", - "paramType": "TYPE_INT32", - "comments": [ - " The maximum number of delivery attempts for any message. The value must be", - " between 5 and 100.", - "", - " The number of delivery attempts is defined as 1 + (the sum of number of", - " NACKs and number of times the acknowledgement deadline has been exceeded", - " for the message).", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that", - " client libraries may automatically extend ack_deadlines.", - "", - " This field will be honored on a best effort basis.", - "", - " If this parameter is 0, a default value of 5 is used." - ] - }, - "ExpirationPolicy:ttl": { - "paramName": "ttl", - "paramType": ".google.protobuf.Duration", - "comments": [ - " Specifies the \"time-to-live\" duration for an associated resource. The", - " resource expires if it is not active for a period of `ttl`. The definition", - " of \"activity\" depends on the type of the associated resource. The minimum", - " and maximum allowed values for `ttl` depend on the type of the associated", - " resource, as well. If `ttl` is not set, the associated resource never", - " expires." - ] - }, - "PushConfig:push_endpoint": { - "paramName": "push_endpoint", - "paramType": "TYPE_STRING", - "comments": [ - " A URL locating the endpoint to which messages should be pushed.", - " For example, a Webhook endpoint might use `https://example.com/push`." - ] - }, - "PushConfig:attributes": { - "paramName": "attributes", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Endpoint configuration attributes that can be used to control different", - " aspects of the message delivery.", - "", - " The only currently supported attribute is `x-goog-version`, which you can", - " use to change the format of the pushed message. This attribute", - " indicates the version of the data expected by the endpoint. This", - " controls the shape of the pushed message (i.e., its fields and metadata).", - "", - " If not present during the `CreateSubscription` call, it will default to", - " the version of the Pub/Sub API used to make such call. If not present in a", - " `ModifyPushConfig` call, its value will not be changed. `GetSubscription`", - " calls will always return a valid version, even if the subscription was", - " created without this attribute.", - "", - " The only supported values for the `x-goog-version` attribute are:", - "", - " * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API.", - " * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API.", - "", - " For example:", - "
attributes { \"x-goog-version\": \"v1\" } 
" - ] - }, - "PushConfig:oidc_token": { - "paramName": "oidc_token", - "paramType": ".google.pubsub.v1.PushConfig.OidcToken", - "comments": [ - " If specified, Pub/Sub will generate and attach an OIDC JWT token as an", - " `Authorization` header in the HTTP request for every pushed message." - ] - }, - "ReceivedMessage:ack_id": { - "paramName": "ack_id", - "paramType": "TYPE_STRING", - "comments": [ - " This ID can be used to acknowledge the received message." - ] - }, - "ReceivedMessage:message": { - "paramName": "message", - "paramType": ".google.pubsub.v1.PubsubMessage", - "comments": [ - " The message." - ] - }, - "ReceivedMessage:delivery_attempt": { - "paramName": "delivery_attempt", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate number of times that Cloud Pub/Sub has attempted to deliver", - " the associated message to a subscriber.", - "", - " More precisely, this is 1 + (number of NACKs) +", - " (number of ack_deadline exceeds) for this message.", - "", - " A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline", - " exceeds event is whenever a message is not acknowledged within", - " ack_deadline. Note that ack_deadline is initially", - " Subscription.ackDeadlineSeconds, but may get extended automatically by", - " the client library.", - "", - " Upon the first delivery of a given message, `delivery_attempt` will have a", - " value of 1. The value is calculated at best effort and is approximate.", - "", - " If a DeadLetterPolicy is not set on the subscription, this will be 0." - ] - }, - "GetSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - "UpdateSubscriptionRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSubscriptionsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - "ListSubscriptionsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - }, - "ListSubscriptionsResponse:subscriptions": { - "paramName": "subscriptions", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The subscriptions that match the request." - ] - }, - "ListSubscriptionsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more subscriptions that match", - " the request; this value should be passed in a new", - " `ListSubscriptionsRequest` to get more subscriptions." - ] - }, - "DeleteSubscriptionRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyPushConfigRequest:push_config": { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - }, - "PullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "PullRequest:return_immediately": { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - "PullRequest:max_messages": { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - }, - "PullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. The list will be empty if there are no more", - " messages available in the backlog. For JSON, the response can be entirely", - " empty. The Pub/Sub system may return fewer than the `maxMessages` requested", - " even if there are more messages available in the backlog." - ] - }, - "ModifyAckDeadlineRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - "ModifyAckDeadlineRequest:ack_deadline_seconds": { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "AcknowledgeRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:ack_ids": { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_seconds": { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:modify_deadline_ack_ids": { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - "StreamingPullRequest:stream_ack_deadline_seconds": { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - "StreamingPullRequest:client_id": { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - "StreamingPullRequest:max_outstanding_messages": { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullRequest:max_outstanding_bytes": { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - "StreamingPullResponse:received_messages": { - "paramName": "received_messages", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Received Pub/Sub messages. This will not be empty." - ] - }, - "CreateSnapshotRequest:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - "CreateSnapshotRequest:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - "UpdateSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - "UpdateSnapshotRequest:update_mask": { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - }, - "Snapshot:name": { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the snapshot." - ] - }, - "Snapshot:topic": { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " The name of the topic from which this snapshot is retaining messages." - ] - }, - "Snapshot:expire_time": { - "paramName": "expire_time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The snapshot is guaranteed to exist up until this time.", - " A newly-created snapshot expires no later than 7 days from the time of its", - " creation. Its exact lifetime is determined at creation by the existing", - " backlog in the source subscription. Specifically, the lifetime of the", - " snapshot is `7 days - (age of oldest unacked message in the subscription)`.", - " For example, consider a subscription whose oldest unacked message is 3 days", - " old. If a snapshot is created from this subscription, the snapshot -- which", - " will always capture this 3-day-old backlog as long as the snapshot", - " exists -- will expire in 4 days. The service will refuse to create a", - " snapshot that would expire in less than 1 hour after creation." - ] - }, - "Snapshot:labels": { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See [Creating and managing labels]", - " (https://cloud.google.com/pubsub/docs/labels)." - ] - }, - "GetSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:project": { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - "ListSnapshotsRequest:page_size": { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - "ListSnapshotsRequest:page_token": { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - }, - "ListSnapshotsResponse:snapshots": { - "paramName": "snapshots", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The resulting snapshots." - ] - }, - "ListSnapshotsResponse:next_page_token": { - "paramName": "next_page_token", - "paramType": "TYPE_STRING", - "comments": [ - " If not empty, indicates that there may be more snapshot that match the", - " request; this value should be passed in a new `ListSnapshotsRequest`." - ] - }, - "DeleteSnapshotRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - "SeekRequest:subscription": { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - "SeekRequest:time": { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - "SeekRequest:snapshot": { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - }, - "GetPolicyOptions:requested_policy_version": { - "paramName": "requested_policy_version", - "paramType": "TYPE_INT32", - "comments": [ - " Optional. The policy format version to be returned.", - "", - " Valid values are 0, 1, and 3. Requests specifying an invalid value will be", - " rejected.", - "", - " Requests for policies with any conditional bindings must specify version 3.", - " Policies without any conditional bindings may specify any valid value or", - " leave the field unset." - ] - }, - "Expr:expression": { - "paramName": "expression", - "paramType": "TYPE_STRING", - "comments": [ - " Textual representation of an expression in Common Expression Language", - " syntax." - ] - }, - "Expr:title": { - "paramName": "title", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Title for the expression, i.e. a short string describing", - " its purpose. This can be used e.g. in UIs which allow to enter the", - " expression." - ] - }, - "Expr:description": { - "paramName": "description", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. Description of the expression. This is a longer text which", - " describes the expression, e.g. when hovered over it in a UI." - ] - }, - "Expr:location": { - "paramName": "location", - "paramType": "TYPE_STRING", - "comments": [ - " Optional. String indicating the location of the expression for error", - " reporting, e.g. a file name and a position in the file." - ] - }, - "Policy:version": { - "paramName": "version", - "paramType": "TYPE_INT32", - "comments": [ - " Specifies the format of the policy.", - "", - " Valid values are `0`, `1`, and `3`. Requests that specify an invalid value", - " are rejected.", - "", - " Any operation that affects conditional role bindings must specify version", - " `3`. This requirement applies to the following operations:", - "", - " * Getting a policy that includes a conditional role binding", - " * Adding a conditional role binding to a policy", - " * Changing a conditional role binding in a policy", - " * Removing any role binding, with or without a condition, from a policy", - " that includes conditions", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost.", - "", - " If a policy does not include any conditions, operations on that policy may", - " specify any valid version or leave the field unset.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "Policy:bindings": { - "paramName": "bindings", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Associates a list of `members`, or principals, with a `role`. Optionally,", - " may specify a `condition` that determines how and when the `bindings` are", - " applied. Each of the `bindings` must contain at least one principal.", - "", - " The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250", - " of these principals can be Google groups. Each occurrence of a principal", - " counts towards these limits. For example, if the `bindings` grant 50", - " different roles to `user:alice@example.com`, and not to any other", - " principal, then you can add another 1,450 principals to the `bindings` in", - " the `Policy`." - ] - }, - "Policy:audit_configs": { - "paramName": "audit_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " Specifies cloud audit logging configuration for this policy." - ] - }, - "Policy:etag": { - "paramName": "etag", - "paramType": "TYPE_BYTES", - "comments": [ - " `etag` is used for optimistic concurrency control as a way to help", - " prevent simultaneous updates of a policy from overwriting each other.", - " It is strongly suggested that systems make use of the `etag` in the", - " read-modify-write cycle to perform policy updates in order to avoid race", - " conditions: An `etag` is returned in the response to `getIamPolicy`, and", - " systems are expected to put that etag in the request to `setIamPolicy` to", - " ensure that their change will be applied to the same version of the policy.", - "", - " **Important:** If you use IAM Conditions, you must include the `etag` field", - " whenever you call `setIamPolicy`. If you omit this field, then IAM allows", - " you to overwrite a version `3` policy with a version `1` policy, and all of", - " the conditions in the version `3` policy are lost." - ] - }, - "Binding:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to the list of `members`, or principals.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`." - ] - }, - "Binding:members": { - "paramName": "members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the principals requesting access for a Google Cloud resource.", - " `members` can have the following values:", - "", - " * `allUsers`: A special identifier that represents anyone who is", - " on the internet; with or without a Google account.", - "", - " * `allAuthenticatedUsers`: A special identifier that represents anyone", - " who is authenticated with a Google account or a service account.", - "", - " * `user:{emailid}`: An email address that represents a specific Google", - " account. For example, `alice@example.com` .", - "", - "", - " * `serviceAccount:{emailid}`: An email address that represents a service", - " account. For example, `my-other-app@appspot.gserviceaccount.com`.", - "", - " * `group:{emailid}`: An email address that represents a Google group.", - " For example, `admins@example.com`.", - "", - " * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a user that has been recently deleted. For", - " example, `alice@example.com?uid=123456789012345678901`. If the user is", - " recovered, this value reverts to `user:{emailid}` and the recovered user", - " retains the role in the binding.", - "", - " * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus", - " unique identifier) representing a service account that has been recently", - " deleted. For example,", - " `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`.", - " If the service account is undeleted, this value reverts to", - " `serviceAccount:{emailid}` and the undeleted service account retains the", - " role in the binding.", - "", - " * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique", - " identifier) representing a Google group that has been recently", - " deleted. For example, `admins@example.com?uid=123456789012345678901`. If", - " the group is recovered, this value reverts to `group:{emailid}` and the", - " recovered group retains the role in the binding.", - "", - "", - " * `domain:{domain}`: The G Suite domain (primary) that represents all the", - " users of that domain. For example, `google.com` or `example.com`.", - "", - "" - ] - }, - "Binding:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding.", - "", - " If the condition evaluates to `true`, then this binding applies to the", - " current request.", - "", - " If the condition evaluates to `false`, then this binding does not apply to", - " the current request. However, a different role binding might grant the same", - " role to one or more of the principals in this binding.", - "", - " To learn which resources support conditions in their IAM policies, see the", - " [IAM", - " documentation](https://cloud.google.com/iam/help/conditions/resource-policies)." - ] - }, - "AuditConfig:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that will be enabled for audit logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services." - ] - }, - "AuditConfig:audit_log_configs": { - "paramName": "audit_log_configs", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The configuration for logging of each type of permission." - ] - }, - "AuditLogConfig:log_type": { - "paramName": "log_type", - "paramType": ".google.iam.v1.AuditLogConfig.LogType", - "comments": [ - " The log type that this config enables." - ] - }, - "AuditLogConfig:exempted_members": { - "paramName": "exempted_members", - "paramType": "TYPE_STRING[]", - "comments": [ - " Specifies the identities that do not cause logging for this type of", - " permission.", - " Follows the same format of", - " [Binding.members][google.iam.v1.Binding.members]." - ] - }, - "PolicyDelta:binding_deltas": { - "paramName": "binding_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for Bindings between two policies." - ] - }, - "PolicyDelta:audit_config_deltas": { - "paramName": "audit_config_deltas", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " The delta for AuditConfigs between two policies." - ] - }, - "BindingDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.BindingDelta.Action", - "comments": [ - " The action that was performed on a Binding.", - " Required" - ] - }, - "BindingDelta:role": { - "paramName": "role", - "paramType": "TYPE_STRING", - "comments": [ - " Role that is assigned to `members`.", - " For example, `roles/viewer`, `roles/editor`, or `roles/owner`.", - " Required" - ] - }, - "BindingDelta:member": { - "paramName": "member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity requesting access for a Google Cloud resource.", - " Follows the same format of Binding.members.", - " Required" - ] - }, - "BindingDelta:condition": { - "paramName": "condition", - "paramType": ".google.type.Expr", - "comments": [ - " The condition that is associated with this binding." - ] - }, - "AuditConfigDelta:action": { - "paramName": "action", - "paramType": ".google.iam.v1.AuditConfigDelta.Action", - "comments": [ - " The action that was performed on an audit configuration in a policy.", - " Required" - ] - }, - "AuditConfigDelta:service": { - "paramName": "service", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies a service that was configured for Cloud Audit Logging.", - " For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.", - " `allServices` is a special value that covers all services.", - " Required" - ] - }, - "AuditConfigDelta:exempted_member": { - "paramName": "exempted_member", - "paramType": "TYPE_STRING", - "comments": [ - " A single identity that is exempted from \"data access\" audit", - " logging for the `service` specified above.", - " Follows the same format of Binding.members." - ] - }, - "AuditConfigDelta:log_type": { - "paramName": "log_type", - "paramType": "TYPE_STRING", - "comments": [ - " Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always", - " enabled, and cannot be configured.", - " Required" - ] - }, - "IAMPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " ## API Overview", - "", - " Manages Identity and Access Management (IAM) policies.", - "", - " Any implementation of an API that offers access control features", - " implements the google.iam.v1.IAMPolicy interface.", - "", - " ## Data model", - "", - " Access control is applied when a principal (user or service account), takes", - " some action on a resource exposed by a service. Resources, identified by", - " URI-like names, are the unit of access control specification. Service", - " implementations can choose the granularity of access control and the", - " supported permissions for their resources.", - " For example one database service may allow access control to be", - " specified only at the Table level, whereas another might allow access control", - " to also be specified at the Column level.", - "", - " ## Policy Structure", - "", - " See google.iam.v1.Policy", - "", - " This is intentionally not a CRUD style API because access control policies", - " are created and deleted implicitly with the resources to which they are", - " attached." - ] - }, - "IAMPolicy:SetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Sets the access control policy on the specified resource. Replaces any", - " existing policy.", - "" - ] - }, - "IAMPolicy:GetIamPolicy": { - "paramName": "", - "paramType": "", - "comments": [ - " Gets the access control policy for a resource.", - " Returns an empty policy if the resource exists and does not have a policy", - " set.", - "" - ] - }, - "IAMPolicy:TestIamPermissions": { - "paramName": "", - "paramType": "", - "comments": [ - " Returns permissions that a caller has on the specified resource.", - " If the resource does not exist, this will return an empty set of", - " permissions, not a NOT_FOUND error.", - "", - " Note: This operation is designed to be used for building permission-aware", - " UIs and command-line tools, not for authorization checking. This operation", - " may \"fail open\" without warning.", - "" - ] - }, - "SetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being specified.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "SetIamPolicyRequest:policy": { - "paramName": "policy", - "paramType": ".google.iam.v1.Policy", - "comments": [ - " REQUIRED: The complete policy to be applied to the `resource`. The size of", - " the policy is limited to a few 10s of KB. An empty policy is a", - " valid policy but certain Cloud Platform services (such as Projects)", - " might reject them." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "GetIamPolicyRequest:options": { - "paramName": "options", - "paramType": ".google.iam.v1.GetPolicyOptions", - "comments": [ - " OPTIONAL: A `GetPolicyOptions` object for specifying options to", - " `GetIamPolicy`. This field is only used by Cloud IAM." - ] - }, - "TestIamPermissionsRequest:resource": { - "paramName": "resource", - "paramType": "TYPE_STRING", - "comments": [ - " REQUIRED: The resource for which the policy detail is being requested.", - " See the operation documentation for the appropriate value for this field." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsRequest:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " The set of permissions to check for the `resource`. Permissions with", - " wildcards (such as '*' or 'storage.*') are not allowed. For more", - " information see", - " [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions)." - ], - "fieldBehavior": 2 - }, - "TestIamPermissionsResponse:permissions": { - "paramName": "permissions", - "paramType": "TYPE_STRING[]", - "comments": [ - " A subset of `TestPermissionsRequest.permissions` that the caller is", - " allowed." - ] - } - } - }, - "retryableCodeMap": { - "codeEnumMapping": { - "0": "OK", - "1": "CANCELLED", - "2": "UNKNOWN", - "3": "INVALID_ARGUMENT", - "4": "DEADLINE_EXCEEDED", - "5": "NOT_FOUND", - "6": "ALREADY_EXISTS", - "7": "PERMISSION_DENIED", - "8": "RESOURCE_EXHAUSTED", - "9": "FAILED_PRECONDITION", - "10": "ABORTED", - "11": "OUT_OF_RANGE", - "12": "UNIMPLEMENTED", - "13": "INTERNAL", - "14": "UNAVAILABLE", - "15": "DATA_LOSS", - "16": "UNAUTHENTICATED", - "OK": "0", - "CANCELLED": "1", - "UNKNOWN": "2", - "INVALID_ARGUMENT": "3", - "DEADLINE_EXCEEDED": "4", - "NOT_FOUND": "5", - "ALREADY_EXISTS": "6", - "PERMISSION_DENIED": "7", - "RESOURCE_EXHAUSTED": "8", - "FAILED_PRECONDITION": "9", - "ABORTED": "10", - "OUT_OF_RANGE": "11", - "UNIMPLEMENTED": "12", - "INTERNAL": "13", - "UNAVAILABLE": "14", - "DATA_LOSS": "15", - "UNAUTHENTICATED": "16" - }, - "uniqueCodesNamesMap": { - "": "non_idempotent", - "deadline_exceeded_unavailable": "idempotent" - }, - "prettyCodesNamesMap": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "uniqueParamsNamesMap": { - "94312e9926796a52a8fcbbedaac41972e07ccd1c": "default" - }, - "prettyParamNamesMap": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - } - }, - "selectiveGapic": { - "isSelectiveGapic": false, - "generateOmittedAsInternal": false, - "methods": [] - }, - "grpcServiceConfig": {}, - "bundleConfigs": [], - "internalMethods": [], - "iamPolicyMixinFlags": { - "enabled": false, - "getIamPolicy": true, - "setIamPolicy": true, - "testIamPermissions": true - }, - "locationMixinFlags": { - "enabled": false, - "getLocation": true, - "listLocations": true - }, - "bundleConfigsMethods": [], - "simpleMethods": [ - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.Subscription", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Creates a subscription to a given topic. See the [resource name rules]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names).", - " If the subscription already exists, returns `ALREADY_EXISTS`.", - " If the corresponding topic doesn't exist, returns `NOT_FOUND`.", - "", - " If the name is not provided in the request, the server will assign a random", - " name for this subscription on the same project as the topic, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated", - " name is populated in the returned Subscription object. Note that for REST", - " API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSubscription", - "inputType": ".google.pubsub.v1.Subscription", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "name,topic,push_config,ack_deadline_seconds" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription. It must have the format", - " `\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must", - " start with a letter, and contain only letters (`[A-Za-z]`), numbers", - " (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),", - " plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters", - " in length, and it must not start with `\"goog\"`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "topic", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the topic from which this subscription is receiving", - " messages. Format is `projects/{project}/topics/{topic}`. The value of this", - " field will be `_deleted-topic_` if the topic has been deleted." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " If push delivery is used with this subscription, this field is", - " used to configure it. An empty `pushConfig` signifies that the subscriber", - " will pull and ack messages using API methods." - ] - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " The approximate amount of time (on a best-effort basis) Pub/Sub waits for", - " the subscriber to acknowledge receipt before resending the message. In the", - " interval after the message is delivered and before it is acknowledged, it", - " is considered to be outstanding. During that time period, the", - " message will not be redelivered (on a best-effort basis).", - "", - " For pull subscriptions, this value is used as the initial value for the ack", - " deadline. To override this value for a given message, call", - " `ModifyAckDeadline` with the corresponding `ack_id` if using", - " non-streaming pull or send the `ack_id` in a", - " `StreamingModifyAckDeadlineRequest` if using streaming pull.", - " The minimum custom deadline you can specify is 10 seconds.", - " The maximum custom deadline you can specify is 600 seconds (10 minutes).", - " If this parameter is 0, a default value of 10 seconds is used.", - "", - " For push delivery, this value is also used to set the request timeout for", - " the call to the push endpoint.", - "", - " If the subscriber never acknowledges the message, the Pub/Sub", - " system will eventually redeliver the message." - ] - }, - { - "paramName": "retain_acked_messages", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether to retain acknowledged messages. If true, then", - " messages are not expunged from the subscription's backlog, even if they are", - " acknowledged, until they fall out of the `message_retention_duration`", - " window. This must be true if you would like to [Seek to a timestamp]", - " (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)." - ] - }, - { - "paramName": "message_retention_duration", - "paramType": ".google.protobuf.Duration", - "comments": [ - " How long to retain unacknowledged messages in the subscription's backlog,", - " from the moment a message is published.", - " If `retain_acked_messages` is true, then this also configures the retention", - " of acknowledged messages, and thus configures how far back in time a `Seek`", - " can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10", - " minutes." - ] - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - }, - { - "paramName": "enable_message_ordering", - "paramType": "TYPE_BOOL", - "comments": [ - " If true, messages published with the same `ordering_key` in `PubsubMessage`", - " will be delivered to the subscribers in the order in which they", - " are received by the Pub/Sub system. Otherwise, they may be delivered in", - " any order." - ] - }, - { - "paramName": "expiration_policy", - "paramType": ".google.pubsub.v1.ExpirationPolicy", - "comments": [ - " A policy that specifies the conditions for this subscription's expiration.", - " A subscription is considered active as long as any connected subscriber is", - " successfully consuming messages from the subscription or is issuing", - " operations on the subscription. If `expiration_policy` is not set, a", - " *default policy* with `ttl` of 31 days will be used. The minimum allowed", - " value for `expiration_policy.ttl` is 1 day." - ] - }, - { - "paramName": "filter", - "paramType": "TYPE_STRING", - "comments": [ - " An expression written in the Pub/Sub [filter", - " language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,", - " then only `PubsubMessage`s whose `attributes` field matches the filter are", - " delivered on this subscription. If empty, then no messages are filtered", - " out." - ] - }, - { - "paramName": "dead_letter_policy", - "paramType": ".google.pubsub.v1.DeadLetterPolicy", - "comments": [ - " A policy that specifies the conditions for dead lettering messages in", - " this subscription. If dead_letter_policy is not set, dead lettering", - " is disabled.", - "", - " The Cloud Pub/Sub service account associated with this subscriptions's", - " parent project (i.e.,", - " service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have", - " permission to Acknowledge() messages on this subscription." - ] - }, - { - "paramName": "retry_policy", - "paramType": ".google.pubsub.v1.RetryPolicy", - "comments": [ - " A policy that specifies how Pub/Sub retries message delivery for this", - " subscription.", - "", - " If not set, the default retry policy is applied. This generally implies", - " that messages will be retried as soon as possible for healthy subscribers.", - " RetryPolicy will be triggered on NACKs or acknowledgement deadline", - " exceeded events for a given message." - ] - }, - { - "paramName": "detached", - "paramType": "TYPE_BOOL", - "comments": [ - " Indicates whether the subscription is detached from its topic. Detached", - " subscriptions don't receive messages from their topic and don't retain any", - " backlog. `Pull` and `StreamingPull` requests will return", - " FAILED_PRECONDITION. If the subscription is a push subscription, pushes to", - " the endpoint will not be made." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Gets the configuration details of a subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSubscription", - "inputType": ".google.pubsub.v1.GetSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "get": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription to get.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputInterface": ".google.pubsub.v1.Subscription", - "comments": [ - " Updates an existing subscription. Note that certain properties of a", - " subscription, such as its topic, are not modifiable.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSubscription", - "inputType": ".google.pubsub.v1.UpdateSubscriptionRequest", - "outputType": ".google.pubsub.v1.Subscription", - "options": { - ".google.api.http": { - "patch": "/v1/{subscription.name=projects/*/subscriptions/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": ".google.pubsub.v1.Subscription", - "comments": [ - " Required. The updated subscription object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided subscription to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Deletes an existing subscription. All messages retained in the subscription", - " are immediately dropped. Calls to `Pull` after deletion will return", - " `NOT_FOUND`. After a subscription is deleted, a new one may be created with", - " the same name, but the new one has no association with the old", - " subscription or its topic unless the same topic is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSubscription", - "inputType": ".google.pubsub.v1.DeleteSubscriptionRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription" - ], - ".google.api.http": { - "delete": "/v1/{subscription=projects/*/subscriptions/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to delete.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the ack deadline for a specific message. This method is useful", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted. Note that this does not modify the", - " subscription-level `ackDeadlineSeconds` used for subsequent messages.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyAckDeadline", - "inputType": ".google.pubsub.v1.ModifyAckDeadlineRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids,ack_deadline_seconds" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. List of acknowledgment IDs." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The new ack deadline with respect to the time this request was", - " sent to the Pub/Sub system. For example, if the value is 10, the new ack", - " deadline will expire 10 seconds after the `ModifyAckDeadline` call was", - " made. Specifying zero might immediately make the message available for", - " delivery to another subscriber client. This typically results in an", - " increase in the rate of message redeliveries (that is, duplicates).", - " The minimum deadline you can specify is 0 seconds.", - " The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.AcknowledgeRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Acknowledges the messages associated with the `ack_ids` in the", - " `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages", - " from the subscription.", - "", - " Acknowledging a message whose ack deadline has expired may succeed,", - " but such a message may be redelivered later. Acknowledging a message more", - " than once will not result in an error.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Acknowledge", - "inputType": ".google.pubsub.v1.AcknowledgeRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,ack_ids" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:acknowledge", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose message is being acknowledged.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " Required. The acknowledgment ID for the messages being acknowledged that", - " was returned by the Pub/Sub system in the `Pull` response. Must not be", - " empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.PullRequest", - "outputInterface": ".google.pubsub.v1.PullResponse", - "comments": [ - " Pulls messages from the server. The server may return `UNAVAILABLE` if", - " there are too many concurrent pull requests pending for the given", - " subscription.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Pull", - "inputType": ".google.pubsub.v1.PullRequest", - "outputType": ".google.pubsub.v1.PullResponse", - "options": { - ".google.api.methodSignature": [ - "subscription,return_immediately,max_messages" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:pull", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription from which messages should be pulled.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "return_immediately", - "paramType": "TYPE_BOOL", - "comments": [ - " Optional. If this field set to true, the system will respond immediately", - " even if it there are no messages available to return in the `Pull`", - " response. Otherwise, the system may wait (for a bounded amount of time)", - " until at least one message is available, rather than returning no messages.", - " Warning: setting this field to `true` is discouraged because it adversely", - " impacts the performance of `Pull` operations. We recommend that users do", - " not set this field." - ], - "fieldBehavior": 1 - }, - { - "paramName": "max_messages", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The maximum number of messages to return for this request. Must", - " be a positive integer. The Pub/Sub system may return fewer than the number", - " specified." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Modifies the `PushConfig` for a specified subscription.", - "", - " This may be used to change a push subscription to a pull one (signified by", - " an empty `PushConfig`) or vice versa, or change the endpoint URL and other", - " attributes of a push subscription. Messages will accumulate for delivery", - " continuously through the call regardless of changes to the `PushConfig`.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ModifyPushConfig", - "inputType": ".google.pubsub.v1.ModifyPushConfigRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "subscription,push_config" - ], - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the subscription.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "push_config", - "paramType": ".google.pubsub.v1.PushConfig", - "comments": [ - " Required. The push configuration for future deliveries.", - "", - " An empty `pushConfig` indicates that the Pub/Sub system should", - " stop pushing messages from the given subscription and allow", - " messages to be pulled and acknowledged - effectively pausing", - " the subscription if `Pull` or `StreamingPull` is not called." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.GetSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Gets the configuration details of a snapshot. Snapshots are used in", - " Seek", - " operations, which allow you to manage message acknowledgments in bulk. That", - " is, you can set the acknowledgment state of messages in an existing", - " subscription to the state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "GetSnapshot", - "inputType": ".google.pubsub.v1.GetSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "get": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to get.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.CreateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Creates a snapshot from the requested subscription. Snapshots are used in", - " [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,", - " which allow you to manage message acknowledgments in bulk. That is, you can", - " set the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " If the snapshot already exists, returns `ALREADY_EXISTS`.", - " If the requested subscription doesn't exist, returns `NOT_FOUND`.", - " If the backlog in the subscription is too old -- and the resulting snapshot", - " would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.", - " See also the `Snapshot.expire_time` field. If the name is not provided in", - " the request, the server will assign a random", - " name for this snapshot on the same project as the subscription, conforming", - " to the [resource name format]", - " (https://cloud.google.com/pubsub/docs/admin#resource_names). The", - " generated name is populated in the returned Snapshot object. Note that for", - " REST API requests, you must specify a name in the request.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "CreateSnapshot", - "inputType": ".google.pubsub.v1.CreateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.methodSignature": [ - "name,subscription" - ], - ".google.api.http": { - "put": "/v1/{name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "name", - "paramType": "TYPE_STRING", - "comments": [ - " Required. User-provided name for this snapshot. If the name is not provided", - " in the request, the server will assign a random name for this snapshot on", - " the same project as the subscription. Note that for REST API requests, you", - " must specify a name. See the resource", - " name rules. Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription whose backlog the snapshot retains.", - " Specifically, the created snapshot is guaranteed to retain:", - " (a) The existing backlog on the subscription. More precisely, this is", - " defined as the messages in the subscription's backlog that are", - " unacknowledged upon the successful completion of the", - " `CreateSnapshot` request; as well as:", - " (b) Any messages published to the subscription's topic following the", - " successful completion of the CreateSnapshot request.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "labels", - "paramType": "TYPE_MESSAGE[]", - "comments": [ - " See Creating and", - " managing labels." - ] - } - ], - "headerRequestParams": [ - [ - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputInterface": ".google.pubsub.v1.Snapshot", - "comments": [ - " Updates an existing snapshot. Snapshots are used in", - " Seek", - " operations, which allow", - " you to manage message acknowledgments in bulk. That is, you can set the", - " acknowledgment state of messages in an existing subscription to the state", - " captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "UpdateSnapshot", - "inputType": ".google.pubsub.v1.UpdateSnapshotRequest", - "outputType": ".google.pubsub.v1.Snapshot", - "options": { - ".google.api.http": { - "patch": "/v1/{snapshot.name=projects/*/snapshots/*}", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": ".google.pubsub.v1.Snapshot", - "comments": [ - " Required. The updated snapshot object." - ], - "fieldBehavior": 2 - }, - { - "paramName": "update_mask", - "paramType": ".google.protobuf.FieldMask", - "comments": [ - " Required. Indicates which fields in the provided snapshot to update.", - " Must be specified and non-empty." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot", - "name" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputInterface": ".google.protobuf.Empty", - "comments": [ - " Removes an existing snapshot. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - " When the snapshot is deleted, all messages retained in the snapshot", - " are immediately dropped. After a snapshot is deleted, a new one may be", - " created with the same name, but the new one has no association with the old", - " snapshot or its subscription, unless the same subscription is specified.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "DeleteSnapshot", - "inputType": ".google.pubsub.v1.DeleteSnapshotRequest", - "outputType": ".google.protobuf.Empty", - "options": { - ".google.api.methodSignature": [ - "snapshot" - ], - ".google.api.http": { - "delete": "/v1/{snapshot=projects/*/snapshots/*}", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the snapshot to delete.", - " Format is `projects/{project}/snapshots/{snap}`." - ], - "fieldBehavior": 2 - } - ], - "headerRequestParams": [ - [ - "snapshot" - ] - ] - }, - { - "autoPopulatedFields": [], - "inputInterface": ".google.pubsub.v1.SeekRequest", - "outputInterface": ".google.pubsub.v1.SeekResponse", - "comments": [ - " Seeks an existing subscription to a point in time or to a given snapshot,", - " whichever is provided in the request. Snapshots are used in [Seek]", - " (https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot. Note that both the subscription and the", - " snapshot must be on the same topic.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "Seek", - "inputType": ".google.pubsub.v1.SeekRequest", - "outputType": ".google.pubsub.v1.SeekResponse", - "options": { - ".google.api.http": { - "post": "/v1/{subscription=projects/*/subscriptions/*}:seek", - "body": "*", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription to affect." - ], - "fieldBehavior": 2 - }, - { - "paramName": "time", - "paramType": ".google.protobuf.Timestamp", - "comments": [ - " The time to seek to.", - " Messages retained in the subscription that were published before this", - " time are marked as acknowledged, and messages retained in the", - " subscription that were published after this time are marked as", - " unacknowledged. Note that this operation affects only those messages", - " retained in the subscription (configured by the combination of", - " `message_retention_duration` and `retain_acked_messages`). For example,", - " if `time` corresponds to a point before the message retention", - " window (or to a point before the system's notion of the subscription", - " creation time), only retained messages will be marked as unacknowledged,", - " and already-expunged messages will not be restored." - ] - }, - { - "paramName": "snapshot", - "paramType": "TYPE_STRING", - "comments": [ - " The snapshot to seek to. The snapshot's topic must be the same as that of", - " the provided subscription.", - " Format is `projects/{project}/snapshots/{snap}`." - ] - } - ], - "headerRequestParams": [ - [ - "subscription" - ] - ] - } - ], - "longRunning": [], - "diregapicLRO": [], - "streaming": [ - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - } - ], - "clientStreaming": [], - "serverStreaming": [], - "bidiStreaming": [ - { - "autoPopulatedFields": [], - "streaming": "BIDI_STREAMING", - "inputInterface": ".google.pubsub.v1.StreamingPullRequest", - "outputInterface": ".google.pubsub.v1.StreamingPullResponse", - "comments": [ - " Establishes a stream with the server, which sends messages down to the", - " client. The client streams acknowledgements and ack deadline modifications", - " back to the server. The server will close the stream and return the status", - " on any error. The server may close the stream with status `UNAVAILABLE` to", - " reassign server-side resources, in which case, the client should", - " re-establish the stream. Flow control can be achieved by configuring the", - " underlying RPC channel.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "StreamingPull", - "inputType": ".google.pubsub.v1.StreamingPullRequest", - "outputType": ".google.pubsub.v1.StreamingPullResponse", - "options": {}, - "clientStreaming": true, - "serverStreaming": true, - "paramComment": [ - { - "paramName": "subscription", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The subscription for which to initialize the new stream. This", - " must be provided in the first request on the stream, and must not be set in", - " subsequent requests from client to server.", - " Format is `projects/{project}/subscriptions/{sub}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs for acknowledging previously received messages", - " (received on this stream or a different stream). If an ack ID has expired,", - " the corresponding message may be redelivered later. Acknowledging a message", - " more than once will not result in an error. If the acknowledgement ID is", - " malformed, the stream will be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_seconds", - "paramType": "TYPE_INT32[]", - "comments": [ - " The list of new ack deadlines for the IDs listed in", - " `modify_deadline_ack_ids`. The size of this list must be the same as the", - " size of `modify_deadline_ack_ids`. If it differs the stream will be aborted", - " with `INVALID_ARGUMENT`. Each element in this list is applied to the", - " element in the same position in `modify_deadline_ack_ids`. The new ack", - " deadline is with respect to the time this request was sent to the Pub/Sub", - " system. Must be >= 0. For example, if the value is 10, the new ack deadline", - " will expire 10 seconds after this request is received. If the value is 0,", - " the message is immediately made available for another streaming or", - " non-streaming pull request. If the value is < 0 (an error), the stream will", - " be aborted with status `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "modify_deadline_ack_ids", - "paramType": "TYPE_STRING[]", - "comments": [ - " List of acknowledgement IDs whose deadline will be modified based on the", - " corresponding element in `modify_deadline_seconds`. This field can be used", - " to indicate that more time is needed to process a message by the", - " subscriber, or to make the message available for redelivery if the", - " processing was interrupted." - ] - }, - { - "paramName": "stream_ack_deadline_seconds", - "paramType": "TYPE_INT32", - "comments": [ - " Required. The ack deadline to use for the stream. This must be provided in", - " the first request on the stream, but it can also be updated on subsequent", - " requests from client to server. The minimum deadline you can specify is 10", - " seconds. The maximum deadline you can specify is 600 seconds (10 minutes)." - ], - "fieldBehavior": 2 - }, - { - "paramName": "client_id", - "paramType": "TYPE_STRING", - "comments": [ - " A unique identifier that is used to distinguish client instances from each", - " other. Only needs to be provided on the initial request. When a stream", - " disconnects and reconnects for the same stream, the client_id should be set", - " to the same value so that state associated with the old stream can be", - " transferred to the new stream. The same client_id should not be used for", - " different client instances." - ] - }, - { - "paramName": "max_outstanding_messages", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding messages. When", - " there are `max_outstanding_messages` or more currently sent to the", - " streaming pull client that have not yet been acked or nacked, the server", - " stops sending more messages. The sending of messages resumes once the", - " number of outstanding messages is less than this value. If the value is", - " <= 0, there is no limit to the number of outstanding messages. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - }, - { - "paramName": "max_outstanding_bytes", - "paramType": "TYPE_INT64", - "comments": [ - " Flow control settings for the maximum number of outstanding bytes. When", - " there are `max_outstanding_bytes` or more worth of messages currently sent", - " to the streaming pull client that have not yet been acked or nacked, the", - " server will stop sending more messages. The sending of messages resumes", - " once the number of outstanding bytes is less than this value. If the value", - " is <= 0, there is no limit to the number of outstanding bytes. This", - " property can only be set on the initial StreamingPullRequest. If it is set", - " on a subsequent request, the stream will be aborted with status", - " `INVALID_ARGUMENT`." - ] - } - ], - "headerRequestParams": [] - } - ], - "paging": [ - { - "autoPopulatedFields": [], - "pagingFieldName": "subscriptions", - "pagingResponseType": ".google.pubsub.v1.Subscription", - "inputInterface": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputInterface": ".google.pubsub.v1.ListSubscriptionsResponse", - "comments": [ - " Lists matching subscriptions.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSubscriptions", - "inputType": ".google.pubsub.v1.ListSubscriptionsRequest", - "outputType": ".google.pubsub.v1.ListSubscriptionsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/subscriptions", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list subscriptions.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of subscriptions to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSubscriptionsResponse`; indicates that", - " this is a continuation of a prior `ListSubscriptions` call, and that the", - " system should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - }, - { - "autoPopulatedFields": [], - "pagingFieldName": "snapshots", - "pagingResponseType": ".google.pubsub.v1.Snapshot", - "inputInterface": ".google.pubsub.v1.ListSnapshotsRequest", - "outputInterface": ".google.pubsub.v1.ListSnapshotsResponse", - "comments": [ - " Lists the existing snapshots. Snapshots are used in [Seek](", - " https://cloud.google.com/pubsub/docs/replay-overview) operations, which", - " allow you to manage message acknowledgments in bulk. That is, you can set", - " the acknowledgment state of messages in an existing subscription to the", - " state captured by a snapshot.", - "" - ], - "methodConfig": {}, - "retryableCodesName": "non_idempotent", - "retryParamsName": "default", - "name": "ListSnapshots", - "inputType": ".google.pubsub.v1.ListSnapshotsRequest", - "outputType": ".google.pubsub.v1.ListSnapshotsResponse", - "options": { - ".google.api.methodSignature": [ - "project" - ], - ".google.api.http": { - "get": "/v1/{project=projects/*}/snapshots", - "additionalBindings": [] - } - }, - "paramComment": [ - { - "paramName": "project", - "paramType": "TYPE_STRING", - "comments": [ - " Required. The name of the project in which to list snapshots.", - " Format is `projects/{project-id}`." - ], - "fieldBehavior": 2 - }, - { - "paramName": "page_size", - "paramType": "TYPE_INT32", - "comments": [ - " Maximum number of snapshots to return." - ] - }, - { - "paramName": "page_token", - "paramType": "TYPE_STRING", - "comments": [ - " The value returned by the last `ListSnapshotsResponse`; indicates that this", - " is a continuation of a prior `ListSnapshots` call, and that the system", - " should return the next page of data." - ] - } - ], - "headerRequestParams": [ - [ - "project" - ] - ] - } - ], - "longRunningOperationsMixinFlags": { - "enabled": false, - "getOperation": true, - "cancelOperation": true, - "deleteOperation": true, - "listOperations": true - }, - "hostname": "", - "port": 0, - "oauthScopes": [ - "https://www.googleapis.com/auth/cloud-platform", - "https://www.googleapis.com/auth/pubsub" - ], - "pathTemplates": [ - { - "name": "Project", - "params": [ - "project" - ], - "type": "cloudresourcemanager.googleapis.com/Project", - "pattern": [ - "projects/{project}" - ] - }, - { - "name": "project_topic", - "params": [ - "project", - "topic" - ], - "pattern": [ - "projects/{project}/topics/{topic}" - ], - "type": "pubsub.googleapis.com/Topic" - }, - { - "name": "Schema", - "params": [ - "project", - "schema" - ], - "type": "pubsub.googleapis.com/Schema", - "pattern": [ - "projects/{project}/schemas/{schema}" - ] - }, - { - "name": "Snapshot", - "params": [ - "project", - "snapshot" - ], - "type": "pubsub.googleapis.com/Snapshot", - "pattern": [ - "projects/{project}/snapshots/{snapshot}" - ] - }, - { - "name": "Subscription", - "params": [ - "project", - "subscription" - ], - "type": "pubsub.googleapis.com/Subscription", - "pattern": [ - "projects/{project}/subscriptions/{subscription}" - ] - } - ] - } - ], - "diregapic": false, - "handwrittenLayer": false, - "legacyProtoLoad": false -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/iam_policy.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/iam_policy.proto.baseline deleted file mode 100644 index 7072854e4c06..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/iam_policy.proto.baseline +++ /dev/null @@ -1,145 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.iam.v1; - -import "google/iam/v1/options.proto"; -import "google/iam/v1/policy.proto"; -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "IamPolicyProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// ## API Overview -// -// Manages Identity and Access Management (IAM) policies. -// -// Any implementation of an API that offers access control features -// implements the google.iam.v1.IAMPolicy interface. -// -// ## Data model -// -// Access control is applied when a principal (user or service account), takes -// some action on a resource exposed by a service. Resources, identified by -// URI-like names, are the unit of access control specification. Service -// implementations can choose the granularity of access control and the -// supported permissions for their resources. -// For example one database service may allow access control to be -// specified only at the Table level, whereas another might allow access control -// to also be specified at the Column level. -// -// ## Policy Structure -// -// See google.iam.v1.Policy -// -// This is intentionally not a CRUD style API because access control policies -// are created and deleted implicitly with the resources to which they are -// attached. -service IAMPolicy { - option (google.api.default_host) = "iam-meta-api.googleapis.com"; - - // Sets the access control policy on the specified resource. Replaces any - // existing policy. - rpc SetIamPolicy(SetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for a resource. - // Returns an empty policy if the resource exists and does not have a policy - // set. - rpc GetIamPolicy(GetIamPolicyRequest) returns (Policy) { - option (google.api.http) = { - post: "/v1/{resource=**}:getIamPolicy" - body: "*" - }; - } - - // Returns permissions that a caller has on the specified resource. - // If the resource does not exist, this will return an empty set of - // permissions, not a NOT_FOUND error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(TestIamPermissionsRequest) returns (TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=**}:testIamPermissions" - body: "*" - }; - } -} - -// Request message for `SetIamPolicy` method. -message SetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being specified. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // REQUIRED: The complete policy to be applied to the `resource`. The size of - // the policy is limited to a few 10s of KB. An empty policy is a - // valid policy but certain Cloud Platform services (such as Projects) - // might reject them. - Policy policy = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for `GetIamPolicy` method. -message GetIamPolicyRequest { - // REQUIRED: The resource for which the policy is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // OPTIONAL: A `GetPolicyOptions` object for specifying options to - // `GetIamPolicy`. This field is only used by Cloud IAM. - GetPolicyOptions options = 2; -} - -// Request message for `TestIamPermissions` method. -message TestIamPermissionsRequest { - // REQUIRED: The resource for which the policy detail is being requested. - // See the operation documentation for the appropriate value for this field. - string resource = 1[ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference).type = "*"]; - - // The set of permissions to check for the `resource`. Permissions with - // wildcards (such as '*' or 'storage.*') are not allowed. For more - // information see - // [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - repeated string permissions = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response message for `TestIamPermissions` method. -message TestIamPermissionsResponse { - // A subset of `TestPermissionsRequest.permissions` that the caller is - // allowed. - repeated string permissions = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/options.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/options.proto.baseline deleted file mode 100644 index a4e17e588db4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/iam/v1/options.proto.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.iam.v1; - -import "google/api/annotations.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Iam.V1"; -option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam"; -option java_multiple_files = true; -option java_outer_classname = "OptionsProto"; -option java_package = "com.google.iam.v1"; -option php_namespace = "Google\\Cloud\\Iam\\V1"; - -// Encapsulates settings provided to GetIamPolicy. -message GetPolicyOptions { - // Optional. The policy format version to be returned. - // - // Valid values are 0, 1, and 3. Requests specifying an invalid value will be - // rejected. - // - // Requests for policies with any conditional bindings must specify version 3. - // Policies without any conditional bindings may specify any valid value or - // leave the field unset. - int32 requested_policy_version = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/pubsub.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/pubsub.proto.baseline deleted file mode 100644 index 0da37dd7dad1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/pubsub.proto.baseline +++ /dev/null @@ -1,1314 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.pubsub.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/pubsub/v1/schema.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; -option java_multiple_files = true; -option java_outer_classname = "PubsubProto"; -option java_package = "com.google.pubsub.v1"; -option php_namespace = "Google\\Cloud\\PubSub\\V1"; -option ruby_package = "Google::Cloud::PubSub::V1"; - -// The service that an application uses to manipulate topics, and to send -// messages to a topic. -service Publisher { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates the given topic with the given name. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). - rpc CreateTopic(Topic) returns (Topic) { - option (google.api.http) = { - put: "/v1/{name=projects/*/topics/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Updates an existing topic. Note that certain properties of a - // topic are not modifiable. - rpc UpdateTopic(UpdateTopicRequest) returns (Topic) { - option (google.api.http) = { - patch: "/v1/{topic.name=projects/*/topics/*}" - body: "*" - }; - } - - // Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic - // does not exist. - rpc Publish(PublishRequest) returns (PublishResponse) { - option (google.api.http) = { - post: "/v1/{topic=projects/*/topics/*}:publish" - body: "*" - }; - option (google.api.method_signature) = "topic,messages"; - } - - // Gets the configuration of a topic. - rpc GetTopic(GetTopicRequest) returns (Topic) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}" - }; - option (google.api.method_signature) = "topic"; - } - - // Lists matching topics. - rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/topics" - }; - option (google.api.method_signature) = "project"; - } - - // Lists the names of the attached subscriptions on this topic. - rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) - returns (ListTopicSubscriptionsResponse) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}/subscriptions" - }; - option (google.api.method_signature) = "topic"; - } - - // Lists the names of the snapshots on this topic. Snapshots are used in - // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - // which allow you to manage message acknowledgments in bulk. That is, you can - // set the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - rpc ListTopicSnapshots(ListTopicSnapshotsRequest) - returns (ListTopicSnapshotsResponse) { - option (google.api.http) = { - get: "/v1/{topic=projects/*/topics/*}/snapshots" - }; - option (google.api.method_signature) = "topic"; - } - - // Deletes the topic with the given name. Returns `NOT_FOUND` if the topic - // does not exist. After a topic is deleted, a new topic may be created with - // the same name; this is an entirely new topic with none of the old - // configuration or subscriptions. Existing subscriptions to this topic are - // not deleted, but their `topic` field is set to `_deleted-topic_`. - rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{topic=projects/*/topics/*}" - }; - option (google.api.method_signature) = "topic"; - } - - // Detaches a subscription from this topic. All messages retained in the - // subscription are dropped. Subsequent `Pull` and `StreamingPull` requests - // will return FAILED_PRECONDITION. If the subscription is a push - // subscription, pushes to the endpoint will stop. - rpc DetachSubscription(DetachSubscriptionRequest) - returns (DetachSubscriptionResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:detach" - }; - } -} - -// A policy constraining the storage of messages published to the topic. -message MessageStoragePolicy { - // A list of IDs of GCP regions where messages that are published to the topic - // may be persisted in storage. Messages published by publishers running in - // non-allowed GCP regions (or running outside of GCP altogether) will be - // routed for storage in one of the allowed regions. An empty list means that - // no regions are allowed, and is not a valid configuration. - repeated string allowed_persistence_regions = 1; -} - -// Settings for validating messages published against a schema. -message SchemaSettings { - // Required. The name of the schema that messages published should be - // validated against. Format is `projects/{project}/schemas/{schema}`. The - // value of this field will be `_deleted-schema_` if the schema has been - // deleted. - string schema = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // The encoding of messages validated against `schema`. - Encoding encoding = 2; -} - -// A topic resource. -message Topic { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" - pattern: "_deleted-topic_" - }; - - // Required. The name of the topic. It must have the format - // `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, - // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), - // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent - // signs (`%`). It must be between 3 and 255 characters in length, and it - // must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // See [Creating and managing labels] - // (https://cloud.google.com/pubsub/docs/labels). - map labels = 2; - - // Policy constraining the set of Google Cloud Platform regions where messages - // published to the topic may be stored. If not present, then no constraints - // are in effect. - MessageStoragePolicy message_storage_policy = 3; - - // The resource name of the Cloud KMS CryptoKey to be used to protect access - // to messages published on this topic. - // - // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string kms_key_name = 5; - - // Settings for validating messages published against a schema. - SchemaSettings schema_settings = 6; - - // Reserved for future use. This field is set only in responses from the - // server; it is ignored if it is set in any requests. - bool satisfies_pzs = 7; -} - -// A message that is published by publishers and consumed by subscribers. The -// message must contain either a non-empty data field or at least one attribute. -// Note that client libraries represent this object differently -// depending on the language. See the corresponding [client library -// documentation](https://cloud.google.com/pubsub/docs/reference/libraries) for -// more information. See [quotas and limits] -// (https://cloud.google.com/pubsub/quotas) for more information about message -// limits. -message PubsubMessage { - // The message data field. If this field is empty, the message must contain - // at least one attribute. - bytes data = 1; - - // Attributes for this message. If this field is empty, the message must - // contain non-empty data. This can be used to filter messages on the - // subscription. - map attributes = 2; - - // ID of this message, assigned by the server when the message is published. - // Guaranteed to be unique within the topic. This value may be read by a - // subscriber that receives a `PubsubMessage` via a `Pull` call or a push - // delivery. It must not be populated by the publisher in a `Publish` call. - string message_id = 3; - - // The time at which the message was published, populated by the server when - // it receives the `Publish` call. It must not be populated by the - // publisher in a `Publish` call. - google.protobuf.Timestamp publish_time = 4; - - // If non-empty, identifies related messages for which publish order should be - // respected. If a `Subscription` has `enable_message_ordering` set to `true`, - // messages published with the same non-empty `ordering_key` value will be - // delivered to subscribers in the order in which they are received by the - // Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest` - // must specify the same `ordering_key` value. - string ordering_key = 5; -} - -// Request for the GetTopic method. -message GetTopicRequest { - // Required. The name of the topic to get. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; -} - -// Request for the UpdateTopic method. -message UpdateTopicRequest { - // Required. The updated topic object. - Topic topic = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided topic to update. Must be - // specified and non-empty. Note that if `update_mask` contains - // "message_storage_policy" but the `message_storage_policy` is not set in - // the `topic` provided above, then the updated value is determined by the - // policy configured at the project or organization level. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the Publish method. -message PublishRequest { - // Required. The messages in the request will be published on this topic. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Required. The messages to publish. - repeated PubsubMessage messages = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `Publish` method. -message PublishResponse { - // The server-assigned ID of each published message, in the same order as - // the messages in the request. IDs are guaranteed to be unique within - // the topic. - repeated string message_ids = 1; -} - -// Request for the `ListTopics` method. -message ListTopicsRequest { - // Required. The name of the project in which to list topics. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of topics to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicsResponse`; indicates that this is - // a continuation of a prior `ListTopics` call, and that the system should - // return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopics` method. -message ListTopicsResponse { - // The resulting topics. - repeated Topic topics = 1; - - // If not empty, indicates that there may be more topics that match the - // request; this value should be passed in a new `ListTopicsRequest`. - string next_page_token = 2; -} - -// Request for the `ListTopicSubscriptions` method. -message ListTopicSubscriptionsRequest { - // Required. The name of the topic that subscriptions are attached to. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Maximum number of subscription names to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicSubscriptionsResponse`; indicates - // that this is a continuation of a prior `ListTopicSubscriptions` call, and - // that the system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopicSubscriptions` method. -message ListTopicSubscriptionsResponse { - // The names of subscriptions attached to the topic specified in the request. - repeated string subscriptions = 1 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - }]; - - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new - // `ListTopicSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; -} - -// Request for the `ListTopicSnapshots` method. -message ListTopicSnapshotsRequest { - // Required. The name of the topic that snapshots are attached to. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // Maximum number of snapshot names to return. - int32 page_size = 2; - - // The value returned by the last `ListTopicSnapshotsResponse`; indicates - // that this is a continuation of a prior `ListTopicSnapshots` call, and - // that the system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListTopicSnapshots` method. -message ListTopicSnapshotsResponse { - // The names of the snapshots that match the request. - repeated string snapshots = 1; - - // If not empty, indicates that there may be more snapshots that match - // the request; this value should be passed in a new - // `ListTopicSnapshotsRequest` to get more snapshots. - string next_page_token = 2; -} - -// Request for the `DeleteTopic` method. -message DeleteTopicRequest { - // Required. Name of the topic to delete. - // Format is `projects/{project}/topics/{topic}`. - string topic = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; -} - -// Request for the DetachSubscription method. -message DetachSubscriptionRequest { - // Required. The subscription to detach. - // Format is `projects/{project}/subscriptions/{subscription}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Response for the DetachSubscription method. -// Reserved for future use. -message DetachSubscriptionResponse {} - -// The service that an application uses to manipulate subscriptions and to -// consume messages from a subscription via the `Pull` method or by -// establishing a bi-directional stream using the `StreamingPull` method. -service Subscriber { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates a subscription to a given topic. See the [resource name rules] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). - // If the subscription already exists, returns `ALREADY_EXISTS`. - // If the corresponding topic doesn't exist, returns `NOT_FOUND`. - // - // If the name is not provided in the request, the server will assign a random - // name for this subscription on the same project as the topic, conforming - // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated - // name is populated in the returned Subscription object. Note that for REST - // API requests, you must specify a name in the request. - rpc CreateSubscription(Subscription) returns (Subscription) { - option (google.api.http) = { - put: "/v1/{name=projects/*/subscriptions/*}" - body: "*" - }; - option (google.api.method_signature) = - "name,topic,push_config,ack_deadline_seconds"; - } - - // Gets the configuration details of a subscription. - rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) { - option (google.api.http) = { - get: "/v1/{subscription=projects/*/subscriptions/*}" - }; - option (google.api.method_signature) = "subscription"; - } - - // Updates an existing subscription. Note that certain properties of a - // subscription, such as its topic, are not modifiable. - rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) { - option (google.api.http) = { - patch: "/v1/{subscription.name=projects/*/subscriptions/*}" - body: "*" - }; - } - - // Lists matching subscriptions. - rpc ListSubscriptions(ListSubscriptionsRequest) - returns (ListSubscriptionsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/subscriptions" - }; - option (google.api.method_signature) = "project"; - } - - // Deletes an existing subscription. All messages retained in the subscription - // are immediately dropped. Calls to `Pull` after deletion will return - // `NOT_FOUND`. After a subscription is deleted, a new one may be created with - // the same name, but the new one has no association with the old - // subscription or its topic unless the same topic is specified. - rpc DeleteSubscription(DeleteSubscriptionRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{subscription=projects/*/subscriptions/*}" - }; - option (google.api.method_signature) = "subscription"; - } - - // Modifies the ack deadline for a specific message. This method is useful - // to indicate that more time is needed to process a message by the - // subscriber, or to make the message available for redelivery if the - // processing was interrupted. Note that this does not modify the - // subscription-level `ackDeadlineSeconds` used for subsequent messages. - rpc ModifyAckDeadline(ModifyAckDeadlineRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline" - body: "*" - }; - option (google.api.method_signature) = - "subscription,ack_ids,ack_deadline_seconds"; - } - - // Acknowledges the messages associated with the `ack_ids` in the - // `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages - // from the subscription. - // - // Acknowledging a message whose ack deadline has expired may succeed, - // but such a message may be redelivered later. Acknowledging a message more - // than once will not result in an error. - rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:acknowledge" - body: "*" - }; - option (google.api.method_signature) = "subscription,ack_ids"; - } - - // Pulls messages from the server. The server may return `UNAVAILABLE` if - // there are too many concurrent pull requests pending for the given - // subscription. - rpc Pull(PullRequest) returns (PullResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:pull" - body: "*" - }; - option (google.api.method_signature) = - "subscription,return_immediately,max_messages"; - } - - // Establishes a stream with the server, which sends messages down to the - // client. The client streams acknowledgements and ack deadline modifications - // back to the server. The server will close the stream and return the status - // on any error. The server may close the stream with status `UNAVAILABLE` to - // reassign server-side resources, in which case, the client should - // re-establish the stream. Flow control can be achieved by configuring the - // underlying RPC channel. - rpc StreamingPull(stream StreamingPullRequest) - returns (stream StreamingPullResponse) {} - - // Modifies the `PushConfig` for a specified subscription. - // - // This may be used to change a push subscription to a pull one (signified by - // an empty `PushConfig`) or vice versa, or change the endpoint URL and other - // attributes of a push subscription. Messages will accumulate for delivery - // continuously through the call regardless of changes to the `PushConfig`. - rpc ModifyPushConfig(ModifyPushConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig" - body: "*" - }; - option (google.api.method_signature) = "subscription,push_config"; - } - - // Gets the configuration details of a snapshot. Snapshots are used in - // Seek - // operations, which allow you to manage message acknowledgments in bulk. That - // is, you can set the acknowledgment state of messages in an existing - // subscription to the state captured by a snapshot. - rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - get: "/v1/{snapshot=projects/*/snapshots/*}" - }; - option (google.api.method_signature) = "snapshot"; - } - - // Lists the existing snapshots. Snapshots are used in [Seek]( - // https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) { - option (google.api.http) = { - get: "/v1/{project=projects/*}/snapshots" - }; - option (google.api.method_signature) = "project"; - } - - // Creates a snapshot from the requested subscription. Snapshots are used in - // [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, - // which allow you to manage message acknowledgments in bulk. That is, you can - // set the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - // If the snapshot already exists, returns `ALREADY_EXISTS`. - // If the requested subscription doesn't exist, returns `NOT_FOUND`. - // If the backlog in the subscription is too old -- and the resulting snapshot - // would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. - // See also the `Snapshot.expire_time` field. If the name is not provided in - // the request, the server will assign a random - // name for this snapshot on the same project as the subscription, conforming - // to the [resource name format] - // (https://cloud.google.com/pubsub/docs/admin#resource_names). The - // generated name is populated in the returned Snapshot object. Note that for - // REST API requests, you must specify a name in the request. - rpc CreateSnapshot(CreateSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - put: "/v1/{name=projects/*/snapshots/*}" - body: "*" - }; - option (google.api.method_signature) = "name,subscription"; - } - - // Updates an existing snapshot. Snapshots are used in - // Seek - // operations, which allow - // you to manage message acknowledgments in bulk. That is, you can set the - // acknowledgment state of messages in an existing subscription to the state - // captured by a snapshot. - rpc UpdateSnapshot(UpdateSnapshotRequest) returns (Snapshot) { - option (google.api.http) = { - patch: "/v1/{snapshot.name=projects/*/snapshots/*}" - body: "*" - }; - } - - // Removes an existing snapshot. Snapshots are used in [Seek] - // (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. - // When the snapshot is deleted, all messages retained in the snapshot - // are immediately dropped. After a snapshot is deleted, a new one may be - // created with the same name, but the new one has no association with the old - // snapshot or its subscription, unless the same subscription is specified. - rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{snapshot=projects/*/snapshots/*}" - }; - option (google.api.method_signature) = "snapshot"; - } - - // Seeks an existing subscription to a point in time or to a given snapshot, - // whichever is provided in the request. Snapshots are used in [Seek] - // (https://cloud.google.com/pubsub/docs/replay-overview) operations, which - // allow you to manage message acknowledgments in bulk. That is, you can set - // the acknowledgment state of messages in an existing subscription to the - // state captured by a snapshot. Note that both the subscription and the - // snapshot must be on the same topic. - rpc Seek(SeekRequest) returns (SeekResponse) { - option (google.api.http) = { - post: "/v1/{subscription=projects/*/subscriptions/*}:seek" - body: "*" - }; - } -} - -// A subscription resource. -message Subscription { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Subscription" - pattern: "projects/{project}/subscriptions/{subscription}" - }; - - // Required. The name of the subscription. It must have the format - // `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must - // start with a letter, and contain only letters (`[A-Za-z]`), numbers - // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`), - // plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters - // in length, and it must not start with `"goog"`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The name of the topic from which this subscription is receiving - // messages. Format is `projects/{project}/topics/{topic}`. The value of this - // field will be `_deleted-topic_` if the topic has been deleted. - string topic = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // If push delivery is used with this subscription, this field is - // used to configure it. An empty `pushConfig` signifies that the subscriber - // will pull and ack messages using API methods. - PushConfig push_config = 4; - - // The approximate amount of time (on a best-effort basis) Pub/Sub waits for - // the subscriber to acknowledge receipt before resending the message. In the - // interval after the message is delivered and before it is acknowledged, it - // is considered to be outstanding. During that time period, the - // message will not be redelivered (on a best-effort basis). - // - // For pull subscriptions, this value is used as the initial value for the ack - // deadline. To override this value for a given message, call - // `ModifyAckDeadline` with the corresponding `ack_id` if using - // non-streaming pull or send the `ack_id` in a - // `StreamingModifyAckDeadlineRequest` if using streaming pull. - // The minimum custom deadline you can specify is 10 seconds. - // The maximum custom deadline you can specify is 600 seconds (10 minutes). - // If this parameter is 0, a default value of 10 seconds is used. - // - // For push delivery, this value is also used to set the request timeout for - // the call to the push endpoint. - // - // If the subscriber never acknowledges the message, the Pub/Sub - // system will eventually redeliver the message. - int32 ack_deadline_seconds = 5; - - // Indicates whether to retain acknowledged messages. If true, then - // messages are not expunged from the subscription's backlog, even if they are - // acknowledged, until they fall out of the `message_retention_duration` - // window. This must be true if you would like to [Seek to a timestamp] - // (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time). - bool retain_acked_messages = 7; - - // How long to retain unacknowledged messages in the subscription's backlog, - // from the moment a message is published. - // If `retain_acked_messages` is true, then this also configures the retention - // of acknowledged messages, and thus configures how far back in time a `Seek` - // can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10 - // minutes. - google.protobuf.Duration message_retention_duration = 8; - - // See Creating and - // managing labels. - map labels = 9; - - // If true, messages published with the same `ordering_key` in `PubsubMessage` - // will be delivered to the subscribers in the order in which they - // are received by the Pub/Sub system. Otherwise, they may be delivered in - // any order. - bool enable_message_ordering = 10; - - // A policy that specifies the conditions for this subscription's expiration. - // A subscription is considered active as long as any connected subscriber is - // successfully consuming messages from the subscription or is issuing - // operations on the subscription. If `expiration_policy` is not set, a - // *default policy* with `ttl` of 31 days will be used. The minimum allowed - // value for `expiration_policy.ttl` is 1 day. - ExpirationPolicy expiration_policy = 11; - - // An expression written in the Pub/Sub [filter - // language](https://cloud.google.com/pubsub/docs/filtering). If non-empty, - // then only `PubsubMessage`s whose `attributes` field matches the filter are - // delivered on this subscription. If empty, then no messages are filtered - // out. - string filter = 12; - - // A policy that specifies the conditions for dead lettering messages in - // this subscription. If dead_letter_policy is not set, dead lettering - // is disabled. - // - // The Cloud Pub/Sub service account associated with this subscriptions's - // parent project (i.e., - // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - // permission to Acknowledge() messages on this subscription. - DeadLetterPolicy dead_letter_policy = 13; - - // A policy that specifies how Pub/Sub retries message delivery for this - // subscription. - // - // If not set, the default retry policy is applied. This generally implies - // that messages will be retried as soon as possible for healthy subscribers. - // RetryPolicy will be triggered on NACKs or acknowledgement deadline - // exceeded events for a given message. - RetryPolicy retry_policy = 14; - - // Indicates whether the subscription is detached from its topic. Detached - // subscriptions don't receive messages from their topic and don't retain any - // backlog. `Pull` and `StreamingPull` requests will return - // FAILED_PRECONDITION. If the subscription is a push subscription, pushes to - // the endpoint will not be made. - bool detached = 15; -} - -// A policy that specifies how Cloud Pub/Sub retries message delivery. -// -// Retry delay will be exponential based on provided minimum and maximum -// backoffs. https://en.wikipedia.org/wiki/Exponential_backoff. -// -// RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded -// events for a given message. -// -// Retry Policy is implemented on a best effort basis. At times, the delay -// between consecutive deliveries may not match the configuration. That is, -// delay can be more or less than configured backoff. -message RetryPolicy { - // The minimum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 10 seconds. - google.protobuf.Duration minimum_backoff = 1; - - // The maximum delay between consecutive deliveries of a given message. - // Value should be between 0 and 600 seconds. Defaults to 600 seconds. - google.protobuf.Duration maximum_backoff = 2; -} - -// Dead lettering is done on a best effort basis. The same message might be -// dead lettered multiple times. -// -// If validation on any of the fields fails at subscription creation/updation, -// the create/update subscription request will fail. -message DeadLetterPolicy { - // The name of the topic to which dead letter messages should be published. - // Format is `projects/{project}/topics/{topic}`.The Cloud Pub/Sub service - // account associated with the enclosing subscription's parent project (i.e., - // service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have - // permission to Publish() to this topic. - // - // The operation will fail if the topic does not exist. - // Users should ensure that there is a subscription attached to this topic - // since messages published to a topic with no subscriptions are lost. - string dead_letter_topic = 1; - - // The maximum number of delivery attempts for any message. The value must be - // between 5 and 100. - // - // The number of delivery attempts is defined as 1 + (the sum of number of - // NACKs and number of times the acknowledgement deadline has been exceeded - // for the message). - // - // A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that - // client libraries may automatically extend ack_deadlines. - // - // This field will be honored on a best effort basis. - // - // If this parameter is 0, a default value of 5 is used. - int32 max_delivery_attempts = 2; -} - -// A policy that specifies the conditions for resource expiration (i.e., -// automatic resource deletion). -message ExpirationPolicy { - // Specifies the "time-to-live" duration for an associated resource. The - // resource expires if it is not active for a period of `ttl`. The definition - // of "activity" depends on the type of the associated resource. The minimum - // and maximum allowed values for `ttl` depend on the type of the associated - // resource, as well. If `ttl` is not set, the associated resource never - // expires. - google.protobuf.Duration ttl = 1; -} - -// Configuration for a push delivery endpoint. -message PushConfig { - // Contains information needed for generating an - // [OpenID Connect - // token](https://developers.google.com/identity/protocols/OpenIDConnect). - message OidcToken { - // [Service account - // email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating the OIDC token. The caller (for - // CreateSubscription, UpdateSubscription, and ModifyPushConfig RPCs) must - // have the iam.serviceAccounts.actAs permission for the service account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. The audience claim - // identifies the recipients that the JWT is intended for. The audience - // value is a single case-sensitive string. Having multiple values (array) - // for the audience field is not supported. More info about the OIDC JWT - // token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 - // Note: if not specified, the Push endpoint URL will be used. - string audience = 2; - } - - // A URL locating the endpoint to which messages should be pushed. - // For example, a Webhook endpoint might use `https://example.com/push`. - string push_endpoint = 1; - - // Endpoint configuration attributes that can be used to control different - // aspects of the message delivery. - // - // The only currently supported attribute is `x-goog-version`, which you can - // use to change the format of the pushed message. This attribute - // indicates the version of the data expected by the endpoint. This - // controls the shape of the pushed message (i.e., its fields and metadata). - // - // If not present during the `CreateSubscription` call, it will default to - // the version of the Pub/Sub API used to make such call. If not present in a - // `ModifyPushConfig` call, its value will not be changed. `GetSubscription` - // calls will always return a valid version, even if the subscription was - // created without this attribute. - // - // The only supported values for the `x-goog-version` attribute are: - // - // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub API. - // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub API. - // - // For example: - //
attributes { "x-goog-version": "v1" } 
- map attributes = 2; - - // An authentication method used by push endpoints to verify the source of - // push requests. This can be used with push endpoints that are private by - // default to allow requests only from the Cloud Pub/Sub system, for example. - // This field is optional and should be set only by users interested in - // authenticated push. - oneof authentication_method { - // If specified, Pub/Sub will generate and attach an OIDC JWT token as an - // `Authorization` header in the HTTP request for every pushed message. - OidcToken oidc_token = 3; - } -} - -// A message and its corresponding acknowledgment ID. -message ReceivedMessage { - // This ID can be used to acknowledge the received message. - string ack_id = 1; - - // The message. - PubsubMessage message = 2; - - // The approximate number of times that Cloud Pub/Sub has attempted to deliver - // the associated message to a subscriber. - // - // More precisely, this is 1 + (number of NACKs) + - // (number of ack_deadline exceeds) for this message. - // - // A NACK is any call to ModifyAckDeadline with a 0 deadline. An ack_deadline - // exceeds event is whenever a message is not acknowledged within - // ack_deadline. Note that ack_deadline is initially - // Subscription.ackDeadlineSeconds, but may get extended automatically by - // the client library. - // - // Upon the first delivery of a given message, `delivery_attempt` will have a - // value of 1. The value is calculated at best effort and is approximate. - // - // If a DeadLetterPolicy is not set on the subscription, this will be 0. - int32 delivery_attempt = 3; -} - -// Request for the GetSubscription method. -message GetSubscriptionRequest { - // Required. The name of the subscription to get. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Request for the UpdateSubscription method. -message UpdateSubscriptionRequest { - // Required. The updated subscription object. - Subscription subscription = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided subscription to update. - // Must be specified and non-empty. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `ListSubscriptions` method. -message ListSubscriptionsRequest { - // Required. The name of the project in which to list subscriptions. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of subscriptions to return. - int32 page_size = 2; - - // The value returned by the last `ListSubscriptionsResponse`; indicates that - // this is a continuation of a prior `ListSubscriptions` call, and that the - // system should return the next page of data. - string page_token = 3; -} - -// Response for the `ListSubscriptions` method. -message ListSubscriptionsResponse { - // The subscriptions that match the request. - repeated Subscription subscriptions = 1; - - // If not empty, indicates that there may be more subscriptions that match - // the request; this value should be passed in a new - // `ListSubscriptionsRequest` to get more subscriptions. - string next_page_token = 2; -} - -// Request for the DeleteSubscription method. -message DeleteSubscriptionRequest { - // Required. The subscription to delete. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; -} - -// Request for the ModifyPushConfig method. -message ModifyPushConfigRequest { - // Required. The name of the subscription. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. The push configuration for future deliveries. - // - // An empty `pushConfig` indicates that the Pub/Sub system should - // stop pushing messages from the given subscription and allow - // messages to be pulled and acknowledged - effectively pausing - // the subscription if `Pull` or `StreamingPull` is not called. - PushConfig push_config = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `Pull` method. -message PullRequest { - // Required. The subscription from which messages should be pulled. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Optional. If this field set to true, the system will respond immediately - // even if it there are no messages available to return in the `Pull` - // response. Otherwise, the system may wait (for a bounded amount of time) - // until at least one message is available, rather than returning no messages. - // Warning: setting this field to `true` is discouraged because it adversely - // impacts the performance of `Pull` operations. We recommend that users do - // not set this field. - bool return_immediately = 2 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - - // Required. The maximum number of messages to return for this request. Must - // be a positive integer. The Pub/Sub system may return fewer than the number - // specified. - int32 max_messages = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `Pull` method. -message PullResponse { - // Received Pub/Sub messages. The list will be empty if there are no more - // messages available in the backlog. For JSON, the response can be entirely - // empty. The Pub/Sub system may return fewer than the `maxMessages` requested - // even if there are more messages available in the backlog. - repeated ReceivedMessage received_messages = 1; -} - -// Request for the ModifyAckDeadline method. -message ModifyAckDeadlineRequest { - // Required. The name of the subscription. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. List of acknowledgment IDs. - repeated string ack_ids = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. The new ack deadline with respect to the time this request was - // sent to the Pub/Sub system. For example, if the value is 10, the new ack - // deadline will expire 10 seconds after the `ModifyAckDeadline` call was - // made. Specifying zero might immediately make the message available for - // delivery to another subscriber client. This typically results in an - // increase in the rate of message redeliveries (that is, duplicates). - // The minimum deadline you can specify is 0 seconds. - // The maximum deadline you can specify is 600 seconds (10 minutes). - int32 ack_deadline_seconds = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the Acknowledge method. -message AcknowledgeRequest { - // Required. The subscription whose message is being acknowledged. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // Required. The acknowledgment ID for the messages being acknowledged that - // was returned by the Pub/Sub system in the `Pull` response. Must not be - // empty. - repeated string ack_ids = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for the `StreamingPull` streaming RPC method. This request is used to -// establish the initial stream as well as to stream acknowledgements and ack -// deadline modifications from the client to the server. -message StreamingPullRequest { - // Required. The subscription for which to initialize the new stream. This - // must be provided in the first request on the stream, and must not be set in - // subsequent requests from client to server. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // List of acknowledgement IDs for acknowledging previously received messages - // (received on this stream or a different stream). If an ack ID has expired, - // the corresponding message may be redelivered later. Acknowledging a message - // more than once will not result in an error. If the acknowledgement ID is - // malformed, the stream will be aborted with status `INVALID_ARGUMENT`. - repeated string ack_ids = 2; - - // The list of new ack deadlines for the IDs listed in - // `modify_deadline_ack_ids`. The size of this list must be the same as the - // size of `modify_deadline_ack_ids`. If it differs the stream will be aborted - // with `INVALID_ARGUMENT`. Each element in this list is applied to the - // element in the same position in `modify_deadline_ack_ids`. The new ack - // deadline is with respect to the time this request was sent to the Pub/Sub - // system. Must be >= 0. For example, if the value is 10, the new ack deadline - // will expire 10 seconds after this request is received. If the value is 0, - // the message is immediately made available for another streaming or - // non-streaming pull request. If the value is < 0 (an error), the stream will - // be aborted with status `INVALID_ARGUMENT`. - repeated int32 modify_deadline_seconds = 3; - - // List of acknowledgement IDs whose deadline will be modified based on the - // corresponding element in `modify_deadline_seconds`. This field can be used - // to indicate that more time is needed to process a message by the - // subscriber, or to make the message available for redelivery if the - // processing was interrupted. - repeated string modify_deadline_ack_ids = 4; - - // Required. The ack deadline to use for the stream. This must be provided in - // the first request on the stream, but it can also be updated on subsequent - // requests from client to server. The minimum deadline you can specify is 10 - // seconds. The maximum deadline you can specify is 600 seconds (10 minutes). - int32 stream_ack_deadline_seconds = 5 - [(google.api.field_behavior) = REQUIRED]; - - // A unique identifier that is used to distinguish client instances from each - // other. Only needs to be provided on the initial request. When a stream - // disconnects and reconnects for the same stream, the client_id should be set - // to the same value so that state associated with the old stream can be - // transferred to the new stream. The same client_id should not be used for - // different client instances. - string client_id = 6; - - // Flow control settings for the maximum number of outstanding messages. When - // there are `max_outstanding_messages` or more currently sent to the - // streaming pull client that have not yet been acked or nacked, the server - // stops sending more messages. The sending of messages resumes once the - // number of outstanding messages is less than this value. If the value is - // <= 0, there is no limit to the number of outstanding messages. This - // property can only be set on the initial StreamingPullRequest. If it is set - // on a subsequent request, the stream will be aborted with status - // `INVALID_ARGUMENT`. - int64 max_outstanding_messages = 7; - - // Flow control settings for the maximum number of outstanding bytes. When - // there are `max_outstanding_bytes` or more worth of messages currently sent - // to the streaming pull client that have not yet been acked or nacked, the - // server will stop sending more messages. The sending of messages resumes - // once the number of outstanding bytes is less than this value. If the value - // is <= 0, there is no limit to the number of outstanding bytes. This - // property can only be set on the initial StreamingPullRequest. If it is set - // on a subsequent request, the stream will be aborted with status - // `INVALID_ARGUMENT`. - int64 max_outstanding_bytes = 8; -} - -// Response for the `StreamingPull` method. This response is used to stream -// messages from the server to the client. -message StreamingPullResponse { - // Received Pub/Sub messages. This will not be empty. - repeated ReceivedMessage received_messages = 1; -} - -// Request for the `CreateSnapshot` method. -message CreateSnapshotRequest { - // Required. User-provided name for this snapshot. If the name is not provided - // in the request, the server will assign a random name for this snapshot on - // the same project as the subscription. Note that for REST API requests, you - // must specify a name. See the resource - // name rules. Format is `projects/{project}/snapshots/{snap}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; - - // Required. The subscription whose backlog the snapshot retains. - // Specifically, the created snapshot is guaranteed to retain: - // (a) The existing backlog on the subscription. More precisely, this is - // defined as the messages in the subscription's backlog that are - // unacknowledged upon the successful completion of the - // `CreateSnapshot` request; as well as: - // (b) Any messages published to the subscription's topic following the - // successful completion of the CreateSnapshot request. - // Format is `projects/{project}/subscriptions/{sub}`. - string subscription = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - // See Creating and - // managing labels. - map labels = 3; -} - -// Request for the UpdateSnapshot method. -message UpdateSnapshotRequest { - // Required. The updated snapshot object. - Snapshot snapshot = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Indicates which fields in the provided snapshot to update. - // Must be specified and non-empty. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// A snapshot resource. Snapshots are used in -// [Seek](https://cloud.google.com/pubsub/docs/replay-overview) -// operations, which allow you to manage message acknowledgments in bulk. That -// is, you can set the acknowledgment state of messages in an existing -// subscription to the state captured by a snapshot. -message Snapshot { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Snapshot" - pattern: "projects/{project}/snapshots/{snapshot}" - }; - - // The name of the snapshot. - string name = 1; - - // The name of the topic from which this snapshot is retaining messages. - string topic = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" } - ]; - - // The snapshot is guaranteed to exist up until this time. - // A newly-created snapshot expires no later than 7 days from the time of its - // creation. Its exact lifetime is determined at creation by the existing - // backlog in the source subscription. Specifically, the lifetime of the - // snapshot is `7 days - (age of oldest unacked message in the subscription)`. - // For example, consider a subscription whose oldest unacked message is 3 days - // old. If a snapshot is created from this subscription, the snapshot -- which - // will always capture this 3-day-old backlog as long as the snapshot - // exists -- will expire in 4 days. The service will refuse to create a - // snapshot that would expire in less than 1 hour after creation. - google.protobuf.Timestamp expire_time = 3; - - // See [Creating and managing labels] - // (https://cloud.google.com/pubsub/docs/labels). - map labels = 4; -} - -// Request for the GetSnapshot method. -message GetSnapshotRequest { - // Required. The name of the snapshot to get. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; -} - -// Request for the `ListSnapshots` method. -message ListSnapshotsRequest { - // Required. The name of the project in which to list snapshots. - // Format is `projects/{project-id}`. - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Maximum number of snapshots to return. - int32 page_size = 2; - - // The value returned by the last `ListSnapshotsResponse`; indicates that this - // is a continuation of a prior `ListSnapshots` call, and that the system - // should return the next page of data. - string page_token = 3; -} - -// Response for the `ListSnapshots` method. -message ListSnapshotsResponse { - // The resulting snapshots. - repeated Snapshot snapshots = 1; - - // If not empty, indicates that there may be more snapshot that match the - // request; this value should be passed in a new `ListSnapshotsRequest`. - string next_page_token = 2; -} - -// Request for the `DeleteSnapshot` method. -message DeleteSnapshotRequest { - // Required. The name of the snapshot to delete. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Snapshot" } - ]; -} - -// Request for the `Seek` method. -message SeekRequest { - // Required. The subscription to affect. - string subscription = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "pubsub.googleapis.com/Subscription" - } - ]; - - oneof target { - // The time to seek to. - // Messages retained in the subscription that were published before this - // time are marked as acknowledged, and messages retained in the - // subscription that were published after this time are marked as - // unacknowledged. Note that this operation affects only those messages - // retained in the subscription (configured by the combination of - // `message_retention_duration` and `retain_acked_messages`). For example, - // if `time` corresponds to a point before the message retention - // window (or to a point before the system's notion of the subscription - // creation time), only retained messages will be marked as unacknowledged, - // and already-expunged messages will not be restored. - google.protobuf.Timestamp time = 2; - - // The snapshot to seek to. The snapshot's topic must be the same as that of - // the provided subscription. - // Format is `projects/{project}/snapshots/{snap}`. - string snapshot = 3 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Snapshot" - }]; - } -} - -// Response for the `Seek` method (this response is empty). -message SeekResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/schema.proto.baseline b/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/schema.proto.baseline deleted file mode 100644 index 1ace7ef3b0d7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/pubsub-api-dump/protos/google/pubsub/v1/schema.proto.baseline +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.pubsub.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.PubSub.V1"; -option go_package = "google.golang.org/genproto/googleapis/pubsub/v1;pubsub"; -option java_multiple_files = true; -option java_outer_classname = "SchemaProto"; -option java_package = "com.google.pubsub.v1"; -option php_namespace = "Google\\Cloud\\PubSub\\V1"; -option ruby_package = "Google::Cloud::PubSub::V1"; - -// Service for doing schema-related operations. -service SchemaService { - option (google.api.default_host) = "pubsub.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/pubsub"; - - // Creates a schema. - rpc CreateSchema(CreateSchemaRequest) returns (Schema) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas" - body: "schema" - }; - option (google.api.method_signature) = "parent,schema,schema_id"; - } - - // Gets a schema. - rpc GetSchema(GetSchemaRequest) returns (Schema) { - option (google.api.http) = { - get: "/v1/{name=projects/*/schemas/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists schemas in a project. - rpc ListSchemas(ListSchemasRequest) returns (ListSchemasResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/schemas" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a schema. - rpc DeleteSchema(DeleteSchemaRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/schemas/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Validates a schema. - rpc ValidateSchema(ValidateSchemaRequest) returns (ValidateSchemaResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas:validate" - body: "*" - }; - option (google.api.method_signature) = "parent,schema"; - } - - // Validates a message against a schema. - rpc ValidateMessage(ValidateMessageRequest) - returns (ValidateMessageResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/schemas:validateMessage" - body: "*" - }; - } -} - -// A schema resource. -message Schema { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Schema" - pattern: "projects/{project}/schemas/{schema}" - }; - - // Possible schema definition types. - enum Type { - // Default value. This value is unused. - TYPE_UNSPECIFIED = 0; - - // A Protocol Buffer schema definition. - PROTOCOL_BUFFER = 1; - - // An Avro schema definition. - AVRO = 2; - } - - // Required. Name of the schema. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The type of the schema definition. - Type type = 2; - - // The definition of the schema. This should contain a string representing - // the full definition of the schema that is a valid schema definition of - // the type specified in `type`. - string definition = 3; -} - -// Request for the CreateSchema method. -message CreateSchemaRequest { - // Required. The name of the project in which to create the schema. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "pubsub.googleapis.com/Schema" - } - ]; - - // Required. The schema object to create. - // - // This schema's `name` parameter is ignored. The schema object returned - // by CreateSchema will have a `name` made using the given `parent` and - // `schema_id`. - Schema schema = 2 [(google.api.field_behavior) = REQUIRED]; - - // The ID to use for the schema, which will become the final component of - // the schema's resource name. - // - // See https://cloud.google.com/pubsub/docs/admin#resource_names for resource - // name constraints. - string schema_id = 3; -} - -// View of Schema object fields to be returned by GetSchema and ListSchemas. -enum SchemaView { - // The default / unset value. - // The API will default to the BASIC view. - SCHEMA_VIEW_UNSPECIFIED = 0; - - // Include the name and type of the schema, but not the definition. - BASIC = 1; - - // Include all Schema object fields. - FULL = 2; -} - -// Request for the GetSchema method. -message GetSchemaRequest { - // Required. The name of the schema to get. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // The set of fields to return in the response. If not set, returns a Schema - // with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all - // fields. - SchemaView view = 2; -} - -// Request for the `ListSchemas` method. -message ListSchemasRequest { - // Required. The name of the project in which to list schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // The set of Schema fields to return in the response. If not set, returns - // Schemas with `name` and `type`, but not `definition`. Set to `FULL` to - // retrieve all fields. - SchemaView view = 2; - - // Maximum number of schemas to return. - int32 page_size = 3; - - // The value returned by the last `ListSchemasResponse`; indicates that - // this is a continuation of a prior `ListSchemas` call, and that the - // system should return the next page of data. - string page_token = 4; -} - -// Response for the `ListSchemas` method. -message ListSchemasResponse { - // The resulting schemas. - repeated Schema schemas = 1; - - // If not empty, indicates that there may be more schemas that match the - // request; this value should be passed in a new `ListSchemasRequest`. - string next_page_token = 2; -} - -// Request for the `DeleteSchema` method. -message DeleteSchemaRequest { - // Required. Name of the schema to delete. - // Format is `projects/{project}/schemas/{schema}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; -} - -// Request for the `ValidateSchema` method. -message ValidateSchemaRequest { - // Required. The name of the project in which to validate schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. The schema object to validate. - Schema schema = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the `ValidateSchema` method. -message ValidateSchemaResponse {} - -// Request for the `ValidateMessage` method. -message ValidateMessageRequest { - // Required. The name of the project in which to validate schemas. - // Format is `projects/{project-id}`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - oneof schema_spec { - // Name of the schema against which to validate. - // - // Format is `projects/{project}/schemas/{schema}`. - string name = 2 [ - (google.api.resource_reference) = { type: "pubsub.googleapis.com/Schema" } - ]; - - // Ad-hoc schema against which to validate - Schema schema = 3; - } - - // Message to validate against the provided `schema_spec`. - bytes message = 4; - - // The encoding expected for messages - Encoding encoding = 5; -} - -// Response for the `ValidateMessage` method. -message ValidateMessageResponse {} - -// Possible encoding types for messages. -enum Encoding { - // Unspecified - ENCODING_UNSPECIFIED = 0; - - // JSON encoding - JSON = 1; - - // Binary encoding, as defined by the schema type. For some schema types, - // binary encoding may not be available. - BINARY = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 8dfcb02ee2fb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/redis/google-cloud-redis-nodejs - dest: /owl-bot-staging/google-cloud-redis - -api-name: redis \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 47142e3f0d6a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'redis', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/README.md.baseline deleted file mode 100644 index ed65a37a7d3e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Redis: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/redis.svg)](https://www.npmjs.org/package/redis) - -Redis client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Redis Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/redis/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Redis API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install redis -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install redis@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/index.ts.baseline deleted file mode 100644 index c280e9e22790..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const CloudRedisClient = v1beta1.CloudRedisClient; -type CloudRedisClient = v1beta1.CloudRedisClient; -export {v1beta1, CloudRedisClient}; -export default {v1beta1, CloudRedisClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client.ts.baseline deleted file mode 100644 index 2a96fdfee5ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client.ts.baseline +++ /dev/null @@ -1,1799 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as cloud_redis_client_config from './cloud_redis_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/cloud_redis_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'cloud_redis_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Configures and manages Cloud Memorystore for Redis instances - * - * Google Cloud Memorystore for Redis v1beta1 - * - * The `redis.googleapis.com` service implements the Google Cloud Memorystore - * for Redis API and defines the following resource model for managing Redis - * instances: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of Redis instances, named: `/instances/*` - * * As such, Redis instances are resources of the form: - * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * - * Note that location_id must be refering to a GCP `region`; for example: - * * `projects/redpepper-1290/locations/us-central1/instances/my-redis` - * @class - * @memberof v1beta1 - */ -export class CloudRedisClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('redis'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudRedisStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudRedisClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 CloudRedisClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudRedisClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'redis.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // 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 = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const importInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const importInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const exportInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const exportInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const failoverInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const failoverInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - importInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importInstanceResponse.decode.bind(importInstanceResponse), - importInstanceMetadata.decode.bind(importInstanceMetadata)), - exportInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportInstanceResponse.decode.bind(exportInstanceResponse), - exportInstanceMetadata.decode.bind(exportInstanceMetadata)), - failoverInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - failoverInstanceResponse.decode.bind(failoverInstanceResponse), - failoverInstanceMetadata.decode.bind(failoverInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.redis.v1beta1.CloudRedis', gapicConfig as gax.ClientConfig, - 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.cloudRedisStub) { - return this.cloudRedisStub; - } - - // Put together the "service stub" for - // google.cloud.redis.v1beta1.CloudRedis. - this.cloudRedisStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.redis.v1beta1.CloudRedis') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.redis.v1beta1.CloudRedis, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudRedisStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'importInstance', 'exportInstance', 'failoverInstance', 'deleteInstance']; - for (const methodName of cloudRedisStubMethods) { - const callPromise = this.cloudRedisStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudRedisStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'redis.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'redis.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a specific Redis instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @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 {@link protos.google.cloud.redis.v1beta1.Instance|Instance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.get_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getInstance request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getInstance response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getInstance(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]) => { - this._log.info('getInstance response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a Redis instance based on the specified tier and memory size. - * - * By default, the instance is accessible from the project's - * [default network](/compute/docs/networks-and-firewalls#networks). - * - * The creation is executed asynchronously and callers may check the returned - * operation to track its progress. Once the operation is completed the Redis - * instance will be fully functional. Completed longrunning.Operation will - * contain the new instance object in the response field. - * - * The returned operation is automatically deleted after a few hours, so there - * is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {string} request.instanceId - * Required. The logical name of the Redis instance in the customer project - * with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project / location - * @param {google.cloud.redis.v1beta1.Instance} request.instance - * Required. A Redis [Instance] resource - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.create_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('createInstance request %j', request); - return this.innerApiCalls.createInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.create_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - this._log.info('createInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a specific Redis instance. - * - * Completed longrunning.Operation will contain the new instance object - * in the response field. The returned operation is automatically deleted - * after a few hours, so there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field may only include these - * fields from {@link protos.google.cloud.redis.v1beta1.Instance|Instance}: - * - * * `displayName` - * * `labels` - * * `memorySizeGb` - * * `redisConfig` - * @param {google.cloud.redis.v1beta1.Instance} request.instance - * Required. Update description. - * Only fields specified in update_mask are 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.update_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance.name': request.instance!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('updateInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('updateInstance request %j', request); - return this.innerApiCalls.updateInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.update_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_UpdateInstance_async - */ - async checkUpdateInstanceProgress(name: string): Promise>{ - this._log.info('updateInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - * Redis may stop serving during this operation. Instance state will be - * IMPORTING for entire operation. When complete, the instance will contain - * only data from the imported file. - * - * The returned operation is automatically deleted after a few hours, so - * there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.InputConfig} request.inputConfig - * Required. Specify data to be imported. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.import_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ImportInstance_async - */ - importInstance( - request?: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importInstance( - request: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importInstance( - request: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importInstance( - request?: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('importInstance request %j', request); - return this.innerApiCalls.importInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.import_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ImportInstance_async - */ - async checkImportInstanceProgress(name: string): Promise>{ - this._log.info('importInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. - * - * Redis will continue serving during this operation. - * - * The returned operation is automatically deleted after a few hours, so - * there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.OutputConfig} request.outputConfig - * Required. Specify data to be exported. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.export_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ExportInstance_async - */ - exportInstance( - request?: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportInstance( - request: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInstance( - request: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInstance( - request?: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('exportInstance request %j', request); - return this.innerApiCalls.exportInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.export_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ExportInstance_async - */ - async checkExportInstanceProgress(name: string): Promise>{ - this._log.info('exportInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Initiates a failover of the master node to current replica node for a - * specific STANDARD tier Cloud Memorystore for Redis instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode} [request.dataProtectionMode] - * Optional. Available data protection modes that the user can choose. If it's - * unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.failover_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_FailoverInstance_async - */ - failoverInstance( - request?: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - failoverInstance( - request: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - failoverInstance( - request: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - failoverInstance( - request?: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('failoverInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('failoverInstance request %j', request); - return this.innerApiCalls.failoverInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('failoverInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `failoverInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.failover_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_FailoverInstance_async - */ - async checkFailoverInstanceProgress(name: string): Promise>{ - this._log.info('failoverInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.failoverInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific Redis instance. Instance stops serving and data is - * deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.delete_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('deleteInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('deleteInstance request %j', request); - return this.innerApiCalls.deleteInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.delete_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - this._log.info('deleteInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all Redis instances owned by a project in either the specified - * location (region) or all locations. - * - * The location should have the following format: - * * `projects/{project_id}/locations/{location_id}` - * - * If `location_id` is specified as `-` (wildcard), then all regions - * available to the project are queried, and the results are aggregated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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 Array of {@link protos.google.cloud.redis.v1beta1.Instance|Instance}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listInstancesAsync()` - * 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. - */ - listInstances( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): void; - listInstances( - request: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): void; - listInstances( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInstances values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listInstances request %j', request); - return this.innerApiCalls - .listInstances(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]) => { - this._log.info('listInstances values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listInstances`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.cloud.redis.v1beta1.Instance|Instance} 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 `listInstancesAsync()` - * 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. - */ - listInstancesStream( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInstances stream %j', request); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, 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. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.cloud.redis.v1beta1.Instance|Instance}. 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 include:samples/generated/v1beta1/cloud_redis.list_instances.js - * region_tag:redis_v1beta1_generated_CloudRedis_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInstances iterate %j', request); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.cancelOperation(request, options, callback); - } - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudRedisStub && !this._terminated) { - return this.cloudRedisStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client_config.json.baseline deleted file mode 100644 index bc798a4f1581..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.redis.v1beta1.CloudRedis": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListInstances": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FailoverInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_proto_list.json.baseline deleted file mode 100644 index 6cd147355156..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/cloud_redis_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/redis/v1beta1/cloud_redis.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index d802d85292de..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {CloudRedisClient} from './cloud_redis_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 9a20333d1050..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const redis = require('redis'); - -function main() { - const cloudRedisClient = new redis.CloudRedisClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index e5e4bbbc3502..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as redis from 'redis'; - -function main() { - const cloudRedisClient = new redis.CloudRedisClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index d585e083599a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {CloudRedisClient} from 'redis'; - -// check that the client class type name can be used -function doStuffWithCloudRedisClient(client: CloudRedisClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudRedisClient = new CloudRedisClient(); - doStuffWithCloudRedisClient(cloudRedisClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/test/gapic_cloud_redis_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/test/gapic_cloud_redis_v1beta1.ts.baseline deleted file mode 100644 index b3f5f20a0fa3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/esm/test/gapic_cloud_redis_v1beta1.ts.baseline +++ /dev/null @@ -1,1909 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as cloudredisModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.CloudRedisClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'redis.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = cloudredisModule.v1beta1.CloudRedisClient.servicePath; - assert.strictEqual(servicePath, 'redis.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = cloudredisModule.v1beta1.CloudRedisClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'redis.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new cloudredisModule.v1beta1.CloudRedisClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = cloudredisModule.v1beta1.CloudRedisClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudRedisStub, undefined); - await client.initialize(); - assert(client.cloudRedisStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.cloudRedisStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudRedisStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.redis.v1beta1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importInstance', () => { - it('invokes importInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.importInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportInstance', () => { - it('invokes exportInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('failoverInstance', () => { - it('invokes failoverInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.failoverInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.failoverInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.failoverInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failoverInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failoverInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.failoverInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failoverInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.failoverInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkFailoverInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkFailoverInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkFailoverInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkFailoverInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.redis.v1beta1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.redis.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.redis.v1beta1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.redis.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.redis.v1beta1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.redis.v1beta1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.redis.v1beta1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json b/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json deleted file mode 100644 index 7d0e5005ce24..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "redis", - "version": "0.1.0", - "description": "Redis client for Node.js", - "repository": "googleapis/nodejs-redis", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google redis", - "redis", - "cloud redis" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline deleted file mode 100644 index 4e50413ea9b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.redis.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/redis/v1beta1;redis"; -option java_multiple_files = true; -option java_outer_classname = "CloudRedisServiceBetaProto"; -option java_package = "com.google.cloud.redis.v1beta1"; - -// Configures and manages Cloud Memorystore for Redis instances -// -// Google Cloud Memorystore for Redis v1beta1 -// -// The `redis.googleapis.com` service implements the Google Cloud Memorystore -// for Redis API and defines the following resource model for managing Redis -// instances: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of Redis instances, named: `/instances/*` -// * As such, Redis instances are resources of the form: -// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` -// -// Note that location_id must be refering to a GCP `region`; for example: -// * `projects/redpepper-1290/locations/us-central1/instances/my-redis` -service CloudRedis { - option (google.api.default_host) = "redis.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all Redis instances owned by a project in either the specified - // location (region) or all locations. - // - // The location should have the following format: - // * `projects/{project_id}/locations/{location_id}` - // - // If `location_id` is specified as `-` (wildcard), then all regions - // available to the project are queried, and the results are aggregated. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific Redis instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a Redis instance based on the specified tier and memory size. - // - // By default, the instance is accessible from the project's - // [default network](/compute/docs/networks-and-firewalls#networks). - // - // The creation is executed asynchronously and callers may check the returned - // operation to track its progress. Once the operation is completed the Redis - // instance will be fully functional. Completed longrunning.Operation will - // contain the new instance object in the response field. - // - // The returned operation is automatically deleted after a few hours, so there - // is no need to call DeleteOperation. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance_id,instance"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Updates the metadata and configuration of a specific Redis instance. - // - // Completed longrunning.Operation will contain the new instance object - // in the response field. The returned operation is automatically deleted - // after a few hours, so there is no need to call DeleteOperation. - rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{instance.name=projects/*/locations/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "update_mask,instance"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - // - // Redis may stop serving during this operation. Instance state will be - // IMPORTING for entire operation. When complete, the instance will contain - // only data from the imported file. - // - // The returned operation is automatically deleted after a few hours, so - // there is no need to call DeleteOperation. - rpc ImportInstance(ImportInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:import" - body: "*" - }; - option (google.api.method_signature) = "name,input_config"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Export Redis instance data into a Redis RDB format file in Cloud Storage. - // - // Redis will continue serving during this operation. - // - // The returned operation is automatically deleted after a few hours, so - // there is no need to call DeleteOperation. - rpc ExportInstance(ExportInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:export" - body: "*" - }; - option (google.api.method_signature) = "name,output_config"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Initiates a failover of the master node to current replica node for a - // specific STANDARD tier Cloud Memorystore for Redis instance. - rpc FailoverInstance(FailoverInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:failover" - body: "*" - }; - option (google.api.method_signature) = "name,data_protection_mode"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Deletes a specific Redis instance. Instance stops serving and data is - // deleted. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Any" - }; - } -} - -// A Google Cloud Redis instance. -message Instance { - option (google.api.resource) = { - type: "redis.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // Represents the different states of a Redis instance. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // Redis instance is being created. - CREATING = 1; - - // Redis instance has been created and is fully usable. - READY = 2; - - // Redis instance configuration is being updated. Certain kinds of updates - // may cause the instance to become unusable while the update is in - // progress. - UPDATING = 3; - - // Redis instance is being deleted. - DELETING = 4; - - // Redis instance is being repaired and may be unusable. - REPAIRING = 5; - - // Maintenance is being performed on this Redis instance. - MAINTENANCE = 6; - - // Redis instance is importing data (availability may be affected). - IMPORTING = 8; - - // Redis instance is failing over (availability may be affected). - FAILING_OVER = 10; - } - - // Available service tiers to choose from - enum Tier { - // Not set. - TIER_UNSPECIFIED = 0; - - // BASIC tier: standalone instance - BASIC = 1; - - // STANDARD_HA tier: highly available primary/replica instances - STANDARD_HA = 3; - } - - // Required. Unique name of the resource in this scope including project and - // location using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // - // Note: Redis instances are managed and addressed at regional level so - // location_id here refers to a GCP region; however, users may choose which - // specific zone (or collection of zones for cross-zone instances) an instance - // should be provisioned in. Refer to [location_id] and - // [alternative_location_id] fields for more details. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // An arbitrary and optional user-provided name for the instance. - string display_name = 2; - - // Resource labels to represent user provided metadata - map labels = 3; - - // Optional. The zone where the instance will be provisioned. If not provided, - // the service will choose a zone for the instance. For STANDARD_HA tier, - // instances will be created across two zones for protection against zonal - // failures. If [alternative_location_id] is also provided, it must be - // different from [location_id]. - string location_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only applicable to STANDARD_HA tier which protects the instance - // against zonal failures by provisioning it across two zones. If provided, it - // must be a different zone from the one provided in [location_id]. - string alternative_location_id = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The version of Redis software. - // If not provided, latest supported version will be used. Updating the - // version will perform an upgrade/downgrade to the new version. Currently, - // the supported values are: - // - // * `REDIS_4_0` for Redis 4.0 compatibility (default) - // * `REDIS_3_2` for Redis 3.2 compatibility - string redis_version = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The CIDR range of internal addresses that are reserved for this - // instance. If not provided, the service will choose an unused /29 block, - // for example, 10.0.0.0/29 or 192.168.0.0/29. Ranges must be unique - // and non-overlapping with existing subnets in an authorized network. - string reserved_ip_range = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Hostname or IP address of the exposed Redis endpoint used by - // clients to connect to the service. - string host = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The port number of the exposed Redis endpoint. - int32 port = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current zone where the Redis endpoint is placed. For Basic - // Tier instances, this will always be the same as the [location_id] - // provided by the user at creation time. For Standard Tier instances, - // this can be either [location_id] or [alternative_location_id] and can - // change after a failover event. - string current_location_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this instance. - State state = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // instance, if available. - string status_message = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Redis configuration parameters, according to - // http://redis.io/topics/config. Currently, the only supported parameters - // are: - // - // Redis 3.2 and above: - // - // * maxmemory-policy - // * notify-keyspace-events - // - // Redis 4.0 and above: - // - // * activedefrag - // * lfu-log-factor - // * lfu-decay-time - map redis_configs = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The service tier of the instance. - Tier tier = 17 [(google.api.field_behavior) = REQUIRED]; - - // Required. Redis memory size in GiB. - int32 memory_size_gb = 18 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The full name of the Google Compute Engine - // [network](/compute/docs/networks-and-firewalls#networks) to which the - // instance is connected. If left unspecified, the `default` network - // will be used. - string authorized_network = 20 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Cloud IAM identity used by import / export operations to - // transfer data to/from Cloud Storage. Format is - // "serviceAccount:". The value may change over time - // for a given instance so should be checked before each import/export - // operation. - string persistence_iam_identity = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances]. -message ListInstancesRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 1000 will be used by the service. - // Regardless of the page_size value, the response may include a partial list - // and a caller should only rely on response's - // [next_page_token][CloudRedis.ListInstancesResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, - // if any. - string page_token = 3; -} - -// Response for [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances]. -message ListInstancesResponse { - // A list of Redis instances in the project in the specified location, - // or across all locations. - // - // If the `location_id` in the parent field of the request is "-", all regions - // available to the project are queried, and the results aggregated. - // If in such an aggregated query a location is unavailable, a dummy Redis - // entry is included in the response with the "name" field set to a value of - // the form projects/{project_id}/locations/{location_id}/instances/- and the - // "status" field set to ERROR and "status_message" field set to "location not - // available for ListInstances". - repeated Instance instances = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetInstance][google.cloud.redis.v1beta1.CloudRedis.GetInstance]. -message GetInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; -} - -// Request for [CreateInstance][google.cloud.redis.v1beta1.CloudRedis.CreateInstance]. -message CreateInstanceRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The logical name of the Redis instance in the customer project - // with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project / location - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Redis [Instance] resource - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [UpdateInstance][google.cloud.redis.v1beta1.CloudRedis.UpdateInstance]. -message UpdateInstanceRequest { - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field may only include these - // fields from [Instance][google.cloud.redis.v1beta1.Instance]: - // - // * `displayName` - // * `labels` - // * `memorySizeGb` - // * `redisConfig` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Update description. - // Only fields specified in update_mask are updated. - Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [DeleteInstance][google.cloud.redis.v1beta1.CloudRedis.DeleteInstance]. -message DeleteInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; -} - -// The Cloud Storage location for the input content -message GcsSource { - // Required. Source data URI. (e.g. 'gs://my_bucket/my_object'). - string uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The input content -message InputConfig { - // Required. Specify source location of input data - oneof source { - // Google Cloud Storage location where input content is located. - GcsSource gcs_source = 1; - } -} - -// Request for [Import][google.cloud.redis.v1beta1.CloudRedis.ImportInstance]. -message ImportInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify data to be imported. - InputConfig input_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The Cloud Storage location for the output content -message GcsDestination { - // Required. Data destination URI (e.g. - // 'gs://my_bucket/my_object'). Existing files will be overwritten. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The output content -message OutputConfig { - // Required. Specify destination location of output data - oneof destination { - // Google Cloud Storage destination for output content. - GcsDestination gcs_destination = 1; - } -} - -// Request for [Export][google.cloud.redis.v1beta1.CloudRedis.ExportInstance]. -message ExportInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify data to be exported. - OutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [Failover][google.cloud.redis.v1beta1.CloudRedis.FailoverInstance]. -message FailoverInstanceRequest { - enum DataProtectionMode { - // Defaults to LIMITED_DATA_LOSS if a data protection mode is not - // specified. - DATA_PROTECTION_MODE_UNSPECIFIED = 0; - - // Instance failover will be protected with data loss control. More - // specifically, the failover will only be performed if the current - // replication offset diff between master and replica is under a certain - // threshold. - LIMITED_DATA_LOSS = 1; - - // Instance failover will be performed without data loss control. - FORCE_DATA_LOSS = 2; - } - - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; - - // Optional. Available data protection modes that the user can choose. If it's - // unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - DataProtectionMode data_protection_mode = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// This location metadata represents additional configuration options for a -// given location where a Redis instance may be created. All fields are output -// only. It is returned as content of the -// `google.cloud.location.Location.metadata` field. -message LocationMetadata { - // Output only. The set of available zones in the location. The map is keyed - // by the lowercase ID of each zone, as defined by GCE. These keys can be - // specified in `location_id` or `alternative_location_id` fields when - // creating a Redis instance. - map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Defines specific information for a particular zone. Currently empty and -// reserved for future use only. -message ZoneMetadata { - -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline deleted file mode 100644 index 52973fe93336..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, instanceId, instance) { - // [START redis_v1beta1_generated_CloudRedis_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Redis instance in the customer project - * with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project / location - */ - // const instanceId = 'abc123' - /** - * Required. A Redis Instance resource - */ - // const instance = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await redisClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END redis_v1beta1_generated_CloudRedis_CreateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline deleted file mode 100644 index af2e9487e262..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_DeleteInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await redisClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END redis_v1beta1_generated_CloudRedis_DeleteInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline deleted file mode 100644 index f8f56c450958..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, outputConfig) { - // [START redis_v1beta1_generated_CloudRedis_ExportInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Required. Specify data to be exported. - */ - // const outputConfig = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callExportInstance() { - // Construct request - const request = { - name, - outputConfig, - }; - - // Run request - const [operation] = await redisClient.exportInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportInstance(); - // [END redis_v1beta1_generated_CloudRedis_ExportInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline deleted file mode 100644 index a47ef6a0a345..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_FailoverInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Optional. Available data protection modes that the user can choose. If it's - * unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - */ - // const dataProtectionMode = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callFailoverInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await redisClient.failoverInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callFailoverInstance(); - // [END redis_v1beta1_generated_CloudRedis_FailoverInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline deleted file mode 100644 index efb6257aeeb7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_GetInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await redisClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END redis_v1beta1_generated_CloudRedis_GetInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline deleted file mode 100644 index 19b3072d5c74..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, inputConfig) { - // [START redis_v1beta1_generated_CloudRedis_ImportInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Required. Specify data to be imported. - */ - // const inputConfig = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callImportInstance() { - // Construct request - const request = { - name, - inputConfig, - }; - - // Run request - const [operation] = await redisClient.importInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportInstance(); - // [END redis_v1beta1_generated_CloudRedis_ImportInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline deleted file mode 100644 index 2e2883de1239..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START redis_v1beta1_generated_CloudRedis_ListInstances_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * next_page_token CloudRedis.ListInstancesResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, - * if any. - */ - // const pageToken = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = redisClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END redis_v1beta1_generated_CloudRedis_ListInstances_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline deleted file mode 100644 index eacb0acea2a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(updateMask, instance) { - // [START redis_v1beta1_generated_CloudRedis_UpdateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field may only include these - * fields from Instance google.cloud.redis.v1beta1.Instance: - * * `displayName` - * * `labels` - * * `memorySizeGb` - * * `redisConfig` - */ - // const updateMask = {} - /** - * Required. Update description. - * Only fields specified in update_mask are updated. - */ - // const instance = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - updateMask, - instance, - }; - - // Run request - const [operation] = await redisClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END redis_v1beta1_generated_CloudRedis_UpdateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline deleted file mode 100644 index 906398d8f64a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline +++ /dev/null @@ -1,367 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-redis", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.redis.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ListInstances_async", - "title": "CloudRedis listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.", - "canonical": true, - "file": "cloud_redis.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.redis.v1beta1.ListInstancesResponse", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ListInstances", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_GetInstance_async", - "title": "CloudRedis getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific Redis instance.", - "canonical": true, - "file": "cloud_redis.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.redis.v1beta1.Instance", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.GetInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_CreateInstance_async", - "title": "CloudRedis createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](/compute/docs/networks-and-firewalls#networks). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.redis.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.CreateInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_UpdateInstance_async", - "title": "CloudRedis updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "instance", - "type": ".google.cloud.redis.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.UpdateInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ImportInstance_async", - "title": "CloudRedis importInstance Sample", - "origin": "API_DEFINITION", - "description": " Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.import_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ImportInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.redis.v1beta1.InputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ImportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ImportInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ExportInstance_async", - "title": "CloudRedis exportInstance Sample", - "origin": "API_DEFINITION", - "description": " Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.export_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ExportInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.redis.v1beta1.OutputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ExportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ExportInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_FailoverInstance_async", - "title": "CloudRedis failoverInstance Sample", - "origin": "API_DEFINITION", - "description": " Initiates a failover of the master node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.", - "canonical": true, - "file": "cloud_redis.failover_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FailoverInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.FailoverInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data_protection_mode", - "type": ".google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "FailoverInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.FailoverInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_DeleteInstance_async", - "title": "CloudRedis deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific Redis instance. Instance stops serving and data is deleted.", - "canonical": true, - "file": "cloud_redis.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.DeleteInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/redis-esm/webpack.config.cjs.baseline deleted file mode 100644 index c8446c2163ea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'CloudRedis', - filename: './cloud-redis.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.OwlBot.yaml.baseline deleted file mode 100644 index 8dfcb02ee2fb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/redis/google-cloud-redis-nodejs - dest: /owl-bot-staging/google-cloud-redis - -api-name: redis \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.jsdoc.js.baseline deleted file mode 100644 index 9e8f82dacf2c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'redis', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/redis/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/redis/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/redis/README.md.baseline deleted file mode 100644 index ed65a37a7d3e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Redis: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/redis.svg)](https://www.npmjs.org/package/redis) - -Redis client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Redis Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/redis/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Redis API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install redis -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install redis@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=redis.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-redis diff --git a/core/generator/gapic-generator-typescript/baselines/redis/package.json b/core/generator/gapic-generator-typescript/baselines/redis/package.json deleted file mode 100644 index 0997ee995e3c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "redis", - "version": "0.1.0", - "description": "Redis client for Node.js", - "repository": "googleapis/nodejs-redis", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google redis", - "redis", - "cloud redis" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline b/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline deleted file mode 100644 index 4e50413ea9b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/protos/google/cloud/redis/v1beta1/cloud_redis.proto.baseline +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.redis.v1beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/redis/v1beta1;redis"; -option java_multiple_files = true; -option java_outer_classname = "CloudRedisServiceBetaProto"; -option java_package = "com.google.cloud.redis.v1beta1"; - -// Configures and manages Cloud Memorystore for Redis instances -// -// Google Cloud Memorystore for Redis v1beta1 -// -// The `redis.googleapis.com` service implements the Google Cloud Memorystore -// for Redis API and defines the following resource model for managing Redis -// instances: -// * The service works with a collection of cloud projects, named: `/projects/*` -// * Each project has a collection of available locations, named: `/locations/*` -// * Each location has a collection of Redis instances, named: `/instances/*` -// * As such, Redis instances are resources of the form: -// `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` -// -// Note that location_id must be refering to a GCP `region`; for example: -// * `projects/redpepper-1290/locations/us-central1/instances/my-redis` -service CloudRedis { - option (google.api.default_host) = "redis.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all Redis instances owned by a project in either the specified - // location (region) or all locations. - // - // The location should have the following format: - // * `projects/{project_id}/locations/{location_id}` - // - // If `location_id` is specified as `-` (wildcard), then all regions - // available to the project are queried, and the results are aggregated. - rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=projects/*/locations/*}/instances" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the details of a specific Redis instance. - rpc GetInstance(GetInstanceRequest) returns (Instance) { - option (google.api.http) = { - get: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a Redis instance based on the specified tier and memory size. - // - // By default, the instance is accessible from the project's - // [default network](/compute/docs/networks-and-firewalls#networks). - // - // The creation is executed asynchronously and callers may check the returned - // operation to track its progress. Once the operation is completed the Redis - // instance will be fully functional. Completed longrunning.Operation will - // contain the new instance object in the response field. - // - // The returned operation is automatically deleted after a few hours, so there - // is no need to call DeleteOperation. - rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=projects/*/locations/*}/instances" - body: "instance" - }; - option (google.api.method_signature) = "parent,instance_id,instance"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Updates the metadata and configuration of a specific Redis instance. - // - // Completed longrunning.Operation will contain the new instance object - // in the response field. The returned operation is automatically deleted - // after a few hours, so there is no need to call DeleteOperation. - rpc UpdateInstance(UpdateInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1beta1/{instance.name=projects/*/locations/*/instances/*}" - body: "instance" - }; - option (google.api.method_signature) = "update_mask,instance"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - // - // Redis may stop serving during this operation. Instance state will be - // IMPORTING for entire operation. When complete, the instance will contain - // only data from the imported file. - // - // The returned operation is automatically deleted after a few hours, so - // there is no need to call DeleteOperation. - rpc ImportInstance(ImportInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:import" - body: "*" - }; - option (google.api.method_signature) = "name,input_config"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Export Redis instance data into a Redis RDB format file in Cloud Storage. - // - // Redis will continue serving during this operation. - // - // The returned operation is automatically deleted after a few hours, so - // there is no need to call DeleteOperation. - rpc ExportInstance(ExportInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:export" - body: "*" - }; - option (google.api.method_signature) = "name,output_config"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Initiates a failover of the master node to current replica node for a - // specific STANDARD tier Cloud Memorystore for Redis instance. - rpc FailoverInstance(FailoverInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{name=projects/*/locations/*/instances/*}:failover" - body: "*" - }; - option (google.api.method_signature) = "name,data_protection_mode"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.redis.v1beta1.Instance" - metadata_type: "google.protobuf.Any" - }; - } - - // Deletes a specific Redis instance. Instance stops serving and data is - // deleted. - rpc DeleteInstance(DeleteInstanceRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1beta1/{name=projects/*/locations/*/instances/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "google.protobuf.Any" - }; - } -} - -// A Google Cloud Redis instance. -message Instance { - option (google.api.resource) = { - type: "redis.googleapis.com/Instance" - pattern: "projects/{project}/locations/{location}/instances/{instance}" - }; - - // Represents the different states of a Redis instance. - enum State { - // Not set. - STATE_UNSPECIFIED = 0; - - // Redis instance is being created. - CREATING = 1; - - // Redis instance has been created and is fully usable. - READY = 2; - - // Redis instance configuration is being updated. Certain kinds of updates - // may cause the instance to become unusable while the update is in - // progress. - UPDATING = 3; - - // Redis instance is being deleted. - DELETING = 4; - - // Redis instance is being repaired and may be unusable. - REPAIRING = 5; - - // Maintenance is being performed on this Redis instance. - MAINTENANCE = 6; - - // Redis instance is importing data (availability may be affected). - IMPORTING = 8; - - // Redis instance is failing over (availability may be affected). - FAILING_OVER = 10; - } - - // Available service tiers to choose from - enum Tier { - // Not set. - TIER_UNSPECIFIED = 0; - - // BASIC tier: standalone instance - BASIC = 1; - - // STANDARD_HA tier: highly available primary/replica instances - STANDARD_HA = 3; - } - - // Required. Unique name of the resource in this scope including project and - // location using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // - // Note: Redis instances are managed and addressed at regional level so - // location_id here refers to a GCP region; however, users may choose which - // specific zone (or collection of zones for cross-zone instances) an instance - // should be provisioned in. Refer to [location_id] and - // [alternative_location_id] fields for more details. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // An arbitrary and optional user-provided name for the instance. - string display_name = 2; - - // Resource labels to represent user provided metadata - map labels = 3; - - // Optional. The zone where the instance will be provisioned. If not provided, - // the service will choose a zone for the instance. For STANDARD_HA tier, - // instances will be created across two zones for protection against zonal - // failures. If [alternative_location_id] is also provided, it must be - // different from [location_id]. - string location_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only applicable to STANDARD_HA tier which protects the instance - // against zonal failures by provisioning it across two zones. If provided, it - // must be a different zone from the one provided in [location_id]. - string alternative_location_id = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The version of Redis software. - // If not provided, latest supported version will be used. Updating the - // version will perform an upgrade/downgrade to the new version. Currently, - // the supported values are: - // - // * `REDIS_4_0` for Redis 4.0 compatibility (default) - // * `REDIS_3_2` for Redis 3.2 compatibility - string redis_version = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The CIDR range of internal addresses that are reserved for this - // instance. If not provided, the service will choose an unused /29 block, - // for example, 10.0.0.0/29 or 192.168.0.0/29. Ranges must be unique - // and non-overlapping with existing subnets in an authorized network. - string reserved_ip_range = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Hostname or IP address of the exposed Redis endpoint used by - // clients to connect to the service. - string host = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The port number of the exposed Redis endpoint. - int32 port = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current zone where the Redis endpoint is placed. For Basic - // Tier instances, this will always be the same as the [location_id] - // provided by the user at creation time. For Standard Tier instances, - // this can be either [location_id] or [alternative_location_id] and can - // change after a failover event. - string current_location_id = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the instance was created. - google.protobuf.Timestamp create_time = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of this instance. - State state = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Additional information about the current status of this - // instance, if available. - string status_message = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Redis configuration parameters, according to - // http://redis.io/topics/config. Currently, the only supported parameters - // are: - // - // Redis 3.2 and above: - // - // * maxmemory-policy - // * notify-keyspace-events - // - // Redis 4.0 and above: - // - // * activedefrag - // * lfu-log-factor - // * lfu-decay-time - map redis_configs = 16 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The service tier of the instance. - Tier tier = 17 [(google.api.field_behavior) = REQUIRED]; - - // Required. Redis memory size in GiB. - int32 memory_size_gb = 18 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The full name of the Google Compute Engine - // [network](/compute/docs/networks-and-firewalls#networks) to which the - // instance is connected. If left unspecified, the `default` network - // will be used. - string authorized_network = 20 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Cloud IAM identity used by import / export operations to - // transfer data to/from Cloud Storage. Format is - // "serviceAccount:". The value may change over time - // for a given instance so should be checked before each import/export - // operation. - string persistence_iam_identity = 21 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances]. -message ListInstancesRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of items to return. - // - // If not specified, a default value of 1000 will be used by the service. - // Regardless of the page_size value, the response may include a partial list - // and a caller should only rely on response's - // [next_page_token][CloudRedis.ListInstancesResponse.next_page_token] - // to determine if there are more instances left to be queried. - int32 page_size = 2; - - // The next_page_token value returned from a previous List request, - // if any. - string page_token = 3; -} - -// Response for [ListInstances][google.cloud.redis.v1beta1.CloudRedis.ListInstances]. -message ListInstancesResponse { - // A list of Redis instances in the project in the specified location, - // or across all locations. - // - // If the `location_id` in the parent field of the request is "-", all regions - // available to the project are queried, and the results aggregated. - // If in such an aggregated query a location is unavailable, a dummy Redis - // entry is included in the response with the "name" field set to a value of - // the form projects/{project_id}/locations/{location_id}/instances/- and the - // "status" field set to ERROR and "status_message" field set to "location not - // available for ListInstances". - repeated Instance instances = 1; - - // Token to retrieve the next page of results, or empty if there are no more - // results in the list. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [GetInstance][google.cloud.redis.v1beta1.CloudRedis.GetInstance]. -message GetInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; -} - -// Request for [CreateInstance][google.cloud.redis.v1beta1.CloudRedis.CreateInstance]. -message CreateInstanceRequest { - // Required. The resource name of the instance location using the form: - // `projects/{project_id}/locations/{location_id}` - // where `location_id` refers to a GCP region. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The logical name of the Redis instance in the customer project - // with the following restrictions: - // - // * Must contain only lowercase letters, numbers, and hyphens. - // * Must start with a letter. - // * Must be between 1-40 characters. - // * Must end with a number or a letter. - // * Must be unique within the customer project / location - string instance_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A Redis [Instance] resource - Instance instance = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [UpdateInstance][google.cloud.redis.v1beta1.CloudRedis.UpdateInstance]. -message UpdateInstanceRequest { - // Required. Mask of fields to update. At least one path must be supplied in - // this field. The elements of the repeated paths field may only include these - // fields from [Instance][google.cloud.redis.v1beta1.Instance]: - // - // * `displayName` - // * `labels` - // * `memorySizeGb` - // * `redisConfig` - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Update description. - // Only fields specified in update_mask are updated. - Instance instance = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [DeleteInstance][google.cloud.redis.v1beta1.CloudRedis.DeleteInstance]. -message DeleteInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; -} - -// The Cloud Storage location for the input content -message GcsSource { - // Required. Source data URI. (e.g. 'gs://my_bucket/my_object'). - string uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The input content -message InputConfig { - // Required. Specify source location of input data - oneof source { - // Google Cloud Storage location where input content is located. - GcsSource gcs_source = 1; - } -} - -// Request for [Import][google.cloud.redis.v1beta1.CloudRedis.ImportInstance]. -message ImportInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify data to be imported. - InputConfig input_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// The Cloud Storage location for the output content -message GcsDestination { - // Required. Data destination URI (e.g. - // 'gs://my_bucket/my_object'). Existing files will be overwritten. - string uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The output content -message OutputConfig { - // Required. Specify destination location of output data - oneof destination { - // Google Cloud Storage destination for output content. - GcsDestination gcs_destination = 1; - } -} - -// Request for [Export][google.cloud.redis.v1beta1.CloudRedis.ExportInstance]. -message ExportInstanceRequest { - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify data to be exported. - OutputConfig output_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for [Failover][google.cloud.redis.v1beta1.CloudRedis.FailoverInstance]. -message FailoverInstanceRequest { - enum DataProtectionMode { - // Defaults to LIMITED_DATA_LOSS if a data protection mode is not - // specified. - DATA_PROTECTION_MODE_UNSPECIFIED = 0; - - // Instance failover will be protected with data loss control. More - // specifically, the failover will only be performed if the current - // replication offset diff between master and replica is under a certain - // threshold. - LIMITED_DATA_LOSS = 1; - - // Instance failover will be performed without data loss control. - FORCE_DATA_LOSS = 2; - } - - // Required. Redis instance resource name using the form: - // `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - // where `location_id` refers to a GCP region. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "redis.googleapis.com/Instance" - } - ]; - - // Optional. Available data protection modes that the user can choose. If it's - // unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - DataProtectionMode data_protection_mode = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// This location metadata represents additional configuration options for a -// given location where a Redis instance may be created. All fields are output -// only. It is returned as content of the -// `google.cloud.location.Location.metadata` field. -message LocationMetadata { - // Output only. The set of available zones in the location. The map is keyed - // by the lowercase ID of each zone, as defined by GCE. These keys can be - // specified in `location_id` or `alternative_location_id` fields when - // creating a Redis instance. - map available_zones = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Defines specific information for a particular zone. Currently empty and -// reserved for future use only. -message ZoneMetadata { - -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline deleted file mode 100644 index 52973fe93336..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.create_instance.js.baseline +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, instanceId, instance) { - // [START redis_v1beta1_generated_CloudRedis_CreateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - */ - // const parent = 'abc123' - /** - * Required. The logical name of the Redis instance in the customer project - * with the following restrictions: - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project / location - */ - // const instanceId = 'abc123' - /** - * Required. A Redis Instance resource - */ - // const instance = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callCreateInstance() { - // Construct request - const request = { - parent, - instanceId, - instance, - }; - - // Run request - const [operation] = await redisClient.createInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateInstance(); - // [END redis_v1beta1_generated_CloudRedis_CreateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline deleted file mode 100644 index af2e9487e262..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.delete_instance.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_DeleteInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callDeleteInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await redisClient.deleteInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteInstance(); - // [END redis_v1beta1_generated_CloudRedis_DeleteInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline deleted file mode 100644 index f8f56c450958..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.export_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, outputConfig) { - // [START redis_v1beta1_generated_CloudRedis_ExportInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Required. Specify data to be exported. - */ - // const outputConfig = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callExportInstance() { - // Construct request - const request = { - name, - outputConfig, - }; - - // Run request - const [operation] = await redisClient.exportInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportInstance(); - // [END redis_v1beta1_generated_CloudRedis_ExportInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline deleted file mode 100644 index a47ef6a0a345..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.failover_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_FailoverInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Optional. Available data protection modes that the user can choose. If it's - * unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - */ - // const dataProtectionMode = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callFailoverInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await redisClient.failoverInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callFailoverInstance(); - // [END redis_v1beta1_generated_CloudRedis_FailoverInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline deleted file mode 100644 index efb6257aeeb7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.get_instance.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START redis_v1beta1_generated_CloudRedis_GetInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callGetInstance() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await redisClient.getInstance(request); - console.log(response); - } - - callGetInstance(); - // [END redis_v1beta1_generated_CloudRedis_GetInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline deleted file mode 100644 index 19b3072d5c74..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.import_instance.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name, inputConfig) { - // [START redis_v1beta1_generated_CloudRedis_ImportInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - */ - // const name = 'abc123' - /** - * Required. Specify data to be imported. - */ - // const inputConfig = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callImportInstance() { - // Construct request - const request = { - name, - inputConfig, - }; - - // Run request - const [operation] = await redisClient.importInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportInstance(); - // [END redis_v1beta1_generated_CloudRedis_ImportInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline deleted file mode 100644 index 2e2883de1239..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.list_instances.js.baseline +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START redis_v1beta1_generated_CloudRedis_ListInstances_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - */ - // const parent = 'abc123' - /** - * The maximum number of items to return. - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * next_page_token CloudRedis.ListInstancesResponse.next_page_token - * to determine if there are more instances left to be queried. - */ - // const pageSize = 1234 - /** - * The next_page_token value returned from a previous List request, - * if any. - */ - // const pageToken = 'abc123' - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callListInstances() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = redisClient.listInstancesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListInstances(); - // [END redis_v1beta1_generated_CloudRedis_ListInstances_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline deleted file mode 100644 index eacb0acea2a5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/cloud_redis.update_instance.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(updateMask, instance) { - // [START redis_v1beta1_generated_CloudRedis_UpdateInstance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field may only include these - * fields from Instance google.cloud.redis.v1beta1.Instance: - * * `displayName` - * * `labels` - * * `memorySizeGb` - * * `redisConfig` - */ - // const updateMask = {} - /** - * Required. Update description. - * Only fields specified in update_mask are updated. - */ - // const instance = {} - - // Imports the Redis library - const {CloudRedisClient} = require('redis').v1beta1; - - // Instantiates a client - const redisClient = new CloudRedisClient(); - - async function callUpdateInstance() { - // Construct request - const request = { - updateMask, - instance, - }; - - // Run request - const [operation] = await redisClient.updateInstance(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateInstance(); - // [END redis_v1beta1_generated_CloudRedis_UpdateInstance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline deleted file mode 100644 index 906398d8f64a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/samples/generated/v1beta1/snippet_metadata_google.cloud.redis.v1beta1.json.baseline +++ /dev/null @@ -1,367 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-redis", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.redis.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ListInstances_async", - "title": "CloudRedis listInstances Sample", - "origin": "API_DEFINITION", - "description": " Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format: * `projects/{project_id}/locations/{location_id}` If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.", - "canonical": true, - "file": "cloud_redis.list_instances.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 71, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListInstances", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ListInstances", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.redis.v1beta1.ListInstancesResponse", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ListInstances", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ListInstances", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_GetInstance_async", - "title": "CloudRedis getInstance Sample", - "origin": "API_DEFINITION", - "description": " Gets the details of a specific Redis instance.", - "canonical": true, - "file": "cloud_redis.get_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.GetInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.redis.v1beta1.Instance", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "GetInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.GetInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_CreateInstance_async", - "title": "CloudRedis createInstance Sample", - "origin": "API_DEFINITION", - "description": " Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](/compute/docs/networks-and-firewalls#networks). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.create_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.CreateInstance", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "instance_id", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": ".google.cloud.redis.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "CreateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.CreateInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_UpdateInstance_async", - "title": "CloudRedis updateInstance Sample", - "origin": "API_DEFINITION", - "description": " Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.update_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.UpdateInstance", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "instance", - "type": ".google.cloud.redis.v1beta1.Instance" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "UpdateInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.UpdateInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ImportInstance_async", - "title": "CloudRedis importInstance Sample", - "origin": "API_DEFINITION", - "description": " Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.import_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ImportInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.redis.v1beta1.InputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ImportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ImportInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_ExportInstance_async", - "title": "CloudRedis exportInstance Sample", - "origin": "API_DEFINITION", - "description": " Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.", - "canonical": true, - "file": "cloud_redis.export_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ExportInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.redis.v1beta1.OutputConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "ExportInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.ExportInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_FailoverInstance_async", - "title": "CloudRedis failoverInstance Sample", - "origin": "API_DEFINITION", - "description": " Initiates a failover of the master node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.", - "canonical": true, - "file": "cloud_redis.failover_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FailoverInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.FailoverInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "data_protection_mode", - "type": ".google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "FailoverInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.FailoverInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - }, - { - "regionTag": "redis_v1beta1_generated_CloudRedis_DeleteInstance_async", - "title": "CloudRedis deleteInstance Sample", - "origin": "API_DEFINITION", - "description": " Deletes a specific Redis instance. Instance stops serving and data is deleted.", - "canonical": true, - "file": "cloud_redis.delete_instance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.DeleteInstance", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CloudRedisClient", - "fullName": "google.cloud.redis.v1beta1.CloudRedisClient" - }, - "method": { - "shortName": "DeleteInstance", - "fullName": "google.cloud.redis.v1beta1.CloudRedis.DeleteInstance", - "service": { - "shortName": "CloudRedis", - "fullName": "google.cloud.redis.v1beta1.CloudRedis" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/src/index.ts.baseline deleted file mode 100644 index 1e69afad6583..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const CloudRedisClient = v1beta1.CloudRedisClient; -type CloudRedisClient = v1beta1.CloudRedisClient; -export {v1beta1, CloudRedisClient}; -export default {v1beta1, CloudRedisClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client.ts.baseline deleted file mode 100644 index 5aa29671579a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client.ts.baseline +++ /dev/null @@ -1,1780 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/cloud_redis_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_redis_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Configures and manages Cloud Memorystore for Redis instances - * - * Google Cloud Memorystore for Redis v1beta1 - * - * The `redis.googleapis.com` service implements the Google Cloud Memorystore - * for Redis API and defines the following resource model for managing Redis - * instances: - * * The service works with a collection of cloud projects, named: `/projects/*` - * * Each project has a collection of available locations, named: `/locations/*` - * * Each location has a collection of Redis instances, named: `/instances/*` - * * As such, Redis instances are resources of the form: - * `/projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * - * Note that location_id must be refering to a GCP `region`; for example: - * * `projects/redpepper-1290/locations/us-central1/instances/my-redis` - * @class - * @memberof v1beta1 - */ -export class CloudRedisClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('redis'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - cloudRedisStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudRedisClient. - * - * @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://cloud.google.com/docs/authentication/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 CloudRedisClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudRedisClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'redis.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/instances/{instance}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // 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 = { - listInstances: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'instances') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const createInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const updateInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const updateInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const importInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const importInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const exportInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const exportInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const failoverInstanceResponse = protoFilesRoot.lookup( - '.google.cloud.redis.v1beta1.Instance') as gax.protobuf.Type; - const failoverInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - const deleteInstanceResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteInstanceMetadata = protoFilesRoot.lookup( - '.google.protobuf.Any') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createInstanceResponse.decode.bind(createInstanceResponse), - createInstanceMetadata.decode.bind(createInstanceMetadata)), - updateInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateInstanceResponse.decode.bind(updateInstanceResponse), - updateInstanceMetadata.decode.bind(updateInstanceMetadata)), - importInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importInstanceResponse.decode.bind(importInstanceResponse), - importInstanceMetadata.decode.bind(importInstanceMetadata)), - exportInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportInstanceResponse.decode.bind(exportInstanceResponse), - exportInstanceMetadata.decode.bind(exportInstanceMetadata)), - failoverInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - failoverInstanceResponse.decode.bind(failoverInstanceResponse), - failoverInstanceMetadata.decode.bind(failoverInstanceMetadata)), - deleteInstance: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteInstanceResponse.decode.bind(deleteInstanceResponse), - deleteInstanceMetadata.decode.bind(deleteInstanceMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.redis.v1beta1.CloudRedis', gapicConfig as gax.ClientConfig, - 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.cloudRedisStub) { - return this.cloudRedisStub; - } - - // Put together the "service stub" for - // google.cloud.redis.v1beta1.CloudRedis. - this.cloudRedisStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.redis.v1beta1.CloudRedis') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.redis.v1beta1.CloudRedis, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudRedisStubMethods = - ['listInstances', 'getInstance', 'createInstance', 'updateInstance', 'importInstance', 'exportInstance', 'failoverInstance', 'deleteInstance']; - for (const methodName of cloudRedisStubMethods) { - const callPromise = this.cloudRedisStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.cloudRedisStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'redis.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'redis.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the details of a specific Redis instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @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 {@link protos.google.cloud.redis.v1beta1.Instance|Instance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.get_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_GetInstance_async - */ - getInstance( - request?: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]>; - getInstance( - request: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - callback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): void; - getInstance( - request?: protos.google.cloud.redis.v1beta1.IGetInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getInstance request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getInstance response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getInstance(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.redis.v1beta1.IInstance, - protos.google.cloud.redis.v1beta1.IGetInstanceRequest|undefined, - {}|undefined - ]) => { - this._log.info('getInstance response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a Redis instance based on the specified tier and memory size. - * - * By default, the instance is accessible from the project's - * [default network](/compute/docs/networks-and-firewalls#networks). - * - * The creation is executed asynchronously and callers may check the returned - * operation to track its progress. Once the operation is completed the Redis - * instance will be fully functional. Completed longrunning.Operation will - * contain the new instance object in the response field. - * - * The returned operation is automatically deleted after a few hours, so there - * is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {string} request.instanceId - * Required. The logical name of the Redis instance in the customer project - * with the following restrictions: - * - * * Must contain only lowercase letters, numbers, and hyphens. - * * Must start with a letter. - * * Must be between 1-40 characters. - * * Must end with a number or a letter. - * * Must be unique within the customer project / location - * @param {google.cloud.redis.v1beta1.Instance} request.instance - * Required. A Redis [Instance] resource - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.create_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_CreateInstance_async - */ - createInstance( - request?: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createInstance( - request: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createInstance( - request?: protos.google.cloud.redis.v1beta1.ICreateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('createInstance request %j', request); - return this.innerApiCalls.createInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.create_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_CreateInstance_async - */ - async checkCreateInstanceProgress(name: string): Promise>{ - this._log.info('createInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the metadata and configuration of a specific Redis instance. - * - * Completed longrunning.Operation will contain the new instance object - * in the response field. The returned operation is automatically deleted - * after a few hours, so there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Mask of fields to update. At least one path must be supplied in - * this field. The elements of the repeated paths field may only include these - * fields from {@link protos.google.cloud.redis.v1beta1.Instance|Instance}: - * - * * `displayName` - * * `labels` - * * `memorySizeGb` - * * `redisConfig` - * @param {google.cloud.redis.v1beta1.Instance} request.instance - * Required. Update description. - * Only fields specified in update_mask are 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.update_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_UpdateInstance_async - */ - updateInstance( - request?: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateInstance( - request: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateInstance( - request?: protos.google.cloud.redis.v1beta1.IUpdateInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'instance.name': request.instance!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('updateInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('updateInstance request %j', request); - return this.innerApiCalls.updateInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `updateInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.update_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_UpdateInstance_async - */ - async checkUpdateInstanceProgress(name: string): Promise>{ - this._log.info('updateInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. - * - * Redis may stop serving during this operation. Instance state will be - * IMPORTING for entire operation. When complete, the instance will contain - * only data from the imported file. - * - * The returned operation is automatically deleted after a few hours, so - * there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.InputConfig} request.inputConfig - * Required. Specify data to be imported. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.import_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ImportInstance_async - */ - importInstance( - request?: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importInstance( - request: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importInstance( - request: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importInstance( - request?: protos.google.cloud.redis.v1beta1.IImportInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('importInstance request %j', request); - return this.innerApiCalls.importInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.import_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ImportInstance_async - */ - async checkImportInstanceProgress(name: string): Promise>{ - this._log.info('importInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Export Redis instance data into a Redis RDB format file in Cloud Storage. - * - * Redis will continue serving during this operation. - * - * The returned operation is automatically deleted after a few hours, so - * there is no need to call DeleteOperation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.OutputConfig} request.outputConfig - * Required. Specify data to be exported. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.export_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ExportInstance_async - */ - exportInstance( - request?: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportInstance( - request: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInstance( - request: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInstance( - request?: protos.google.cloud.redis.v1beta1.IExportInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('exportInstance request %j', request); - return this.innerApiCalls.exportInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.export_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_ExportInstance_async - */ - async checkExportInstanceProgress(name: string): Promise>{ - this._log.info('exportInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Initiates a failover of the master node to current replica node for a - * specific STANDARD tier Cloud Memorystore for Redis instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @param {google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode} [request.dataProtectionMode] - * Optional. Available data protection modes that the user can choose. If it's - * unspecified, data protection mode will be LIMITED_DATA_LOSS by default. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.failover_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_FailoverInstance_async - */ - failoverInstance( - request?: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - failoverInstance( - request: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - failoverInstance( - request: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - failoverInstance( - request?: protos.google.cloud.redis.v1beta1.IFailoverInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('failoverInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('failoverInstance request %j', request); - return this.innerApiCalls.failoverInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('failoverInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `failoverInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.failover_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_FailoverInstance_async - */ - async checkFailoverInstanceProgress(name: string): Promise>{ - this._log.info('failoverInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.failoverInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a specific Redis instance. Instance stops serving and data is - * deleted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Redis instance resource name using the form: - * `projects/{project_id}/locations/{location_id}/instances/{instance_id}` - * where `location_id` refers to a GCP region. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.delete_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_DeleteInstance_async - */ - deleteInstance( - request?: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteInstance( - request: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteInstance( - request?: protos.google.cloud.redis.v1beta1.IDeleteInstanceRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('deleteInstance response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('deleteInstance request %j', request); - return this.innerApiCalls.deleteInstance(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteInstance response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `deleteInstance()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/cloud_redis.delete_instance.js - * region_tag:redis_v1beta1_generated_CloudRedis_DeleteInstance_async - */ - async checkDeleteInstanceProgress(name: string): Promise>{ - this._log.info('deleteInstance long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteInstance, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all Redis instances owned by a project in either the specified - * location (region) or all locations. - * - * The location should have the following format: - * * `projects/{project_id}/locations/{location_id}` - * - * If `location_id` is specified as `-` (wildcard), then all regions - * available to the project are queried, and the results are aggregated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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 Array of {@link protos.google.cloud.redis.v1beta1.Instance|Instance}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listInstancesAsync()` - * 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. - */ - listInstances( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]>; - listInstances( - request: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): void; - listInstances( - request: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - callback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): void; - listInstances( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>, - callback?: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>): - Promise<[ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.redis.v1beta1.IListInstancesRequest, - protos.google.cloud.redis.v1beta1.IListInstancesResponse|null|undefined, - protos.google.cloud.redis.v1beta1.IInstance>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listInstances values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listInstances request %j', request); - return this.innerApiCalls - .listInstances(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.redis.v1beta1.IInstance[], - protos.google.cloud.redis.v1beta1.IListInstancesRequest|null, - protos.google.cloud.redis.v1beta1.IListInstancesResponse - ]) => { - this._log.info('listInstances values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listInstances`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.cloud.redis.v1beta1.Instance|Instance} 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 `listInstancesAsync()` - * 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. - */ - listInstancesStream( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInstances stream %j', request); - return this.descriptors.page.listInstances.createStream( - this.innerApiCalls.listInstances as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listInstances`, 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. The resource name of the instance location using the form: - * `projects/{project_id}/locations/{location_id}` - * where `location_id` refers to a GCP region. - * @param {number} request.pageSize - * The maximum number of items to return. - * - * If not specified, a default value of 1000 will be used by the service. - * Regardless of the page_size value, the response may include a partial list - * and a caller should only rely on response's - * {@link protos.CloudRedis.ListInstancesResponse.next_page_token|next_page_token} - * to determine if there are more instances left to be queried. - * @param {string} request.pageToken - * The next_page_token value returned from a previous List request, - * if any. - * @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.cloud.redis.v1beta1.Instance|Instance}. 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 include:samples/generated/v1beta1/cloud_redis.list_instances.js - * region_tag:redis_v1beta1_generated_CloudRedis_ListInstances_async - */ - listInstancesAsync( - request?: protos.google.cloud.redis.v1beta1.IListInstancesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listInstances']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listInstances iterate %j', request); - return this.descriptors.page.listInstances.asyncIterate( - this.innerApiCalls['listInstances'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.cancelOperation(request, options, callback); - } - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - optionsOrCallback?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - let options: gax.CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as gax.CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,location:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - location: location, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the location from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the location. - */ - matchLocationFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).location; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudRedisStub && !this._terminated) { - return this.cloudRedisStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client_config.json.baseline deleted file mode 100644 index bc798a4f1581..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.redis.v1beta1.CloudRedis": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListInstances": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ImportInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExportInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FailoverInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteInstance": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_proto_list.json.baseline deleted file mode 100644 index 6cd147355156..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/cloud_redis_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/redis/v1beta1/cloud_redis.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/index.ts.baseline deleted file mode 100644 index 6e57dc3915dd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {CloudRedisClient} from './cloud_redis_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index d247d541c8a7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const redis = require('redis'); - -function main() { - const cloudRedisClient = new redis.CloudRedisClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 5ca80129b7e0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {CloudRedisClient} from 'redis'; - -// check that the client class type name can be used -function doStuffWithCloudRedisClient(client: CloudRedisClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudRedisClient = new CloudRedisClient(); - doStuffWithCloudRedisClient(cloudRedisClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/test/gapic_cloud_redis_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/redis/test/gapic_cloud_redis_v1beta1.ts.baseline deleted file mode 100644 index 37c85361962e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/test/gapic_cloud_redis_v1beta1.ts.baseline +++ /dev/null @@ -1,1900 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as cloudredisModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.CloudRedisClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'redis.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = cloudredisModule.v1beta1.CloudRedisClient.servicePath; - assert.strictEqual(servicePath, 'redis.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = cloudredisModule.v1beta1.CloudRedisClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'redis.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'redis.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new cloudredisModule.v1beta1.CloudRedisClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = cloudredisModule.v1beta1.CloudRedisClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudRedisStub, undefined); - await client.initialize(); - assert(client.cloudRedisStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.cloudRedisStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudRedisStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getInstance', () => { - it('invokes getInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCall(expectedResponse); - const [response] = await client.getInstance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.Instance() - ); - client.innerApiCalls.getInstance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getInstance( - request, - (err?: Error|null, result?: protos.google.cloud.redis.v1beta1.IInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getInstance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getInstance with closed client', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.GetInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.GetInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getInstance(request), expectedError); - }); - }); - - describe('createInstance', () => { - it('invokes createInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.createInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.CreateInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.CreateInstanceRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateInstance', () => { - it('invokes updateInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.UpdateInstanceRequest() - ); - request.instance ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.UpdateInstanceRequest', ['instance', 'name']); - request.instance.name = defaultValue1; - const expectedHeaderRequestParams = `instance.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importInstance', () => { - it('invokes importInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.importInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ImportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ImportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportInstance', () => { - it('invokes exportInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ExportInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ExportInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('failoverInstance', () => { - it('invokes failoverInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.failoverInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.failoverInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.failoverInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failoverInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failoverInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.failoverInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failoverInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.FailoverInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.FailoverInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failoverInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.failoverInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failoverInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkFailoverInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkFailoverInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkFailoverInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkFailoverInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteInstance', () => { - it('invokes deleteInstance without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteInstance(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteInstance = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteInstance( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with call error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteInstance(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteInstance with LRO error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.DeleteInstanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.DeleteInstanceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteInstance = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteInstance(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteInstance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteInstanceProgress without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteInstanceProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteInstanceProgress with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteInstanceProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listInstances', () => { - it('invokes listInstances without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCall(expectedResponse); - const [response] = await client.listInstances(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.innerApiCalls.listInstances = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listInstances( - request, - (err?: Error|null, result?: protos.google.cloud.redis.v1beta1.IInstance[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstances with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listInstances = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listInstances(request), expectedError); - const actualRequest = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listInstances as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listInstancesStream without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.redis.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.redis.v1beta1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listInstancesStream with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listInstancesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.redis.v1beta1.Instance[] = []; - stream.on('data', (response: protos.google.cloud.redis.v1beta1.Instance) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listInstances, request)); - assert( - (client.descriptors.page.listInstances.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - generateSampleMessage(new protos.google.cloud.redis.v1beta1.Instance()), - ]; - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.redis.v1beta1.IInstance[] = []; - const iterable = client.listInstancesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listInstances with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.redis.v1beta1.ListInstancesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.redis.v1beta1.ListInstancesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listInstances.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listInstancesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.redis.v1beta1.IInstance[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listInstances.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }).catch(err => {throw err}); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.IOperation[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.IOperation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('instance', async () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - instance: "instanceValue", - }; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "locationValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromInstanceName', () => { - const result = client.matchLocationFromInstanceName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new cloudredisModule.v1beta1.CloudRedisClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/redis/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/redis/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/redis/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/redis/webpack.config.js.baseline deleted file mode 100644 index c8446c2163ea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/redis/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'CloudRedis', - filename: './cloud-redis.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 3360262a4374..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/retail/google-cloud-retail-nodejs - dest: /owl-bot-staging/google-cloud-retail - -api-name: retail \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 1dc04d032492..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'retail', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/README.md.baseline deleted file mode 100644 index 4fadc347e8b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Vertex AI Search for commerce API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/retail.svg)](https://www.npmjs.org/package/retail) - -Vertex AI Search for commerce API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Vertex AI Search for commerce API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/retail/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Vertex AI Search for commerce API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install retail -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install retail@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=retail.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/index.ts.baseline deleted file mode 100644 index 6a9662eafa83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2alpha from './v2alpha/index.js'; -const AnalyticsServiceClient = v2alpha.AnalyticsServiceClient; -type AnalyticsServiceClient = v2alpha.AnalyticsServiceClient; -const BranchServiceClient = v2alpha.BranchServiceClient; -type BranchServiceClient = v2alpha.BranchServiceClient; -const CatalogServiceClient = v2alpha.CatalogServiceClient; -type CatalogServiceClient = v2alpha.CatalogServiceClient; -const CompletionServiceClient = v2alpha.CompletionServiceClient; -type CompletionServiceClient = v2alpha.CompletionServiceClient; -const ControlServiceClient = v2alpha.ControlServiceClient; -type ControlServiceClient = v2alpha.ControlServiceClient; -const ConversationalSearchServiceClient = v2alpha.ConversationalSearchServiceClient; -type ConversationalSearchServiceClient = v2alpha.ConversationalSearchServiceClient; -const GenerativeQuestionServiceClient = v2alpha.GenerativeQuestionServiceClient; -type GenerativeQuestionServiceClient = v2alpha.GenerativeQuestionServiceClient; -const MerchantCenterAccountLinkServiceClient = v2alpha.MerchantCenterAccountLinkServiceClient; -type MerchantCenterAccountLinkServiceClient = v2alpha.MerchantCenterAccountLinkServiceClient; -const ModelServiceClient = v2alpha.ModelServiceClient; -type ModelServiceClient = v2alpha.ModelServiceClient; -const PredictionServiceClient = v2alpha.PredictionServiceClient; -type PredictionServiceClient = v2alpha.PredictionServiceClient; -const ProductServiceClient = v2alpha.ProductServiceClient; -type ProductServiceClient = v2alpha.ProductServiceClient; -const ProjectServiceClient = v2alpha.ProjectServiceClient; -type ProjectServiceClient = v2alpha.ProjectServiceClient; -const SearchServiceClient = v2alpha.SearchServiceClient; -type SearchServiceClient = v2alpha.SearchServiceClient; -const ServingConfigServiceClient = v2alpha.ServingConfigServiceClient; -type ServingConfigServiceClient = v2alpha.ServingConfigServiceClient; -const UserEventServiceClient = v2alpha.UserEventServiceClient; -type UserEventServiceClient = v2alpha.UserEventServiceClient; -export {v2alpha, AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient}; -export default {v2alpha, AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client.ts.baseline deleted file mode 100644 index 54c15438c652..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client.ts.baseline +++ /dev/null @@ -1,1164 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as analytics_service_client_config from './analytics_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/analytics_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'analytics_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for managing & accessing retail search business metric. - * Retail recommendation business metric is currently not available. - * @class - * @memberof v2alpha - */ -export class AnalyticsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - analyticsServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AnalyticsServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 AnalyticsServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AnalyticsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const exportAnalyticsMetricsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportAnalyticsMetricsResponse') as gax.protobuf.Type; - const exportAnalyticsMetricsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - exportAnalyticsMetrics: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAnalyticsMetricsResponse.decode.bind(exportAnalyticsMetricsResponse), - exportAnalyticsMetricsMetadata.decode.bind(exportAnalyticsMetricsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.AnalyticsService', gapicConfig as gax.ClientConfig, - 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.analyticsServiceStub) { - return this.analyticsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.AnalyticsService. - this.analyticsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.AnalyticsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.AnalyticsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const analyticsServiceStubMethods = - ['exportAnalyticsMetrics']; - for (const methodName of analyticsServiceStubMethods) { - const callPromise = this.analyticsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.analyticsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Exports analytics metrics. - * - * `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - * `Operation.metadata` is of type `ExportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Full resource name of the parent catalog. - * Expected format: `projects/* /locations/* /catalogs/*` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned metrics. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned metrics. Use this expression to restrict results to a - * specific time range. - * - * Currently we expect only one types of fields: - * - * * `timestamp`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `timestamp` restriction should result in one, contiguous, valid, - * `timestamp` range. - * - * Some examples of valid filters expressions: - * - * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - * timestamp < "2012-04-23T18:30:43.511Z"` - * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/analytics_service.export_analytics_metrics.js - * region_tag:retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async - */ - exportAnalyticsMetrics( - request?: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAnalyticsMetrics( - request: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAnalyticsMetrics( - request: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAnalyticsMetrics( - request?: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportAnalyticsMetrics response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('exportAnalyticsMetrics request %j', request); - return this.innerApiCalls.exportAnalyticsMetrics(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportAnalyticsMetrics response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportAnalyticsMetrics()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/analytics_service.export_analytics_metrics.js - * region_tag:retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async - */ - async checkExportAnalyticsMetricsProgress(name: string): Promise>{ - this._log.info('exportAnalyticsMetrics long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAnalyticsMetrics, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.analyticsServiceStub && !this._terminated) { - return this.analyticsServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client_config.json.baseline deleted file mode 100644 index 80e172e83da1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_client_config.json.baseline +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.AnalyticsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ExportAnalyticsMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/analytics_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client.ts.baseline deleted file mode 100644 index ff2581330a0f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client.ts.baseline +++ /dev/null @@ -1,1212 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as branch_service_client_config from './branch_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/branch_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'branch_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for {@link protos.google.cloud.retail.v2alpha.Branch|Branch} Management - * - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}es are automatically created when - * a {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} is created. There are fixed - * three branches in each catalog, and may use - * {@link protos.google.cloud.retail.v2alpha.BranchService.ListBranches|ListBranches} method - * to get the details of all branches. - * @class - * @memberof v2alpha - */ -export class BranchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - branchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BranchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 BranchServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BranchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.BranchService', gapicConfig as gax.ClientConfig, - 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.branchServiceStub) { - return this.branchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.BranchService. - this.branchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.BranchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.BranchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const branchServiceStubMethods = - ['listBranches', 'getBranch']; - for (const methodName of branchServiceStubMethods) { - const callPromise = this.branchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.branchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Lists all instances of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} under - * the specified parent {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name. - * @param {google.cloud.retail.v2alpha.BranchView} request.view - * The view to apply to the returned - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. Defaults to - * [Branch.BranchView.BASIC] if unspecified. - * See documentation of fields of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} - * to find what fields are excluded from BASIC view. - * @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 {@link protos.google.cloud.retail.v2alpha.ListBranchesResponse|ListBranchesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/branch_service.list_branches.js - * region_tag:retail_v2alpha_generated_BranchService_ListBranches_async - */ - listBranches( - request?: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, {}|undefined - ]>; - listBranches( - request: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): void; - listBranches( - request: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): void; - listBranches( - request?: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listBranches request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listBranches response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listBranches(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, {}|undefined - ]) => { - this._log.info('listBranches response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the branch to retrieve. - * Format: - * `projects/* /locations/global/catalogs/default_catalog/branches/some_branch_id`. - * - * "default_branch" can be used as a special branch_id, it returns the - * default branch that has been set for the catalog. - * @param {google.cloud.retail.v2alpha.BranchView} request.view - * The view to apply to the returned - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. Defaults to - * [Branch.BranchView.BASIC] if unspecified. - * See documentation of fields of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} - * to find what fields are excluded from BASIC view. - * @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 {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/branch_service.get_branch.js - * region_tag:retail_v2alpha_generated_BranchService_GetBranch_async - */ - getBranch( - request?: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, {}|undefined - ]>; - getBranch( - request: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): void; - getBranch( - request: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): void; - getBranch( - request?: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBranch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBranch response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, {}|undefined - ]) => { - this._log.info('getBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.branchServiceStub && !this._terminated) { - return this.branchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client_config.json.baseline deleted file mode 100644 index 92fe8a070c6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_client_config.json.baseline +++ /dev/null @@ -1,45 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.BranchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListBranches": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetBranch": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/branch_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client.ts.baseline deleted file mode 100644 index 34ffc508aefa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client.ts.baseline +++ /dev/null @@ -1,2473 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as catalog_service_client_config from './catalog_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/catalog_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'catalog_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for managing catalog configuration. - * @class - * @memberof v2alpha - */ -export class CatalogServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - catalogServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CatalogServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 CatalogServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CatalogServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listCatalogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'catalogs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.CatalogService', gapicConfig as gax.ClientConfig, - 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.catalogServiceStub) { - return this.catalogServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.CatalogService. - this.catalogServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.CatalogService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.CatalogService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const catalogServiceStubMethods = - ['listCatalogs', 'updateCatalog', 'setDefaultBranch', 'getDefaultBranch', 'getCompletionConfig', 'updateCompletionConfig', 'getAttributesConfig', 'updateAttributesConfig', 'addCatalogAttribute', 'removeCatalogAttribute', 'batchRemoveCatalogAttributes', 'replaceCatalogAttribute']; - for (const methodName of catalogServiceStubMethods) { - const callPromise = this.catalogServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.catalogServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Updates the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Catalog} request.catalog - * Required. The {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update does not - * exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * 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 {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_catalog.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateCatalog_async - */ - updateCatalog( - request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, {}|undefined - ]>; - updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): void; - updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): void; - updateCatalog( - request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCatalog request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCatalog response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCatalog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCatalog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Set a specified branch id as default branch. API methods such as - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * will treat requests using "default_branch" to the actual branch id set as - * default. - * - * For example, if `projects/* /locations/* /catalogs/* /branches/1` is set as - * default, setting - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * `projects/* /locations/* /catalogs/* /branches/default_branch` is equivalent - * to setting - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * `projects/* /locations/* /catalogs/* /branches/1`. - * - * Using multiple branches can be useful when developers would like - * to have a staging branch to test and verify for future usage. When it - * becomes ready, developers switch on the staging branch using this API - * while keeping using - * `projects/* /locations/* /catalogs/* /branches/default_branch` as - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * route the traffic to this staging branch. - * - * CAUTION: If you have live predict/search traffic, switching the default - * branch could potentially cause outages if the ID space of the new branch - * is very different from the old one. - * - * More specifically: - * - * * PredictionService will only return product IDs from branch {newBranch}. - * * SearchService will only return product IDs from branch {newBranch} - * (if branch is not explicitly set). - * * UserEventService will only join events with products from branch - * {newBranch}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.branchId - * The final component of the resource name of a branch. - * - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * - * If there are no sufficient active products in the targeted branch and - * {@link protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest.force|force} is not - * set, a FAILED_PRECONDITION error is returned. - * @param {string} request.note - * Some note on this request, this can be retrieved by - * {@link protos.google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} - * before next valid default branch set occurs. - * - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {boolean} request.force - * If set to true, it permits switching to a branch with - * {@link protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id|branch_id} - * even if it has no sufficient active products. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.set_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_SetDefaultBranch_async - */ - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, {}|undefined - ]>; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('setDefaultBranch request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('setDefaultBranch response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.setDefaultBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, {}|undefined - ]) => { - this._log.info('setDefaultBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get which branch is currently default branch set by - * {@link protos.google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @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 {@link protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse|GetDefaultBranchResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_GetDefaultBranch_async - */ - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, {}|undefined - ]>; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDefaultBranch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDefaultBranch response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getDefaultBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, {}|undefined - ]) => { - this._log.info('getDefaultBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full CompletionConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - * @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 {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_completion_config.js - * region_tag:retail_v2alpha_generated_CatalogService_GetCompletionConfig_async - */ - getCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, {}|undefined - ]>; - getCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - getCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - getCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCompletionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCompletionConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getCompletionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getCompletionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.CompletionConfig} request.completionConfig - * Required. The - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to - * update does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. - * The following are the only supported fields: - * - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.matching_order|CompletionConfig.matching_order} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length|CompletionConfig.min_prefix_length} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.auto_learning|CompletionConfig.auto_learning} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_completion_config.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async - */ - updateCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, {}|undefined - ]>; - updateCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'completion_config.name': request.completionConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCompletionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCompletionConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateCompletionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateCompletionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets an {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_attributes_config.js - * region_tag:retail_v2alpha_generated_CatalogService_GetAttributesConfig_async - */ - getAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, {}|undefined - ]>; - getAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAttributesConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAttributesConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getAttributesConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getAttributesConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * The catalog attributes in the request will be updated in the catalog, or - * inserted if they do not exist. Existing catalog attributes not included in - * the request will remain unchanged. Attributes that are assigned to - * products, but do not exist at the catalog level, are always included in the - * response. The product attribute is assigned default values for missing - * catalog attribute fields, e.g., searchable and dynamic facetable options. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.AttributesConfig} request.attributesConfig - * Required. The - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. - * The following is the only supported field: - * - * * {@link protos.google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes|AttributesConfig.catalog_attributes} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_attributes_config.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async - */ - updateAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, {}|undefined - ]>; - updateAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config.name': request.attributesConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAttributesConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAttributesConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateAttributesConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateAttributesConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Adds the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * add already exists, an ALREADY_EXISTS error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute - * Required. The - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to add. - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.add_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async - */ - addCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, {}|undefined - ]>; - addCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - addCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - addCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('addCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.addCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, {}|undefined - ]) => { - this._log.info('addCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Removes the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} from the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * remove does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {string} request.key - * Required. The attribute name key of the - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to remove. - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async - */ - removeCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, {}|undefined - ]>; - removeCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - removeCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - removeCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('removeCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('removeCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.removeCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, {}|undefined - ]) => { - this._log.info('removeCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Removes all specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}s from the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. The attributes config resource shared by all catalog attributes - * being deleted. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {string[]} request.attributeKeys - * Required. The attribute name keys of the - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}s to - * delete. A maximum of 1000 catalog attributes can be deleted in a batch. - * @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 {@link protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse|BatchRemoveCatalogAttributesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js - * region_tag:retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async - */ - batchRemoveCatalogAttributes( - request?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, {}|undefined - ]>; - batchRemoveCatalogAttributes( - request: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): void; - batchRemoveCatalogAttributes( - request: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): void; - batchRemoveCatalogAttributes( - request?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchRemoveCatalogAttributes request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchRemoveCatalogAttributes response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.batchRemoveCatalogAttributes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, {}|undefined - ]) => { - this._log.info('batchRemoveCatalogAttributes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Replaces the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} in the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} by - * updating the catalog attribute with the same - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * replace does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute - * Required. The updated - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to update. - * The following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async - */ - replaceCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, {}|undefined - ]>; - replaceCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - replaceCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - replaceCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('replaceCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('replaceCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.replaceCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, {}|undefined - ]) => { - this._log.info('replaceCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s associated - * with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error 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 Array of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCatalogsAsync()` - * 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. - */ - listCatalogs( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]>; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): void; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): void; - listCatalogs( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCatalogs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listCatalogs request %j', request); - return this.innerApiCalls - .listCatalogs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]) => { - this._log.info('listCatalogs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCatalogs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error 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 {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} 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 `listCatalogsAsync()` - * 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. - */ - listCatalogsStream( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCatalogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCatalogs stream %j', request); - return this.descriptors.page.listCatalogs.createStream( - this.innerApiCalls.listCatalogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCatalogs`, 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. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @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.cloud.retail.v2alpha.Catalog|Catalog}. 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 include:samples/generated/v2alpha/catalog_service.list_catalogs.js - * region_tag:retail_v2alpha_generated_CatalogService_ListCatalogs_async - */ - listCatalogsAsync( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCatalogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCatalogs iterate %j', request); - return this.descriptors.page.listCatalogs.asyncIterate( - this.innerApiCalls['listCatalogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.catalogServiceStub && !this._terminated) { - return this.catalogServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client_config.json.baseline deleted file mode 100644 index 430dc2ec64ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_client_config.json.baseline +++ /dev/null @@ -1,95 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.CatalogService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListCatalogs": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateCatalog": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "SetDefaultBranch": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetDefaultBranch": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetCompletionConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateCompletionConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetAttributesConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateAttributesConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "AddCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "RemoveCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "BatchRemoveCatalogAttributes": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "ReplaceCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/catalog_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client.ts.baseline deleted file mode 100644 index 330e4256222b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client.ts.baseline +++ /dev/null @@ -1,1336 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as completion_service_client_config from './completion_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/completion_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'completion_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Autocomplete service for retail. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * @class - * @memberof v2alpha - */ -export class CompletionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - completionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CompletionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 CompletionServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CompletionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const importCompletionDataResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportCompletionDataResponse') as gax.protobuf.Type; - const importCompletionDataMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - importCompletionData: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importCompletionDataResponse.decode.bind(importCompletionDataResponse), - importCompletionDataMetadata.decode.bind(importCompletionDataMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.CompletionService', gapicConfig as gax.ClientConfig, - 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.completionServiceStub) { - return this.completionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.CompletionService. - this.completionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.CompletionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.CompletionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const completionServiceStubMethods = - ['completeQuery', 'importCompletionData']; - for (const methodName of completionServiceStubMethods) { - const callPromise = this.completionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.completionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Completes the specified prefix with keyword suggestions. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Catalog for which the completion is performed. - * - * Full resource name of catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.query - * Required. The query used to generate suggestions. - * - * The maximum number of allowed characters is 255. - * @param {string} request.visitorId - * Recommended field. A unique identifier for tracking visitors. For example, - * this could be implemented with an HTTP cookie, which should be able to - * uniquely identify a visitor on a single device. This unique identifier - * should not change if the visitor logs in or out of the website. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {string[]} request.languageCodes - * Note that this field applies for `user-data` dataset only. For requests - * with `cloud-retail` dataset, setting this field has no effect. - * - * The language filters applied to the output suggestions. If set, it should - * contain the language of the query. If not set, suggestions are returned - * without considering language restrictions. This is the BCP-47 language - * code, such as "en-US" or "sr-Latn". For more information, see [Tags for - * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - * number of language codes is 3. - * @param {string} request.deviceType - * The device type context for completion suggestions. We recommend that you - * leave this field empty. - * - * It can apply different suggestions on different device types, e.g. - * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - * types. - * - * Supported formats: - * - * * `UNKNOWN_DEVICE_TYPE` - * - * * `DESKTOP` - * - * * `MOBILE` - * - * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - * @param {string} request.dataset - * Determines which dataset to use for fetching completion. "user-data" will - * use the dataset imported through - * {@link protos.google.cloud.retail.v2alpha.CompletionService.ImportCompletionData|CompletionService.ImportCompletionData}. - * `cloud-retail` will use the dataset generated by Cloud Retail based on user - * events. If left empty, completions will be fetched from the `user-data` - * dataset. - * - * Current supported values: - * - * * user-data - * - * * cloud-retail: - * This option requires enabling auto-learning function first. See - * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - * @param {number} request.maxSuggestions - * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions}. - * - * The maximum allowed max suggestions is 20. If it is set higher, it will be - * capped by 20. - * @param {boolean} request.enableAttributeSuggestions - * If true, attribute suggestions are enabled and provided in the response. - * - * This field is only available for the `cloud-retail` dataset. - * @param {string} request.entity - * The entity for customers who run multiple entities, domains, sites, or - * regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it must be an exact match with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * per-entity autocomplete results. This field will be applied to - * `completion_results` only. It has no effect on the `attribute_results`. - * Also, this entity should be limited to 256 characters, if too long, it will - * be truncated to 256 characters in both generation and serving time, and may - * lead to mis-match. To ensure it works, please set the entity with string - * within 256 characters. - * @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 {@link protos.google.cloud.retail.v2alpha.CompleteQueryResponse|CompleteQueryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.complete_query.js - * region_tag:retail_v2alpha_generated_CompletionService_CompleteQuery_async - */ - completeQuery( - request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, {}|undefined - ]>; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): void; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): void; - completeQuery( - request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('completeQuery request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('completeQuery response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.completeQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, {}|undefined - ]) => { - this._log.info('completeQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Bulk import of processed completion dataset. - * - * Request processing is asynchronous. Partial updating is not supported. - * - * The operation is successfully finished only after the imported suggestions - * are indexed successfully and ready for serving. The process takes hours. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog which the suggestions dataset belongs to. - * - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * {@link protos.google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js - * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async - */ - importCompletionData( - request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importCompletionData( - request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importCompletionData( - request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importCompletionData( - request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importCompletionData response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('importCompletionData request %j', request); - return this.innerApiCalls.importCompletionData(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importCompletionData response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importCompletionData()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js - * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async - */ - async checkImportCompletionDataProgress(name: string): Promise>{ - this._log.info('importCompletionData long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importCompletionData, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.completionServiceStub && !this._terminated) { - return this.completionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client_config.json.baseline deleted file mode 100644 index ac2795a5fb1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_client_config.json.baseline +++ /dev/null @@ -1,45 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.CompletionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CompleteQuery": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "ImportCompletionData": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/completion_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client.ts.baseline deleted file mode 100644 index d84c175f4916..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client.ts.baseline +++ /dev/null @@ -1,1635 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as control_service_client_config from './control_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/control_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'control_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for modifying Control. - * @class - * @memberof v2alpha - */ -export class ControlServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - controlServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ControlServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ControlServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ControlServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listControls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'controls') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ControlService', gapicConfig as gax.ClientConfig, - 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.controlServiceStub) { - return this.controlServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ControlService. - this.controlServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ControlService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ControlService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const controlServiceStubMethods = - ['createControl', 'deleteControl', 'updateControl', 'getControl', 'listControls']; - for (const methodName of controlServiceStubMethods) { - const callPromise = this.controlServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.controlServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a Control. - * - * If the {@link protos.google.cloud.retail.v2alpha.Control|Control} to create already - * exists, an ALREADY_EXISTS error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent catalog. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.Control} request.control - * Required. The Control to create. - * @param {string} request.controlId - * Required. The ID to use for the Control, which will become the final - * component of the Control's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-_/. - * @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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.create_control.js - * region_tag:retail_v2alpha_generated_ControlService_CreateControl_async - */ - createControl( - request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, {}|undefined - ]>; - createControl( - request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): void; - createControl( - request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): void; - createControl( - request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, {}|undefined - ]) => { - this._log.info('createControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a Control. - * - * If the {@link protos.google.cloud.retail.v2alpha.Control|Control} to delete does not - * exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Control to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.delete_control.js - * region_tag:retail_v2alpha_generated_ControlService_DeleteControl_async - */ - deleteControl( - request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, {}|undefined - ]>; - deleteControl( - request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): void; - deleteControl( - request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): void; - deleteControl( - request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteControl request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a Control. - * - * {@link protos.google.cloud.retail.v2alpha.Control|Control} cannot be set to a different - * oneof field, if so an INVALID_ARGUMENT is returned. If the - * {@link protos.google.cloud.retail.v2alpha.Control|Control} to update does not exist, a - * NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Control} request.control - * Required. The Control to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Control|Control} to update. The following are - * NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.Control.name|Control.name} - * - * If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.update_control.js - * region_tag:retail_v2alpha_generated_ControlService_UpdateControl_async - */ - updateControl( - request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, {}|undefined - ]>; - updateControl( - request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): void; - updateControl( - request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): void; - updateControl( - request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'control.name': request.control!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, {}|undefined - ]) => { - this._log.info('updateControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a Control. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Control to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.get_control.js - * region_tag:retail_v2alpha_generated_ControlService_GetControl_async - */ - getControl( - request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, {}|undefined - ]>; - getControl( - request: protos.google.cloud.retail.v2alpha.IGetControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): void; - getControl( - request: protos.google.cloud.retail.v2alpha.IGetControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): void; - getControl( - request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, {}|undefined - ]) => { - this._log.info('getControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all Controls by their parent - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listControlsAsync()` - * 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. - */ - listControls( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]>; - listControls( - request: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): void; - listControls( - request: protos.google.cloud.retail.v2alpha.IListControlsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): void; - listControls( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listControls values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listControls request %j', request); - return this.innerApiCalls - .listControls(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]) => { - this._log.info('listControls values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listControls`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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.cloud.retail.v2alpha.Control|Control} 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 `listControlsAsync()` - * 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. - */ - listControlsStream( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listControls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listControls stream %j', request); - return this.descriptors.page.listControls.createStream( - this.innerApiCalls.listControls as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listControls`, 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. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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.cloud.retail.v2alpha.Control|Control}. 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 include:samples/generated/v2alpha/control_service.list_controls.js - * region_tag:retail_v2alpha_generated_ControlService_ListControls_async - */ - listControlsAsync( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listControls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listControls iterate %j', request); - return this.descriptors.page.listControls.asyncIterate( - this.innerApiCalls['listControls'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.controlServiceStub && !this._terminated) { - return this.controlServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client_config.json.baseline deleted file mode 100644 index 9a86d786b232..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ControlService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListControls": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/control_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client.ts.baseline deleted file mode 100644 index 88820210e6f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client.ts.baseline +++ /dev/null @@ -1,1110 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import {PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as conversational_search_service_client_config from './conversational_search_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/conversational_search_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'conversational_search_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for retail conversational search. - * - * This feature is only available for users who have Retail Conversational - * Search enabled. Enable Retail Conversational Search on Cloud Console - * before using this feature. - * @class - * @memberof v2alpha - */ -export class ConversationalSearchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationalSearchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationalSearchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ConversationalSearchServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationalSearchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - conversationalSearch: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ConversationalSearchService', gapicConfig as gax.ClientConfig, - 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.conversationalSearchServiceStub) { - return this.conversationalSearchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ConversationalSearchService. - this.conversationalSearchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ConversationalSearchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ConversationalSearchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationalSearchServiceStubMethods = - ['conversationalSearch']; - for (const methodName of conversationalSearchServiceStubMethods) { - const callPromise = this.conversationalSearchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationalSearchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Performs a conversational search. - * - * This feature is only available for users who have Conversational Search - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` - * or - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * This field is used to identify the serving config name and the set - * of models that will be used to make the search. - * @param {string} request.branch - * Required. The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} [request.query] - * Optional. Raw search query to be searched for. - * - * If this field is empty, the request is considered a category browsing - * request. - * @param {string[]} [request.pageCategories] - * Optional. The categories associated with a category page. Must be set for - * category navigation queries to achieve good search quality. The format - * should be the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {string} [request.conversationId] - * Optional. This field specifies the conversation id, which maintains the - * state of the conversation between client side and server side. Use the - * value from the previous - * {@link protos.google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id|ConversationalSearchResponse.conversation_id}. - * For the initial request, this should be empty. - * @param {google.cloud.retail.v2alpha.ConversationalSearchRequest.SearchParams} [request.searchParams] - * Optional. Search parameters. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} [request.userInfo] - * Optional. User information. - * @param {google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec} [request.conversationalFilteringSpec] - * Optional. This field specifies all conversational filtering related - * parameters. - * @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 {@link protos.google.cloud.retail.v2alpha.ConversationalSearchResponse|ConversationalSearchResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/conversational_search_service.conversational_search.js - * region_tag:retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async - */ - conversationalSearch( - request?: protos.google.cloud.retail.v2alpha.IConversationalSearchRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('conversationalSearch stream %j', options); - return this.innerApiCalls.conversationalSearch(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.conversationalSearchServiceStub && !this._terminated) { - return this.conversationalSearchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client_config.json.baseline deleted file mode 100644 index 02ce954afabc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ConversationalSearchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ConversationalSearch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/conversational_search_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client.ts.baseline deleted file mode 100644 index 3d6c782f1ea5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client.ts.baseline +++ /dev/null @@ -1,1486 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as generative_question_service_client_config from './generative_question_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/generative_question_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'generative_question_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for managing LLM generated questions in search serving. - * @class - * @memberof v2alpha - */ -export class GenerativeQuestionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - generativeQuestionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GenerativeQuestionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 GenerativeQuestionServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GenerativeQuestionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.GenerativeQuestionService', gapicConfig as gax.ClientConfig, - 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.generativeQuestionServiceStub) { - return this.generativeQuestionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.GenerativeQuestionService. - this.generativeQuestionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.GenerativeQuestionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.GenerativeQuestionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const generativeQuestionServiceStubMethods = - ['updateGenerativeQuestionsFeatureConfig', 'getGenerativeQuestionsFeatureConfig', 'listGenerativeQuestionConfigs', 'updateGenerativeQuestionConfig', 'batchUpdateGenerativeQuestionConfigs']; - for (const methodName of generativeQuestionServiceStubMethods) { - const callPromise = this.generativeQuestionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.generativeQuestionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Manages overal generative question feature state -- enables toggling - * feature on and off. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig} request.generativeQuestionsFeatureConfig - * Required. The configuration managing the feature state. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig} - * to update. If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async - */ - updateGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>; - updateGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'generative_questions_feature_config.catalog': request.generativeQuestionsFeatureConfig!.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGenerativeQuestionsFeatureConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGenerativeQuestionsFeatureConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateGenerativeQuestionsFeatureConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateGenerativeQuestionsFeatureConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Manages overal generative question feature state -- enables toggling - * feature on and off. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async - */ - getGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>; - getGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - getGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - getGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGenerativeQuestionsFeatureConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGenerativeQuestionsFeatureConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getGenerativeQuestionsFeatureConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getGenerativeQuestionsFeatureConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns all questions for a given catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @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 {@link protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse|ListGenerativeQuestionConfigsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async - */ - listGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>; - listGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - listGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - listGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listGenerativeQuestionConfigs request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listGenerativeQuestionConfigs response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listGenerativeQuestionConfigs(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]) => { - this._log.info('listGenerativeQuestionConfigs response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Allows management of individual questions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.GenerativeQuestionConfig} request.generativeQuestionConfig - * Required. The question to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig|GenerativeQuestionConfig} - * to update. The following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency|GenerativeQuestionConfig.frequency} - * - * If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig|GenerativeQuestionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.update_generative_question_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async - */ - updateGenerativeQuestionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, {}|undefined - ]>; - updateGenerativeQuestionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'generative_question_config.catalog': request.generativeQuestionConfig!.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGenerativeQuestionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGenerativeQuestionConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateGenerativeQuestionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateGenerativeQuestionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Allows management of multiple questions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.parent] - * Optional. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @param {number[]} request.requests - * Required. The updates question configs. - * @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 {@link protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse|BatchUpdateGenerativeQuestionConfigsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async - */ - batchUpdateGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>; - batchUpdateGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchUpdateGenerativeQuestionConfigs request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchUpdateGenerativeQuestionConfigs response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.batchUpdateGenerativeQuestionConfigs(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]) => { - this._log.info('batchUpdateGenerativeQuestionConfigs response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.generativeQuestionServiceStub && !this._terminated) { - return this.generativeQuestionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client_config.json.baseline deleted file mode 100644 index 7742daee3e52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.GenerativeQuestionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "UpdateGenerativeQuestionsFeatureConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGenerativeQuestionsFeatureConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGenerativeQuestionConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGenerativeQuestionConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchUpdateGenerativeQuestionConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/generative_question_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/index.ts.baseline deleted file mode 100644 index 54e41a8c063c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -export {AnalyticsServiceClient} from './analytics_service_client.js'; -export {BranchServiceClient} from './branch_service_client.js'; -export {CatalogServiceClient} from './catalog_service_client.js'; -export {CompletionServiceClient} from './completion_service_client.js'; -export {ControlServiceClient} from './control_service_client.js'; -export {ConversationalSearchServiceClient} from './conversational_search_service_client.js'; -export {GenerativeQuestionServiceClient} from './generative_question_service_client.js'; -export {MerchantCenterAccountLinkServiceClient} from './merchant_center_account_link_service_client.js'; -export {ModelServiceClient} from './model_service_client.js'; -export {PredictionServiceClient} from './prediction_service_client.js'; -export {ProductServiceClient} from './product_service_client.js'; -export {ProjectServiceClient} from './project_service_client.js'; -export {SearchServiceClient} from './search_service_client.js'; -export {ServingConfigServiceClient} from './serving_config_service_client.js'; -export {UserEventServiceClient} from './user_event_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client.ts.baseline deleted file mode 100644 index 2acee956f67e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client.ts.baseline +++ /dev/null @@ -1,1346 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as merchant_center_account_link_service_client_config from './merchant_center_account_link_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/merchant_center_account_link_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'merchant_center_account_link_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Merchant Center Link service to link a Branch to a Merchant Center Account. - * @class - * @memberof v2alpha - */ -export class MerchantCenterAccountLinkServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - merchantCenterAccountLinkServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MerchantCenterAccountLinkServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 MerchantCenterAccountLinkServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MerchantCenterAccountLinkServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMerchantCenterAccountLinkResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.MerchantCenterAccountLink') as gax.protobuf.Type; - const createMerchantCenterAccountLinkMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMerchantCenterAccountLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMerchantCenterAccountLinkResponse.decode.bind(createMerchantCenterAccountLinkResponse), - createMerchantCenterAccountLinkMetadata.decode.bind(createMerchantCenterAccountLinkMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.MerchantCenterAccountLinkService', gapicConfig as gax.ClientConfig, - 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.merchantCenterAccountLinkServiceStub) { - return this.merchantCenterAccountLinkServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.MerchantCenterAccountLinkService. - this.merchantCenterAccountLinkServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.MerchantCenterAccountLinkService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.MerchantCenterAccountLinkService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const merchantCenterAccountLinkServiceStubMethods = - ['listMerchantCenterAccountLinks', 'createMerchantCenterAccountLink', 'deleteMerchantCenterAccountLink']; - for (const methodName of merchantCenterAccountLinkServiceStubMethods) { - const callPromise = this.merchantCenterAccountLinkServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.merchantCenterAccountLinkServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Lists all - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}s - * under the specified parent {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent Catalog of the resource. - * It must match this format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_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 {@link protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse|ListMerchantCenterAccountLinksResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async - */ - listMerchantCenterAccountLinks( - request?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, {}|undefined - ]>; - listMerchantCenterAccountLinks( - request: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): void; - listMerchantCenterAccountLinks( - request: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): void; - listMerchantCenterAccountLinks( - request?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listMerchantCenterAccountLinks request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listMerchantCenterAccountLinks response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listMerchantCenterAccountLinks(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, {}|undefined - ]) => { - this._log.info('listMerchantCenterAccountLinks response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}. - * If the - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink} - * to delete does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async - */ - deleteMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, {}|undefined - ]>; - deleteMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): void; - deleteMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): void; - deleteMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteMerchantCenterAccountLink request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteMerchantCenterAccountLink response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteMerchantCenterAccountLink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteMerchantCenterAccountLink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The branch resource where this MerchantCenterAccountLink will be - * created. Format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - * @param {google.cloud.retail.v2alpha.MerchantCenterAccountLink} request.merchantCenterAccountLink - * Required. The - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink} - * to create. - * - * If the caller does not have permission to create the - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}, - * regardless of whether or not it exists, a PERMISSION_DENIED error 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async - */ - createMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createMerchantCenterAccountLink response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('createMerchantCenterAccountLink request %j', request); - return this.innerApiCalls.createMerchantCenterAccountLink(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMerchantCenterAccountLink response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createMerchantCenterAccountLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async - */ - async checkCreateMerchantCenterAccountLinkProgress(name: string): Promise>{ - this._log.info('createMerchantCenterAccountLink long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMerchantCenterAccountLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.merchantCenterAccountLinkServiceStub && !this._terminated) { - return this.merchantCenterAccountLinkServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline deleted file mode 100644 index 218d843e54f6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMerchantCenterAccountLinks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateMerchantCenterAccountLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMerchantCenterAccountLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client.ts.baseline deleted file mode 100644 index 5b46fe83ea38..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client.ts.baseline +++ /dev/null @@ -1,1966 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as model_service_client_config from './model_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/model_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'model_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for performing CRUD operations on models. - * Recommendation models contain all the metadata necessary to generate a set of - * models for the `Predict()` API. A model is queried - * indirectly via a ServingConfig, which associates a model with a - * given Placement (e.g. Frequently Bought Together on Home Page). - * - * This service allows you to do the following: - * - * * Initiate training of a model. - * * Pause training of an existing model. - * * List all the available models along with their metadata. - * * Control their tuning schedule. - * @class - * @memberof v2alpha - */ -export class ModelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - modelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ModelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ModelServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ModelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listModels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'models') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createModelResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.Model') as gax.protobuf.Type; - const createModelMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.CreateModelMetadata') as gax.protobuf.Type; - const tuneModelResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.TuneModelResponse') as gax.protobuf.Type; - const tuneModelMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.TuneModelMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createModelResponse.decode.bind(createModelResponse), - createModelMetadata.decode.bind(createModelMetadata)), - tuneModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - tuneModelResponse.decode.bind(tuneModelResponse), - tuneModelMetadata.decode.bind(tuneModelMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ModelService', gapicConfig as gax.ClientConfig, - 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.modelServiceStub) { - return this.modelServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ModelService. - this.modelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ModelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ModelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const modelServiceStubMethods = - ['createModel', 'getModel', 'pauseModel', 'resumeModel', 'deleteModel', 'listModels', 'updateModel', 'tuneModel']; - for (const methodName of modelServiceStubMethods) { - const callPromise = this.modelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.modelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.retail.v2alpha.Model|Model} to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.get_model.js - * region_tag:retail_v2alpha_generated_ModelService_GetModel_async - */ - getModel( - request?: protos.google.cloud.retail.v2alpha.IGetModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, {}|undefined - ]>; - getModel( - request: protos.google.cloud.retail.v2alpha.IGetModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request: protos.google.cloud.retail.v2alpha.IGetModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request?: protos.google.cloud.retail.v2alpha.IGetModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, {}|undefined - ]) => { - this._log.info('getModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Pauses the training of an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the model to pause. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.pause_model.js - * region_tag:retail_v2alpha_generated_ModelService_PauseModel_async - */ - pauseModel( - request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, {}|undefined - ]>; - pauseModel( - request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): void; - pauseModel( - request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): void; - pauseModel( - request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('pauseModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pauseModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.pauseModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, {}|undefined - ]) => { - this._log.info('pauseModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Resumes the training of an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the model to resume. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.resume_model.js - * region_tag:retail_v2alpha_generated_ModelService_ResumeModel_async - */ - resumeModel( - request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, {}|undefined - ]>; - resumeModel( - request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): void; - resumeModel( - request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): void; - resumeModel( - request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('resumeModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resumeModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.resumeModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, {}|undefined - ]) => { - this._log.info('resumeModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.retail.v2alpha.Model|Model} to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.delete_model.js - * region_tag:retail_v2alpha_generated_ModelService_DeleteModel_async - */ - deleteModel( - request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, {}|undefined - ]>; - deleteModel( - request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteModel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update of model metadata. Only fields that - * currently can be updated are: `filtering_option` and - * `periodic_tuning_state`. - * If other values are provided, this API method ignores them. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Model} request.model - * Required. The body of the updated - * {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided 'model' to - * update. If not set, by default updates all 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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.update_model.js - * region_tag:retail_v2alpha_generated_ModelService_UpdateModel_async - */ - updateModel( - request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, {}|undefined - ]>; - updateModel( - request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): void; - updateModel( - request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): void; - updateModel( - request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'model.name': request.model!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateModel response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, {}|undefined - ]) => { - this._log.info('updateModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a new model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource under which to create the model. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.Model} request.model - * Required. The payload of the {@link protos.google.cloud.retail.v2alpha.Model|Model} to - * create. - * @param {boolean} [request.dryRun] - * Optional. Whether to run a dry run to validate the request (without - * actually creating the model). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.create_model.js - * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async - */ - createModel( - request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createModel( - request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createModel( - request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createModel( - request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createModel response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('createModel request %j', request); - return this.innerApiCalls.createModel(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createModel response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.create_model.js - * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async - */ - async checkCreateModelProgress(name: string): Promise>{ - this._log.info('createModel long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Tunes an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the model to tune. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.tune_model.js - * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async - */ - tuneModel( - request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - tuneModel( - request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - tuneModel( - request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - tuneModel( - request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('tuneModel response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('tuneModel request %j', request); - return this.innerApiCalls.tuneModel(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('tuneModel response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `tuneModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.tune_model.js - * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async - */ - async checkTuneModelProgress(name: string): Promise>{ - this._log.info('tuneModel long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.tuneModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all the models linked to this event store. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listModelsAsync()` - * 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. - */ - listModels( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]>; - listModels( - request: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): void; - listModels( - request: protos.google.cloud.retail.v2alpha.IListModelsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): void; - listModels( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listModels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listModels request %j', request); - return this.innerApiCalls - .listModels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]) => { - this._log.info('listModels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listModels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.Model|Model} 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 `listModelsAsync()` - * 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. - */ - listModelsStream( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels stream %j', request); - return this.descriptors.page.listModels.createStream( - this.innerApiCalls.listModels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listModels`, 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. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.Model|Model}. 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 include:samples/generated/v2alpha/model_service.list_models.js - * region_tag:retail_v2alpha_generated_ModelService_ListModels_async - */ - listModelsAsync( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels iterate %j', request); - return this.descriptors.page.listModels.asyncIterate( - this.innerApiCalls['listModels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.modelServiceStub && !this._terminated) { - return this.modelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client_config.json.baseline deleted file mode 100644 index 7734305bc78c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ModelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "PauseModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ResumeModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListModels": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "TuneModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/model_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client.ts.baseline deleted file mode 100644 index 8d59a986cc28..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client.ts.baseline +++ /dev/null @@ -1,1221 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as prediction_service_client_config from './prediction_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/prediction_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'prediction_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for making recommendation prediction. - * @class - * @memberof v2alpha - */ -export class PredictionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - predictionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PredictionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 PredictionServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof PredictionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.PredictionService', gapicConfig as gax.ClientConfig, - 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.predictionServiceStub) { - return this.predictionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.PredictionService. - this.predictionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.PredictionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.PredictionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const predictionServiceStubMethods = - ['predict']; - for (const methodName of predictionServiceStubMethods) { - const callPromise = this.predictionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.predictionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Makes a recommendation prediction. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. Full resource name of the format: - * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` - * or - * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. - * We recommend using the `servingConfigs` resource. `placements` is a legacy - * resource. - * The ID of the Recommendations AI serving config or placement. - * Before you can request predictions from your model, you must create at - * least one serving config or placement for it. For more information, see - * [Manage serving configs] - * (https://cloud.google.com/retail/docs/manage-configs). - * - * The full list of available serving configs can be seen at - * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent - * Required. Context about the user, what they are looking at and what action - * they took to trigger the predict request. Note that this user event detail - * won't be ingested to userEvent logs. Thus, a separate userEvent write - * request is required for event logging. - * - * Don't set - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} or - * {@link protos.google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} to the - * same fixed ID for different users. If you are trying to receive - * non-personalized recommendations (not recommended; this can negatively - * impact model performance), instead set - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} to - * a random unique ID and leave - * {@link protos.google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} unset. - * @param {number} request.pageSize - * Maximum number of results to return. Set this property to the number of - * prediction results needed. If zero, the service will choose a reasonable - * default. The maximum allowed value is 100. Values above 100 will be coerced - * to 100. - * @param {string} request.pageToken - * This field is not used; leave it unset. - * @param {string} request.filter - * Filter for restricting prediction results with a length limit of 5,000 - * characters. Accepts values for tags and the `filterOutOfStockItems` flag. - * - * * Tag expressions. Restricts predictions to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses, and must be separated from the - * tag values by a space. `-"tagA"` is also supported and is equivalent to - * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - * with a size limit of 1,000 characters. - * - * Note: "Recently viewed" models don't support tag filtering at the - * moment. - * - * * filterOutOfStockItems. Restricts predictions to products that do not - * have a - * stockState value of OUT_OF_STOCK. - * - * Examples: - * - * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - * * filterOutOfStockItems tag=(-"promotional") - * * filterOutOfStockItems - * - * If your filter blocks all prediction results, the API will return *no* - * results. If instead you want empty result sets to return generic - * (unfiltered) popular products, set `strictFiltering` to False in - * `PredictRequest.params`. Note that the API will never return items with - * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - * - * If `filterSyntaxV2` is set to true under the `params` field, then - * attribute-based expressions are expected instead of the above described - * tag-based syntax. Examples: - * - * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - * * (availability: ANY("IN_STOCK")) AND - * (colors: ANY("Red") OR categories: ANY("Phones")) - * - * For more information, see - * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - * @param {boolean} request.validateOnly - * Use validate only mode for this prediction query. If set to true, a - * dummy model will be used that returns arbitrary products. - * Note that the validate only mode should only be used for testing the API, - * or if the model is not ready. - * @param {number[]} request.params - * Additional domain specific parameters for the predictions. - * - * Allowed values: - * - * * `returnProduct`: Boolean. If set to true, the associated product - * object will be returned in the `results.metadata` field in the - * prediction response. - * * `returnScore`: Boolean. If set to true, the prediction 'score' - * corresponding to each returned product will be set in the - * `results.metadata` field in the prediction response. The given - * 'score' indicates the probability of a product being clicked/purchased - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular products instead of empty if - * your filter blocks all prediction results. - * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-price-reranking', 'low-price-reranking', - * 'medium-price-reranking', 'high-price-reranking'}. This gives - * request-level control and adjusts prediction results based on product - * price. - * * `diversityLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-diversity', 'low-diversity', - * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - * request-level control and adjusts prediction results based on product - * category. - * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - * field is interpreteted according to the new, attribute-based syntax. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * See [Google Cloud - * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * for more details. - * @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 {@link protos.google.cloud.retail.v2alpha.PredictResponse|PredictResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/prediction_service.predict.js - * region_tag:retail_v2alpha_generated_PredictionService_Predict_async - */ - predict( - request?: protos.google.cloud.retail.v2alpha.IPredictRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, {}|undefined - ]>; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): void; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): void; - predict( - request?: protos.google.cloud.retail.v2alpha.IPredictRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('predict request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('predict response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.predict(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, {}|undefined - ]) => { - this._log.info('predict response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.predictionServiceStub && !this._terminated) { - return this.predictionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client_config.json.baseline deleted file mode 100644 index ed48fe501013..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_client_config.json.baseline +++ /dev/null @@ -1,40 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.PredictionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Predict": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/prediction_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client.ts.baseline deleted file mode 100644 index ed837e7029ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client.ts.baseline +++ /dev/null @@ -1,3387 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as product_service_client_config from './product_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/product_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'product_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for ingesting {@link protos.google.cloud.retail.v2alpha.Product|Product} - * information of the customer's website. - * @class - * @memberof v2alpha - */ -export class ProductServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - productServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProductServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ProductServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProductServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listProducts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'products') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const purgeProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeProductsResponse') as gax.protobuf.Type; - const purgeProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeProductsMetadata') as gax.protobuf.Type; - const importProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportProductsResponse') as gax.protobuf.Type; - const importProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - const exportProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportProductsResponse') as gax.protobuf.Type; - const exportProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - const setInventoryResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.SetInventoryResponse') as gax.protobuf.Type; - const setInventoryMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.SetInventoryMetadata') as gax.protobuf.Type; - const addFulfillmentPlacesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse') as gax.protobuf.Type; - const addFulfillmentPlacesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata') as gax.protobuf.Type; - const removeFulfillmentPlacesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse') as gax.protobuf.Type; - const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata') as gax.protobuf.Type; - const addLocalInventoriesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddLocalInventoriesResponse') as gax.protobuf.Type; - const addLocalInventoriesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata') as gax.protobuf.Type; - const removeLocalInventoriesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse') as gax.protobuf.Type; - const removeLocalInventoriesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - purgeProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeProductsResponse.decode.bind(purgeProductsResponse), - purgeProductsMetadata.decode.bind(purgeProductsMetadata)), - importProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductsResponse.decode.bind(importProductsResponse), - importProductsMetadata.decode.bind(importProductsMetadata)), - exportProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportProductsResponse.decode.bind(exportProductsResponse), - exportProductsMetadata.decode.bind(exportProductsMetadata)), - setInventory: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - setInventoryResponse.decode.bind(setInventoryResponse), - setInventoryMetadata.decode.bind(setInventoryMetadata)), - addFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - addFulfillmentPlacesResponse.decode.bind(addFulfillmentPlacesResponse), - addFulfillmentPlacesMetadata.decode.bind(addFulfillmentPlacesMetadata)), - removeFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - removeFulfillmentPlacesResponse.decode.bind(removeFulfillmentPlacesResponse), - removeFulfillmentPlacesMetadata.decode.bind(removeFulfillmentPlacesMetadata)), - addLocalInventories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), - addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata)), - removeLocalInventories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - removeLocalInventoriesResponse.decode.bind(removeLocalInventoriesResponse), - removeLocalInventoriesMetadata.decode.bind(removeLocalInventoriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ProductService', gapicConfig as gax.ClientConfig, - 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.productServiceStub) { - return this.productServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ProductService. - this.productServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ProductService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ProductService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const productServiceStubMethods = - ['createProduct', 'getProduct', 'listProducts', 'updateProduct', 'deleteProduct', 'purgeProducts', 'importProducts', 'exportProducts', 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', 'addLocalInventories', 'removeLocalInventories']; - for (const methodName of productServiceStubMethods) { - const callPromise = this.productServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.productServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. - * @param {google.cloud.retail.v2alpha.Product} request.product - * Required. The {@link protos.google.cloud.retail.v2alpha.Product|Product} to create. - * @param {string} request.productId - * Required. The ID to use for the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, which will become the final - * component of the {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name}. - * - * If the caller does not have permission to create the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * This field must be unique among all - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s with the same - * {@link protos.google.cloud.retail.v2alpha.CreateProductRequest.parent|parent}. - * Otherwise, an ALREADY_EXISTS error is returned. - * - * This field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error 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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.create_product.js - * region_tag:retail_v2alpha_generated_ProductService_CreateProduct_async - */ - createProduct( - request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, {}|undefined - ]>; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): void; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): void; - createProduct( - request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createProduct response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, {}|undefined - ]) => { - this._log.info('createProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the requested {@link protos.google.cloud.retail.v2alpha.Product|Product} does not - * exist, a NOT_FOUND error 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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.get_product.js - * region_tag:retail_v2alpha_generated_ProductService_GetProduct_async - */ - getProduct( - request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, {}|undefined - ]>; - getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): void; - getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): void; - getProduct( - request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProduct response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, {}|undefined - ]) => { - this._log.info('getProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Product} request.product - * Required. The product to update/create. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update does not - * exist and - * {@link protos.google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing|allow_missing} - * is not set, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to update. The immutable and - * output only fields are NOT supported. If not set, all supported fields (the - * fields that are neither immutable nor output only) are updated. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * - * The attribute key can be updated by setting the mask path as - * "attributes.${key_name}". If a key name is present in the mask but not in - * the patching product from the request, this key will be deleted after the - * update. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, a new {@link protos.google.cloud.retail.v2alpha.Product|Product} will be - * created. In this situation, `update_mask` is ignored. - * @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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.update_product.js - * region_tag:retail_v2alpha_generated_ProductService_UpdateProduct_async - */ - updateProduct( - request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, {}|undefined - ]>; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): void; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): void; - updateProduct( - request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateProduct response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, {}|undefined - ]) => { - this._log.info('updateProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to delete the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to delete does not - * exist, a NOT_FOUND error is returned. - * - * The {@link protos.google.cloud.retail.v2alpha.Product|Product} to delete can neither be - * a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} member nor a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} with more than one - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variants}. Otherwise, an - * INVALID_ARGUMENT error is returned. - * - * All inventory information for the named - * {@link protos.google.cloud.retail.v2alpha.Product|Product} will be deleted. - * @param {boolean} request.force - * This value only applies to the case when the target product is of type - * PRIMARY. - * When deleting a product of VARIANT/COLLECTION type, this value - * will be ignored. - * When set to true, the subsequent variant products will be - * deleted. - * When set to false, if the primary product has active variant products, an - * error will be 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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.delete_product.js - * region_tag:retail_v2alpha_generated_ProductService_DeleteProduct_async - */ - deleteProduct( - request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, {}|undefined - ]>; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): void; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): void; - deleteProduct( - request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteProduct request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteProduct response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Permanently deletes all selected - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under a branch. - * - * This process is asynchronous. If the request is valid, the removal will be - * enqueued and processed offline. Depending on the number of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s, this operation could take - * hours to complete. Before the operation completes, some - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s may still be returned by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Depending on the number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s, - * this operation could take hours to complete. To get a sample of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s that would be deleted, set - * {@link protos.google.cloud.retail.v2alpha.PurgeProductsRequest.force|PurgeProductsRequest.force} - * to false. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the branch under which the products are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - * @param {string} request.filter - * Required. The filter string to specify the products to be deleted with a - * length limit of 5,000 characters. - * - * Empty string filter is not allowed. "*" implies delete all items in a - * branch. - * - * The eligible fields for filtering are: - * - * * `availability`: Double quoted - * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * string. - * * `create_time` : in ISO 8601 "zulu" format. - * - * Supported syntax: - * - * * Comparators (">", "<", ">=", "<=", "="). - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" - * * availability = "IN_STOCK" - * - * * Conjunctions ("AND") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - * - * * Disjunctions ("OR") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - * - * * Can support nested queries. - * Examples: - * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - * - * * Filter Limits: - * * Filter should not contain more than 6 conditions. - * * Max nesting depth should not exceed 2 levels. - * - * Examples queries: - * * Delete back order products created before a timestamp. - * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - * @param {boolean} request.force - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any products. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.purge_products.js - * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async - */ - purgeProducts( - request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - purgeProducts( - request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeProducts( - request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeProducts( - request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('purgeProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('purgeProducts request %j', request); - return this.innerApiCalls.purgeProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('purgeProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `purgeProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.purge_products.js - * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async - */ - async checkPurgeProductsProgress(name: string): Promise>{ - this._log.info('purgeProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.purgeProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Bulk import of multiple {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * Request processing may be synchronous. - * Non-existing items are created. - * - * Note that it is possible for a subset of the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s to be successfully updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * - * If no updateMask is specified, requires products.create permission. - * If updateMask is specified, requires products.update permission. - * @param {string} request.requestId - * Deprecated. This field has no effect. - * @param {google.cloud.retail.v2alpha.ProductInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided imported `products` to update. If - * not set, all fields are updated. If provided, only the existing product - * fields are updated. Missing products will not be created. - * @param {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} request.reconciliationMode - * The mode of reconciliation between existing products and the products to be - * imported. Defaults to - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. - * @param {string} request.notificationPubsubTopic - * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * {@link protos.google.longrunning.Operation|Operation}. - * - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - * to be within the same project as - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.parent|ImportProductsRequest.parent}. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * - * Only supported when - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. - * @param {boolean} request.skipDefaultBranchProtection - * If true, this performs the FULL import even if it would delete a large - * proportion of the products in the default branch, which could potentially - * cause outages if you have live predict/search traffic. - * - * Only supported when - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.import_products.js - * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async - */ - importProducts( - request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importProducts( - request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('importProducts request %j', request); - return this.innerApiCalls.importProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.import_products.js - * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async - */ - async checkImportProductsProgress(name: string): Promise>{ - this._log.info('importProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports multiple {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of a {@link protos.google.cloud.retail.v2alpha.Branch|Branch}, - * and `default_branch` for branch_id component is supported. For example - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned products. Use this expression to restrict results to a - * specific time range, tag, or stock state or to filter products by product - * type. - * For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - * - * We expect only four types of fields: - * - * * `lastModifiedTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `lastModifiedTime` restriction should result in one, contiguous, - * valid, last-modified, time range. - * - * * `productType`: Supported values are `primary` and `variant`. The - * Boolean operators `OR` and `NOT` are supported if the expression is - * enclosed in parentheses and must be separated from the - * `productType` values by a space. - * - * * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - * `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - * supported if the expression is enclosed in parentheses and must be - * separated from the `availability` values by a space. - * - * * `Tag expressions`: Restricts output to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. Also supported is '`-"tagA"`', which - * is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - * UTF-8 encoded strings and have a size limit of 1,000 characters. - * - * Some examples of valid filters expressions: - * - * * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * productType = "variant"` - * * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - * tag=(NOT "promotional") - * productType = "primary" lastModifiedTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `availability = (IN_STOCK OR BACKORDER)` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.export_products.js - * region_tag:retail_v2alpha_generated_ProductService_ExportProducts_async - */ - exportProducts( - request?: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportProducts( - request: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportProducts( - request: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportProducts( - request?: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('exportProducts request %j', request); - return this.innerApiCalls.exportProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.export_products.js - * region_tag:retail_v2alpha_generated_ProductService_ExportProducts_async - */ - async checkExportProductsProgress(name: string): Promise>{ - this._log.info('exportProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} while respecting the last - * update timestamps of each inventory field. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update is enqueued - * and processed downstream. As a consequence, when a response is returned, - * updates are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * When inventory is updated with - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct}, - * the specified inventory field value(s) overwrite any existing value(s) - * while ignoring the last update time for this field. Furthermore, the last - * update times for the specified inventory fields are overwritten by the - * times of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * request. - * - * If no inventory fields are set in - * {@link protos.google.cloud.retail.v2alpha.CreateProductRequest.product|CreateProductRequest.product}, - * then any pre-existing inventory information for this product is used. - * - * If no inventory fields are set in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, - * then any existing inventory information is preserved. - * - * Pre-existing inventory information can only be updated with - * {@link protos.google.cloud.retail.v2alpha.ProductService.SetInventory|ProductService.SetInventory}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s is obsolete after - * one day, and the {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API returns `NOT_FOUND` afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates are not marked as {@link protos.google.longrunning.Operation.done|done} until - * they are obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Product} request.inventory - * Required. The inventory information to update. The allowable fields to - * update are: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * * {@link protos.google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} - * * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} - * The updated inventory fields must be specified in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. - * - * If - * {@link protos.google.cloud.retail.v2alpha.Product.name|SetInventoryRequest.inventory.name} - * is empty or invalid, an INVALID_ARGUMENT error is returned. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} named in - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name}, regardless of - * whether or not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update does not - * have existing inventory information, the provided inventory information - * will be inserted. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update has - * existing inventory information, the provided inventory information will be - * merged while respecting the last update time for each inventory field, - * using the provided or default value for - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. - * - * The caller can replace place IDs for a subset of fulfillment types in the - * following ways: - * - * * Adds "fulfillment_info" in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} - * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in - * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} - * - * The caller can clear all place IDs from a subset of fulfillment types in - * the following ways: - * - * * Adds "fulfillment_info" in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} - * * Specifies only the desired fulfillment types to clear in - * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} - * * Checks that only the desired fulfillment info types have empty - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} - * - * The last update time is recorded for the following inventory fields: - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * * {@link protos.google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} - * * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} - * - * If a full overwrite of inventory information while ignoring timestamps is - * needed, - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * should be invoked instead. - * @param {google.protobuf.FieldMask} request.setMask - * Indicates which inventory fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to update. - * - * At least one field must be provided. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - * @param {google.protobuf.Timestamp} request.setTime - * The time when the request is issued, used to prevent - * out-of-order updates on inventory fields with the last update time - * recorded. If not provided, the internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} with - * name {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is not found, - * the inventory update will still be processed and retained for at most 1 day - * until the {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set - * to false, a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.set_inventory.js - * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async - */ - setInventory( - request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setInventory( - request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'inventory.name': request.inventory!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('setInventory response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('setInventory request %j', request); - return this.innerApiCalls.setInventory(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('setInventory response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `setInventory()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.set_inventory.js - * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async - */ - async checkSetInventoryProgress(name: string): Promise>{ - this._log.info('setInventory long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setInventory, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * We recommend that you use the - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddLocalInventories|ProductService.AddLocalInventories} - * method instead of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces} - * method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddLocalInventories|ProductService.AddLocalInventories} - * achieves the same results but provides more fine-grained control over - * ingesting local inventory data. - * - * Incrementally adds place IDs to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, the added place IDs are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string} request.type - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * - * Supported values: - * - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * - * This field directly corresponds to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. - * @param {string[]} request.placeIds - * Required. The IDs for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}, such - * as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery" to be added for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}. - * Duplicate IDs will be automatically ignored. - * - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * - * If the total number of place IDs exceeds 2000 for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type} after - * adding, then the update will be rejected. - * @param {google.protobuf.Timestamp} request.addTime - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async - */ - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('addFulfillmentPlaces response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('addFulfillmentPlaces request %j', request); - return this.innerApiCalls.addFulfillmentPlaces(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addFulfillmentPlaces response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `addFulfillmentPlaces()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async - */ - async checkAddFulfillmentPlacesProgress(name: string): Promise>{ - this._log.info('addFulfillmentPlaces long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * We recommend that you use the - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} - * method instead of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces} - * method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} - * achieves the same results but provides more fine-grained control over - * ingesting local inventory data. - * - * Incrementally removes place IDs from a - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, the removed place IDs are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string} request.type - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * - * Supported values: - * - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * - * This field directly corresponds to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. - * @param {string[]} request.placeIds - * Required. The IDs for this - * {@link protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}, - * such as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery", to be removed for this - * {@link protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}. - * - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {google.protobuf.Timestamp} request.removeTime - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async - */ - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('removeFulfillmentPlaces response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('removeFulfillmentPlaces request %j', request); - return this.innerApiCalls.removeFulfillmentPlaces(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeFulfillmentPlaces response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `removeFulfillmentPlaces()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async - */ - async checkRemoveFulfillmentPlacesProgress(name: string): Promise>{ - this._log.info('removeFulfillmentPlaces long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates local inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} at a list of places, while - * respecting the last update timestamps of each inventory field. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * inventory information. If the request is valid, the update will be enqueued - * and processed downstream. As a consequence, when a response is returned, - * updates are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Local inventory information can only be modified using this method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * has no effect on local inventories. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {number[]} request.localInventories - * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 3000 inventories are allowed per - * request. - * @param {google.protobuf.FieldMask} request.addMask - * Indicates which inventory fields in the provided list of - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory} to update. The - * field is updated to the provided value. - * - * If a field is set while the place does not have a previous local inventory, - * the local inventory at that store is created. - * - * If a field is set while the value of that field is not provided, the - * original field value, if it exists, is deleted. - * - * If the mask is not set or set with empty paths, all inventory fields will - * be updated. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - * @param {google.protobuf.Timestamp} request.addTime - * The time when the inventory updates are issued. Used to prevent - * out-of-order updates on local inventory fields. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the local inventory will still be processed and retained for at - * most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async - */ - addLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('addLocalInventories response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('addLocalInventories request %j', request); - return this.innerApiCalls.addLocalInventories(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addLocalInventories response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `addLocalInventories()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async - */ - async checkAddLocalInventoriesProgress(name: string): Promise>{ - this._log.info('addLocalInventories long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addLocalInventories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Remove local inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} at a list of places at a - * removal timestamp. - * - * This process is asynchronous. If the request is valid, the removal will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, removals are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Local inventory information can only be removed using this method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * has no effect on local inventories. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string[]} request.placeIds - * Required. A list of place IDs to have their inventory deleted. - * At most 3000 place IDs are allowed per request. - * @param {google.protobuf.Timestamp} request.removeTime - * The time when the inventory deletions are issued. Used to prevent - * out-of-order updates and deletions on local inventory fields. If not - * provided, the internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the local inventory removal request will still be processed and - * retained for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async - */ - removeLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('removeLocalInventories response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('removeLocalInventories request %j', request); - return this.innerApiCalls.removeLocalInventories(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeLocalInventories response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `removeLocalInventories()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async - */ - async checkRemoveLocalInventoriesProgress(name: string): Promise>{ - this._log.info('removeLocalInventories long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeLocalInventories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Gets a list of {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * 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. - */ - listProducts( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]>; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): void; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): void; - listProducts( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listProducts values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listProducts request %j', request); - return this.innerApiCalls - .listProducts(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]) => { - this._log.info('listProducts values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listProducts`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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.cloud.retail.v2alpha.Product|Product} 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 `listProductsAsync()` - * 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. - */ - listProductsStream( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listProducts stream %j', request); - return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listProducts`, 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. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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.cloud.retail.v2alpha.Product|Product}. 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 include:samples/generated/v2alpha/product_service.list_products.js - * region_tag:retail_v2alpha_generated_ProductService_ListProducts_async - */ - listProductsAsync( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listProducts iterate %j', request); - return this.descriptors.page.listProducts.asyncIterate( - this.innerApiCalls['listProducts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.productServiceStub && !this._terminated) { - return this.productServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client_config.json.baseline deleted file mode 100644 index a50b8b0ae321..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_client_config.json.baseline +++ /dev/null @@ -1,109 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ProductService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "49abb7cadc111ff8dd551b61fcad123362c8d090": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 300000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ListProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "DeleteProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "PurgeProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ImportProducts": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" - }, - "ExportProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "SetInventory": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AddFulfillmentPlaces": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "RemoveFulfillmentPlaces": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AddLocalInventories": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "RemoveLocalInventories": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/product_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client.ts.baseline deleted file mode 100644 index 9ec5e1615f23..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client.ts.baseline +++ /dev/null @@ -1,1869 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as project_service_client_config from './project_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/project_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'project_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for settings at Project level. - * @class - * @memberof v2alpha - */ -export class ProjectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - projectServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProjectServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ProjectServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProjectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const enrollSolutionResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.EnrollSolutionResponse') as gax.protobuf.Type; - const enrollSolutionMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.EnrollSolutionMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - enrollSolution: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - enrollSolutionResponse.decode.bind(enrollSolutionResponse), - enrollSolutionMetadata.decode.bind(enrollSolutionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ProjectService', gapicConfig as gax.ClientConfig, - 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.projectServiceStub) { - return this.projectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ProjectService. - this.projectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ProjectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ProjectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const projectServiceStubMethods = - ['getProject', 'acceptTerms', 'enrollSolution', 'listEnrolledSolutions', 'getLoggingConfig', 'updateLoggingConfig', 'getAlertConfig', 'updateAlertConfig']; - for (const methodName of projectServiceStubMethods) { - const callPromise = this.projectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.projectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the project. - * - * Throws `NOT_FOUND` if the project wasn't initialized for the Retail API - * service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - * @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 {@link protos.google.cloud.retail.v2alpha.Project|Project}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_project.js - * region_tag:retail_v2alpha_generated_ProjectService_GetProject_async - */ - getProject( - request?: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, {}|undefined - ]>; - getProject( - request: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): void; - getProject( - request: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): void; - getProject( - request?: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getProject request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProject response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getProject(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, {}|undefined - ]) => { - this._log.info('getProject response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Accepts service terms for this project. - * By making requests to this API, you agree to the terms of service linked - * below. - * https://cloud.google.com/retail/data-use-terms - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - * @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 {@link protos.google.cloud.retail.v2alpha.Project|Project}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.accept_terms.js - * region_tag:retail_v2alpha_generated_ProjectService_AcceptTerms_async - */ - acceptTerms( - request?: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, {}|undefined - ]>; - acceptTerms( - request: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): void; - acceptTerms( - request: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): void; - acceptTerms( - request?: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('acceptTerms request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('acceptTerms response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.acceptTerms(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, {}|undefined - ]) => { - this._log.info('acceptTerms response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Lists all the retail API solutions the project has enrolled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_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 {@link protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse|ListEnrolledSolutionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.list_enrolled_solutions.js - * region_tag:retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async - */ - listEnrolledSolutions( - request?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, {}|undefined - ]>; - listEnrolledSolutions( - request: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): void; - listEnrolledSolutions( - request: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): void; - listEnrolledSolutions( - request?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listEnrolledSolutions request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listEnrolledSolutions response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listEnrolledSolutions(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, {}|undefined - ]) => { - this._log.info('listEnrolledSolutions response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} of the - * requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full LoggingConfig resource name. Format: - * projects/{project_number}/loggingConfig - * @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 {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_logging_config.js - * region_tag:retail_v2alpha_generated_ProjectService_GetLoggingConfig_async - */ - getLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, {}|undefined - ]>; - getLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - getLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - getLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getLoggingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLoggingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getLoggingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getLoggingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} of - * the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.LoggingConfig} request.loggingConfig - * Required. The {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to - * update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to update - * does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to update. The - * following are the only supported fields: - * - * * {@link protos.google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule|LoggingConfig.default_log_generation_rule} - * * {@link protos.google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules|LoggingConfig.service_log_generation_rules} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.update_logging_config.js - * region_tag:retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async - */ - updateLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, {}|undefined - ]>; - updateLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'logging_config.name': request.loggingConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateLoggingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateLoggingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateLoggingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateLoggingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get the {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} of the - * requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full AlertConfig resource name. Format: - * projects/{project_number}/alertConfig - * @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 {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_alert_config.js - * region_tag:retail_v2alpha_generated_ProjectService_GetAlertConfig_async - */ - getAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, {}|undefined - ]>; - getAlertConfig( - request: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - getAlertConfig( - request: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - getAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAlertConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAlertConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getAlertConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getAlertConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the alert config of the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.AlertConfig} request.alertConfig - * Required. The {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to - * update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to update - * does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to update. If not - * set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.update_alert_config.js - * region_tag:retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async - */ - updateAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, {}|undefined - ]>; - updateAlertConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAlertConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'alert_config.name': request.alertConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAlertConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAlertConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateAlertConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateAlertConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * The method enrolls a solution of type [Retail - * Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] - * into a project. - * - * The [Recommendations AI solution - * type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] - * is enrolled by default when your project enables Retail API, so you don't - * need to call the enrollSolution method for recommendations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - * @param {google.cloud.retail.v2alpha.SolutionType} request.solution - * Required. Solution to enroll. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.enroll_solution.js - * region_tag:retail_v2alpha_generated_ProjectService_EnrollSolution_async - */ - enrollSolution( - request?: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - enrollSolution( - request: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enrollSolution( - request: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enrollSolution( - request?: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('enrollSolution response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('enrollSolution request %j', request); - return this.innerApiCalls.enrollSolution(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('enrollSolution response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `enrollSolution()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.enroll_solution.js - * region_tag:retail_v2alpha_generated_ProjectService_EnrollSolution_async - */ - async checkEnrollSolutionProgress(name: string): Promise>{ - this._log.info('enrollSolution long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.enrollSolution, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.projectServiceStub && !this._terminated) { - return this.projectServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client_config.json.baseline deleted file mode 100644 index 9360e98eed01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_client_config.json.baseline +++ /dev/null @@ -1,75 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ProjectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetProject": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AcceptTerms": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "EnrollSolution": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ListEnrolledSolutions": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetLoggingConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateLoggingConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetAlertConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateAlertConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/project_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client.ts.baseline deleted file mode 100644 index c4d120af3ba1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client.ts.baseline +++ /dev/null @@ -1,2155 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as search_service_client_config from './search_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/search_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'search_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for search. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * @class - * @memberof v2alpha - */ -export class SearchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - searchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SearchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 SearchServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SearchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - experimentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - search: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.SearchService', gapicConfig as gax.ClientConfig, - 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.searchServiceStub) { - return this.searchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.SearchService. - this.searchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.SearchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.SearchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const searchServiceStubMethods = - ['search']; - for (const methodName of searchServiceStubMethods) { - const callPromise = this.searchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.searchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Performs a search. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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 Array of {@link protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAsync()` - * 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. - */ - search( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]>; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): void; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): void; - search( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): - Promise<[ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('search values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('search request %j', request); - return this.innerApiCalls - .search(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]) => { - this._log.info('search values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `search`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult} 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 `searchAsync()` - * 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. - */ - searchStream( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - Transform{ - 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({ - 'placement': request.placement ?? '', - }); - const defaultCallSettings = this._defaults['search']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('search stream %j', request); - return this.descriptors.page.search.createStream( - this.innerApiCalls.search as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `search`, 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.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult}. 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 include:samples/generated/v2alpha/search_service.search.js - * region_tag:retail_v2alpha_generated_SearchService_Search_async - */ - searchAsync( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'placement': request.placement ?? '', - }); - const defaultCallSettings = this._defaults['search']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('search iterate %j', request); - return this.descriptors.page.search.asyncIterate( - this.innerApiCalls['search'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified experiment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} experiment - * @returns {string} Resource name string. - */ - experimentPath(project:string,location:string,catalog:string,experiment:string) { - return this.pathTemplates.experimentPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - experiment: experiment, - }); - } - - /** - * Parse the project from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).project; - } - - /** - * Parse the location from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).location; - } - - /** - * Parse the catalog from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).catalog; - } - - /** - * Parse the experiment from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the experiment. - */ - matchExperimentFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).experiment; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.searchServiceStub && !this._terminated) { - return this.searchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client_config.json.baseline deleted file mode 100644 index 71a5a478c8cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_client_config.json.baseline +++ /dev/null @@ -1,40 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.SearchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Search": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/search_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client.ts.baseline deleted file mode 100644 index 1c15ebee1c9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client.ts.baseline +++ /dev/null @@ -1,1817 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as serving_config_service_client_config from './serving_config_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/serving_config_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'serving_config_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for modifying ServingConfig. - * @class - * @memberof v2alpha - */ -export class ServingConfigServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - servingConfigServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServingConfigServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ServingConfigServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServingConfigServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listServingConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'servingConfigs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ServingConfigService', gapicConfig as gax.ClientConfig, - 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.servingConfigServiceStub) { - return this.servingConfigServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ServingConfigService. - this.servingConfigServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ServingConfigService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ServingConfigService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const servingConfigServiceStubMethods = - ['createServingConfig', 'deleteServingConfig', 'updateServingConfig', 'getServingConfig', 'listServingConfigs', 'addControl', 'removeControl']; - for (const methodName of servingConfigServiceStubMethods) { - const callPromise = this.servingConfigServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.servingConfigServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a ServingConfig. - * - * A maximum of 100 - * {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}s are allowed in - * a {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}, otherwise a - * FAILED_PRECONDITION error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig - * Required. The ServingConfig to create. - * @param {string} request.servingConfigId - * Required. The ID to use for the ServingConfig, which will become the final - * component of the ServingConfig's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-_/. - * @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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.create_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async - */ - createServingConfig( - request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, {}|undefined - ]>; - createServingConfig( - request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - createServingConfig( - request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - createServingConfig( - request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createServingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('createServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a ServingConfig. - * - * Returns a NotFound error if the ServingConfig does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ServingConfig to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.delete_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async - */ - deleteServingConfig( - request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, {}|undefined - ]>; - deleteServingConfig( - request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteServingConfig( - request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteServingConfig( - request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteServingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a ServingConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig - * Required. The ServingConfig to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig} to update. The - * following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.ServingConfig.name|ServingConfig.name} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.update_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async - */ - updateServingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, {}|undefined - ]>; - updateServingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateServingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateServingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config.name': request.servingConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateServingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('updateServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a ServingConfig. - * - * Returns a NotFound error if the ServingConfig does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ServingConfig to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.get_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_GetServingConfig_async - */ - getServingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, {}|undefined - ]>; - getServingConfig( - request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): void; - getServingConfig( - request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): void; - getServingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServingConfig response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, {}|undefined - ]) => { - this._log.info('getServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Enables a Control on the specified ServingConfig. - * The control is added in the last position of the list of controls - * it belongs to (e.g. if it's a facet spec control it will be applied - * in the last position of servingConfig.facetSpecIds) - * Returns a ALREADY_EXISTS error if the control has already been applied. - * Returns a FAILED_PRECONDITION error if the addition could exceed maximum - * number of control allowed for that type of control. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.servingConfig - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - * @param {string} request.controlId - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config - if id is not found a NOT_FOUND error 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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.add_control.js - * region_tag:retail_v2alpha_generated_ServingConfigService_AddControl_async - */ - addControl( - request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, {}|undefined - ]>; - addControl( - request: protos.google.cloud.retail.v2alpha.IAddControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): void; - addControl( - request: protos.google.cloud.retail.v2alpha.IAddControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): void; - addControl( - request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config': request.servingConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('addControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.addControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, {}|undefined - ]) => { - this._log.info('addControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Disables a Control on the specified ServingConfig. - * The control is removed from the ServingConfig. - * Returns a NOT_FOUND error if the Control is not enabled for the - * ServingConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.servingConfig - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - * @param {string} request.controlId - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config. - * @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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.remove_control.js - * region_tag:retail_v2alpha_generated_ServingConfigService_RemoveControl_async - */ - removeControl( - request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, {}|undefined - ]>; - removeControl( - request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): void; - removeControl( - request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): void; - removeControl( - request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config': request.servingConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('removeControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('removeControl response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.removeControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, {}|undefined - ]) => { - this._log.info('removeControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all ServingConfigs linked to this catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServingConfigsAsync()` - * 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. - */ - listServingConfigs( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]>; - listServingConfigs( - request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): void; - listServingConfigs( - request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): void; - listServingConfigs( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServingConfigs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listServingConfigs request %j', request); - return this.innerApiCalls - .listServingConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]) => { - this._log.info('listServingConfigs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServingConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.ServingConfig|ServingConfig} 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 `listServingConfigsAsync()` - * 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. - */ - listServingConfigsStream( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServingConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServingConfigs stream %j', request); - return this.descriptors.page.listServingConfigs.createStream( - this.innerApiCalls.listServingConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServingConfigs`, 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. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.ServingConfig|ServingConfig}. 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 include:samples/generated/v2alpha/serving_config_service.list_serving_configs.js - * region_tag:retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async - */ - listServingConfigsAsync( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServingConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServingConfigs iterate %j', request); - return this.descriptors.page.listServingConfigs.asyncIterate( - this.innerApiCalls['listServingConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.servingConfigServiceStub && !this._terminated) { - return this.servingConfigServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client_config.json.baseline deleted file mode 100644 index 6489c5db6ef6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ServingConfigService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServingConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/serving_config_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client.ts.baseline deleted file mode 100644 index 71e7127cac1e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client.ts.baseline +++ /dev/null @@ -1,1807 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as user_event_service_client_config from './user_event_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/user_event_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'user_event_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service for ingesting end user actions on the customer website. - * @class - * @memberof v2alpha - */ -export class UserEventServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - userEventServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of UserEventServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 UserEventServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof UserEventServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const purgeUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeUserEventsResponse') as gax.protobuf.Type; - const purgeUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeMetadata') as gax.protobuf.Type; - const importUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportUserEventsResponse') as gax.protobuf.Type; - const importUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - const exportUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportUserEventsResponse') as gax.protobuf.Type; - const exportUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - const rejoinUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RejoinUserEventsResponse') as gax.protobuf.Type; - const rejoinUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RejoinUserEventsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - purgeUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeUserEventsResponse.decode.bind(purgeUserEventsResponse), - purgeUserEventsMetadata.decode.bind(purgeUserEventsMetadata)), - importUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importUserEventsResponse.decode.bind(importUserEventsResponse), - importUserEventsMetadata.decode.bind(importUserEventsMetadata)), - exportUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportUserEventsResponse.decode.bind(exportUserEventsResponse), - exportUserEventsMetadata.decode.bind(exportUserEventsMetadata)), - rejoinUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rejoinUserEventsResponse.decode.bind(rejoinUserEventsResponse), - rejoinUserEventsMetadata.decode.bind(rejoinUserEventsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.UserEventService', gapicConfig as gax.ClientConfig, - 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.userEventServiceStub) { - return this.userEventServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.UserEventService. - this.userEventServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.UserEventService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.UserEventService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const userEventServiceStubMethods = - ['writeUserEvent', 'collectUserEvent', 'purgeUserEvents', 'importUserEvents', 'exportUserEvents', 'rejoinUserEvents']; - for (const methodName of userEventServiceStubMethods) { - const callPromise = this.userEventServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.userEventServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Writes a single user event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent - * Required. User event to write. - * @param {boolean} request.writeAsync - * If set to true, the user event will be written asynchronously after - * validation, and the API will respond without waiting for the write. - * Therefore, silent failures can occur even if the API returns success. In - * case of silent failures, error messages can be found in Stackdriver logs. - * @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 {@link protos.google.cloud.retail.v2alpha.UserEvent|UserEvent}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.write_user_event.js - * region_tag:retail_v2alpha_generated_UserEventService_WriteUserEvent_async - */ - writeUserEvent( - request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, {}|undefined - ]>; - writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): void; - writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): void; - writeUserEvent( - request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('writeUserEvent request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('writeUserEvent response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.writeUserEvent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, {}|undefined - ]) => { - this._log.info('writeUserEvent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Writes a single user event from the browser. - * - * For larger user event payload over 16 KB, the POST method should be used - * instead, otherwise a 400 Bad Request error is returned. - * - * This method is used only by the Retail API JavaScript pixel and Google Tag - * Manager. Users should not call this method directly. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.prebuiltRule - * The prebuilt rule name that can convert a specific type of raw_json. - * For example: "ga4_bq" rule for the GA4 user event schema. - * @param {string} request.parent - * Required. The parent catalog name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {string} request.userEvent - * Required. URL encoded UserEvent proto with a length limit of 2,000,000 - * characters. - * @param {string} request.uri - * The URL including cgi-parameters but excluding the hash fragment with a - * length limit of 5,000 characters. This is often more useful than the - * referer URL, because many browsers only send the domain for 3rd party - * requests. - * @param {number} request.ets - * The event timestamp in milliseconds. This prevents browser caching of - * otherwise identical get requests. The name is abbreviated to reduce the - * payload bytes. - * @param {string} request.rawJson - * An arbitrary serialized JSON string that contains necessary information - * that can comprise a user event. When this field is specified, the - * user_event field will be ignored. Note: line-delimited JSON is not - * supported, a single JSON only. - * @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 {@link protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.collect_user_event.js - * region_tag:retail_v2alpha_generated_UserEventService_CollectUserEvent_async - */ - collectUserEvent( - request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, {}|undefined - ]>; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): void; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): void; - collectUserEvent( - request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('collectUserEvent request %j', request); - const wrappedCallback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('collectUserEvent response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.collectUserEvent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, {}|undefined - ]) => { - this._log.info('collectUserEvent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Deletes permanently all user events specified by the filter provided. - * Depending on the number of events specified by the filter, this operation - * could take hours or days to complete. To test a filter, use the list - * command first. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the catalog under which the events are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}` - * @param {string} request.filter - * Required. The filter string to specify the events to be deleted with a - * length limit of 5,000 characters. Empty string filter is not allowed. The - * eligible fields for filtering are: - * - * * `eventType`: Double quoted - * {@link protos.google.cloud.retail.v2alpha.UserEvent.event_type|UserEvent.event_type} - * string. - * * `eventTime`: in ISO 8601 "zulu" format. - * * `visitorId`: Double quoted string. Specifying this will delete all - * events associated with a visitor. - * * `userId`: Double quoted string. Specifying this will delete all events - * associated with a user. - * - * Examples: - * - * * Deleting all events in a time range: - * `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Deleting specific eventType in time range: - * `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - * * Deleting all events for a specific visitor: - * `visitorId = "visitor1024"` - * - * The filtering fields are assumed to have an implicit AND. - * @param {boolean} request.force - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any user events. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async - */ - purgeUserEvents( - request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeUserEvents( - request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('purgeUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('purgeUserEvents request %j', request); - return this.innerApiCalls.purgeUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('purgeUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `purgeUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async - */ - async checkPurgeUserEventsProgress(name: string): Promise>{ - this._log.info('purgeUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.purgeUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Bulk import of User events. Request processing might be - * synchronous. Events that already exist are skipped. - * Use this method for backfilling historical user events. - * - * `Operation.response` is of type `ImportResponse`. Note that it is - * possible for a subset of the items to be successfully inserted. - * `Operation.metadata` is of type `ImportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async - */ - importUserEvents( - request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importUserEvents( - request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('importUserEvents request %j', request); - return this.innerApiCalls.importUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async - */ - async checkImportUserEventsProgress(name: string): Promise>{ - this._log.info('importUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports user events. - * - * `Operation.response` is of type `ExportResponse`. - * `Operation.metadata` is of type `ExportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of a - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. For example - * `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned user events. Use this expression to restrict results to a - * specific time range or to filter events by eventType. - * For example, `eventTime > "2012-04-23T18:25:43.511Z" - * eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - * eventType=search` - * - * We expect only three types of fields: - * - * * `eventTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `eventTime` restriction should result in one, contiguous, valid, - * `eventTime` range. - * - * * `eventType`: Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. - * - * * `eventsMissingCatalogItems`: This restricts results - * to events for which catalog items were not found in the catalog. The - * default behavior is to return only those events for which catalog - * items were found. - * - * Some examples of valid filters expressions: - * - * * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - * eventType = detail-page-view` - * * Example 3: `eventsMissingCatalogItems - * eventType = (NOT search) eventTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `eventType = (detail-page-view OR search)` - * * Example 6: `eventsMissingCatalogItems` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.export_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ExportUserEvents_async - */ - exportUserEvents( - request?: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportUserEvents( - request: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportUserEvents( - request: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportUserEvents( - request?: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('exportUserEvents request %j', request); - return this.innerApiCalls.exportUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.export_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ExportUserEvents_async - */ - async checkExportUserEventsProgress(name: string): Promise>{ - this._log.info('exportUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a user-event rejoin operation with latest product catalog. Events - * are not annotated with detailed product information for products that are - * missing from the catalog when the user event is ingested. These - * events are stored as unjoined events with limited usage on training and - * serving. You can use this method to start a join operation on specified - * events with the latest version of product catalog. You can also use this - * method to correct events joined with the wrong product catalog. A rejoin - * operation can take hours or days to complete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.userEventRejoinScope - * The type of the user event rejoin to define the scope and range of the user - * events to be rejoined with the latest product catalog. Defaults to - * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - * an invalid integer value. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async - */ - rejoinUserEvents( - request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rejoinUserEvents( - request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('rejoinUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('rejoinUserEvents request %j', request); - return this.innerApiCalls.rejoinUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('rejoinUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `rejoinUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async - */ - async checkRejoinUserEventsProgress(name: string): Promise>{ - this._log.info('rejoinUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rejoinUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.userEventServiceStub && !this._terminated) { - return this.userEventServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client_config.json.baseline deleted file mode 100644 index 65e9ec7d6f6e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_client_config.json.baseline +++ /dev/null @@ -1,83 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.UserEventService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "49abb7cadc111ff8dd551b61fcad123362c8d090": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 300000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "WriteUserEvent": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "CollectUserEvent": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "PurgeUserEvents": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ImportUserEvents": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" - }, - "ExportUserEvents": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "RejoinUserEvents": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/src/v2alpha/user_event_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 7b9b41bbb335..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const retail = require('retail'); - -function main() { - const analyticsServiceClient = new retail.AnalyticsServiceClient(); - const branchServiceClient = new retail.BranchServiceClient(); - const catalogServiceClient = new retail.CatalogServiceClient(); - const completionServiceClient = new retail.CompletionServiceClient(); - const controlServiceClient = new retail.ControlServiceClient(); - const conversationalSearchServiceClient = new retail.ConversationalSearchServiceClient(); - const generativeQuestionServiceClient = new retail.GenerativeQuestionServiceClient(); - const merchantCenterAccountLinkServiceClient = new retail.MerchantCenterAccountLinkServiceClient(); - const modelServiceClient = new retail.ModelServiceClient(); - const predictionServiceClient = new retail.PredictionServiceClient(); - const productServiceClient = new retail.ProductServiceClient(); - const projectServiceClient = new retail.ProjectServiceClient(); - const searchServiceClient = new retail.SearchServiceClient(); - const servingConfigServiceClient = new retail.ServingConfigServiceClient(); - const userEventServiceClient = new retail.UserEventServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index be1f058a2723..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as retail from 'retail'; - -function main() { - const analyticsServiceClient = new retail.AnalyticsServiceClient(); - const branchServiceClient = new retail.BranchServiceClient(); - const catalogServiceClient = new retail.CatalogServiceClient(); - const completionServiceClient = new retail.CompletionServiceClient(); - const controlServiceClient = new retail.ControlServiceClient(); - const conversationalSearchServiceClient = new retail.ConversationalSearchServiceClient(); - const generativeQuestionServiceClient = new retail.GenerativeQuestionServiceClient(); - const merchantCenterAccountLinkServiceClient = new retail.MerchantCenterAccountLinkServiceClient(); - const modelServiceClient = new retail.ModelServiceClient(); - const predictionServiceClient = new retail.PredictionServiceClient(); - const productServiceClient = new retail.ProductServiceClient(); - const projectServiceClient = new retail.ProjectServiceClient(); - const searchServiceClient = new retail.SearchServiceClient(); - const servingConfigServiceClient = new retail.ServingConfigServiceClient(); - const userEventServiceClient = new retail.UserEventServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index bdba7b07a3bf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient} from 'retail'; - -// check that the client class type name can be used -function doStuffWithAnalyticsServiceClient(client: AnalyticsServiceClient) { - client.close(); -} -function doStuffWithBranchServiceClient(client: BranchServiceClient) { - client.close(); -} -function doStuffWithCatalogServiceClient(client: CatalogServiceClient) { - client.close(); -} -function doStuffWithCompletionServiceClient(client: CompletionServiceClient) { - client.close(); -} -function doStuffWithControlServiceClient(client: ControlServiceClient) { - client.close(); -} -function doStuffWithConversationalSearchServiceClient(client: ConversationalSearchServiceClient) { - client.close(); -} -function doStuffWithGenerativeQuestionServiceClient(client: GenerativeQuestionServiceClient) { - client.close(); -} -function doStuffWithMerchantCenterAccountLinkServiceClient(client: MerchantCenterAccountLinkServiceClient) { - client.close(); -} -function doStuffWithModelServiceClient(client: ModelServiceClient) { - client.close(); -} -function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { - client.close(); -} -function doStuffWithProductServiceClient(client: ProductServiceClient) { - client.close(); -} -function doStuffWithProjectServiceClient(client: ProjectServiceClient) { - client.close(); -} -function doStuffWithSearchServiceClient(client: SearchServiceClient) { - client.close(); -} -function doStuffWithServingConfigServiceClient(client: ServingConfigServiceClient) { - client.close(); -} -function doStuffWithUserEventServiceClient(client: UserEventServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const analyticsServiceClient = new AnalyticsServiceClient(); - doStuffWithAnalyticsServiceClient(analyticsServiceClient); - // check that the client instance can be created - const branchServiceClient = new BranchServiceClient(); - doStuffWithBranchServiceClient(branchServiceClient); - // check that the client instance can be created - const catalogServiceClient = new CatalogServiceClient(); - doStuffWithCatalogServiceClient(catalogServiceClient); - // check that the client instance can be created - const completionServiceClient = new CompletionServiceClient(); - doStuffWithCompletionServiceClient(completionServiceClient); - // check that the client instance can be created - const controlServiceClient = new ControlServiceClient(); - doStuffWithControlServiceClient(controlServiceClient); - // check that the client instance can be created - const conversationalSearchServiceClient = new ConversationalSearchServiceClient(); - doStuffWithConversationalSearchServiceClient(conversationalSearchServiceClient); - // check that the client instance can be created - const generativeQuestionServiceClient = new GenerativeQuestionServiceClient(); - doStuffWithGenerativeQuestionServiceClient(generativeQuestionServiceClient); - // check that the client instance can be created - const merchantCenterAccountLinkServiceClient = new MerchantCenterAccountLinkServiceClient(); - doStuffWithMerchantCenterAccountLinkServiceClient(merchantCenterAccountLinkServiceClient); - // check that the client instance can be created - const modelServiceClient = new ModelServiceClient(); - doStuffWithModelServiceClient(modelServiceClient); - // check that the client instance can be created - const predictionServiceClient = new PredictionServiceClient(); - doStuffWithPredictionServiceClient(predictionServiceClient); - // check that the client instance can be created - const productServiceClient = new ProductServiceClient(); - doStuffWithProductServiceClient(productServiceClient); - // check that the client instance can be created - const projectServiceClient = new ProjectServiceClient(); - doStuffWithProjectServiceClient(projectServiceClient); - // check that the client instance can be created - const searchServiceClient = new SearchServiceClient(); - doStuffWithSearchServiceClient(searchServiceClient); - // check that the client instance can be created - const servingConfigServiceClient = new ServingConfigServiceClient(); - doStuffWithServingConfigServiceClient(servingConfigServiceClient); - // check that the client instance can be created - const userEventServiceClient = new UserEventServiceClient(); - doStuffWithUserEventServiceClient(userEventServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_analytics_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_analytics_service_v2alpha.ts.baseline deleted file mode 100644 index 8a505ca00160..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_analytics_service_v2alpha.ts.baseline +++ /dev/null @@ -1,952 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as analyticsserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.AnalyticsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = analyticsserviceModule.v2alpha.AnalyticsServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = analyticsserviceModule.v2alpha.AnalyticsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = analyticsserviceModule.v2alpha.AnalyticsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.analyticsServiceStub, undefined); - await client.initialize(); - assert(client.analyticsServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.analyticsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.analyticsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('exportAnalyticsMetrics', () => { - it('invokes exportAnalyticsMetrics without error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAnalyticsMetrics(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics without error using callback', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAnalyticsMetrics( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics with call error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAnalyticsMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics with LRO error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAnalyticsMetrics(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportAnalyticsMetricsProgress without error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAnalyticsMetricsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAnalyticsMetricsProgress with error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAnalyticsMetricsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_branch_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_branch_service_v2alpha.ts.baseline deleted file mode 100644 index 1e29cd127728..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_branch_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1002 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as branchserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.BranchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = branchserviceModule.v2alpha.BranchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = branchserviceModule.v2alpha.BranchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new branchserviceModule.v2alpha.BranchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = branchserviceModule.v2alpha.BranchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.branchServiceStub, undefined); - await client.initialize(); - assert(client.branchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.branchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.branchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listBranches', () => { - it('invokes listBranches without error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesResponse() - ); - client.innerApiCalls.listBranches = stubSimpleCall(expectedResponse); - const [response] = await client.listBranches(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches without error using callback', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesResponse() - ); - client.innerApiCalls.listBranches = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBranches( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListBranchesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches with error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBranches = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBranches(request), expectedError); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches with closed client', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listBranches(request), expectedError); - }); - }); - - describe('getBranch', () => { - it('invokes getBranch without error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Branch() - ); - client.innerApiCalls.getBranch = stubSimpleCall(expectedResponse); - const [response] = await client.getBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch without error using callback', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Branch() - ); - client.innerApiCalls.getBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBranch( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBranch|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch with error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch with closed client', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBranch(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_catalog_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_catalog_service_v2alpha.ts.baseline deleted file mode 100644 index 38dc32adbca3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_catalog_service_v2alpha.ts.baseline +++ /dev/null @@ -1,2316 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as catalogserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.CatalogServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = catalogserviceModule.v2alpha.CatalogServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = catalogserviceModule.v2alpha.CatalogServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new catalogserviceModule.v2alpha.CatalogServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = catalogserviceModule.v2alpha.CatalogServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.catalogServiceStub, undefined); - await client.initialize(); - assert(client.catalogServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.catalogServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.catalogServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('updateCatalog', () => { - it('invokes updateCatalog without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Catalog() - ); - client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); - const [response] = await client.updateCatalog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Catalog() - ); - client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCatalog( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICatalog|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCatalog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCatalog(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCatalog(request), expectedError); - }); - }); - - describe('setDefaultBranch', () => { - it('invokes setDefaultBranch without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); - const [response] = await client.setDefaultBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.setDefaultBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setDefaultBranch( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setDefaultBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setDefaultBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.setDefaultBranch(request), expectedError); - }); - }); - - describe('getDefaultBranch', () => { - it('invokes getDefaultBranch without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() - ); - client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); - const [response] = await client.getDefaultBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() - ); - client.innerApiCalls.getDefaultBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDefaultBranch( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDefaultBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDefaultBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDefaultBranch(request), expectedError); - }); - }); - - describe('getCompletionConfig', () => { - it('invokes getCompletionConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.getCompletionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getCompletionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.getCompletionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCompletionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompletionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCompletionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCompletionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCompletionConfig(request), expectedError); - }); - }); - - describe('updateCompletionConfig', () => { - it('invokes updateCompletionConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.updateCompletionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateCompletionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.updateCompletionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCompletionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompletionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCompletionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCompletionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCompletionConfig(request), expectedError); - }); - }); - - describe('getAttributesConfig', () => { - it('invokes getAttributesConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.getAttributesConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAttributesConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.getAttributesConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAttributesConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAttributesConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAttributesConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAttributesConfig(request), expectedError); - }); - }); - - describe('updateAttributesConfig', () => { - it('invokes updateAttributesConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.updateAttributesConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateAttributesConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.updateAttributesConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAttributesConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAttributesConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAttributesConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAttributesConfig(request), expectedError); - }); - }); - - describe('addCatalogAttribute', () => { - it('invokes addCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.addCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.addCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.addCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addCatalogAttribute(request), expectedError); - }); - }); - - describe('removeCatalogAttribute', () => { - it('invokes removeCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.removeCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.removeCatalogAttribute(request), expectedError); - }); - }); - - describe('batchRemoveCatalogAttributes', () => { - it('invokes batchRemoveCatalogAttributes without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse() - ); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall(expectedResponse); - const [response] = await client.batchRemoveCatalogAttributes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse() - ); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchRemoveCatalogAttributes( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchRemoveCatalogAttributes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchRemoveCatalogAttributes(request), expectedError); - }); - }); - - describe('replaceCatalogAttribute', () => { - it('invokes replaceCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.replaceCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.replaceCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.replaceCatalogAttribute(request), expectedError); - }); - }); - - describe('listCatalogs', () => { - it('invokes listCatalogs without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); - const [response] = await client.listCatalogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogs without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCatalogs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICatalog[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogs with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCatalogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCatalogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogsStream without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCatalogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Catalog) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCatalogs, request)); - assert( - (client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCatalogsStream with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCatalogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Catalog) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCatalogs, request)); - assert( - (client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCatalogs without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; - const iterable = client.listCatalogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCatalogs with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCatalogsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_completion_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_completion_service_v2alpha.ts.baseline deleted file mode 100644 index 5ff69dc5b518..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_completion_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1064 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as completionserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.CompletionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = completionserviceModule.v2alpha.CompletionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = completionserviceModule.v2alpha.CompletionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new completionserviceModule.v2alpha.CompletionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = completionserviceModule.v2alpha.CompletionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.completionServiceStub, undefined); - await client.initialize(); - assert(client.completionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.completionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.completionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('completeQuery', () => { - it('invokes completeQuery without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() - ); - client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); - const [response] = await client.completeQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery without error using callback', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() - ); - client.innerApiCalls.completeQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeQuery( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompleteQueryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery with error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery with closed client', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.completeQuery(request), expectedError); - }); - }); - - describe('importCompletionData', () => { - it('invokes importCompletionData without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importCompletionData = stubLongRunningCall(expectedResponse); - const [operation] = await client.importCompletionData(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData without error using callback', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importCompletionData = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importCompletionData( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData with call error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCompletionData = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importCompletionData(request), expectedError); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData with LRO error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCompletionData = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importCompletionData(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportCompletionDataProgress without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportCompletionDataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportCompletionDataProgress with error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportCompletionDataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_control_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_control_service_v2alpha.ts.baseline deleted file mode 100644 index f25a690821f2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_control_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1514 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as controlserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ControlServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = controlserviceModule.v2alpha.ControlServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = controlserviceModule.v2alpha.ControlServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new controlserviceModule.v2alpha.ControlServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = controlserviceModule.v2alpha.ControlServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.controlServiceStub, undefined); - await client.initialize(); - assert(client.controlServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.controlServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.controlServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createControl', () => { - it('invokes createControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); - const [response] = await client.createControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.createControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createControl(request), expectedError); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createControl(request), expectedError); - }); - }); - - describe('deleteControl', () => { - it('invokes deleteControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); - const [response] = await client.deleteControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteControl( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteControl(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteControl(request), expectedError); - }); - }); - - describe('updateControl', () => { - it('invokes updateControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); - const [response] = await client.updateControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.updateControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateControl(request), expectedError); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateControl(request), expectedError); - }); - }); - - describe('getControl', () => { - it('invokes getControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); - const [response] = await client.getControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.getControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getControl(request), expectedError); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getControl(request), expectedError); - }); - }); - - describe('listControls', () => { - it('invokes listControls without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); - const [response] = await client.listControls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControls without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.innerApiCalls.listControls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listControls( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControls with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listControls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listControls(request), expectedError); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControlsStream without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.descriptors.page.listControls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listControlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Control[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Control) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listControls, request)); - assert( - (client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listControlsStream with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listControls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listControlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Control[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Control) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listControls, request)); - assert( - (client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listControls without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; - const iterable = client.listControlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listControls with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listControlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_conversational_search_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_conversational_search_service_v2alpha.ts.baseline deleted file mode 100644 index 2c252f952650..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_conversational_search_service_v2alpha.ts.baseline +++ /dev/null @@ -1,931 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as conversationalsearchserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v2alpha.ConversationalSearchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationalSearchServiceStub, undefined); - await client.initialize(); - assert(client.conversationalSearchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.conversationalSearchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationalSearchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('conversationalSearch', () => { - it('invokes conversationalSearch without error', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchResponse() - ); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(expectedResponse); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch without error and gaxServerStreamingRetries enabled', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchResponse() - ); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(expectedResponse); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch with error', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(undefined, expectedError); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch with closed client', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.conversationalSearch(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_generative_question_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_generative_question_service_v2alpha.ts.baseline deleted file mode 100644 index 57b41985a21f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_generative_question_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1334 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as generativequestionserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.GenerativeQuestionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.generativeQuestionServiceStub, undefined); - await client.initialize(); - assert(client.generativeQuestionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.generativeQuestionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.generativeQuestionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('updateGenerativeQuestionsFeatureConfig', () => { - it('invokes updateGenerativeQuestionsFeatureConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateGenerativeQuestionsFeatureConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGenerativeQuestionsFeatureConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGenerativeQuestionsFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGenerativeQuestionsFeatureConfig(request), expectedError); - }); - }); - - describe('getGenerativeQuestionsFeatureConfig', () => { - it('invokes getGenerativeQuestionsFeatureConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getGenerativeQuestionsFeatureConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGenerativeQuestionsFeatureConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGenerativeQuestionsFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGenerativeQuestionsFeatureConfig(request), expectedError); - }); - }); - - describe('listGenerativeQuestionConfigs', () => { - it('invokes listGenerativeQuestionConfigs without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listGenerativeQuestionConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGenerativeQuestionConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGenerativeQuestionConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listGenerativeQuestionConfigs(request), expectedError); - }); - }); - - describe('updateGenerativeQuestionConfig', () => { - it('invokes updateGenerativeQuestionConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig() - ); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateGenerativeQuestionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig() - ); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGenerativeQuestionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGenerativeQuestionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGenerativeQuestionConfig(request), expectedError); - }); - }); - - describe('batchUpdateGenerativeQuestionConfigs', () => { - it('invokes batchUpdateGenerativeQuestionConfigs without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.batchUpdateGenerativeQuestionConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateGenerativeQuestionConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchUpdateGenerativeQuestionConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchUpdateGenerativeQuestionConfigs(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline deleted file mode 100644 index d186919c1d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1172 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as merchantcenteraccountlinkserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.MerchantCenterAccountLinkServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.merchantCenterAccountLinkServiceStub, undefined); - await client.initialize(); - assert(client.merchantCenterAccountLinkServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.merchantCenterAccountLinkServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.merchantCenterAccountLinkServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listMerchantCenterAccountLinks', () => { - it('invokes listMerchantCenterAccountLinks without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse() - ); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCall(expectedResponse); - const [response] = await client.listMerchantCenterAccountLinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse() - ); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMerchantCenterAccountLinks( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMerchantCenterAccountLinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks with closed client', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listMerchantCenterAccountLinks(request), expectedError); - }); - }); - - describe('deleteMerchantCenterAccountLink', () => { - it('invokes deleteMerchantCenterAccountLink without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMerchantCenterAccountLink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMerchantCenterAccountLink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMerchantCenterAccountLink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink with closed client', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteMerchantCenterAccountLink(request), expectedError); - }); - }); - - describe('createMerchantCenterAccountLink', () => { - it('invokes createMerchantCenterAccountLink without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMerchantCenterAccountLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMerchantCenterAccountLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink with call error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMerchantCenterAccountLink(request), expectedError); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink with LRO error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMerchantCenterAccountLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMerchantCenterAccountLinkProgress without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMerchantCenterAccountLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMerchantCenterAccountLinkProgress with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMerchantCenterAccountLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_model_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_model_service_v2alpha.ts.baseline deleted file mode 100644 index 05617e930de0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_model_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1946 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as modelserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ModelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = modelserviceModule.v2alpha.ModelServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = modelserviceModule.v2alpha.ModelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new modelserviceModule.v2alpha.ModelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = modelserviceModule.v2alpha.ModelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - await client.initialize(); - assert(client.modelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.modelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getModel', () => { - it('invokes getModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.getModel = stubSimpleCall(expectedResponse); - const [response] = await client.getModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getModel(request), expectedError); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getModel(request), expectedError); - }); - }); - - describe('pauseModel', () => { - it('invokes pauseModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.pauseModel = stubSimpleCall(expectedResponse); - const [response] = await client.pauseModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.pauseModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseModel(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pauseModel(request), expectedError); - }); - }); - - describe('resumeModel', () => { - it('invokes resumeModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.resumeModel = stubSimpleCall(expectedResponse); - const [response] = await client.resumeModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.resumeModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeModel(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resumeModel(request), expectedError); - }); - }); - - describe('deleteModel', () => { - it('invokes deleteModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteModel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteModel(request), expectedError); - }); - }); - - describe('updateModel', () => { - it('invokes updateModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.updateModel = stubSimpleCall(expectedResponse); - const [response] = await client.updateModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.updateModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateModel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateModel(request), expectedError); - }); - }); - - describe('createModel', () => { - it('invokes createModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel with call error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createModel(request), expectedError); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel with LRO error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateModelProgress without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateModelProgress with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('tuneModel', () => { - it('invokes tuneModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.tuneModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.tuneModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.tuneModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tuneModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel with call error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.tuneModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.tuneModel(request), expectedError); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel with LRO error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.tuneModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.tuneModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkTuneModelProgress without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkTuneModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkTuneModelProgress with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkTuneModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listModels', () => { - it('invokes listModels without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); - const [response] = await client.listModels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listModels( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listModels(request), expectedError); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModelsStream without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Model[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listModelsStream with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Model[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; - const iterable = client.listModelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listModelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_prediction_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_prediction_service_v2alpha.ts.baseline deleted file mode 100644 index eca48b4b3719..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_prediction_service_v2alpha.ts.baseline +++ /dev/null @@ -1,894 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as predictionserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.PredictionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = predictionserviceModule.v2alpha.PredictionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = predictionserviceModule.v2alpha.PredictionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new predictionserviceModule.v2alpha.PredictionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = predictionserviceModule.v2alpha.PredictionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.predictionServiceStub, undefined); - await client.initialize(); - assert(client.predictionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.predictionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.predictionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('predict', () => { - it('invokes predict without error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictResponse() - ); - client.innerApiCalls.predict = stubSimpleCall(expectedResponse); - const [response] = await client.predict(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict without error using callback', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictResponse() - ); - client.innerApiCalls.predict = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.predict( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IPredictResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict with error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.predict(request), expectedError); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict with closed client', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.predict(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_product_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_product_service_v2alpha.ts.baseline deleted file mode 100644 index 0d4fddb425d3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_product_service_v2alpha.ts.baseline +++ /dev/null @@ -1,2766 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as productserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ProductServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = productserviceModule.v2alpha.ProductServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = productserviceModule.v2alpha.ProductServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new productserviceModule.v2alpha.ProductServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new productserviceModule.v2alpha.ProductServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = productserviceModule.v2alpha.ProductServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productServiceStub, undefined); - await client.initialize(); - assert(client.productServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.productServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); - const [response] = await client.createProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createProduct(request), expectedError); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); - const [response] = await client.getProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProduct(request), expectedError); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); - const [response] = await client.updateProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateProduct(request), expectedError); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProduct( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteProduct(request), expectedError); - }); - }); - - describe('purgeProducts', () => { - it('invokes purgeProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.purgeProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.purgeProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkPurgeProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importProducts', () => { - it('invokes importProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportProducts', () => { - it('invokes exportProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('setInventory', () => { - it('invokes setInventory without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setInventory = stubLongRunningCall(expectedResponse); - const [operation] = await client.setInventory(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setInventory = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setInventory( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setInventory = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.setInventory(request), expectedError); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setInventory = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.setInventory(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSetInventoryProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSetInventoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSetInventoryProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSetInventoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('addFulfillmentPlaces', () => { - it('invokes addFulfillmentPlaces without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(expectedResponse); - const [operation] = await client.addFulfillmentPlaces(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addFulfillmentPlaces( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addFulfillmentPlaces(request), expectedError); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addFulfillmentPlaces(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAddFulfillmentPlacesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddFulfillmentPlacesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAddFulfillmentPlacesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddFulfillmentPlacesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('removeFulfillmentPlaces', () => { - it('invokes removeFulfillmentPlaces without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeFulfillmentPlaces(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeFulfillmentPlaces( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeFulfillmentPlaces(request), expectedError); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeFulfillmentPlaces(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveFulfillmentPlacesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRemoveFulfillmentPlacesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveFulfillmentPlacesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('addLocalInventories', () => { - it('invokes addLocalInventories without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(expectedResponse); - const [operation] = await client.addLocalInventories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addLocalInventories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addLocalInventories( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addLocalInventories(request), expectedError); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addLocalInventories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAddLocalInventoriesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddLocalInventoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAddLocalInventoriesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddLocalInventoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('removeLocalInventories', () => { - it('invokes removeLocalInventories without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeLocalInventories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeLocalInventories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeLocalInventories( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeLocalInventories(request), expectedError); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeLocalInventories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRemoveLocalInventoriesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveLocalInventoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRemoveLocalInventoriesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveLocalInventoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); - const [response] = await client.listProducts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.innerApiCalls.listProducts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProducts( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProducts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsStream without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.descriptors.page.listProducts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Product[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProducts, request)); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsStream with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Product[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProducts, request)); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; - const iterable = client.listProductsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_project_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_project_service_v2alpha.ts.baseline deleted file mode 100644 index bc734d97200c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_project_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1750 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as projectserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.ProjectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = projectserviceModule.v2alpha.ProjectServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = projectserviceModule.v2alpha.ProjectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new projectserviceModule.v2alpha.ProjectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = projectserviceModule.v2alpha.ProjectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - await client.initialize(); - assert(client.projectServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.projectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getProject', () => { - it('invokes getProject without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.getProject = stubSimpleCall(expectedResponse); - const [response] = await client.getProject(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.getProject = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProject( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProject = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProject(request), expectedError); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProject(request), expectedError); - }); - }); - - describe('acceptTerms', () => { - it('invokes acceptTerms without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.acceptTerms = stubSimpleCall(expectedResponse); - const [response] = await client.acceptTerms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.acceptTerms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acceptTerms( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.acceptTerms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.acceptTerms(request), expectedError); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.acceptTerms(request), expectedError); - }); - }); - - describe('listEnrolledSolutions', () => { - it('invokes listEnrolledSolutions without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse() - ); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCall(expectedResponse); - const [response] = await client.listEnrolledSolutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse() - ); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEnrolledSolutions( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnrolledSolutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listEnrolledSolutions(request), expectedError); - }); - }); - - describe('getLoggingConfig', () => { - it('invokes getLoggingConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.getLoggingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getLoggingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.getLoggingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLoggingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ILoggingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoggingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoggingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLoggingConfig(request), expectedError); - }); - }); - - describe('updateLoggingConfig', () => { - it('invokes updateLoggingConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.updateLoggingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateLoggingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.updateLoggingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLoggingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ILoggingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLoggingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLoggingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateLoggingConfig(request), expectedError); - }); - }); - - describe('getAlertConfig', () => { - it('invokes getAlertConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.getAlertConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAlertConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.getAlertConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAlertConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAlertConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAlertConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAlertConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAlertConfig(request), expectedError); - }); - }); - - describe('updateAlertConfig', () => { - it('invokes updateAlertConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.updateAlertConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateAlertConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.updateAlertConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAlertConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAlertConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAlertConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAlertConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAlertConfig(request), expectedError); - }); - }); - - describe('enrollSolution', () => { - it('invokes enrollSolution without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.enrollSolution = stubLongRunningCall(expectedResponse); - const [operation] = await client.enrollSolution(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.enrollSolution = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.enrollSolution( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution with call error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.enrollSolution = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.enrollSolution(request), expectedError); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution with LRO error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.enrollSolution = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.enrollSolution(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkEnrollSolutionProgress without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkEnrollSolutionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkEnrollSolutionProgress with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkEnrollSolutionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_search_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_search_service_v2alpha.ts.baseline deleted file mode 100644 index b3111ae687a7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_search_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1132 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as searchserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.SearchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = searchserviceModule.v2alpha.SearchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = searchserviceModule.v2alpha.SearchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new searchserviceModule.v2alpha.SearchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = searchserviceModule.v2alpha.SearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.searchServiceStub, undefined); - await client.initialize(); - assert(client.searchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.searchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.searchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('search', () => { - it('invokes search without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.innerApiCalls.search = stubSimpleCall(expectedResponse); - const [response] = await client.search(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes search without error using callback', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.innerApiCalls.search = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.search( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes search with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.search(request), expectedError); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchStream without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.descriptors.page.search.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.search.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.search, request)); - assert( - (client.descriptors.page.search.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchStream with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.search.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.search.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.search, request)); - assert( - (client.descriptors.page.search.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with search without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.descriptors.page.search.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = []; - const iterable = client.searchAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with search with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.search.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('experiment', () => { - const fakePath = "/rendered/path/experiment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - experiment: "experimentValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.experimentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.experimentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('experimentPath', () => { - const result = client.experimentPath("projectValue", "locationValue", "catalogValue", "experimentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.experimentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExperimentName', () => { - const result = client.matchProjectFromExperimentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExperimentName', () => { - const result = client.matchLocationFromExperimentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromExperimentName', () => { - const result = client.matchCatalogFromExperimentName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExperimentFromExperimentName', () => { - const result = client.matchExperimentFromExperimentName(fakePath); - assert.strictEqual(result, "experimentValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_serving_config_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_serving_config_service_v2alpha.ts.baseline deleted file mode 100644 index ae2f7b6662df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_serving_config_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1730 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as servingconfigserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ServingConfigServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - await client.initialize(); - assert(client.servingConfigServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.servingConfigServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createServingConfig', () => { - it('invokes createServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.createServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.createServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServingConfig(request), expectedError); - }); - }); - - describe('deleteServingConfig', () => { - it('invokes deleteServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServingConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteServingConfig(request), expectedError); - }); - }); - - describe('updateServingConfig', () => { - it('invokes updateServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.updateServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.updateServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateServingConfig(request), expectedError); - }); - }); - - describe('getServingConfig', () => { - it('invokes getServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.getServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServingConfig(request), expectedError); - }); - }); - - describe('addControl', () => { - it('invokes addControl without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); - const [response] = await client.addControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.addControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addControl(request), expectedError); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addControl(request), expectedError); - }); - }); - - describe('removeControl', () => { - it('invokes removeControl without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); - const [response] = await client.removeControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.removeControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeControl(request), expectedError); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.removeControl(request), expectedError); - }); - }); - - describe('listServingConfigs', () => { - it('invokes listServingConfigs without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.innerApiCalls.listServingConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listServingConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigs without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.innerApiCalls.listServingConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServingConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigs with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServingConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServingConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigsStream without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServingConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServingConfigs, request)); - assert( - (client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServingConfigsStream with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServingConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServingConfigs, request)); - assert( - (client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServingConfigs without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = []; - const iterable = client.listServingConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServingConfigs with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServingConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_user_event_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_user_event_service_v2alpha.ts.baseline deleted file mode 100644 index 07bb9d1fbf1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/esm/test/gapic_user_event_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1634 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as usereventserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.UserEventServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = usereventserviceModule.v2alpha.UserEventServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = usereventserviceModule.v2alpha.UserEventServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new usereventserviceModule.v2alpha.UserEventServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = usereventserviceModule.v2alpha.UserEventServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.userEventServiceStub, undefined); - await client.initialize(); - assert(client.userEventServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.userEventServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.userEventServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('writeUserEvent', () => { - it('invokes writeUserEvent without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UserEvent() - ); - client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); - const [response] = await client.writeUserEvent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UserEvent() - ); - client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeUserEvent( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IUserEvent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.writeUserEvent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeUserEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent with closed client', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.writeUserEvent(request), expectedError); - }); - }); - - describe('collectUserEvent', () => { - it('invokes collectUserEvent without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); - const [response] = await client.collectUserEvent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.collectUserEvent( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.collectUserEvent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.collectUserEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent with closed client', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.collectUserEvent(request), expectedError); - }); - }); - - describe('purgeUserEvents', () => { - it('invokes purgeUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.purgeUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.purgeUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkPurgeUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importUserEvents', () => { - it('invokes importUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.importUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportUserEvents', () => { - it('invokes exportUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rejoinUserEvents', () => { - it('invokes rejoinUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.rejoinUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rejoinUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rejoinUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rejoinUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRejoinUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRejoinUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRejoinUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRejoinUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json b/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json deleted file mode 100644 index 4dad3cdc8951..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "name": "retail", - "version": "0.1.0", - "description": "Retail client for Node.js", - "repository": "googleapis/nodejs-retail", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google retail", - "retail", - "analytics service", - "branch service", - "catalog service", - "completion service", - "control service", - "conversational search service", - "generative question service", - "merchant center account link service", - "model service", - "prediction service", - "product service", - "project service", - "search service", - "serving config service", - "user event service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline deleted file mode 100644 index 23f0f4743b2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "AnalyticsServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing & accessing retail search business metric. -// Retail recommendation business metric is currently not available. -service AnalyticsService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Exports analytics metrics. - // - // `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - // `Operation.metadata` is of type `ExportMetadata`. - rpc ExportAnalyticsMetrics(ExportAnalyticsMetricsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportAnalyticsMetricsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch.proto.baseline deleted file mode 100644 index 404ff3c67934..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch.proto.baseline +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "BranchProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// A view that specifies different level of fields of a -// [Branch][google.cloud.retail.v2alpha.Branch] to show in responses. -enum BranchView { - // The value when it's unspecified. This defaults to the BASIC view. - BRANCH_VIEW_UNSPECIFIED = 0; - - // Includes basic metadata about the branch, but not statistical fields. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BRANCH_VIEW_BASIC = 1; - - // Includes all fields of a [Branch][google.cloud.retail.v2alpha.Branch]. - BRANCH_VIEW_FULL = 2; -} - -// A data branch that stores all instances of -// [Product][google.cloud.retail.v2alpha.Product]s. -message Branch { - option (google.api.resource) = { - type: "retail.googleapis.com/Branch" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" - }; - - // A statistic about the number of products in a branch. - message ProductCountStatistic { - // Scope of what products are included for this count. - enum ProductCountScope { - // Default value for enum. This value is not used in the API response. - PRODUCT_COUNT_SCOPE_UNSPECIFIED = 0; - - // Scope for all existing products in the branch. Useful for understanding - // how many products there are in a branch. - ALL_PRODUCTS = 1; - - // Scope for products created or updated in the last 24 hours. - LAST_24_HOUR_UPDATE = 2; - } - - // [ProductCountScope] of the [counts]. - ProductCountScope scope = 1; - - // The number of products in - // [scope][google.cloud.retail.v2alpha.Branch.ProductCountStatistic.scope] - // broken down into different groups. - // - // The key is a group representing a set of products, and the value is the - // number of products in that group. - // Note: keys in this map may change over time. - // - // Possible keys: - // * "primary-in-stock", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // availability. - // - // * "primary-out-of-stock", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // availability. - // - // * "primary-preorder", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.PREORDER][google.cloud.retail.v2alpha.Product.Availability.PREORDER] - // availability. - // - // * "primary-backorder", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.BACKORDER][google.cloud.retail.v2alpha.Product.Availability.BACKORDER] - // availability. - // - // * "variant-in-stock", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // availability. - // - // * "variant-out-of-stock", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // availability. - // - // * "variant-preorder", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.PREORDER][google.cloud.retail.v2alpha.Product.Availability.PREORDER] - // availability. - // - // * "variant-backorder", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.BACKORDER][google.cloud.retail.v2alpha.Product.Availability.BACKORDER] - // availability. - // - // * "price-discounted", products have [Product.price_info.price] < - // [Product.price_info.original_price]. - map counts = 2; - } - - // Metric measured on a group of - // [Product][google.cloud.retail.v2alpha.Product]s against a certain quality - // requirement. Contains the number of products that pass the check and the - // number of products that don't. - message QualityMetric { - // The key that represents a quality requirement rule. - // - // Supported keys: - // * "has-valid-uri": product has a valid and accessible - // [uri][google.cloud.retail.v2alpha.Product.uri]. - // - // * "available-expire-time-conformance": - // [Product.available_time][google.cloud.retail.v2alpha.Product.available_time] - // is early than "now", and - // [Product.expire_time][google.cloud.retail.v2alpha.Product.expire_time] is - // greater than "now". - // - // * "has-searchable-attributes": product has at least one - // [attribute][google.cloud.retail.v2alpha.Product.attributes] set to - // searchable. - // - // * "has-description": product has non-empty - // [description][google.cloud.retail.v2alpha.Product.description]. - // - // * "has-at-least-bigram-title": Product - // [title][google.cloud.retail.v2alpha.Product.title] has at least two - // words. A comprehensive title helps to improve search quality. - // - // * "variant-has-image": the - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] products has - // at least one [image][google.cloud.retail.v2alpha.Product.images]. You may - // ignore this metric if all your products are at - // [primary][google.cloud.retail.v2alpha.Product.Type.PRIMARY] level. - // - // * "variant-has-price-info": the - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] products has - // [price_info][google.cloud.retail.v2alpha.Product.price_info] set. You may - // ignore this metric if all your products are at - // [primary][google.cloud.retail.v2alpha.Product.Type.PRIMARY] level. - // - // * "has-publish-time": product has non-empty - // [publish_time][google.cloud.retail.v2alpha.Product.publish_time]. - string requirement_key = 1; - - // Number of products passing the quality requirement check. We only check - // searchable products. - int32 qualified_product_count = 2; - - // Number of products failing the quality requirement check. We only check - // searchable products. - int32 unqualified_product_count = 3; - - // Value from 0 to 100 representing the suggested percentage of products - // that meet the quality requirements to get good search and recommendation - // performance. 100 * (qualified_product_count) / - // (qualified_product_count + unqualified_product_count) should be greater - // or equal to this suggestion. - double suggested_quality_percent_threshold = 4; - - // A list of a maximum of 100 sample products that do not qualify for - // this requirement. - // - // This field is only populated in the response to - // [BranchService.GetBranch][google.cloud.retail.v2alpha.BranchService.GetBranch] - // API, and is always empty for - // [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches]. - // - // Only the following fields are set in the - // [Product][google.cloud.retail.v2alpha.Product]. - // - // * [Product.name][google.cloud.retail.v2alpha.Product.name] - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // * [Product.title][google.cloud.retail.v2alpha.Product.title] - repeated Product unqualified_sample_products = 5; - } - - // Immutable. Full resource name of the branch, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/branch_id`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Human readable name of the branch to display in the UI. - string display_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this branch is set as the default branch of - // its parent catalog. - bool is_default = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp of last import through - // [ProductService.ImportProducts][google.cloud.retail.v2alpha.ProductService.ImportProducts]. - // Empty value means no import has been made to this branch. - google.protobuf.Timestamp last_product_import_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for number of products in the branch, provided for - // different - // [scopes][google.cloud.retail.v2alpha.Branch.ProductCountStatistic.ProductCountScope]. - // - // This field is not populated in [BranchView.BASIC][] view. - repeated ProductCountStatistic product_count_stats = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The quality metrics measured among products of this branch. - // - // See - // [QualityMetric.requirement_key][google.cloud.retail.v2alpha.Branch.QualityMetric.requirement_key] - // for supported metrics. Metrics could be missing if failed to retrieve. - // - // This field is not populated in [BranchView.BASIC][] view. - repeated QualityMetric quality_metrics = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline deleted file mode 100644 index 4015336d687d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/branch.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "BranchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for [Branch][google.cloud.retail.v2alpha.Branch] Management -// -// [Branch][google.cloud.retail.v2alpha.Branch]es are automatically created when -// a [Catalog][google.cloud.retail.v2alpha.Catalog] is created. There are fixed -// three branches in each catalog, and may use -// [ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] method -// to get the details of all branches. -service BranchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all instances of [Branch][google.cloud.retail.v2alpha.Branch] under - // the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/branches" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves a [Branch][google.cloud.retail.v2alpha.Branch]. - rpc GetBranch(GetBranchRequest) returns (Branch) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request for -// [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] -// method. -message ListBranchesRequest { - // Required. The parent catalog resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // The view to apply to the returned - // [Branch][google.cloud.retail.v2alpha.Branch]. Defaults to - // [Branch.BranchView.BASIC] if unspecified. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BranchView view = 2; -} - -// Response for -// [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] -// method. -message ListBranchesResponse { - // The Branches. - repeated Branch branches = 1; -} - -// Request for -// [BranchService.GetBranch][google.cloud.retail.v2alpha.BranchService.GetBranch] -// method. -message GetBranchRequest { - // Required. The name of the branch to retrieve. - // Format: - // `projects/*/locations/global/catalogs/default_catalog/branches/some_branch_id`. - // - // "default_branch" can be used as a special branch_id, it returns the - // default branch that has been set for the catalog. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // The view to apply to the returned - // [Branch][google.cloud.retail.v2alpha.Branch]. Defaults to - // [Branch.BranchView.BASIC] if unspecified. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BranchView view = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog.proto.baseline deleted file mode 100644 index a940c764b0ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog.proto.baseline +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CatalogProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures what level the product should be uploaded with regards to -// how users will be send events and how predictions will be made. -message ProductLevelConfig { - // The type of [Product][google.cloud.retail.v2alpha.Product]s allowed to be - // ingested into the catalog. Acceptable values are: - // - // * `primary` (default): You can ingest - // [Product][google.cloud.retail.v2alpha.Product]s of all types. When - // ingesting a [Product][google.cloud.retail.v2alpha.Product], its type will - // default to - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // if unset. - // * `variant` (incompatible with Retail Search): You can only - // ingest - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. This means - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // cannot be empty. - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // If this field is `variant` and - // [merchant_center_product_id_field][google.cloud.retail.v2alpha.ProductLevelConfig.merchant_center_product_id_field] - // is `itemGroupId`, an INVALID_ARGUMENT error is returned. - // - // See [Product - // levels](https://cloud.google.com/retail/docs/catalog#product-levels) - // for more details. - string ingestion_product_type = 1; - - // Which field of [Merchant Center - // Product](/bigquery-transfer/docs/merchant-center-products-schema) should be - // imported as [Product.id][google.cloud.retail.v2alpha.Product.id]. - // Acceptable values are: - // - // * `offerId` (default): Import `offerId` as the product ID. - // * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail - // API will choose one item from the ones with the same `itemGroupId`, and - // use it to represent the item group. - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // If this field is `itemGroupId` and - // [ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // is `variant`, an INVALID_ARGUMENT error is returned. - // - // See [Product - // levels](https://cloud.google.com/retail/docs/catalog#product-levels) - // for more details. - string merchant_center_product_id_field = 2; -} - -// Catalog level attribute config for an attribute. For example, if customers -// want to enable/disable facet for a specific attribute. -message CatalogAttribute { - // Possible options for the facet that corresponds to the current attribute - // config. - message FacetConfig { - // [Facet values][google.cloud.retail.v2alpha.SearchResponse.Facet.values] - // to ignore on [facets][google.cloud.retail.v2alpha.SearchResponse.Facet] - // during the specified time range for the given - // [SearchResponse.Facet.key][google.cloud.retail.v2alpha.SearchResponse.Facet.key] - // attribute. - message IgnoredFacetValues { - // List of facet values to ignore for the following time range. The facet - // values are the same as the attribute values. There is a limit of 10 - // values per instance of IgnoredFacetValues. Each value can have at most - // 128 characters. - repeated string values = 1; - - // Time range for the current list of facet values to ignore. - // If multiple time ranges are specified for an facet value for the - // current attribute, consider all of them. If both are empty, ignore - // always. If start time and end time are set, then start time - // must be before end time. - // If start time is not empty and end time is empty, then will ignore - // these facet values after the start time. - google.protobuf.Timestamp start_time = 2; - - // If start time is empty and end time is not empty, then ignore these - // facet values before end time. - google.protobuf.Timestamp end_time = 3; - } - - // Replaces a set of textual facet values by the same (possibly different) - // merged facet value. Each facet value should appear at most once as a - // value per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]. This - // feature is available only for textual custom attributes. - message MergedFacetValue { - // All the facet values that are replaces by the same - // [merged_value][google.cloud.retail.v2alpha.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value] - // that follows. The maximum number of values per MergedFacetValue is 25. - // Each value can have up to 128 characters. - repeated string values = 1; - - // All the previous values are replaced by this merged facet value. - // This merged_value must be non-empty and can have up to 128 characters. - string merged_value = 2; - } - - // The current facet key (i.e. attribute config) maps into the - // [merged_facet_key][google.cloud.retail.v2alpha.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]. - // A facet key can have at most one child. The current facet key and the - // merged facet key need both to be textual custom attributes or both - // numerical custom attributes (same type). - message MergedFacet { - // The merged facet key should be a valid facet key that is different than - // the facet key of the current catalog attribute. We refer this is - // merged facet key as the child of the current catalog attribute. This - // merged facet key can't be a parent of another facet key (i.e. no - // directed path of length 2). This merged facet key needs to be either a - // textual custom attribute or a numerical custom attribute. - string merged_facet_key = 1; - } - - // Options to rerank based on facet values engaged by the user for the - // current key. That key needs to be a custom textual key and facetable. - // To use this control, you also need to pass all the facet keys engaged by - // the user in the request using the field [SearchRequest.FacetSpec]. In - // particular, if you don't pass the facet keys engaged that you want to - // rerank on, this control won't be effective. Moreover, to obtain better - // results, the facet values that you want to rerank on should be close to - // English (ideally made of words, underscores, and spaces). - message RerankConfig { - // If set to true, then we also rerank the dynamic facets based on the - // facet values engaged by the user for the current attribute key during - // serving. - bool rerank_facet = 1; - - // If empty, rerank on all facet values for the current key. Otherwise, - // will rerank on the facet values from this list only. - repeated string facet_values = 2; - } - - // If you don't set the facet - // [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals] - // in the request to a numerical attribute, then we use the computed - // intervals with rounded bounds obtained from all its product numerical - // attribute values. The computed intervals might not be ideal for some - // attributes. Therefore, we give you the option to overwrite them with the - // facet_intervals field. The maximum of facet intervals per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 40. - // Each interval must have a lower bound or an upper bound. If both bounds - // are provided, then the lower bound must be smaller or equal than the - // upper bound. - repeated Interval facet_intervals = 1; - - // Each instance represents a list of attribute values to ignore as facet - // values for a specific time range. The maximum number of instances per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 25. - repeated IgnoredFacetValues ignored_facet_values = 2; - - // Each instance replaces a list of facet values by a merged facet - // value. If a facet value is not in any list, then it will stay the same. - // To avoid conflicts, only paths of length 1 are accepted. In other words, - // if "dark_blue" merged into "BLUE", then the latter can't merge into - // "blues" because this would create a path of length 2. The maximum number - // of instances of MergedFacetValue per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 100. - // This feature is available only for textual custom attributes. - repeated MergedFacetValue merged_facet_values = 3; - - // Use this field only if you want to merge a facet key into another facet - // key. - MergedFacet merged_facet = 4; - - // Set this field only if you want to rerank based on facet values engaged - // by the user for the current key. This option is only possible for custom - // facetable textual keys. - RerankConfig rerank_config = 5; - } - - // The type of an attribute. - enum AttributeType { - // The type of the attribute is unknown. - // - // Used when type cannot be derived from attribute that is not - // [in_use][google.cloud.retail.v2alpha.CatalogAttribute.in_use]. - UNKNOWN = 0; - - // Textual attribute. - TEXTUAL = 1; - - // Numerical attribute. - NUMERICAL = 2; - } - - // The status of the indexable option of a catalog attribute. - enum IndexableOption { - // Value used when unset. - INDEXABLE_OPTION_UNSPECIFIED = 0; - - // Indexable option enabled for an attribute. - INDEXABLE_ENABLED = 1; - - // Indexable option disabled for an attribute. - INDEXABLE_DISABLED = 2; - } - - // The status of the dynamic facetable option of a catalog attribute. - enum DynamicFacetableOption { - // Value used when unset. - DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; - - // Dynamic facetable option enabled for an attribute. - DYNAMIC_FACETABLE_ENABLED = 1; - - // Dynamic facetable option disabled for an attribute. - DYNAMIC_FACETABLE_DISABLED = 2; - } - - // The status of the searchable option of a catalog attribute. - enum SearchableOption { - // Value used when unset. - SEARCHABLE_OPTION_UNSPECIFIED = 0; - - // Searchable option enabled for an attribute. - SEARCHABLE_ENABLED = 1; - - // Searchable option disabled for an attribute. - SEARCHABLE_DISABLED = 2; - } - - // The status of the exact-searchable option of a catalog attribute. - enum ExactSearchableOption { - // Value used when unset. - EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0; - - // Exact searchable option enabled for an attribute. - EXACT_SEARCHABLE_ENABLED = 1; - - // Exact searchable option disabled for an attribute. - EXACT_SEARCHABLE_DISABLED = 2; - } - - // The status of the retrievable option of a catalog attribute. - enum RetrievableOption { - // Value used when unset. - RETRIEVABLE_OPTION_UNSPECIFIED = 0; - - // Retrievable option enabled for an attribute. - RETRIEVABLE_ENABLED = 1; - - // Retrievable option disabled for an attribute. - RETRIEVABLE_DISABLED = 2; - } - - // Required. Attribute name. - // For example: `color`, `brands`, `attributes.custom_attribute`, such as - // `attributes.xyz`. - // To be indexable, the attribute name can contain only alpha-numeric - // characters and underscores. For example, an attribute named - // `attributes.abc_xyz` can be indexed, but an attribute named - // `attributes.abc-xyz` cannot be indexed. - // - // If the attribute key starts with `attributes.`, then the attribute is a - // custom attribute. Attributes such as `brands`, `patterns`, and `title` are - // built-in and called system attributes. - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Indicates whether this attribute has been used by any - // products. `True` if at least one - // [Product][google.cloud.retail.v2alpha.Product] is using this attribute in - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - // Otherwise, this field is `False`. - // - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] can be - // pre-loaded by using - // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute] - // or - // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] - // APIs. This field is `False` for pre-loaded - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s. - // - // Only pre-loaded [catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are neither - // in use by products nor predefined can be deleted. [Catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are - // either in use by products or are predefined attributes cannot be deleted; - // however, their configuration properties will reset to default values upon - // removal request. - // - // After catalog changes, it takes about 10 minutes for this field to update. - bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of this attribute. This is derived from the attribute - // in [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values - // are indexed so that it can be filtered, faceted, or boosted in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // Must be specified when - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - IndexableOption indexable_option = 5; - - // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic - // facet. Could only be DYNAMIC_FACETABLE_DISABLED if - // [CatalogAttribute.indexable_option][google.cloud.retail.v2alpha.CatalogAttribute.indexable_option] - // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Must be specified, otherwise throws INVALID_FORMAT error. - DynamicFacetableOption dynamic_facetable_option = 6; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values - // are searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values - // will not be searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], - // as there are no text values associated to numerical attributes. - // - // Must be specified, when - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - SearchableOption searchable_option = 7; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if RECOMMENDATIONS_FILTERING_ENABLED, - // attribute values are filterable for recommendations. - // This option works for categorical features only, - // does not work for numerical features, inventory filtering. - RecommendationsFilteringOption recommendations_filtering_option = 8; - - // If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable. - // This property only applies to textual custom attributes and requires - // indexable set to enabled to enable exact-searchable. If unset, the server - // behavior defaults to - // [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2alpha.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]. - ExactSearchableOption exact_searchable_option = 11; - - // If RETRIEVABLE_ENABLED, attribute values are retrievable in the search - // results. If unset, the server behavior defaults to - // [RETRIEVABLE_DISABLED][google.cloud.retail.v2alpha.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]. - RetrievableOption retrievable_option = 12; - - // Contains facet options. - FacetConfig facet_config = 13; -} - -// Catalog level attribute config. -message AttributesConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/AttributesConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" - }; - - // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Enable attribute(s) config at catalog level. - // For example, indexable, dynamic_facetable, or searchable for each - // attribute. - // - // The key is catalog attribute's name. - // For example: `color`, `brands`, `attributes.custom_attribute`, such as - // `attributes.xyz`. - // - // The maximum number of catalog attributes allowed in a request is 1000. - map catalog_attributes = 2; - - // Output only. The - // [AttributeConfigLevel][google.cloud.retail.v2alpha.AttributeConfigLevel] - // used for this catalog. - AttributeConfigLevel attribute_config_level = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Catalog level autocomplete config for customers to customize autocomplete -// feature's settings. -message CompletionConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/CompletionConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" - }; - - // Required. Immutable. Fully qualified name - // `projects/*/locations/*/catalogs/*/completionConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Specifies the matching order for autocomplete suggestions, e.g., a query - // consisting of 'sh' with 'out-of-order' specified would suggest "women's - // shoes", whereas a query of 'red s' with 'exact-prefix' specified would - // suggest "red shoes". Currently supported values: - // - // * 'out-of-order' - // * 'exact-prefix' - // - // Default value: 'exact-prefix'. - string matching_order = 2; - - // The maximum number of autocomplete suggestions returned per term. Default - // value is 20. If left unset or set to 0, then will fallback to default - // value. - // - // Value range is 1 to 20. - int32 max_suggestions = 3; - - // The minimum number of characters needed to be typed in order to get - // suggestions. Default value is 2. If left unset or set to 0, then will - // fallback to default value. - // - // Value range is 1 to 20. - int32 min_prefix_length = 4; - - // If set to true, the auto learning function is enabled. Auto learning uses - // user data to generate suggestions using ML techniques. Default value is - // false. Only after enabling auto learning can users use `cloud-retail` - // data in - // [CompleteQueryRequest][google.cloud.retail.v2alpha.CompleteQueryRequest]. - bool auto_learning = 11; - - // Output only. The source data for the latest import of the autocomplete - // suggestion phrases. - CompletionDataInputConfig suggestions_input_config = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest suggestion terms - // list import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API - // method to retrieve the latest state of the Long Running Operation. - string last_suggestions_import_operation = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The source data for the latest import of the autocomplete - // denylist phrases. - CompletionDataInputConfig denylist_input_config = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest denylist import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to - // retrieve the latest state of the Long Running Operation. - string last_denylist_import_operation = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The source data for the latest import of the autocomplete - // allowlist phrases. - CompletionDataInputConfig allowlist_input_config = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest allowlist import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to - // retrieve the latest state of the Long Running Operation. - string last_allowlist_import_operation = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a link between a Merchant Center account and a branch. -// After a link is established, products from the linked Merchant Center account -// are streamed to the linked branch. -message MerchantCenterLink { - // Required. The linked [Merchant Center account - // ID](https://developers.google.com/shopping-content/guides/accountstatuses). - // The account must be a standalone account or a sub-account of a MCA. - int64 merchant_center_account_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The branch ID (e.g. 0/1/2) within this catalog that products from - // merchant_center_account_id are streamed to. When updating this field, an - // empty value will use the currently configured default branch. However, - // changing the default branch later on won't change the linked branch here. - // - // A single branch ID can only have one linked Merchant Center account ID. - string branch_id = 2; - - // String representing the destination to import for, all if left empty. - // List of possible values is given in [Included - // destination](https://support.google.com/merchants/answer/7501026). - // List of allowed string values: - // "Shopping_ads", "Buy_on_google_listings", "Display_ads", "Local_inventory - // _ads", "Free_listings", "Free_local_listings" - // NOTE: The string values are case sensitive. - repeated string destinations = 3; - - // Region code of offers to accept. 2-letter Uppercase ISO 3166-1 alpha-2 - // code. List of values can be found - // [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) - // under the `region` tag. If left blank no region filtering will be - // performed. - // - // Example value: `US`. - string region_code = 4; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // ISO 639-1. - // - // This specifies the language of offers in Merchant Center that will be - // accepted. If empty no language filtering will be performed. - // - // Example value: `en`. - string language_code = 5; - - // Criteria for the Merchant Center feeds to be ingested via the link. - // All offers will be ingested if the list is empty. - // Otherwise the offers will be ingested from selected feeds. - repeated MerchantCenterFeedFilter feeds = 6; -} - -// Merchant Center Feed filter criterion. -message MerchantCenterFeedFilter { - // Merchant Center primary feed ID. - // Deprecated: use data_source_id instead. - int64 primary_feed_id = 1 [deprecated = true]; - - // AFM data source ID. - int64 data_source_id = 3; - - // Merchant Center primary feed name. The name is used for the display - // purposes only. - string primary_feed_name = 2; -} - -// Configures Merchant Center linking. -// Links contained in the config will be used to sync data from a Merchant -// Center account to a Cloud Retail branch. -message MerchantCenterLinkingConfig { - // Links between Merchant Center accounts and branches. - repeated MerchantCenterLink links = 1; -} - -// The catalog configuration. -message Catalog { - option (google.api.resource) = { - type: "retail.googleapis.com/Catalog" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}" - }; - - // Required. Immutable. The fully qualified resource name of the catalog. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The catalog display name. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string display_name = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. The product level configuration. - ProductLevelConfig product_level_config = 4 - [(google.api.field_behavior) = REQUIRED]; - - // The Merchant Center linking configuration. - // After a link is added, the data stream from Merchant Center to Cloud Retail - // will be enabled automatically. The requester must have access to the - // Merchant Center account in order to make changes to this field. - MerchantCenterLinkingConfig merchant_center_linking_config = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline deleted file mode 100644 index f05ab3bac7b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline +++ /dev/null @@ -1,528 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/catalog.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CatalogServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing catalog configuration. -service CatalogService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated - // with the project. - rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*}/catalogs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s. - rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) { - option (google.api.http) = { - patch: "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}" - body: "catalog" - }; - option (google.api.method_signature) = "catalog,update_mask"; - } - - // Set a specified branch id as default branch. API methods such as - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // will treat requests using "default_branch" to the actual branch id set as - // default. - // - // For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as - // default, setting - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent - // to setting - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // `projects/*/locations/*/catalogs/*/branches/1`. - // - // Using multiple branches can be useful when developers would like - // to have a staging branch to test and verify for future usage. When it - // becomes ready, developers switch on the staging branch using this API - // while keeping using - // `projects/*/locations/*/catalogs/*/branches/default_branch` as - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // route the traffic to this staging branch. - // - // CAUTION: If you have live predict/search traffic, switching the default - // branch could potentially cause outages if the ID space of the new branch - // is very different from the old one. - // - // More specifically: - // - // * PredictionService will only return product IDs from branch {newBranch}. - // * SearchService will only return product IDs from branch {newBranch} - // (if branch is not explicitly set). - // * UserEventService will only join events with products from branch - // {newBranch}. - rpc SetDefaultBranch(SetDefaultBranchRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch" - body: "*" - }; - option (google.api.method_signature) = "catalog"; - } - - // Get which branch is currently default branch set by - // [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] - // method under a specified parent catalog. - rpc GetDefaultBranch(GetDefaultBranchRequest) - returns (GetDefaultBranchResponse) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" - }; - option (google.api.method_signature) = "catalog"; - } - - // Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]. - rpc GetCompletionConfig(GetCompletionConfigRequest) - returns (CompletionConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/completionConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s. - rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) - returns (CompletionConfig) { - option (google.api.http) = { - patch: "/v2alpha/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" - body: "completion_config" - }; - option (google.api.method_signature) = "completion_config,update_mask"; - } - - // Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - rpc GetAttributesConfig(GetAttributesConfigRequest) - returns (AttributesConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/attributesConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // The catalog attributes in the request will be updated in the catalog, or - // inserted if they do not exist. Existing catalog attributes not included in - // the request will remain unchanged. Attributes that are assigned to - // products, but do not exist at the catalog level, are always included in the - // response. The product attribute is assigned default values for missing - // catalog attribute fields, e.g., searchable and dynamic facetable options. - rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) - returns (AttributesConfig) { - option (google.api.http) = { - patch: "/v2alpha/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" - body: "attributes_config" - }; - option (google.api.method_signature) = "attributes_config,update_mask"; - } - - // Adds the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // add already exists, an ALREADY_EXISTS error is returned. - rpc AddCatalogAttribute(AddCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" - body: "*" - }; - } - - // Removes the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // remove does not exist, a NOT_FOUND error is returned. - rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" - body: "*" - }; - } - - // Removes all specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - rpc BatchRemoveCatalogAttributes(BatchRemoveCatalogAttributesRequest) - returns (BatchRemoveCatalogAttributesResponse) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:batchRemoveCatalogAttributes" - body: "*" - }; - } - - // Replaces the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by - // updating the catalog attribute with the same - // [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // replace does not exist, a NOT_FOUND error is returned. - rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" - body: "*" - }; - } -} - -// Request for -// [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] -// method. -message ListCatalogsRequest { - // Required. The account resource name with an associated location. - // - // If the caller does not have permission to list - // [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, - // regardless of whether or not this location exists, a PERMISSION_DENIED - // error is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of [Catalog][google.cloud.retail.v2alpha.Catalog]s to - // return. If unspecified, defaults to 50. The maximum allowed value is 1000. - // Values above 1000 will be coerced to 1000. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 page_size = 2; - - // A page token - // [ListCatalogsResponse.next_page_token][google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token], - // received from a previous - // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 3; -} - -// Response for -// [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] -// method. -message ListCatalogsResponse { - // All the customer's [Catalog][google.cloud.retail.v2alpha.Catalog]s. - repeated Catalog catalogs = 1; - - // A token that can be sent as - // [ListCatalogsRequest.page_token][google.cloud.retail.v2alpha.ListCatalogsRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 2; -} - -// Request for -// [CatalogService.UpdateCatalog][google.cloud.retail.v2alpha.CatalogService.UpdateCatalog] -// method. -message UpdateCatalogRequest { - // Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update. - // - // If the caller does not have permission to update the - // [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Catalog][google.cloud.retail.v2alpha.Catalog] to update does not - // exist, a NOT_FOUND error is returned. - Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Catalog][google.cloud.retail.v2alpha.Catalog] to update. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message to set a specified branch as new default_branch. -message SetDefaultBranchRequest { - // Full resource name of the catalog, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // The final component of the resource name of a branch. - // - // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - // error is returned. - // - // If there are no sufficient active products in the targeted branch and - // [force][google.cloud.retail.v2alpha.SetDefaultBranchRequest.force] is not - // set, a FAILED_PRECONDITION error is returned. - string branch_id = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Some note on this request, this can be retrieved by - // [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch] - // before next valid default branch set occurs. - // - // This field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string note = 3; - - // If set to true, it permits switching to a branch with - // [branch_id][google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id] - // even if it has no sufficient active products. - bool force = 4; -} - -// Request message to show which branch is currently the default branch. -message GetDefaultBranchRequest { - // The parent catalog resource name, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response message of -// [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch]. -message GetDefaultBranchResponse { - // Full resource name of the branch id currently set as default branch. - string branch = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // The time when this branch is set to default. - google.protobuf.Timestamp set_time = 2; - - // This corresponds to - // [SetDefaultBranchRequest.note][google.cloud.retail.v2alpha.SetDefaultBranchRequest.note] - // field, when this branch was set as default. - string note = 3; -} - -// Request for -// [CatalogService.GetCompletionConfig][google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig] -// method. -message GetCompletionConfigRequest { - // Required. Full CompletionConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/CompletionConfig" - } - ]; -} - -// Request for -// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig] -// method. -message UpdateCompletionConfigRequest { - // Required. The - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. - // - // If the caller does not have permission to update the - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to - // update does not exist, a NOT_FOUND error is returned. - CompletionConfig completion_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. - // The following are the only supported fields: - // - // * [CompletionConfig.matching_order][google.cloud.retail.v2alpha.CompletionConfig.matching_order] - // * [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions] - // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length] - // * [CompletionConfig.auto_learning][google.cloud.retail.v2alpha.CompletionConfig.auto_learning] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [CatalogService.GetAttributesConfig][google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig] -// method. -message GetAttributesConfigRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; -} - -// Request for -// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] -// method. -message UpdateAttributesConfigRequest { - // Required. The - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. - AttributesConfig attributes_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. - // The following is the only supported field: - // - // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute] -// method. -message AddCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add. - CatalogAttribute catalog_attribute = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute] -// method. -message RemoveCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The attribute name key of the - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove. - string key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes] -// method. -message BatchRemoveCatalogAttributesRequest { - // Required. The attributes config resource shared by all catalog attributes - // being deleted. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The attribute name keys of the - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s to - // delete. A maximum of 1000 catalog attributes can be deleted in a batch. - repeated string attribute_keys = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response of the -// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes]. -message BatchRemoveCatalogAttributesResponse { - // Catalog attributes that were deleted. Only pre-loaded [catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are - // neither [in - // use][google.cloud.retail.v2alpha.CatalogAttribute.in_use] by - // products nor predefined can be deleted. - repeated string deleted_catalog_attributes = 1; - - // Catalog attributes that were reset. [Catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are either - // [in use][google.cloud.retail.v2alpha.CatalogAttribute.in_use] by products - // or are predefined attributes cannot be deleted; however, their - // configuration properties will reset to default values upon removal request. - repeated string reset_catalog_attributes = 2; -} - -// Request for -// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute] -// method. -message ReplaceCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The updated - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]. - CatalogAttribute catalog_attribute = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to update. - // The following are NOT supported: - // - // * [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/common.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/common.proto.baseline deleted file mode 100644 index cee0a42a399a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/common.proto.baseline +++ /dev/null @@ -1,1004 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// At which level we offer configuration for attributes. -enum AttributeConfigLevel { - // Value used when unset. In this case, server behavior defaults to - // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2alpha.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. - ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; - - // At this level, we honor the attribute configurations set in - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; - - // At this level, we honor the attribute configurations set in - // `CatalogConfig.attribute_configs`. - CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; -} - -// The type of solution. -enum SolutionType { - // Default value. - SOLUTION_TYPE_UNSPECIFIED = 0; - - // Used for Recommendations AI. - SOLUTION_TYPE_RECOMMENDATION = 1; - - // Used for Retail Search. - SOLUTION_TYPE_SEARCH = 2; -} - -// If filtering for recommendations is enabled. -enum RecommendationsFilteringOption { - // Value used when unset. - // In this case, server behavior defaults to - // [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2alpha.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]. - RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0; - - // Recommendation filtering is disabled. - RECOMMENDATIONS_FILTERING_DISABLED = 1; - - // Recommendation filtering is enabled. - RECOMMENDATIONS_FILTERING_ENABLED = 3; -} - -// The use case of Cloud Retail Search. -enum SearchSolutionUseCase { - // The value when it's unspecified. In this case, server behavior defaults to - // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2alpha.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]. - SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; - - // Search use case. Expects the traffic has a non-empty - // [query][google.cloud.retail.v2alpha.SearchRequest.query]. - SEARCH_SOLUTION_USE_CASE_SEARCH = 1; - - // Browse use case. Expects the traffic has an empty - // [query][google.cloud.retail.v2alpha.SearchRequest.query]. - SEARCH_SOLUTION_USE_CASE_BROWSE = 2; -} - -// Metadata that is used to define a condition that triggers an action. -// A valid condition must specify at least one of 'query_terms' or -// 'products_filter'. If multiple fields are specified, the condition is met if -// all the fields are satisfied e.g. if a set of query terms and product_filter -// are set, then only items matching the product_filter for requests with a -// query matching the query terms wil get boosted. -message Condition { - // Query terms that we want to match on. - message QueryTerm { - // The value of the term to match on. - // Value cannot be empty. - // Value can have at most 3 terms if specified as a partial match. Each - // space separated string is considered as one term. - // For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms - // and not allowed for a partial match. - string value = 1; - - // Whether this is supposed to be a full or partial match. - bool full_match = 2; - } - - // Used for time-dependent conditions. - // Example: Want to have rule applied for week long sale. - message TimeRange { - // Start of time range. Range is inclusive. - google.protobuf.Timestamp start_time = 1; - - // End of time range. Range is inclusive. - google.protobuf.Timestamp end_time = 2; - } - - // A list (up to 10 entries) of terms to match the query on. If not - // specified, match all queries. - // If many query terms are specified, the condition - // is matched if any of the terms is a match (i.e. using the OR operator). - repeated QueryTerm query_terms = 1; - - // Range of time(s) specifying when Condition is active. - // Condition true if any time range matches. - repeated TimeRange active_time_range = 3; - - // Used to support browse uses cases. - // A list (up to 10 entries) of categories or departments. - // The format should be the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - repeated string page_categories = 4; -} - -// A rule is a condition-action pair -// -// * A condition defines when a rule is to be triggered. -// * An action specifies what occurs on that trigger. -// Currently rules only work for [controls][google.cloud.retail.v2alpha.Control] -// with -// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. -message Rule { - // A boost action to apply to results matching condition specified above. - message BoostAction { - // Strength of the condition boost, which must be in [-1, 1]. Negative - // boost means demotion. Default is 0.0. - // - // Setting to 1.0 gives the item a big promotion. However, it does not - // necessarily mean that the boosted item will be the top result at all - // times, nor that other items will be excluded. Results could still be - // shown even when none of them matches the condition. And results that - // are significantly more relevant to the search query can still trump - // your heavily favored but irrelevant items. - // - // Setting to -1.0 gives the item a big demotion. However, results that - // are deeply relevant might still be shown. The item will have an - // upstream battle to get a fairly high ranking, but it is not blocked out - // completely. - // - // Setting to 0.0 means no boost applied. The boosting condition is - // ignored. - float boost = 1; - - // The filter can have a max size of 5000 characters. - // An expression which specifies which products to apply an action to. - // The syntax and supported fields are the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. - // - // Examples: - // - // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* - string products_filter = 2; - } - - // * Rule Condition: - // - No - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // provided is a global match. - // - 1 or more - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // provided are combined with OR operator. - // - // * Action Input: The request query and filter that are applied to the - // retrieved products, in addition to any filters already provided with the - // SearchRequest. The AND operator is used to combine the query's existing - // filters with the filter rule(s). NOTE: May result in 0 results when - // filters conflict. - // - // * Action Result: Filters the returned objects to be ONLY those that passed - // the filter. - message FilterAction { - // A filter to apply on the matching condition results. Supported features: - // - // * [filter][google.cloud.retail.v2alpha.Rule.FilterAction.filter] must be - // set. - // * Filter syntax is identical to - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - // For more - // information, see [Filter](/retail/docs/filter-and-order#filter). - // * To filter products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* - string filter = 1; - } - - // Redirects a shopper to a specific page. - // - // * Rule Condition: - // Must specify - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms]. - // * Action Input: Request Query - // * Action Result: Redirects shopper to provided uri. - message RedirectAction { - // URL must have length equal or less than 2000 characters. - string redirect_uri = 1; - } - - // Creates a set of terms that will be treated as synonyms of each other. - // Example: synonyms of "sneakers" and "shoes": - // - // * "sneakers" will use a synonym of "shoes". - // * "shoes" will use a synonym of "sneakers". - message TwowaySynonymsAction { - // Defines a set of synonyms. - // Can specify up to 100 synonyms. - // Must specify at least 2 synonyms. - repeated string synonyms = 1; - } - - // Maps a set of terms to a set of synonyms. - // Set of synonyms will be treated as synonyms of each query term only. - // `query_terms` will not be treated as synonyms of each other. - // Example: "sneakers" will use a synonym of "shoes". - // "shoes" will not use a synonym of "sneakers". - message OnewaySynonymsAction { - // Terms from the search query. - // Will treat synonyms as their synonyms. - // Not themselves synonyms of the synonyms. - // Can specify up to 100 terms. - repeated string query_terms = 3; - - // Defines a set of synonyms. - // Cannot contain duplicates. - // Can specify up to 100 synonyms. - repeated string synonyms = 4; - - // Will be [deprecated = true] post migration; - repeated string oneway_terms = 2; - } - - // Prevents `query_term` from being associated with specified terms during - // search. - // Example: Don't associate "gShoe" and "cheap". - message DoNotAssociateAction { - // Terms from the search query. - // Will not consider do_not_associate_terms for search if in search query. - // Can specify up to 100 terms. - repeated string query_terms = 2; - - // Cannot contain duplicates or the query term. - // Can specify up to 100 terms. - repeated string do_not_associate_terms = 3; - - // Will be [deprecated = true] post migration; - repeated string terms = 1; - } - - // Replaces a term in the query. Multiple replacement candidates can be - // specified. All `query_terms` will be replaced with the replacement term. - // Example: Replace "gShoe" with "google shoe". - message ReplacementAction { - // Terms from the search query. - // Will be replaced by replacement term. - // Can specify up to 100 terms. - repeated string query_terms = 2; - - // Term that will be used for replacement. - string replacement_term = 3; - - // Will be [deprecated = true] post migration; - string term = 1; - } - - // Prevents a term in the query from being used in search. - // Example: Don't search for "shoddy". - message IgnoreAction { - // Terms to ignore in the search query. - repeated string ignore_terms = 1; - } - - // Force returns an attribute/facet in the request around a certain position - // or above. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Inputs: attribute name, position - // - // * Action Result: Will force return a facet key around a certain position - // or above if the condition is satisfied. - // - // Example: Suppose the query is "shoes", the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is "shoes", the - // [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2alpha.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name] - // is "size" and the - // [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2alpha.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position] - // is 8. - // - // Two cases: a) The facet key "size" is not already in the top 8 slots, then - // the facet "size" will appear at a position close to 8. b) The facet key - // "size" in among the top 8 positions in the request, then it will stay at - // its current rank. - message ForceReturnFacetAction { - // Each facet position adjustment consists of a single attribute name (i.e. - // facet key) along with a specified position. - message FacetPositionAdjustment { - // The attribute name to force return as a facet. Each attribute name - // should be a valid attribute name, be non-empty and contain at most 80 - // characters long. - string attribute_name = 1; - - // This is the position in the request as explained above. It should be - // strictly positive be at most 100. - int32 position = 2; - } - - // Each instance corresponds to a force return attribute for the given - // condition. There can't be more 15 instances here. - repeated FacetPositionAdjustment facet_position_adjustments = 1; - } - - // Removes an attribute/facet in the request if is present. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Input: attribute name - // - // * Action Result: Will remove the attribute (as a facet) from the request - // if it is present. - // - // Example: Suppose the query is "shoes", the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is "shoes" and the attribute name "size", then facet key "size" will be - // removed from the request (if it is present). - message RemoveFacetAction { - // The attribute names (i.e. facet keys) to remove from the dynamic facets - // (if present in the request). There can't be more 3 attribute names. - // Each attribute name should be a valid attribute name, be non-empty and - // contain at most 80 characters. - repeated string attribute_names = 1; - } - - // Pins one or more specified products to a specific position in the - // results. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Input: mapping of `[pin_position, product_id]` pairs (pin position - // uses 1-based indexing). - // - // * Action Result: Will pin products with matching ids to the position - // specified in the final result order. - // - // Example: Suppose the query is `shoes`, the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will - // be pinned to the top position in the final results. - // - // If multiple PinActions are matched to a single request the actions will - // be processed from most to least recently updated. - // - // Pins to positions larger than the max allowed page size of 120 are not - // allowed. - message PinAction { - // Required. A map of positions to product_ids. - // - // Partial matches per action are allowed, if a certain position in the map - // is already filled that `[position, product_id]` pair will be ignored - // but the rest may still be applied. This case will only occur if multiple - // pin actions are matched to a single request, as the map guarantees that - // pin positions are unique within the same action. - // - // Duplicate product_ids are not permitted within a single pin map. - // - // The max size of this map is 120, equivalent to the max [request page - // size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body). - map pin_map = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // An action must be provided. - oneof action { - // A boost action. - BoostAction boost_action = 2; - - // Redirects a shopper to a specific page. - RedirectAction redirect_action = 3; - - // Treats specific term as a synonym with a group of terms. - // Group of terms will not be treated as synonyms with the specific term. - OnewaySynonymsAction oneway_synonyms_action = 6; - - // Prevents term from being associated with other terms. - DoNotAssociateAction do_not_associate_action = 7; - - // Replaces specific terms in the query. - ReplacementAction replacement_action = 8; - - // Ignores specific terms from query during search. - IgnoreAction ignore_action = 9; - - // Filters results. - FilterAction filter_action = 10; - - // Treats a set of terms as synonyms of one another. - TwowaySynonymsAction twoway_synonyms_action = 11; - - // Force returns an attribute as a facet in the request. - ForceReturnFacetAction force_return_facet_action = 12; - - // Remove an attribute as a facet in the request (if present). - RemoveFacetAction remove_facet_action = 13; - - // Pins one or more specified products to a specific position in the - // results. - PinAction pin_action = 14; - } - - // Required. The condition that triggers the rule. - // If the condition is empty, the rule will always apply. - Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// An intended audience of the [Product][google.cloud.retail.v2alpha.Product] -// for whom it's sold. -message Audience { - // The genders of the audience. Strongly encouraged to use the standard - // values: "male", "female", "unisex". - // - // At most 5 values are allowed. Each value must be a UTF-8 encoded string - // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Google Merchant Center property - // [gender](https://support.google.com/merchants/answer/6324479). Schema.org - // property - // [Product.audience.suggestedGender](https://schema.org/suggestedGender). - repeated string genders = 1; - - // The age groups of the audience. Strongly encouraged to use the standard - // values: "newborn" (up to 3 months old), "infant" (3–12 months old), - // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically - // teens or older). - // - // At most 5 values are allowed. Each value must be a UTF-8 encoded string - // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Google Merchant Center property - // [age_group](https://support.google.com/merchants/answer/6324463). - // Schema.org property - // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and - // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). - repeated string age_groups = 2; -} - -// The color information of a [Product][google.cloud.retail.v2alpha.Product]. -message ColorInfo { - // The standard color families. Strongly recommended to use the following - // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", - // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed". - // Normally it is expected to have only 1 color family. May consider using - // single "Mixed" instead of multiple values. - // - // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - // - // The colorFamilies field as a system attribute is not a required field but - // strongly recommended to be specified. Google Search models treat this field - // as more important than a custom product attribute when specified. - repeated string color_families = 1; - - // The color display names, which may be different from standard color family - // names, such as the color aliases used in the website frontend. Normally - // it is expected to have only 1 color. May consider using single "Mixed" - // instead of multiple values. - // - // A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - repeated string colors = 2; -} - -// A custom attribute that is not explicitly modeled in -// [Product][google.cloud.retail.v2alpha.Product]. -message CustomAttribute { - // The textual values of this custom attribute. For example, `["yellow", - // "green"]` when the key is "color". - // - // Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Exactly one of [text][google.cloud.retail.v2alpha.CustomAttribute.text] or - // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be - // set. Otherwise, an INVALID_ARGUMENT error is returned. - repeated string text = 1; - - // The numerical values of this custom attribute. For example, `[2.3, 15.4]` - // when the key is "lengths_cm". - // - // Exactly one of [text][google.cloud.retail.v2alpha.CustomAttribute.text] or - // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be - // set. Otherwise, an INVALID_ARGUMENT error is returned. - repeated double numbers = 2; - - // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the - // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about - // product-level attribute configuration, see [Configuration - // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - // If true, custom attribute values are searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This field is ignored in a - // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. - // - // Only set if type [text][google.cloud.retail.v2alpha.CustomAttribute.text] - // is set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3 [deprecated = true]; - - // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the - // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about - // product-level attribute configuration, see [Configuration - // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - // If true, custom attribute values are indexed, so that they can be filtered, - // faceted or boosted in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This field is ignored in a - // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. - // - // See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // for more details. - optional bool indexable = 4 [deprecated = true]; -} - -// Fulfillment information, such as the store IDs for in-store pickup or region -// IDs for different shipping methods. -message FulfillmentInfo { - // The fulfillment type, including commonly used types (such as pickup in - // store and same day delivery), and custom types. Customers have to map - // custom types to their display names before rendering UI. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - string type = 1; - - // The IDs for this [type][google.cloud.retail.v2alpha.FulfillmentInfo.type], - // such as the store IDs for - // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // or the region IDs for - // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - // - // A maximum of 3000 values are allowed. Each value must be a string with a - // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such - // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is - // returned. - repeated string place_ids = 2; -} - -// [Product][google.cloud.retail.v2alpha.Product] image. Recommendations AI and -// Retail Search use product images to improve prediction and search results. -// Product images can be returned in results, and are shown in prediction or -// search previews in the console. Please try to provide correct product images -// and avoid using images with size too small. -message Image { - // Required. URI of the image. - // - // This field must be a valid UTF-8 encoded URI with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [image_link](https://support.google.com/merchants/answer/6324350). - // Schema.org property [Product.image](https://schema.org/image). - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Height of the image in number of pixels. - // - // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 height = 2; - - // Width of the image in number of pixels. - // - // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 width = 3; -} - -// A floating point interval. -message Interval { - // The lower bound of the interval. If neither of the min fields are set, then - // the lower bound is negative infinity. - // - // This field must not be larger than max. - // Otherwise, an INVALID_ARGUMENT error is returned. - oneof min { - // Inclusive lower bound. - double minimum = 1; - - // Exclusive lower bound. - double exclusive_minimum = 2; - } - - // The upper bound of the interval. If neither of the max fields are set, then - // the upper bound is positive infinity. - // - // This field must be not smaller than min. - // Otherwise, an INVALID_ARGUMENT error is returned. - oneof max { - // Inclusive upper bound. - double maximum = 3; - - // Exclusive upper bound. - double exclusive_maximum = 4; - } -} - -// The price information of a [Product][google.cloud.retail.v2alpha.Product]. -message PriceInfo { - // The price range of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - message PriceRange { - // The inclusive - // [Product.pricing_info.price][google.cloud.retail.v2alpha.PriceInfo.price] - // interval of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - Interval price = 1; - - // The inclusive - // [Product.pricing_info.original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] - // internal of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - Interval original_price = 2; - } - - // The 3-letter currency code defined in [ISO - // 4217](https://www.iso.org/iso-4217-currency-codes.html). - // - // If this field is an unrecognizable currency code, an INVALID_ARGUMENT - // error is returned. - // - // The - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s with the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // must share the same - // [currency_code][google.cloud.retail.v2alpha.PriceInfo.currency_code]. - // Otherwise, a FAILED_PRECONDITION error is returned. - string currency_code = 1; - - // Price of the product. - // - // Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). Schema.org - // property [Offer.price](https://schema.org/price). - float price = 2; - - // Price of the product without any discount. If zero, by default set to be - // the [price][google.cloud.retail.v2alpha.PriceInfo.price]. If set, - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] - // should be greater than or equal to - // [price][google.cloud.retail.v2alpha.PriceInfo.price], otherwise an - // INVALID_ARGUMENT error is thrown. - float original_price = 3; - - // The costs associated with the sale of a particular product. Used for gross - // profit reporting. - // - // * Profit = [price][google.cloud.retail.v2alpha.PriceInfo.price] - - // [cost][google.cloud.retail.v2alpha.PriceInfo.cost] - // - // Google Merchant Center property - // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). - float cost = 4; - - // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] - // starts to be effective. This can be set as a future timestamp, and the - // [price][google.cloud.retail.v2alpha.PriceInfo.price] is only used for - // search after - // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. - // If so, the - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must - // be set and - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is - // used before - // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. - // - // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is - // always effective because it will cause additional latency during search. - google.protobuf.Timestamp price_effective_time = 5; - - // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] - // stops to be effective. The - // [price][google.cloud.retail.v2alpha.PriceInfo.price] is used for search - // before - // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. - // If this field is set, the - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must - // be set and - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is - // used after - // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. - // - // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is - // always effective because it will cause additional latency during search. - google.protobuf.Timestamp price_expire_time = 6; - - // Output only. The price range of all the child - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s grouped together on the - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. Only populated for - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s. - // - // Note: This field is OUTPUT_ONLY for - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. - // Do not set this field in API requests. - PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The rating of a [Product][google.cloud.retail.v2alpha.Product]. -message Rating { - // The total number of ratings. This value is independent of the value of - // [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram]. - // - // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 rating_count = 1; - - // The average rating of the [Product][google.cloud.retail.v2alpha.Product]. - // - // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is - // returned. - float average_rating = 2; - - // List of rating counts per rating value (index = rating - 1). The list is - // empty if there is no rating. If the list is non-empty, its size is - // always 5. Otherwise, an INVALID_ARGUMENT error is returned. - // - // For example, [41, 14, 13, 47, 303]. It means that the - // [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star, - // 14 ratings with 2 star, and so on. - repeated int32 rating_histogram = 3; -} - -// Information of an end user. -message UserInfo { - // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. Don't set for anonymous users. - // - // Always use a hashed value for this ID. - // - // Don't set the field to the same fixed ID for different users. This mixes - // the event history of those users together, which results in degraded - // model quality. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string user_id = 1; - - // The end user's IP address. This field is used to extract location - // information for personalization. - // - // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6 - // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // This should not be set when: - // - // * setting - // [SearchRequest.user_info][google.cloud.retail.v2alpha.SearchRequest.user_info]. - // * using the JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent] - // or if - // [direct_user_request][google.cloud.retail.v2alpha.UserInfo.direct_user_request] - // is set. - string ip_address = 2; - - // User agent as included in the HTTP header. - // The field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This should not be set when using the client side event reporting with - // GTM or JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent] - // or if - // [direct_user_request][google.cloud.retail.v2alpha.UserInfo.direct_user_request] - // is set. - string user_agent = 3; - - // True if the request is made directly from the end user, in which case the - // [ip_address][google.cloud.retail.v2alpha.UserInfo.ip_address] and - // [user_agent][google.cloud.retail.v2alpha.UserInfo.user_agent] can be - // populated from the HTTP request. This flag should be set only if the API - // request is made directly from the end user such as a mobile app (and not if - // a gateway or a server is processing and pushing the user events). - // - // This should not be set when using the JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent]. - bool direct_user_request = 4; -} - -// The inventory information at a place (e.g. a store) identified -// by a place ID. -message LocalInventory { - // Product availability. If this field is unspecified, the product is - // assumed to be in stock. - enum Availability { - // Default product availability. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK] - // if unset. - AVAILABILITY_UNSPECIFIED = 0; - - // Product in stock. - IN_STOCK = 1; - - // Product out of stock. - OUT_OF_STOCK = 2; - - // Product that is in pre-order state. - PREORDER = 3; - - // Product that is back-ordered (i.e. temporarily out of stock). - BACKORDER = 4; - } - - // Optional. The place ID for the current set of inventory information. - string place_id = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Product price and cost information. - // - // Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). - PriceInfo price_info = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The availability of the - // [Product][google.cloud.retail.v2alpha.Product] at this place_id. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK]. - // - // For primary products with variants set the availability of the primary as - // [Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.OUT_OF_STOCK] - // and set the true availability at the variant level. This way the primary - // product will be considered "in stock" as long as it has at least one - // variant in stock. - // - // For primary products with no variants set the true availability at the - // primary level. - // - // Corresponding properties: Google Merchant Center property - // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org property [Offer.availability](https://schema.org/availability). - // - // This field is currently only used by the Recommendations API. For Search, - // please make use of - // [fulfillment_types][google.cloud.retail.v2alpha.LocalInventory.fulfillment_types] - // or custom attributes for similar behaviour. See [here]( - // https://cloud.google.com/retail/docs/local-inventory-updates#local-inventory-update-methods) - // for more details. - Availability availability = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional local inventory attributes, for example, store name, - // promotion tags, etc. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * At most 30 attributes are allowed. - // * The key must be a UTF-8 encoded string with a length limit of 32 - // characters. - // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, - // key0LikeThis or KEY_1_LIKE_THIS. - // * The attribute values must be of the same type (text or number). - // * Only 1 value is allowed for each attribute. - // * For text values, the length limit is 256 UTF-8 characters. - // * The attribute does not support search. The `searchable` field should be - // unset or set to false. - // * The max summed total bytes of custom attribute keys and values per - // product is 5MiB. - map attributes = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Supported fulfillment types. Valid fulfillment type values - // include commonly used types (such as pickup in store and same day - // delivery), and custom types. Customers have to map custom types to their - // display names before rendering UI. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is - // returned. - repeated string fulfillment_types = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata for pinning to be returned in the response. -// This is used for distinguishing between applied vs dropped pins. -message PinControlMetadata { - // List of product ids which have associated pins. - message ProductPins { - // List of product ids which have associated pins. - repeated string product_id = 1; - } - - // Map of all matched pins, keyed by pin position. - map all_matched_pins = 1; - - // Map of pins that were dropped due to overlap with other matching pins, - // keyed by pin position. - map dropped_pins = 2; -} - -// A list of string values. -message StringList { - // String values. - repeated string values = 1; -} - -// A message with a list of double values. -message DoubleList { - // The list of double values. - repeated double values = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline deleted file mode 100644 index 9ff72ed4fc52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CompletionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Autocomplete service for retail. -// -// This feature is only available for users who have Retail Search enabled. -// Enable Retail Search on Cloud Console before using this feature. -service CompletionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Completes the specified prefix with keyword suggestions. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - }; - } - - // Bulk import of processed completion dataset. - // - // Request processing is asynchronous. Partial updating is not supported. - // - // The operation is successfully finished only after the imported suggestions - // are indexed successfully and ready for serving. The process takes hours. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc ImportCompletionData(ImportCompletionDataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/completionData:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportCompletionDataResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } -} - -// Autocomplete parameters. -message CompleteQueryRequest { - // Required. Catalog for which the completion is performed. - // - // Full resource name of catalog, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The query used to generate suggestions. - // - // The maximum number of allowed characters is 255. - string query = 2 [(google.api.field_behavior) = REQUIRED]; - - // Recommended field. A unique identifier for tracking visitors. For example, - // this could be implemented with an HTTP cookie, which should be able to - // uniquely identify a visitor on a single device. This unique identifier - // should not change if the visitor logs in or out of the website. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 7; - - // Note that this field applies for `user-data` dataset only. For requests - // with `cloud-retail` dataset, setting this field has no effect. - // - // The language filters applied to the output suggestions. If set, it should - // contain the language of the query. If not set, suggestions are returned - // without considering language restrictions. This is the BCP-47 language - // code, such as "en-US" or "sr-Latn". For more information, see [Tags for - // Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - // number of language codes is 3. - repeated string language_codes = 3; - - // The device type context for completion suggestions. We recommend that you - // leave this field empty. - // - // It can apply different suggestions on different device types, e.g. - // `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - // types. - // - // Supported formats: - // - // * `UNKNOWN_DEVICE_TYPE` - // - // * `DESKTOP` - // - // * `MOBILE` - // - // * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - string device_type = 4; - - // Determines which dataset to use for fetching completion. "user-data" will - // use the dataset imported through - // [CompletionService.ImportCompletionData][google.cloud.retail.v2alpha.CompletionService.ImportCompletionData]. - // `cloud-retail` will use the dataset generated by Cloud Retail based on user - // events. If left empty, completions will be fetched from the `user-data` - // dataset. - // - // Current supported values: - // - // * user-data - // - // * cloud-retail: - // This option requires enabling auto-learning function first. See - // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - string dataset = 6; - - // Completion max suggestions. If left unset or set to 0, then will fallback - // to the configured value - // [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]. - // - // The maximum allowed max suggestions is 20. If it is set higher, it will be - // capped by 20. - int32 max_suggestions = 5; - - // If true, attribute suggestions are enabled and provided in the response. - // - // This field is only available for the `cloud-retail` dataset. - bool enable_attribute_suggestions = 9; - - // The entity for customers who run multiple entities, domains, sites, or - // regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // If this is set, it must be an exact match with - // [UserEvent.entity][google.cloud.retail.v2alpha.UserEvent.entity] to get - // per-entity autocomplete results. This field will be applied to - // `completion_results` only. It has no effect on the `attribute_results`. - // Also, this entity should be limited to 256 characters, if too long, it will - // be truncated to 256 characters in both generation and serving time, and may - // lead to mis-match. To ensure it works, please set the entity with string - // within 256 characters. - string entity = 10; -} - -// Response of the autocomplete query. -message CompleteQueryResponse { - // Resource that represents completion results. - message CompletionResult { - // The suggestion for the query. - string suggestion = 1; - - // Custom attributes for the suggestion term. - // - // * For `user-data`, the attributes are additional custom attributes - // ingested through BigQuery. - // - // * For `cloud-retail`, the attributes are product attributes generated - // by Cloud Retail. It requires - // [UserEvent.product_details][google.cloud.retail.v2alpha.UserEvent.product_details] - // is imported properly. - map attributes = 2; - - // Facet information for the suggestion term. Gives the number of items - // resulting from a search with this suggestion term for each facet. - // - // This is an experimental feature for limited customers. If you want to - // receive this facet information, reach out to the Retail support team. - repeated SearchResponse.Facet facets = 3; - - // Total number of products associated with a search with this suggestion. - // - // This is an experimental feature for limited customers. If you want to - // receive this product count information, reach out to the Retail support - // team. - int32 total_product_count = 4; - } - - // Deprecated: Recent search of this user. - message RecentSearchResult { - option deprecated = true; - - // The recent search query. - string recent_search = 1; - } - - // Resource that represents attribute results. - message AttributeResult { - // The list of suggestions for the attribute. - repeated string suggestions = 1; - } - - // Results of the matching suggestions. The result list is ordered and the - // first result is top suggestion. - repeated CompletionResult completion_results = 1; - - // A unique complete token. This should be included in the - // [UserEvent.completion_detail][google.cloud.retail.v2alpha.UserEvent.completion_detail] - // for search events resulting from this completion, which enables accurate - // attribution of complete model performance. - string attribution_token = 2; - - // Deprecated. Matched recent searches of this user. The maximum number of - // recent searches is 10. This field is a restricted feature. If you want to - // enable it, contact Retail Search support. - // - // This feature is only available when - // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2alpha.CompleteQueryRequest.visitor_id] - // field is set and [UserEvent][google.cloud.retail.v2alpha.UserEvent] is - // imported. The recent searches satisfy the follow rules: - // - // * They are ordered from latest to oldest. - // - // * They are matched with - // [CompleteQueryRequest.query][google.cloud.retail.v2alpha.CompleteQueryRequest.query] - // case insensitively. - // - // * They are transformed to lower case. - // - // * They are UTF-8 safe. - // - // Recent searches are deduplicated. More recent searches will be reserved - // when duplication happens. - repeated RecentSearchResult recent_search_results = 3 [deprecated = true]; - - // A map of matched attribute suggestions. This field is only available for - // `cloud-retail` dataset. - // - // Current supported keys: - // - // * `brands` - // - // * `categories` - map attribute_results = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control.proto.baseline deleted file mode 100644 index 5bd5c0d7470b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control.proto.baseline +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ControlProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures dynamic metadata that can be linked to a -// [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] and affect search -// or recommendation results at serving time. -message Control { - option (google.api.resource) = { - type: "retail.googleapis.com/Control" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" - }; - - // The behavior/type of the control - // - // A behavior/type must be specified on creation. Type cannot be changed once - // specified (e.g. A Rule control will always be a Rule control.). An - // INVALID_ARGUMENT will be returned if either condition is violated. - oneof control { - // A facet specification to perform faceted search. - // - // Note that this field is deprecated and will throw NOT_IMPLEMENTED if - // used for creating a control. - SearchRequest.FacetSpec facet_spec = 3 [deprecated = true]; - - // A rule control - a condition-action pair. - // Enacts a set action when the condition is triggered. - // For example: Boost "gShoe" when query full matches "Running Shoes". - Rule rule = 4; - } - - // Immutable. Fully qualified name - // `projects/*/locations/global/catalogs/*/controls/*` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. The human readable control display name. Used in Retail UI. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is thrown. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. List of [serving - // config][google.cloud.retail.v2alpha.ServingConfig] ids that are associated - // with this control in the same - // [Catalog][google.cloud.retail.v2alpha.Catalog]. - // - // Note the association is managed via the - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig], this is an - // output only denormalized view. - repeated string associated_serving_config_ids = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The solution types that the control is used for. - // Currently we support setting only one type of solution at creation time. - // - // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. - // If no solution type is provided at creation time, will default to - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated SolutionType solution_types = 6 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Specifies the use case for the control. - // Affects what condition fields can be set. - // Only settable by search controls. - // Will default to - // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2alpha.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH] - // if not specified. Currently only allow one search_solution_use_case per - // control. - repeated SearchSolutionUseCase search_solution_use_case = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control_service.proto.baseline deleted file mode 100644 index 7b659bdb2bce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/control_service.proto.baseline +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/control.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ControlServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for modifying Control. -service ControlService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Control. - // - // If the [Control][google.cloud.retail.v2alpha.Control] to create already - // exists, an ALREADY_EXISTS error is returned. - rpc CreateControl(CreateControlRequest) returns (Control) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" - body: "control" - }; - option (google.api.method_signature) = "parent,control,control_id"; - } - - // Deletes a Control. - // - // If the [Control][google.cloud.retail.v2alpha.Control] to delete does not - // exist, a NOT_FOUND error is returned. - rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a Control. - // - // [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different - // oneof field, if so an INVALID_ARGUMENT is returned. If the - // [Control][google.cloud.retail.v2alpha.Control] to update does not exist, a - // NOT_FOUND error is returned. - rpc UpdateControl(UpdateControlRequest) returns (Control) { - option (google.api.http) = { - patch: "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}" - body: "control" - }; - option (google.api.method_signature) = "control,update_mask"; - } - - // Gets a Control. - rpc GetControl(GetControlRequest) returns (Control) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all Controls by their parent - // [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for CreateControl method. -message CreateControlRequest { - // Required. Full resource name of parent catalog. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The Control to create. - Control control = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the Control, which will become the final - // component of the Control's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-_/. - string control_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for UpdateControl method. -message UpdateControlRequest { - // Required. The Control to update. - Control control = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Control][google.cloud.retail.v2alpha.Control] to update. The following are - // NOT supported: - // - // * [Control.name][google.cloud.retail.v2alpha.Control.name] - // - // If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for DeleteControl method. -message DeleteControlRequest { - // Required. The resource name of the Control to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } - ]; -} - -// Request for GetControl method. -message GetControlRequest { - // Required. The resource name of the Control to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } - ]; -} - -// Request for ListControls method. -message ListControlsRequest { - // Required. The catalog resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 50. Max allowed value is 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListControls` call. - // Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter to apply on the list results. Supported features: - // - // * List all the products under the parent branch if - // [filter][google.cloud.retail.v2alpha.ListControlsRequest.filter] is unset. - // * List controls that are used in a single ServingConfig: - // 'serving_config = "boosted_home_page_cvr"' - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for ListControls method. -message ListControlsResponse { - // All the Controls for a given catalog. - repeated Control controls = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline deleted file mode 100644 index 21e33ba6c4aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ConversationalSearchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for retail conversational search. -// -// This feature is only available for users who have Retail Conversational -// Search enabled. Enable Retail Conversational Search on Cloud Console -// before using this feature. -service ConversationalSearchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Performs a conversational search. - // - // This feature is only available for users who have Conversational Search - // enabled. - rpc ConversationalSearch(ConversationalSearchRequest) - returns (stream ConversationalSearchResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:conversationalSearch" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:conversationalSearch" - body: "*" - } - }; - } -} - -// Request message for -// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] -// method. -message ConversationalSearchRequest { - // Search parameters. - message SearchParams { - // Optional. The filter string to restrict search results. - // - // The syntax of the filter string is the same as - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - string filter = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The canonical filter string to restrict search results. - // - // The syntax of the canonical filter string is the same as - // [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter]. - string canonical_filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sort string to specify the sorting of search results. - // - // The syntax of the sort string is the same as - // [SearchRequest.sort][]. - string sort_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The boost spec to specify the boosting of search results. - // - // The syntax of the boost spec is the same as - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec]. - SearchRequest.BoostSpec boost_spec = 4 - [(google.api.field_behavior) = OPTIONAL]; - } - - // This field specifies the current user answer during the conversational - // filtering search. This can be either user selected from suggested answers - // or user input plain text. - message UserAnswer { - // This field specifies the selected answers during the conversational - // search. - message SelectedAnswer { - // Optional. This field specifies the selected answer which is a attribute - // key-value. - ProductAttributeValue product_attribute_value = 1 - [(google.api.field_behavior) = OPTIONAL]; - } - - // This field specifies the type of user answer. - oneof type { - // This field specifies the incremental input text from the user during - // the conversational search. - string text_answer = 1; - - // Optional. This field specifies the selected answer during the - // conversational search. This should be a subset of - // [ConversationalSearchResponse.followup_question.suggested_answers][]. - SelectedAnswer selected_answer = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - } - - // This field specifies all conversational filtering related parameters - // addition to conversational retail search. - message ConversationalFilteringSpec { - // Enum to control Conversational Filtering mode. - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // Enabled Conversational Filtering without default Conversational Search. - CONVERSATIONAL_FILTER_ONLY = 3; - } - - // Optional. This field is deprecated. Please use - // [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode] - // instead. - bool enable_conversational_filtering = 1 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies the current user answer during the - // conversational filtering search. It can be either user selected from - // suggested answers or user input plain text. - UserAnswer user_answer = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Mode to control Conversational Filtering. - // Defaults to - // [Mode.DISABLED][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED] - // if it's unset. - Mode conversational_filtering_mode = 4 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` - // or - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - // This field is used to identify the serving config name and the set - // of models that will be used to make the search. - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. - // - // Use "default_branch" as the branch ID or leave this field empty, to search - // products under the default branch. - string branch = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Optional. Raw search query to be searched for. - // - // If this field is empty, the request is considered a category browsing - // request. - string query = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The categories associated with a category page. Must be set for - // category navigation queries to achieve good search quality. The format - // should be the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - repeated string page_categories = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies the conversation id, which maintains the - // state of the conversation between client side and server side. Use the - // value from the previous - // [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id]. - // For the initial request, this should be empty. - string conversation_id = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Search parameters. - SearchParams search_params = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Required. A unique identifier for tracking visitors. For example, this - // could be implemented with an HTTP cookie, which should be able to uniquely - // identify a visitor on a single device. This unique identifier should not - // change if the visitor logs in or out of the website. - // - // This should be the same identifier as - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 9 [(google.api.field_behavior) = REQUIRED]; - - // Optional. User information. - UserInfo user_info = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies all conversational filtering related - // parameters. - ConversationalFilteringSpec conversational_filtering_spec = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] -// method. -message ConversationalSearchResponse { - // The conversational followup question generated for Intent refinement. - message FollowupQuestion { - // Suggested answers to the follow-up question. - // If it's numerical attribute, only ProductAttributeInterval will be set. - // If it's textual attribute, only productAttributeValue will be set. - message SuggestedAnswer { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // The conversational followup question generated for Intent refinement. - string followup_question = 1; - - // The answer options provided to client for the follow-up question. - repeated SuggestedAnswer suggested_answers = 2; - } - - // The proposed refined search for intent-refinement/bundled shopping - // conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the - // refined_query from search response will be populated here. - message RefinedSearch { - // The query to be used for search. - string query = 1; - } - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational filtering search. - message ConversationalFilteringResult { - // Additional filter that client side need to apply. - message AdditionalFilter { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // The conversational filtering question. - FollowupQuestion followup_question = 1; - - // This is the incremental additional filters implied from the current - // user answer. User should add the suggested addition filters to the - // previous [ConversationalSearchRequest.search_params.filter][] and - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // and use the merged filter in the follow up requests. - AdditionalFilter additional_filter = 2; - } - - // Conversation UUID. This field will be stored in client side storage to - // maintain the conversation session with server and will be used for next - // search request's - // [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchRequest.conversation_id] - // to restore conversation state in server. - string conversation_id = 4; - - // The proposed refined search queries. They can be used to fetch the relevant - // search results. When using CONVERSATIONAL_FILTER_ONLY mode, the - // refined_query from search response will be populated here. - repeated RefinedSearch refined_search = 6; - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational filtering search. - ConversationalFilteringResult conversational_filtering_result = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/export_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/export_config.proto.baseline deleted file mode 100644 index e5cbf8d00a26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/export_config.proto.baseline +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ExportConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// The output configuration setting. -message OutputConfig { - // The Google Cloud Storage output destination configuration. - message GcsDestination { - // Required. The output uri prefix for saving output data to json files. - // Some mapping examples are as follows: - // output_uri_prefix sample output(assuming the object is foo.json) - // ======================== ============================================= - // gs://bucket/ gs://bucket/foo.json - // gs://bucket/folder/ gs://bucket/folder/foo.json - // gs://bucket/folder/item_ gs://bucket/folder/item_foo.json - string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The BigQuery output destination configuration. - message BigQueryDestination { - // Required. The ID of a BigQuery Dataset. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The prefix of exported BigQuery tables. - string table_id_prefix = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Describes the table type. The following values are supported: - // - // * `table`: A BigQuery native table. - // * `view`: A virtual table defined by a SQL query. - string table_type = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // The configuration of destination for holding output data. - oneof destination { - // The Google Cloud Storage location where the output is to be written to. - GcsDestination gcs_destination = 1; - - // The BigQuery location where the output is to be written to. - BigQueryDestination bigquery_destination = 2; - } -} - -// Configuration of destination for Export related errors. -message ExportErrorsConfig { - // Required. Errors destination. - oneof destination { - // Google Cloud Storage path for import errors. This must be an empty, - // existing Cloud Storage bucket. Export errors will be written to a file in - // this bucket, one per line, as a JSON-encoded - // `google.rpc.Status` message. - string gcs_prefix = 1; - } -} - -// Request message for ExportProducts method. -message ExportProductsRequest { - // Required. Resource name of a [Branch][google.cloud.retail.v2alpha.Branch], - // and `default_branch` for branch_id component is supported. For example - // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned events. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned products. Use this expression to restrict results to a - // specific time range, tag, or stock state or to filter products by product - // type. - // For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - // - // We expect only four types of fields: - // - // * `lastModifiedTime`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `lastModifiedTime` restriction should result in one, contiguous, - // valid, last-modified, time range. - // - // * `productType`: Supported values are `primary` and `variant`. The - // Boolean operators `OR` and `NOT` are supported if the expression is - // enclosed in parentheses and must be separated from the - // `productType` values by a space. - // - // * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - // `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - // supported if the expression is enclosed in parentheses and must be - // separated from the `availability` values by a space. - // - // * `Tag expressions`: Restricts output to products that match all of the - // specified tags. Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses and the operators are separated - // from the tag values by a space. Also supported is '`-"tagA"`', which - // is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - // UTF-8 encoded strings and have a size limit of 1,000 characters. - // - // Some examples of valid filters expressions: - // - // * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // lastModifiedTime < "2012-04-23T18:30:43.511Z"` - // * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // productType = "variant"` - // * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - // tag=(NOT "promotional") - // productType = "primary" lastModifiedTime < - // "2018-04-23T18:30:43.511Z"` - // * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - // * Example 5: `availability = (IN_STOCK OR BACKORDER)` - string filter = 3; -} - -// Request message for the `ExportUserEvents` method. -message ExportUserEventsRequest { - // Required. Resource name of a - // [Catalog][google.cloud.retail.v2alpha.Catalog]. For example - // `projects/1234/locations/global/catalogs/default_catalog` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned events. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned user events. Use this expression to restrict results to a - // specific time range or to filter events by eventType. - // For example, `eventTime > "2012-04-23T18:25:43.511Z" - // eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - // eventType=search` - // - // We expect only three types of fields: - // - // * `eventTime`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `eventTime` restriction should result in one, contiguous, valid, - // `eventTime` range. - // - // * `eventType`: Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses and the operators are separated - // from the tag values by a space. - // - // * `eventsMissingCatalogItems`: This restricts results - // to events for which catalog items were not found in the catalog. The - // default behavior is to return only those events for which catalog - // items were found. - // - // Some examples of valid filters expressions: - // - // * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - // eventTime < "2012-04-23T18:30:43.511Z"` - // * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - // eventType = detail-page-view` - // * Example 3: `eventsMissingCatalogItems - // eventType = (NOT search) eventTime < - // "2018-04-23T18:30:43.511Z"` - // * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - // * Example 5: `eventType = (detail-page-view OR search)` - // * Example 6: `eventsMissingCatalogItems` - string filter = 3; -} - -// Request message for the `ExportAnalyticsMetrics` method. -message ExportAnalyticsMetricsRequest { - // Required. Full resource name of the parent catalog. - // Expected format: `projects/*/locations/*/catalogs/*` - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned metrics. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned metrics. Use this expression to restrict results to a - // specific time range. - // - // Currently we expect only one types of fields: - // - // * `timestamp`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `timestamp` restriction should result in one, contiguous, valid, - // `timestamp` range. - // - // Some examples of valid filters expressions: - // - // * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - // timestamp < "2012-04-23T18:30:43.511Z"` - // * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - string filter = 3; -} - -// Metadata related to the progress of the Export operation. This is -// returned by the google.longrunning.Operation.metadata field. -message ExportMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; -} - -// Response of the ExportProductsRequest. If the long running -// operation is done, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportProductsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Response of the ExportUserEventsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportUserEventsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Response of the ExportAnalyticsMetricsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportAnalyticsMetricsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Output result that stores the information about where the exported data is -// stored. -message OutputResult { - // The BigQuery location where the result is stored. - repeated BigQueryOutputResult bigquery_result = 1; - - // The Google Cloud Storage location where the result is stored. - repeated GcsOutputResult gcs_result = 2; -} - -// A BigQuery output result. -message BigQueryOutputResult { - // The ID of a BigQuery Dataset. - string dataset_id = 1; - - // The ID of a BigQuery Table. - string table_id = 2; -} - -// A Gcs output result. -message GcsOutputResult { - // The uri of Gcs output - string output_uri = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline deleted file mode 100644 index e639eccd62ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "GenerativeQuestionProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configuration for overall generative question feature state. -message GenerativeQuestionsFeatureConfig { - // Required. Resource name of the affected catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines whether questions will be used at serving time. - // Note: This feature cannot be enabled until initial data requirements are - // satisfied. - bool feature_enabled = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Minimum number of products in the response to trigger follow-up - // questions. Value must be 0 or positive. - int32 minimum_products = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for a single generated question. -message GenerativeQuestionConfig { - // Required. Resource name of the catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The facet to which the question is associated. - string facet = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The LLM generated question. - string generated_question = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The question that will be used at serving time. - // Question can have a max length of 300 bytes. - // When not populated, generated_question should be used. - string final_question = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Values that can be used to answer the question. - repeated string example_values = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ratio of how often a question was asked. - float frequency = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Whether the question is asked at serving time. - bool allowed_in_conversation = 7 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline deleted file mode 100644 index cbd46d1f8ca7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/generative_question.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "GenerativeQuestionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing LLM generated questions in search serving. -service GenerativeQuestionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Manages overal generative question feature state -- enables toggling - // feature on and off. - rpc UpdateGenerativeQuestionsFeatureConfig( - UpdateGenerativeQuestionsFeatureConfigRequest) - returns (GenerativeQuestionsFeatureConfig) { - option (google.api.http) = { - patch: "/v2alpha/{generative_questions_feature_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature" - body: "generative_questions_feature_config" - }; - option (google.api.method_signature) = - "generative_questions_feature_config,update_mask"; - } - - // Manages overal generative question feature state -- enables toggling - // feature on and off. - rpc GetGenerativeQuestionsFeatureConfig( - GetGenerativeQuestionsFeatureConfigRequest) - returns (GenerativeQuestionsFeatureConfig) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature" - }; - option (google.api.method_signature) = "catalog"; - } - - // Returns all questions for a given catalog. - rpc ListGenerativeQuestionConfigs(ListGenerativeQuestionConfigsRequest) - returns (ListGenerativeQuestionConfigsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/generativeQuestions" - }; - option (google.api.method_signature) = "parent"; - } - - // Allows management of individual questions. - rpc UpdateGenerativeQuestionConfig(UpdateGenerativeQuestionConfigRequest) - returns (GenerativeQuestionConfig) { - option (google.api.http) = { - patch: "/v2alpha/{generative_question_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestion" - body: "generative_question_config" - }; - option (google.api.method_signature) = - "generative_question_config,update_mask"; - } - - // Allows management of multiple questions. - rpc BatchUpdateGenerativeQuestionConfigs( - BatchUpdateGenerativeQuestionConfigsRequest) - returns (BatchUpdateGenerativeQuestionConfigsResponse) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/generativeQuestion:batchUpdate" - body: "*" - }; - option (google.api.method_signature) = "parent,requests"; - } -} - -// Request for UpdateGenerativeQuestionsFeatureConfig method. -message UpdateGenerativeQuestionsFeatureConfigRequest { - // Required. The configuration managing the feature state. - GenerativeQuestionsFeatureConfig generative_questions_feature_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided - // [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig] - // to update. If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for GetGenerativeQuestionsFeatureConfig method. -message GetGenerativeQuestionsFeatureConfigRequest { - // Required. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Request for ListQuestions method. -message ListGenerativeQuestionConfigsRequest { - // Required. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response for ListQuestions method. -message ListGenerativeQuestionConfigsResponse { - // All the questions for a given catalog. - repeated GenerativeQuestionConfig generative_question_configs = 1; -} - -// Request for UpdateGenerativeQuestionConfig method. -message UpdateGenerativeQuestionConfigRequest { - // Required. The question to update. - GenerativeQuestionConfig generative_question_config = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided - // [GenerativeQuestionConfig][google.cloud.retail.v2alpha.GenerativeQuestionConfig] - // to update. The following are NOT supported: - // - // * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency] - // - // If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for BatchUpdateGenerativeQuestionConfig method. -message BatchUpdateGenerativeQuestionConfigsRequest { - // Optional. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string parent = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The updates question configs. - repeated UpdateGenerativeQuestionConfigRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Aggregated response for UpdateGenerativeQuestionConfig method. -message BatchUpdateGenerativeQuestionConfigsResponse { - // Optional. The updates question configs. - repeated GenerativeQuestionConfig generative_question_configs = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/import_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/import_config.proto.baseline deleted file mode 100644 index e2137da67b8a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/import_config.proto.baseline +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ImportConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Google Cloud Storage location for input content. -message GcsSource { - // Required. Google Cloud Storage URIs to input files. URI can be up to - // 2000 characters long. URIs can match the full object path (for example, - // `gs://bucket/directory/object.json`) or a pattern matching one or more - // files, such as `gs://bucket/directory/*.json`. A request can - // contain at most 100 files, and each file can be up to 2 GB. See - // [Importing product - // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) - // for the expected file format and setup instructions. - repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; - - // The schema to use when parsing the data from the source. - // - // Supported values for product imports: - // - // * `product` (default): One JSON - // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must - // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. - // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - // - // Supported values for user events imports: - // - // * `user_event` (default): One JSON - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. - // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719. - // - // Supported values for control imports: - // - // * `control` (default): One JSON - // [Control][google.cloud.retail.v2alpha.Control] per line. - // - // Supported values for catalog attribute imports: - // - // * `catalog_attribute` (default): One CSV - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] per line. - string data_schema = 2; -} - -// BigQuery source import data from. -message BigQuerySource { - // BigQuery table partition info. Leave this empty if the BigQuery table - // is not partitioned. - oneof partition { - // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. - google.type.Date partition_date = 6; - } - - // The project ID (can be project # or ID) that the BigQuery source is in with - // a length limit of 128 characters. If not specified, inherits the project - // ID from the parent request. - string project_id = 5; - - // Required. The BigQuery data set to copy the data from with a length limit - // of 1,024 characters. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table to copy the data from with a length limit of - // 1,024 characters. - string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Intermediate Cloud Storage directory used for the import with a length - // limit of 2,000 characters. Can be specified if one wants to have the - // BigQuery export to a specific Cloud Storage directory. - string gcs_staging_dir = 3; - - // The schema to use when parsing the data from the source. - // - // Supported values for product imports: - // - // * `product` (default): One JSON - // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must - // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. - // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - // - // Supported values for user events imports: - // - // * `user_event` (default): One JSON - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. - // * `user_event_ga360`: - // The schema is available here: - // https://support.google.com/analytics/answer/3437719. - // * `user_event_ga4`: - // The schema is available here: - // https://support.google.com/analytics/answer/7029846. - // - // Supported values for autocomplete imports: - // - // * `suggestions` (default): One JSON completion suggestion per line. - // * `denylist`: One JSON deny suggestion per line. - // * `allowlist`: One JSON allow suggestion per line. - string data_schema = 4; -} - -// The inline source for the input config for ImportProducts method. -message ProductInlineSource { - // Required. A list of products to update/create. Each product must have a - // valid [Product.id][google.cloud.retail.v2alpha.Product.id]. Recommended max - // of 100 items. - repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The inline source for the input config for ImportUserEvents method. -message UserEventInlineSource { - // Required. A list of user events to import. Recommended max of 10k items. - repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration of destination for Import related errors. -message ImportErrorsConfig { - // Required. Errors destination. - oneof destination { - // Google Cloud Storage prefix for import errors. This must be an empty, - // existing Cloud Storage directory. Import errors are written to - // sharded files in this directory, one per line, as a JSON-encoded - // `google.rpc.Status` message. - string gcs_prefix = 1; - } -} - -// Request message for Import methods. -message ImportProductsRequest { - // Indicates how imported products are reconciled with the existing products - // created or imported before. - enum ReconciliationMode { - // Defaults to INCREMENTAL. - RECONCILIATION_MODE_UNSPECIFIED = 0; - - // Inserts new products or updates existing products. - INCREMENTAL = 1; - - // Calculates diff and replaces the entire product dataset. Existing - // products may be deleted if they are not present in the source location. - FULL = 2; - } - - // Required. - // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - // - // If no updateMask is specified, requires products.create permission. - // If updateMask is specified, requires products.update permission. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Deprecated. This field has no effect. - string request_id = 6 [deprecated = true]; - - // Required. The desired input location of the data. - ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // The desired location of errors incurred during the Import. - ImportErrorsConfig errors_config = 3; - - // Indicates which fields in the provided imported `products` to update. If - // not set, all fields are updated. If provided, only the existing product - // fields are updated. Missing products will not be created. - google.protobuf.FieldMask update_mask = 4; - - // The mode of reconciliation between existing products and the products to be - // imported. Defaults to - // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. - ReconciliationMode reconciliation_mode = 5; - - // Full Pub/Sub topic name for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - // to be within the same project as - // [ImportProductsRequest.parent][google.cloud.retail.v2alpha.ImportProductsRequest.parent]. - // Make sure that both - // `cloud-retail-customer-data-access@system.gserviceaccount.com` and - // `service-@gcp-sa-retail.iam.gserviceaccount.com` - // have the `pubsub.topics.publish` IAM permission on the topic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - string notification_pubsub_topic = 7; - - // If true, this performs the FULL import even if it would delete a large - // proportion of the products in the default branch, which could potentially - // cause outages if you have live predict/search traffic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - bool skip_default_branch_protection = 8; -} - -// Request message for the ImportUserEvents request. -message ImportUserEventsRequest { - // Required. `projects/1234/locations/global/catalogs/default_catalog` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The desired input location of the data. - UserEventInputConfig input_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // The desired location of errors incurred during the Import. Cannot be set - // for inline user event imports. - ImportErrorsConfig errors_config = 3; -} - -// Request message for ImportCompletionData methods. -message ImportCompletionDataRequest { - // Required. The catalog which the suggestions dataset belongs to. - // - // Format: `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The desired input location of the data. - CompletionDataInputConfig input_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - string notification_pubsub_topic = 3; -} - -// The input config source for products. -message ProductInputConfig { - // Required. The source of the input. - oneof source { - // The Inline source for the input content for products. - ProductInlineSource product_inline_source = 1; - - // Google Cloud Storage location for the input content. - GcsSource gcs_source = 2; - - // BigQuery input source. - BigQuerySource big_query_source = 3; - } -} - -// The input config source for user events. -message UserEventInputConfig { - // The source of the input. - oneof source { - // Required. The Inline source for the input content for UserEvents. - UserEventInlineSource user_event_inline_source = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Google Cloud Storage location for the input content. - GcsSource gcs_source = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. BigQuery input source. - BigQuerySource big_query_source = 3 - [(google.api.field_behavior) = REQUIRED]; - } -} - -// The input config source for completion data. -message CompletionDataInputConfig { - // The source of the input. - // - // Supported - // [BigQuerySource.data_schema][google.cloud.retail.v2alpha.BigQuerySource.data_schema] - // values for suggestions imports: - // - // * `suggestions` (default): One JSON completion suggestion per line. - // * `denylist`: One JSON deny suggestion per line. - // * `allowlist`: One JSON allow suggestion per line. - oneof source { - // Required. BigQuery input source. - // - // Add the IAM permission "BigQuery Data Viewer" for - // cloud-retail-customer-data-access@system.gserviceaccount.com before - // using this feature otherwise an error is thrown. - BigQuerySource big_query_source = 1 - [(google.api.field_behavior) = REQUIRED]; - } -} - -// Metadata related to the progress of the Import operation. This is -// returned by the google.longrunning.Operation.metadata field. -message ImportMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; - - // Count of entries that were processed successfully. - int64 success_count = 3; - - // Count of entries that encountered errors while processing. - int64 failure_count = 4; - - // Deprecated. This field is never set. - string request_id = 5 [deprecated = true]; - - // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - string notification_pubsub_topic = 6; - - // Metadata related to transform user events. - TransformedUserEventsMetadata transformed_user_events_metadata = 7; -} - -// Metadata related to transform user events operation. -message TransformedUserEventsMetadata { - // Count of entries in the source user events BigQuery table. - int64 source_events_count = 1; - - // Count of entries in the transformed user events BigQuery table, which could - // be different from the actually imported number of user events. - int64 transformed_events_count = 2; -} - -// Response of the -// [ImportProductsRequest][google.cloud.retail.v2alpha.ImportProductsRequest]. -// If the long running operation is done, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ImportProductsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // Echoes the destination for the complete errors in the request if set. - ImportErrorsConfig errors_config = 2; -} - -// Response of the ImportUserEventsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ImportUserEventsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // Echoes the destination for the complete errors if this field was set in - // the request. - ImportErrorsConfig errors_config = 2; - - // Aggregated statistics of user event import status. - UserEventImportSummary import_summary = 3; -} - -// A summary of import result. The UserEventImportSummary summarizes -// the import status for user events. -message UserEventImportSummary { - // Count of user events imported with complete existing catalog information. - int64 joined_events_count = 1; - - // Count of user events imported, but with catalog information not found - // in the imported catalog. - int64 unjoined_events_count = 2; -} - -// Response of the -// [ImportCompletionDataRequest][google.cloud.retail.v2alpha.ImportCompletionDataRequest]. -// If the long running operation is done, this message is returned by the -// google.longrunning.Operations.response field if the operation is successful. -message ImportCompletionDataResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline deleted file mode 100644 index 2f6ca4528ac8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "MerchantCenterAccountLinkProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Represents a link between a Merchant Center account and a branch. -// After a link is established, products from the linked Merchant Center account -// are streamed to the linked branch. -message MerchantCenterAccountLink { - option (google.api.resource) = { - type: "retail.googleapis.com/MerchantCenterAccountLink" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}" - }; - - // Merchant Center Feed filter criterion. - message MerchantCenterFeedFilter { - // Merchant Center primary feed ID. - // Deprecated: use data_source_id instead. - int64 primary_feed_id = 1 [deprecated = true]; - - // AFM data source ID. - int64 data_source_id = 3; - - // Merchant Center primary feed name. The name is used for the display - // purposes only. - string primary_feed_name = 2; - } - - // The state of the link. - enum State { - // Default value. - STATE_UNSPECIFIED = 0; - - // Link is created and LRO is not complete. - PENDING = 1; - - // Link is active. - ACTIVE = 2; - - // Link creation failed. - FAILED = 3; - } - - // Output only. Immutable. Full resource name of the Merchant Center Account - // Link, such as - // `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/merchant_center_account_link`. - string name = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Immutable. - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // identifier, which is the final component of - // [name][google.cloud.retail.v2alpha.MerchantCenterAccountLink.name]. This - // field is auto generated and follows the convention: - // `BranchId_MerchantCenterAccountId`. - // `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/id_1`. - string id = 8 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Required. The linked [Merchant center account - // id](https://developers.google.com/shopping-content/guides/accountstatuses). - // The account must be a standalone account or a sub-account of a MCA. - int64 merchant_center_account_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The branch ID (e.g. 0/1/2) within the catalog that products from - // merchant_center_account_id are streamed to. When updating this field, an - // empty value will use the currently configured default branch. However, - // changing the default branch later on won't change the linked branch here. - // - // A single branch ID can only have one linked Merchant Center account ID. - string branch_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // The FeedLabel used to perform filtering. - // Note: this replaces - // [region_id](https://developers.google.com/shopping-content/reference/rest/v2.1/products#Product.FIELDS.feed_label). - // - // Example value: `US`. - // Example value: `FeedLabel1`. - string feed_label = 4; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // ISO 639-1. - // - // This specifies the language of offers in Merchant Center that will be - // accepted. If empty, no language filtering will be performed. - // - // Example value: `en`. - string language_code = 5; - - // Criteria for the Merchant Center feeds to be ingested via the link. - // All offers will be ingested if the list is empty. - // Otherwise the offers will be ingested from selected feeds. - repeated MerchantCenterFeedFilter feed_filters = 6; - - // Output only. Represents the state of the link. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Google Cloud project ID. - string project_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. An optional arbitrary string that could be used as a tag for - // tracking link source. - string source = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -// Common metadata related to the progress of the operations. -message CreateMerchantCenterAccountLinkMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline deleted file mode 100644 index 86aa95afbb03..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/merchant_center_account_link.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "MerchantCenterAccountLinkServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Merchant Center Link service to link a Branch to a Merchant Center Account. -service MerchantCenterAccountLinkService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]s - // under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListMerchantCenterAccountLinks(ListMerchantCenterAccountLinksRequest) - returns (ListMerchantCenterAccountLinksResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. - rpc CreateMerchantCenterAccountLink(CreateMerchantCenterAccountLinkRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks" - body: "merchant_center_account_link" - }; - option (google.api.method_signature) = - "parent,merchant_center_account_link"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.MerchantCenterAccountLink" - metadata_type: "google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkMetadata" - }; - } - - // Deletes a - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. - // If the - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // to delete does not exist, a NOT_FOUND error is returned. - rpc DeleteMerchantCenterAccountLink(DeleteMerchantCenterAccountLinkRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/merchantCenterAccountLinks/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request for -// [MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks] -// method. -message ListMerchantCenterAccountLinksRequest { - // Required. The parent Catalog of the resource. - // It must match this format: - // `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response for -// [MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks] -// method. -message ListMerchantCenterAccountLinksResponse { - // The links. - repeated MerchantCenterAccountLink merchant_center_account_links = 1; -} - -// Request for -// [MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink] -// method. -message CreateMerchantCenterAccountLinkRequest { - // Required. The branch resource where this MerchantCenterAccountLink will be - // created. Format: - // `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // to create. - // - // If the caller does not have permission to create the - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink], - // regardless of whether or not it exists, a PERMISSION_DENIED error is - // returned. - MerchantCenterAccountLink merchant_center_account_link = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink] -// method. -message DeleteMerchantCenterAccountLinkRequest { - // Required. Full resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/MerchantCenterAccountLink" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model.proto.baseline deleted file mode 100644 index 7dc15eb66576..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model.proto.baseline +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ModelProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Metadata that describes the training and serving parameters of a -// [Model][google.cloud.retail.v2alpha.Model]. A -// [Model][google.cloud.retail.v2alpha.Model] can be associated with a -// [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] and then queried -// through the Predict API. -message Model { - option (google.api.resource) = { - type: "retail.googleapis.com/Model" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" - }; - - // The PageOptimizationConfig for model training. - // - // This determines how many panels to optimize for, and which serving - // configs to consider for each panel. - // The purpose of this model is to optimize which - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to show on which - // panels in way that optimizes the visitors shopping journey. - message PageOptimizationConfig { - // A candidate to consider for a given panel. Currently only - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] are valid - // candidates. - message Candidate { - oneof candidate { - // This has to be a valid - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] - // identifier. For example, for a ServingConfig with full name: - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/my_candidate_config`, - // this would be `my_candidate_config`. - string serving_config_id = 1; - } - } - - // An individual panel with a list of - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] to consider - // for it. - message Panel { - // Optional. The name to display for the panel. - string display_name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The candidates to consider on the panel. - repeated Candidate candidates = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The default candidate. If the model fails at serving time, - // we fall back to the default. - Candidate default_candidate = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Restrictions of expected returned results. - enum Restriction { - // Unspecified value for restriction. - RESTRICTION_UNSPECIFIED = 0; - - // Allow any [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to - // be show on any number of panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity, - // pdp_cvr_no_diversity - // - // `Restriction` = NO_RESTRICTION - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: [] - NO_RESTRICTION = 1; - - // Do not allow the same - // [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] to - // be shown on multiple panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_SERVING_CONFIG_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity_low) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - UNIQUE_SERVING_CONFIG_RESTRICTION = 2; - - // Do not allow multiple - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same - // [Model.name][google.cloud.retail.v2alpha.Model.name] to be show on on - // different panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_MODEL_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - UNIQUE_MODEL_RESTRICTION = 3; - - // Do not allow multiple - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same - // [Model.type][google.cloud.retail.v2alpha.Model.type] to be shown on - // different panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_MODEL_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity) - UNIQUE_MODEL_TYPE_RESTRICTION = 4; - } - - // Required. The type of [UserEvent][google.cloud.retail.v2alpha.UserEvent] - // this page optimization is shown for. - // - // Each page has an associated event type - this will be the - // corresponding event type for the page that the page optimization - // model is used on. - // - // Supported types: - // - // * `add-to-cart`: Products being added to cart. - // * `detail-page-view`: Products detail page viewed. - // * `home-page-view`: Homepage viewed - // * `category-page-view`: Homepage viewed - // * `shopping-cart-page-view`: User viewing a shopping cart. - // - // `home-page-view` only allows models with type `recommended-for-you`. - // All other page_optimization_event_type allow all - // [Model.types][google.cloud.retail.v2alpha.Model.type]. - string page_optimization_event_type = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of panel configurations. - // - // Limit = 5. - repeated Panel panels = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. How to restrict results across panels e.g. can the same - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] be shown on - // multiple panels at once. - // - // If unspecified, default to `UNIQUE_MODEL_RESTRICTION`. - Restriction restriction = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents an ordered combination of valid serving configs, which - // can be used for `PAGE_OPTIMIZATION` recommendations. - message ServingConfigList { - // Optional. A set of valid serving configs that may be used for - // `PAGE_OPTIMIZATION`. - repeated string serving_config_ids = 1 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Additional configs for the frequently-bought-together model type. - message FrequentlyBoughtTogetherFeaturesConfig { - // Optional. Specifies the context of the model when it is used in predict - // requests. Can only be set for the `frequently-bought-together` type. If - // it isn't specified, it defaults to - // [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2alpha.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]. - ContextProductsType context_products_type = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Additional model features config. - message ModelFeaturesConfig { - oneof type_dedicated_config { - // Additional configs for frequently-bought-together models. - FrequentlyBoughtTogetherFeaturesConfig frequently_bought_together_config = - 1; - } - } - - // The serving state of the model. - enum ServingState { - // Unspecified serving state. - SERVING_STATE_UNSPECIFIED = 0; - - // The model is not serving. - INACTIVE = 1; - - // The model is serving and can be queried. - ACTIVE = 2; - - // The model is trained on tuned hyperparameters and can be - // queried. - TUNED = 3; - } - - // The training state of the model. - enum TrainingState { - // Unspecified training state. - TRAINING_STATE_UNSPECIFIED = 0; - - // The model training is paused. - PAUSED = 1; - - // The model is training. - TRAINING = 2; - } - - // Describes whether periodic tuning is enabled for this model - // or not. Periodic tuning is scheduled at most every three months. You can - // start a tuning process manually by using the `TuneModel` - // method, which starts a tuning process immediately and resets the quarterly - // schedule. Enabling or disabling periodic tuning does not affect any - // current tuning processes. - enum PeriodicTuningState { - // Unspecified default value, should never be explicitly set. - PERIODIC_TUNING_STATE_UNSPECIFIED = 0; - - // The model has periodic tuning disabled. Tuning - // can be reenabled by calling the `EnableModelPeriodicTuning` - // method or by calling the `TuneModel` method. - PERIODIC_TUNING_DISABLED = 1; - - // The model cannot be tuned with periodic tuning OR the - // `TuneModel` method. Hide the options in customer UI and - // reject any requests through the backend self serve API. - ALL_TUNING_DISABLED = 3; - - // The model has periodic tuning enabled. Tuning - // can be disabled by calling the `DisableModelPeriodicTuning` - // method. - PERIODIC_TUNING_ENABLED = 2; - } - - // Describes whether this model have sufficient training data - // to be continuously trained. - enum DataState { - // Unspecified default value, should never be explicitly set. - DATA_STATE_UNSPECIFIED = 0; - - // The model has sufficient training data. - DATA_OK = 1; - - // The model does not have sufficient training data. Error - // messages can be queried via Stackdriver. - DATA_ERROR = 2; - } - - // Use single or multiple context products for recommendations. - enum ContextProductsType { - // Unspecified default value, should never be explicitly set. - // Defaults to - // [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2alpha.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]. - CONTEXT_PRODUCTS_TYPE_UNSPECIFIED = 0; - - // Use only a single product as context for the recommendation. Typically - // used on pages like add-to-cart or product details. - SINGLE_CONTEXT_PRODUCT = 1; - - // Use one or multiple products as context for the recommendation. Typically - // used on shopping cart pages. - MULTIPLE_CONTEXT_PRODUCTS = 2; - } - - // Training configuration specific to a - // [Model.type][google.cloud.retail.v2alpha.Model.type] - currently, only for - // page optimization. - oneof training_config { - // Optional. The page optimization config. - PageOptimizationConfig page_optimization_config = 17 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The fully qualified resource name of the model. - // - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - // catalog_id has char limit of 50. - // recommendation_model_id has char limit of 40. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The display name of the model. - // - // Should be human readable, used to display Recommendation Models in the - // Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 - // characters. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The training state that the model is in (e.g. - // `TRAINING` or `PAUSED`). - // - // Since part of the cost of running the service - // is frequency of training - this can be used to determine when to train - // model in order to control cost. If not specified: the default value for - // `CreateModel` method is `TRAINING`. The default value for - // `UpdateModel` method is to keep the state the same as before. - TrainingState training_state = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. - ServingState serving_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp the Recommendation Model was created at. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp the Recommendation Model was last updated. E.g. - // if a Recommendation Model was paused - this would be the time the pause was - // initiated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The type of model e.g. `home-page`. - // - // Currently supported values: `recommended-for-you`, `others-you-may-like`, - // `frequently-bought-together`, `page-optimization`, `similar-items`, - // `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value). - // - // This field together with - // [optimization_objective][google.cloud.retail.v2alpha.Model.optimization_objective] - // describe model metadata to use to control model training and serving. - // See https://cloud.google.com/retail/docs/models - // for more details on what the model metadata control and which combination - // of parameters are valid. For invalid combinations of parameters (e.g. type - // = `frequently-bought-together` and optimization_objective = `ctr`), you - // receive an error 400 if you try to create/update a recommendation with - // this set of knobs. - string type = 7 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The optimization objective e.g. `cvr`. - // - // Currently supported - // values: `ctr`, `cvr`, `revenue-per-order`. - // - // If not specified, we choose default based on model type. - // Default depends on type of recommendation: - // - // `recommended-for-you` => `ctr` - // - // `others-you-may-like` => `ctr` - // - // `frequently-bought-together` => `revenue_per_order` - // - // This field together with - // [optimization_objective][google.cloud.retail.v2alpha.Model.type] - // describe model metadata to use to control model training and serving. - // See https://cloud.google.com/retail/docs/models - // for more details on what the model metadata control and which combination - // of parameters are valid. For invalid combinations of parameters (e.g. type - // = `frequently-bought-together` and optimization_objective = `ctr`), you - // receive an error 400 if you try to create/update a recommendation with - // this set of knobs. - string optimization_objective = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The state of periodic tuning. - // - // The period we use is 3 months - to do a - // one-off tune earlier use the `TuneModel` method. Default value - // is `PERIODIC_TUNING_ENABLED`. - PeriodicTuningState periodic_tuning_state = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The timestamp when the latest successful tune finished. - google.protobuf.Timestamp last_tune_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The tune operation associated with the model. - // - // Can be used to determine if there is an ongoing tune for this - // recommendation. Empty field implies no tune is goig on. - string tuning_operation = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of data requirements for this model: `DATA_OK` and - // `DATA_ERROR`. - // - // Recommendation model cannot be trained if the data is in - // `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even - // if serving state is `ACTIVE`: models were trained successfully before, but - // cannot be refreshed because model no longer has sufficient - // data for training. - DataState data_state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering - // by attributes is enabled for the model. - RecommendationsFilteringOption filtering_option = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The list of valid serving configs associated with the - // PageOptimizationConfig. - repeated ServingConfigList serving_config_lists = 19 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Additional model features config. - ModelFeaturesConfig model_features_config = 22 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model_service.proto.baseline deleted file mode 100644 index 609d3fbd2290..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/model_service.proto.baseline +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/model.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ModelServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for performing CRUD operations on models. -// Recommendation models contain all the metadata necessary to generate a set of -// models for the `Predict()` API. A model is queried -// indirectly via a ServingConfig, which associates a model with a -// given Placement (e.g. Frequently Bought Together on Home Page). -// -// This service allows you to do the following: -// -// * Initiate training of a model. -// * Pause training of an existing model. -// * List all the available models along with their metadata. -// * Control their tuning schedule. -service ModelService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new model. - rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" - body: "model" - }; - option (google.api.method_signature) = "parent,model"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.Model" - metadata_type: "google.cloud.retail.v2alpha.CreateModelMetadata" - }; - } - - // Gets a model. - rpc GetModel(GetModelRequest) returns (Model) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses the training of an existing model. - rpc PauseModel(PauseModelRequest) returns (Model) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resumes the training of an existing model. - rpc ResumeModel(ResumeModelRequest) returns (Model) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes an existing model. - rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all the models linked to this event store. - rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" - }; - option (google.api.method_signature) = "parent"; - } - - // Update of model metadata. Only fields that - // currently can be updated are: `filtering_option` and - // `periodic_tuning_state`. - // If other values are provided, this API method ignores them. - rpc UpdateModel(UpdateModelRequest) returns (Model) { - option (google.api.http) = { - patch: "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}" - body: "model" - }; - option (google.api.method_signature) = "model,update_mask"; - } - - // Tunes an existing model. - rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.TuneModelResponse" - metadata_type: "google.cloud.retail.v2alpha.TuneModelMetadata" - }; - } -} - -// Request for creating a model. -message CreateModelRequest { - // Required. The parent resource under which to create the model. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The payload of the [Model][google.cloud.retail.v2alpha.Model] to - // create. - Model model = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether to run a dry run to validate the request (without - // actually creating the model). - bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for updating an existing model. -message UpdateModelRequest { - // Required. The body of the updated - // [Model][google.cloud.retail.v2alpha.Model]. - Model model = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided 'model' to - // update. If not set, by default updates all fields. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for getting a model. -message GetModelRequest { - // Required. The resource name of the - // [Model][google.cloud.retail.v2alpha.Model] to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Request for pausing training of a model. -message PauseModelRequest { - // Required. The name of the model to pause. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Request for resuming training of a model. -message ResumeModelRequest { - // Required. The name of the model to resume. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for listing models associated with a resource. -message ListModelsRequest { - // Required. The parent for which to list models. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 50. Max allowed value is 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListModels` - // call. Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for deleting a model. -message DeleteModelRequest { - // Required. The resource name of the - // [Model][google.cloud.retail.v2alpha.Model] to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Response to a ListModelRequest. -message ListModelsResponse { - // List of Models. - repeated Model models = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} - -// Request to manually start a tuning process now (instead of waiting for -// the periodically scheduled tuning to happen). -message TuneModelRequest { - // Required. The resource name of the model to tune. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Metadata associated with a create operation. -message CreateModelMetadata { - // The resource name of the model that this create applies to. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string model = 1; -} - -// Metadata associated with a tune operation. -message TuneModelMetadata { - // The resource name of the model that this tune applies to. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string model = 1; -} - -// Response associated with a tune operation. -message TuneModelResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline deleted file mode 100644 index 2eb3aceb650d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PredictionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for making recommendation prediction. -service PredictionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Makes a recommendation prediction. - rpc Predict(PredictRequest) returns (PredictResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict" - body: "*" - } - }; - } -} - -// Request message for Predict method. -message PredictRequest { - // Required. Full resource name of the format: - // `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` - // or - // `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. - // We recommend using the `servingConfigs` resource. `placements` is a legacy - // resource. - // The ID of the Recommendations AI serving config or placement. - // Before you can request predictions from your model, you must create at - // least one serving config or placement for it. For more information, see - // [Manage serving configs] - // (https://cloud.google.com/retail/docs/manage-configs). - // - // The full list of available serving configs can be seen at - // https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Context about the user, what they are looking at and what action - // they took to trigger the predict request. Note that this user event detail - // won't be ingested to userEvent logs. Thus, a separate userEvent write - // request is required for event logging. - // - // Don't set - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] or - // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] to the - // same fixed ID for different users. If you are trying to receive - // non-personalized recommendations (not recommended; this can negatively - // impact model performance), instead set - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] to - // a random unique ID and leave - // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] unset. - UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // Maximum number of results to return. Set this property to the number of - // prediction results needed. If zero, the service will choose a reasonable - // default. The maximum allowed value is 100. Values above 100 will be coerced - // to 100. - int32 page_size = 3; - - // This field is not used; leave it unset. - string page_token = 4 [deprecated = true]; - - // Filter for restricting prediction results with a length limit of 5,000 - // characters. Accepts values for tags and the `filterOutOfStockItems` flag. - // - // * Tag expressions. Restricts predictions to products that match all of the - // specified tags. Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses, and must be separated from the - // tag values by a space. `-"tagA"` is also supported and is equivalent to - // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - // with a size limit of 1,000 characters. - // - // Note: "Recently viewed" models don't support tag filtering at the - // moment. - // - // * filterOutOfStockItems. Restricts predictions to products that do not - // have a - // stockState value of OUT_OF_STOCK. - // - // Examples: - // - // * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - // * filterOutOfStockItems tag=(-"promotional") - // * filterOutOfStockItems - // - // If your filter blocks all prediction results, the API will return *no* - // results. If instead you want empty result sets to return generic - // (unfiltered) popular products, set `strictFiltering` to False in - // `PredictRequest.params`. Note that the API will never return items with - // storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - // - // If `filterSyntaxV2` is set to true under the `params` field, then - // attribute-based expressions are expected instead of the above described - // tag-based syntax. Examples: - // - // * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - // * (availability: ANY("IN_STOCK")) AND - // (colors: ANY("Red") OR categories: ANY("Phones")) - // - // For more information, see - // [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - string filter = 5; - - // Use validate only mode for this prediction query. If set to true, a - // dummy model will be used that returns arbitrary products. - // Note that the validate only mode should only be used for testing the API, - // or if the model is not ready. - bool validate_only = 6; - - // Additional domain specific parameters for the predictions. - // - // Allowed values: - // - // * `returnProduct`: Boolean. If set to true, the associated product - // object will be returned in the `results.metadata` field in the - // prediction response. - // * `returnScore`: Boolean. If set to true, the prediction 'score' - // corresponding to each returned product will be set in the - // `results.metadata` field in the prediction response. The given - // 'score' indicates the probability of a product being clicked/purchased - // given the user's context and history. - // * `strictFiltering`: Boolean. True by default. If set to false, the service - // will return generic (unfiltered) popular products instead of empty if - // your filter blocks all prediction results. - // * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - // it needs to be one of {'no-price-reranking', 'low-price-reranking', - // 'medium-price-reranking', 'high-price-reranking'}. This gives - // request-level control and adjusts prediction results based on product - // price. - // * `diversityLevel`: String. Default empty. If set to be non-empty, then - // it needs to be one of {'no-diversity', 'low-diversity', - // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - // request-level control and adjusts prediction results based on product - // category. - // * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - // field is interpreteted according to the new, attribute-based syntax. - map params = 7; - - // The labels applied to a resource must meet the following requirements: - // - // * Each resource can have multiple labels, up to a maximum of 64. - // * Each label must be a key-value pair. - // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters and cannot be empty. Values can be empty and have a maximum - // length of 63 characters. - // * Keys and values can contain only lowercase letters, numeric characters, - // underscores, and dashes. All characters must use UTF-8 encoding, and - // international characters are allowed. - // * The key portion of a label must be unique. However, you can use the same - // key with multiple resources. - // * Keys must start with a lowercase letter or international character. - // - // See [Google Cloud - // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - // for more details. - map labels = 8; -} - -// Response message for predict method. -message PredictResponse { - // PredictionResult represents the recommendation prediction results. - message PredictionResult { - // ID of the recommended product - string id = 1; - - // Additional product metadata / annotations. - // - // Possible values: - // - // * `product`: JSON representation of the product. Is set if - // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Is set if - // `returnScore` is set to true in `PredictRequest.params`. - map metadata = 2; - } - - // A list of recommended products. The order represents the ranking (from the - // most relevant product to the least). - repeated PredictionResult results = 1; - - // A unique attribution token. This should be included in the - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] logs resulting from this - // recommendation, which enables accurate attribution of recommendation model - // performance. - string attribution_token = 2; - - // IDs of products in the request that were missing from the inventory. - repeated string missing_ids = 3; - - // True if the validateOnly property was set in the request. - bool validate_only = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product.proto.baseline deleted file mode 100644 index 87875ec86153..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product.proto.baseline +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/promotion.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProductProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Product captures all metadata information of items to be recommended or -// searched. -message Product { - option (google.api.resource) = { - type: "retail.googleapis.com/Product" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" - }; - - // The type of this product. - enum Type { - // Default value. Default to - // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // if unset. - TYPE_UNSPECIFIED = 0; - - // The primary type. - // - // As the primary unit for predicting, indexing and search serving, a - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] is grouped with multiple - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. - PRIMARY = 1; - - // The variant type. - // - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s usually share some common - // attributes on the same - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s, but they have variant - // attributes like different colors, sizes and prices, etc. - VARIANT = 2; - - // The collection type. Collection products are bundled - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s or - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s that are sold together, - // such as a jewelry set with necklaces, earrings and rings, etc. - COLLECTION = 3; - } - - // Product availability. If this field is unspecified, the product is - // assumed to be in stock. - enum Availability { - // Default product availability. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // if unset. - AVAILABILITY_UNSPECIFIED = 0; - - // Product in stock. - IN_STOCK = 1; - - // Product out of stock. - OUT_OF_STOCK = 2; - - // Product that is in pre-order state. - PREORDER = 3; - - // Product that is back-ordered (i.e. temporarily out of stock). - BACKORDER = 4; - } - - oneof expiration { - // Note that this field is applied in the following ways: - // - // * If the [Product][google.cloud.retail.v2alpha.Product] is already - // expired when it is uploaded, this product - // is not indexed for search. - // - // * If the [Product][google.cloud.retail.v2alpha.Product] is not expired - // when it is uploaded, only the - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY]'s and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]'s - // expireTime is respected, and - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]'s - // expireTime is not used. - // - // In general, we suggest the users to delete the stale - // products explicitly, instead of using this field to determine staleness. - // - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] must be - // later than - // [available_time][google.cloud.retail.v2alpha.Product.available_time] and - // [publish_time][google.cloud.retail.v2alpha.Product.publish_time], - // otherwise an INVALID_ARGUMENT error is thrown. - // - // Corresponding properties: Google Merchant Center property - // [expiration_date](https://support.google.com/merchants/answer/6324499). - google.protobuf.Timestamp expire_time = 16; - - // Input only. The TTL (time to live) of the product. Note that this is only - // applicable to - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], - // and ignored for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. In - // general, we suggest the users to delete the stale products explicitly, - // instead of using this field to determine staleness. - // - // If it is set, it must be a non-negative value, and - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is set as - // current timestamp plus [ttl][google.cloud.retail.v2alpha.Product.ttl]. - // The derived - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is - // returned in the output and [ttl][google.cloud.retail.v2alpha.Product.ttl] - // is left blank when retrieving the - // [Product][google.cloud.retail.v2alpha.Product]. - // - // If it is set, the product is not available for - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // after current timestamp plus - // [ttl][google.cloud.retail.v2alpha.Product.ttl]. However, the product can - // still be retrieved by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // and - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - google.protobuf.Duration ttl = 17 - [(google.api.field_behavior) = INPUT_ONLY]; - } - - // Immutable. Full resource name of the product, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. [Product][google.cloud.retail.v2alpha.Product] identifier, which - // is the final component of [name][google.cloud.retail.v2alpha.Product.name]. - // For example, this field is "id_1", if - // [name][google.cloud.retail.v2alpha.Product.name] is - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [id](https://support.google.com/merchants/answer/6324405). Schema.org - // property [Product.sku](https://schema.org/sku). - string id = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The type of the product. Default to - // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // if unset. - Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Variant group identifier. Must be an - // [id][google.cloud.retail.v2alpha.Product.id], with the same parent branch - // with this product. Otherwise, an error is thrown. - // - // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s, this field can only be - // empty or set to the same value as - // [id][google.cloud.retail.v2alpha.Product.id]. - // - // For VARIANT [Product][google.cloud.retail.v2alpha.Product]s, this field - // cannot be empty. A maximum of 2,000 products are allowed to share the same - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [item_group_id](https://support.google.com/merchants/answer/6324507). - // Schema.org property - // [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID). - string primary_product_id = 4; - - // The [id][google.cloud.retail.v2alpha.Product.id] of the collection members - // when [type][google.cloud.retail.v2alpha.Product.type] is - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]. - // - // Non-existent product ids are allowed. - // The [type][google.cloud.retail.v2alpha.Product.type] of the members must be - // either [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] or - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] otherwise - // an INVALID_ARGUMENT error is thrown. Should not set it for other types. A - // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is - // return. - repeated string collection_member_ids = 5; - - // The Global Trade Item Number (GTIN) of the product. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Corresponding properties: Google Merchant Center property - // [gtin](https://support.google.com/merchants/answer/6324461). - // Schema.org property - // [Product.isbn](https://schema.org/isbn), - // [Product.gtin8](https://schema.org/gtin8), - // [Product.gtin12](https://schema.org/gtin12), - // [Product.gtin13](https://schema.org/gtin13), or - // [Product.gtin14](https://schema.org/gtin14). - // - // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. - string gtin = 6; - - // Product categories. This field is repeated for supporting one product - // belonging to several parallel categories. Strongly recommended using the - // full path for better search / recommendation quality. - // - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // For example, if a shoes product belongs to both - // ["Shoes & Accessories" -> "Shoes"] and - // ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be - // represented as: - // - // "categories": [ - // "Shoes & Accessories > Shoes", - // "Sports & Fitness > Athletic Clothing > Shoes" - // ] - // - // Must be set for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] otherwise an - // INVALID_ARGUMENT error is returned. - // - // At most 250 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product] unless overridden through - // the Google Cloud console. Empty values are not allowed. Each value must be - // a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, - // an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [google_product_category][mc_google_product_category]. Schema.org property - // [Product.category] (https://schema.org/category). - // - // [mc_google_product_category]: - // https://support.google.com/merchants/answer/6324436 - repeated string categories = 7; - - // Required. Product title. - // - // This field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [title](https://support.google.com/merchants/answer/6324415). Schema.org - // property [Product.name](https://schema.org/name). - string title = 8 [(google.api.field_behavior) = REQUIRED]; - - // The brands of the product. - // - // A maximum of 30 brands are allowed unless overridden through the Google - // Cloud console. Each - // brand must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [brand](https://support.google.com/merchants/answer/6324351). Schema.org - // property [Product.brand](https://schema.org/brand). - repeated string brands = 9; - - // Product description. - // - // This field must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [description](https://support.google.com/merchants/answer/6324468). - // Schema.org property [Product.description](https://schema.org/description). - string description = 10; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // - // For product prediction, this field is ignored and the model automatically - // detects the text language. The - // [Product][google.cloud.retail.v2alpha.Product] can include text in - // different languages, but duplicating - // [Product][google.cloud.retail.v2alpha.Product]s to provide text in multiple - // languages can result in degraded model performance. - // - // For product search this field is in use. It defaults to "en-US" if unset. - string language_code = 11; - - // Highly encouraged. Extra product attributes to be included. For example, - // for products, this could include the store name, vendor, style, color, etc. - // These are very strong signals for recommendation model, thus we highly - // recommend providing the attributes here. - // - // Features that can take on one of a limited number of possible values. Two - // types of features can be set are: - // - // Textual features. some examples would be the brand/maker of a product, or - // country of a customer. Numerical features. Some examples would be the - // height/weight of a product, or age of a customer. - // - // For example: `{ "vendor": {"text": ["vendor123", "vendor456"]}, - // "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]} - // }`. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * Max entries count: 200. - // * The key must be a UTF-8 encoded string with a length limit of 128 - // characters. - // * For indexable attribute, the key must match the pattern: - // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or - // `KEY_1_LIKE_THIS`. - // * For text attributes, at most 400 values are allowed. Empty values are not - // allowed. Each value must be a non-empty UTF-8 encoded string with a - // length limit of 256 characters. - // * For number attributes, at most 400 values are allowed. - map attributes = 12; - - // Custom tags associated with the product. - // - // At most 250 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. This value must be a UTF-8 - // encoded string with a length limit of 1,000 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // This tag can be used for filtering recommendation results by passing the - // tag as part of the - // [PredictRequest.filter][google.cloud.retail.v2alpha.PredictRequest.filter]. - // - // Corresponding properties: Google Merchant Center property - // [custom_label_0–4](https://support.google.com/merchants/answer/6324473). - repeated string tags = 13; - - // Product price and cost information. - // - // Corresponding properties: Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). - PriceInfo price_info = 14; - - // The rating of this product. - Rating rating = 15; - - // The timestamp when this [Product][google.cloud.retail.v2alpha.Product] - // becomes available for - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // Note that this is only applicable to - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], and - // ignored for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. - google.protobuf.Timestamp available_time = 18; - - // The online availability of the - // [Product][google.cloud.retail.v2alpha.Product]. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK]. - // - // For primary products with variants set the availability of the primary as - // [Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // and set the true availability at the variant level. This way the primary - // product will be considered "in stock" as long as it has at least one - // variant in stock. - // - // For primary products with no variants set the true availability at the - // primary level. - // - // Corresponding properties: Google Merchant Center property - // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org property [Offer.availability](https://schema.org/availability). - Availability availability = 19; - - // The available quantity of the item. - google.protobuf.Int32Value available_quantity = 20; - - // Fulfillment information, such as the store IDs for in-store pickup or - // region IDs for different shipping methods. - // - // All the elements must have distinct - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - // Otherwise, an INVALID_ARGUMENT error is returned. - repeated FulfillmentInfo fulfillment_info = 21; - - // Canonical URL directly linking to the product detail page. - // - // It is strongly recommended to provide a valid uri for the product, - // otherwise the service performance could be significantly degraded. - // - // This field must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [link](https://support.google.com/merchants/answer/6324416). Schema.org - // property [Offer.url](https://schema.org/url). - string uri = 22; - - // Product images for the product. We highly recommend putting the main - // image first. - // - // A maximum of 300 images are allowed. - // - // Corresponding properties: Google Merchant Center property - // [image_link](https://support.google.com/merchants/answer/6324350). - // Schema.org property [Product.image](https://schema.org/image). - repeated Image images = 23; - - // The target group associated with a given audience (e.g. male, veterans, - // car owners, musicians, etc.) of the product. - Audience audience = 24; - - // The color of the product. - // - // Corresponding properties: Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - ColorInfo color_info = 25; - - // The size of the product. To represent different size systems or size types, - // consider using this format: [[[size_system:]size_type:]size_value]. - // - // For example, in "US:MENS:M", "US" represents size system; "MENS" represents - // size type; "M" represents size value. In "GIRLS:27", size system is empty; - // "GIRLS" represents size type; "27" represents size value. In "32 inches", - // both size system and size type are empty, while size value is "32 inches". - // - // A maximum of 20 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [size](https://support.google.com/merchants/answer/6324492), - // [size_type](https://support.google.com/merchants/answer/6324497), and - // [size_system](https://support.google.com/merchants/answer/6324502). - // Schema.org property [Product.size](https://schema.org/size). - repeated string sizes = 26; - - // The material of the product. For example, "leather", "wooden". - // - // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 200 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [material](https://support.google.com/merchants/answer/6324410). Schema.org - // property [Product.material](https://schema.org/material). - repeated string materials = 27; - - // The pattern or graphic print of the product. For example, "striped", "polka - // dot", "paisley". - // - // A maximum of 20 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org - // property [Product.pattern](https://schema.org/pattern). - repeated string patterns = 28; - - // The condition of the product. Strongly encouraged to use the standard - // values: "new", "refurbished", "used". - // - // A maximum of 1 value is allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [condition](https://support.google.com/merchants/answer/6324469). - // Schema.org property - // [Offer.itemCondition](https://schema.org/itemCondition). - repeated string conditions = 29; - - // The promotions applied to the product. A maximum of 10 values are allowed - // per [Product][google.cloud.retail.v2alpha.Product]. Only - // [Promotion.promotion_id][google.cloud.retail.v2alpha.Promotion.promotion_id] - // will be used, other fields will be ignored if set. - repeated Promotion promotions = 34; - - // The timestamp when the product is published by the retailer for the first - // time, which indicates the freshness of the products. Note that this field - // is different from - // [available_time][google.cloud.retail.v2alpha.Product.available_time], given - // it purely describes product freshness regardless of when it is available on - // search and recommendation. - google.protobuf.Timestamp publish_time = 33; - - // Indicates which fields in the - // [Product][google.cloud.retail.v2alpha.Product]s are returned in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse]. - // - // Supported fields for all [type][google.cloud.retail.v2alpha.Product.type]s: - // - // * [audience][google.cloud.retail.v2alpha.Product.audience] - // * [availability][google.cloud.retail.v2alpha.Product.availability] - // * [brands][google.cloud.retail.v2alpha.Product.brands] - // * [color_info][google.cloud.retail.v2alpha.Product.color_info] - // * [conditions][google.cloud.retail.v2alpha.Product.conditions] - // * [gtin][google.cloud.retail.v2alpha.Product.gtin] - // * [materials][google.cloud.retail.v2alpha.Product.materials] - // * [name][google.cloud.retail.v2alpha.Product.name] - // * [patterns][google.cloud.retail.v2alpha.Product.patterns] - // * [price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [rating][google.cloud.retail.v2alpha.Product.rating] - // * [sizes][google.cloud.retail.v2alpha.Product.sizes] - // * [title][google.cloud.retail.v2alpha.Product.title] - // * [uri][google.cloud.retail.v2alpha.Product.uri] - // - // Supported fields only for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]: - // - // * [categories][google.cloud.retail.v2alpha.Product.categories] - // * [description][google.cloud.retail.v2alpha.Product.description] - // * [images][google.cloud.retail.v2alpha.Product.images] - // - // Supported fields only for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]: - // - // * Only the first image in - // [images][google.cloud.retail.v2alpha.Product.images] - // - // To mark [attributes][google.cloud.retail.v2alpha.Product.attributes] as - // retrievable, include paths of the form "attributes.key" where "key" is the - // key of a custom attribute, as specified in - // [attributes][google.cloud.retail.v2alpha.Product.attributes]. - // - // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], the - // following fields are always returned in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] by default: - // - // * [name][google.cloud.retail.v2alpha.Product.name] - // - // For [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT], the - // following fields are always returned in by default: - // - // * [name][google.cloud.retail.v2alpha.Product.name] - // * [color_info][google.cloud.retail.v2alpha.Product.color_info] - // - // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] can increase - // response payload size and serving latency. - // - // This field is deprecated. Use the retrievable site-wide control instead. - google.protobuf.FieldMask retrievable_fields = 30 [deprecated = true]; - - // Output only. Product variants grouped together on primary product which - // share similar product attributes. It's automatically grouped by - // [primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // for all the product variants. Only populated for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s. - // - // Note: This field is OUTPUT_ONLY for - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. - // Do not set this field in API requests. - repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A list of local inventories specific to different places. - // - // This field can be managed by - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // and - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // APIs if fine-grained, high-volume updates are necessary. - repeated LocalInventory local_inventories = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product_service.proto.baseline deleted file mode 100644 index 2e1297f467fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/product_service.proto.baseline +++ /dev/null @@ -1,1004 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/cloud/retail/v2alpha/purge_config.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProductServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for ingesting [Product][google.cloud.retail.v2alpha.Product] -// information of the customer's website. -service ProductService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a [Product][google.cloud.retail.v2alpha.Product]. - rpc CreateProduct(CreateProductRequest) returns (Product) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" - body: "product" - }; - option (google.api.method_signature) = "parent,product,product_id"; - } - - // Gets a [Product][google.cloud.retail.v2alpha.Product]. - rpc GetProduct(GetProductRequest) returns (Product) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a list of [Product][google.cloud.retail.v2alpha.Product]s. - rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a [Product][google.cloud.retail.v2alpha.Product]. - rpc UpdateProduct(UpdateProductRequest) returns (Product) { - option (google.api.http) = { - patch: "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - body: "product" - }; - option (google.api.method_signature) = "product,update_mask"; - } - - // Deletes a [Product][google.cloud.retail.v2alpha.Product]. - rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Permanently deletes all selected - // [Product][google.cloud.retail.v2alpha.Product]s under a branch. - // - // This process is asynchronous. If the request is valid, the removal will be - // enqueued and processed offline. Depending on the number of - // [Product][google.cloud.retail.v2alpha.Product]s, this operation could take - // hours to complete. Before the operation completes, some - // [Product][google.cloud.retail.v2alpha.Product]s may still be returned by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, - // this operation could take hours to complete. To get a sample of - // [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set - // [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] - // to false. - rpc PurgeProducts(PurgeProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.PurgeProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.PurgeProductsMetadata" - }; - } - - // Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. - // - // Request processing may be synchronous. - // Non-existing items are created. - // - // Note that it is possible for a subset of the - // [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated. - rpc ImportProducts(ImportProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } - - // Exports multiple [Product][google.cloud.retail.v2alpha.Product]s. - rpc ExportProducts(ExportProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:export" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } - - // Updates inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] while respecting the last - // update timestamps of each inventory field. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update is enqueued - // and processed downstream. As a consequence, when a response is returned, - // updates are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // When inventory is updated with - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], - // the specified inventory field value(s) overwrite any existing value(s) - // while ignoring the last update time for this field. Furthermore, the last - // update times for the specified inventory fields are overwritten by the - // times of the - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // or - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // request. - // - // If no inventory fields are set in - // [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], - // then any pre-existing inventory information for this product is used. - // - // If no inventory fields are set in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], - // then any existing inventory information is preserved. - // - // Pre-existing inventory information can only be updated with - // [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], - // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], - // and - // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. - // - // The returned [Operation][google.longrunning.Operation]s is obsolete after - // one day, and the [GetOperation][google.longrunning.Operations.GetOperation] - // API returns `NOT_FOUND` afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates are not marked as [done][google.longrunning.Operation.done] until - // they are obsolete. - rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" - body: "*" - }; - option (google.api.method_signature) = "inventory,set_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.SetInventoryResponse" - metadata_type: "google.cloud.retail.v2alpha.SetInventoryMetadata" - }; - } - - // We recommend that you use the - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // method instead of the - // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] - // method. - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // achieves the same results but provides more fine-grained control over - // ingesting local inventory data. - // - // Incrementally adds place IDs to - // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, the added place IDs are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse" - metadata_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata" - }; - } - - // We recommend that you use the - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // method instead of the - // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] - // method. - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // achieves the same results but provides more fine-grained control over - // ingesting local inventory data. - // - // Incrementally removes place IDs from a - // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, the removed place IDs are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse" - metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" - }; - } - - // Updates local inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] at a list of places, while - // respecting the last update timestamps of each inventory field. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // inventory information. If the request is valid, the update will be enqueued - // and processed downstream. As a consequence, when a response is returned, - // updates are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Local inventory information can only be modified using this method. - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // has no effect on local inventories. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc AddLocalInventories(AddLocalInventoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.AddLocalInventoriesResponse" - metadata_type: "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" - }; - } - - // Remove local inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] at a list of places at a - // removal timestamp. - // - // This process is asynchronous. If the request is valid, the removal will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, removals are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Local inventory information can only be removed using this method. - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // has no effect on local inventories. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse" - metadata_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" - }; - } -} - -// Request message for -// [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] -// method. -message CreateProductRequest { - // Required. The parent catalog resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The [Product][google.cloud.retail.v2alpha.Product] to create. - Product product = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the - // [Product][google.cloud.retail.v2alpha.Product], which will become the final - // component of the [Product.name][google.cloud.retail.v2alpha.Product.name]. - // - // If the caller does not have permission to create the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // This field must be unique among all - // [Product][google.cloud.retail.v2alpha.Product]s with the same - // [parent][google.cloud.retail.v2alpha.CreateProductRequest.parent]. - // Otherwise, an ALREADY_EXISTS error is returned. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string product_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] -// method. -message GetProductRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the requested [Product][google.cloud.retail.v2alpha.Product] does not - // exist, a NOT_FOUND error is returned. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; -} - -// Request message for -// [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] -// method. -message UpdateProductRequest { - // Required. The product to update/create. - // - // If the caller does not have permission to update the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update does not - // exist and - // [allow_missing][google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing] - // is not set, a NOT_FOUND error is returned. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Product][google.cloud.retail.v2alpha.Product] to update. The immutable and - // output only fields are NOT supported. If not set, all supported fields (the - // fields that are neither immutable nor output only) are updated. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - // - // The attribute key can be updated by setting the mask path as - // "attributes.${key_name}". If a key name is present in the mask but not in - // the patching product from the request, this key will be deleted after the - // update. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, a new [Product][google.cloud.retail.v2alpha.Product] will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for -// [ProductService.DeleteProduct][google.cloud.retail.v2alpha.ProductService.DeleteProduct] -// method. -message DeleteProductRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to delete the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to delete does not - // exist, a NOT_FOUND error is returned. - // - // The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be - // a - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product] member nor a - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] with more than one - // [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // All inventory information for the named - // [Product][google.cloud.retail.v2alpha.Product] will be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // This value only applies to the case when the target product is of type - // PRIMARY. - // When deleting a product of VARIANT/COLLECTION type, this value - // will be ignored. - // When set to true, the subsequent variant products will be - // deleted. - // When set to false, if the primary product has active variant products, an - // error will be returned. - bool force = 4; -} - -// Request message for -// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] -// method. -message ListProductsRequest { - // Required. The parent branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use - // `default_branch` as the branch ID, to list products under the default - // branch. - // - // If the caller does not have permission to list - // [Product][google.cloud.retail.v2alpha.Product]s under this branch, - // regardless of whether or not this branch exists, a PERMISSION_DENIED error - // is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to - // return. If unspecified, defaults to 100. The maximum allowed value is 1000. - // Values above 1000 will be coerced to 1000. - // - // If this field is negative, an INVALID_ARGUMENT error is returned. - int32 page_size = 2; - - // A page token - // [ListProductsResponse.next_page_token][google.cloud.retail.v2alpha.ListProductsResponse.next_page_token], - // received from a previous - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 3; - - // A filter to apply on the list results. Supported features: - // - // * List all the products under the parent branch if - // [filter][google.cloud.retail.v2alpha.ListProductsRequest.filter] is unset. - // * List - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s sharing the same - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. For example: - // `primary_product_id = "some_product_id"` - // * List [Product][google.cloud.retail.v2alpha.Product]s bundled in a - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product]. - // For example: - // `collection_product_id = "some_product_id"` - // * List [Product][google.cloud.retail.v2alpha.Product]s with a partibular - // type. For example: - // `type = "PRIMARY"` - // `type = "VARIANT"` - // `type = "COLLECTION"` - // - // If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - // - // If the specified - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] or - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product] does not exist, a NOT_FOUND - // error is returned. - string filter = 4; - - // The fields of [Product][google.cloud.retail.v2alpha.Product] to return in - // the responses. If not set or empty, the following fields are returned: - // - // * [Product.name][google.cloud.retail.v2alpha.Product.name] - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // * [Product.title][google.cloud.retail.v2alpha.Product.title] - // * [Product.uri][google.cloud.retail.v2alpha.Product.uri] - // * [Product.images][google.cloud.retail.v2alpha.Product.images] - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.brands][google.cloud.retail.v2alpha.Product.brands] - // - // If "*" is provided, all fields are returned. - // [Product.name][google.cloud.retail.v2alpha.Product.name] is always returned - // no matter what mask is set. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - google.protobuf.FieldMask read_mask = 5; - - // If true and - // [page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] is - // empty, - // [ListProductsResponse.total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] - // is set to the total count of matched items irrespective of pagination. - // - // Notice that setting this field to true affects the performance. - bool require_total_size = 6; -} - -// Response message for -// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] -// method. -message ListProductsResponse { - // The [Product][google.cloud.retail.v2alpha.Product]s. - repeated Product products = 1; - - // A token that can be sent as - // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 2; - - // The total count of matched [Product][google.cloud.retail.v2alpha.Product]s - // irrespective of pagination. The total number of - // [Product][google.cloud.retail.v2alpha.Product]s returned by pagination may - // be less than the - // [total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] - // that matches. - // - // This field is ignored if - // [ListProductsRequest.require_total_size][google.cloud.retail.v2alpha.ListProductsRequest.require_total_size] - // is not set or - // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] - // is not empty. - int32 total_size = 3; -} - -// Request message for -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryRequest { - // Required. The inventory information to update. The allowable fields to - // update are: - // - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // The updated inventory fields must be specified in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. - // - // If - // [SetInventoryRequest.inventory.name][google.cloud.retail.v2alpha.Product.name] - // is empty or invalid, an INVALID_ARGUMENT error is returned. - // - // If the caller does not have permission to update the - // [Product][google.cloud.retail.v2alpha.Product] named in - // [Product.name][google.cloud.retail.v2alpha.Product.name], regardless of - // whether or not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update does not - // have existing inventory information, the provided inventory information - // will be inserted. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update has - // existing inventory information, the provided inventory information will be - // merged while respecting the last update time for each inventory field, - // using the provided or default value for - // [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. - // - // The caller can replace place IDs for a subset of fulfillment types in the - // following ways: - // - // * Adds "fulfillment_info" in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] - // * Specifies only the desired fulfillment types and corresponding place IDs - // to update in - // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // - // The caller can clear all place IDs from a subset of fulfillment types in - // the following ways: - // - // * Adds "fulfillment_info" in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] - // * Specifies only the desired fulfillment types to clear in - // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // * Checks that only the desired fulfillment info types have empty - // [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // - // The last update time is recorded for the following inventory fields: - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // - // If a full overwrite of inventory information while ignoring timestamps is - // needed, - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // should be invoked instead. - Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which inventory fields in the provided - // [Product][google.cloud.retail.v2alpha.Product] to update. - // - // At least one field must be provided. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned and the entire update will be ignored. - google.protobuf.FieldMask set_mask = 2; - - // The time when the request is issued, used to prevent - // out-of-order updates on inventory fields with the last update time - // recorded. If not provided, the internal system time will be used. - google.protobuf.Timestamp set_time = 3; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] with - // name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, - // the inventory update will still be processed and retained for at most 1 day - // until the [Product][google.cloud.retail.v2alpha.Product] is created. If set - // to false, a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 4; -} - -// Metadata related to the progress of the SetInventory operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryMetadata {} - -// Response of the SetInventoryRequest. Currently empty because -// there is no meaningful response populated from the -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryResponse {} - -// Request message for -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. The fulfillment type, including commonly used types (such as - // pickup in store and same day delivery), and custom types. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // This field directly corresponds to - // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The IDs for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type], such - // as the store IDs for "pickup-in-store" or the region IDs for - // "same-day-delivery" to be added for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type]. - // Duplicate IDs will be automatically ignored. - // - // At least 1 value is required, and a maximum of 2000 values are allowed. - // Each value must be a string with a length limit of 10 characters, matching - // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // If the total number of place IDs exceeds 2000 for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after - // adding, then the update will be rejected. - repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; - - // The time when the fulfillment updates are issued, used to prevent - // out-of-order updates on fulfillment information. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp add_time = 4; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the fulfillment information will still be processed and retained - // for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 5; -} - -// Metadata related to the progress of the AddFulfillmentPlaces operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesMetadata {} - -// Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesResponse {} - -// Request message for -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. A list of inventory information at difference places. Each place - // is identified by its place ID. At most 3000 inventories are allowed per - // request. - repeated LocalInventory local_inventories = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which inventory fields in the provided list of - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The - // field is updated to the provided value. - // - // If a field is set while the place does not have a previous local inventory, - // the local inventory at that store is created. - // - // If a field is set while the value of that field is not provided, the - // original field value, if it exists, is deleted. - // - // If the mask is not set or set with empty paths, all inventory fields will - // be updated. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned and the entire update will be ignored. - google.protobuf.FieldMask add_mask = 4; - - // The time when the inventory updates are issued. Used to prevent - // out-of-order updates on local inventory fields. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp add_time = 5; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the local inventory will still be processed and retained for at - // most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 6; -} - -// Metadata related to the progress of the AddLocalInventories operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesMetadata {} - -// Response of the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// API. Currently empty because there is no meaningful response populated from -// the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesResponse {} - -// Request message for -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. A list of place IDs to have their inventory deleted. - // At most 3000 place IDs are allowed per request. - repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; - - // The time when the inventory deletions are issued. Used to prevent - // out-of-order updates and deletions on local inventory fields. If not - // provided, the internal system time will be used. - google.protobuf.Timestamp remove_time = 5; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the local inventory removal request will still be processed and - // retained for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 3; -} - -// Metadata related to the progress of the RemoveLocalInventories operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesMetadata {} - -// Response of the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// API. Currently empty because there is no meaningful response populated from -// the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesResponse {} - -// Request message for -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. The fulfillment type, including commonly used types (such as - // pickup in store and same day delivery), and custom types. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // This field directly corresponds to - // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The IDs for this - // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type], - // such as the store IDs for "pickup-in-store" or the region IDs for - // "same-day-delivery", to be removed for this - // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. - // - // At least 1 value is required, and a maximum of 2000 values are allowed. - // Each value must be a string with a length limit of 10 characters, matching - // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - // INVALID_ARGUMENT error is returned. - repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; - - // The time when the fulfillment updates are issued, used to prevent - // out-of-order updates on fulfillment information. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp remove_time = 4; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the fulfillment information will still be processed and retained - // for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 5; -} - -// Metadata related to the progress of the RemoveFulfillmentPlaces operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesMetadata {} - -// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there -// is no meaningful response populated from the -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project.proto.baseline deleted file mode 100644 index 41da0d53c1b7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project.proto.baseline +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProjectProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Project level logging config to control what level of log will be generated -// and written to Cloud Logging. -message LoggingConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/LoggingConfig" - pattern: "projects/{project}/loggingConfig" - }; - - // The logging configurations for services supporting log generation. - message LogGenerationRule { - // The logging level. - // - // By default it is set to `LOG_WARNINGS_AND_ABOVE`. - LoggingLevel logging_level = 1; - - // The log sample rate for INFO level log entries. You can use this to - // reduce the number of entries generated for INFO level logs. - // - // DO NOT set this field if the - // [logging_level][google.cloud.retail.v2alpha.LoggingConfig.LogGenerationRule.logging_level] - // is not - // [LoggingLevel.LOG_ALL][google.cloud.retail.v2alpha.LoggingConfig.LoggingLevel.LOG_ALL]. - // Otherwise, an INVALID_ARGUMENT error is returned. - // - // Sample rate for INFO logs defaults to 1 when unset (generate and send all - // INFO logs to Cloud Logging). Its value must be greater than 0 and less - // than or equal to 1. - optional float info_log_sample_rate = 2; - } - - // The granular logging configurations for supported services. - message ServiceLogGenerationRule { - // Required. Supported service names: - // "CatalogService", - // "CompletionService", - // "ControlService", - // "MerchantCenterStreaming", - // "ModelService", - // "PredictionService", - // "ProductService", - // "ServingConfigService", - // "UserEventService", - string service_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The log generation rule that applies to this service. - LogGenerationRule log_generation_rule = 3; - } - - // The setting to control log generation. - enum LoggingLevel { - // Default value. Defaults to `LOG_FOR_WARNINGS_AND_ABOVE` if unset. - LOGGING_LEVEL_UNSPECIFIED = 0; - - // No log will be generated and sent to Cloud Logging. - LOGGING_DISABLED = 1; - - // Log for operations resulted in fatal error. - LOG_ERRORS_AND_ABOVE = 2; - - // In addition to `LOG_ERRORS_AND_ABOVE`, also log for operations that have - // soft errors, quality suggestions. - LOG_WARNINGS_AND_ABOVE = 3; - - // Log all operations, including successful ones. - LOG_ALL = 4; - } - - // Required. Immutable. The name of the LoggingConfig singleton resource. - // Format: projects/*/loggingConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // The log generation rule that applies by default to all services - // supporting log generation. It can be overridden by - // [ServiceLogGenerationRule][google.cloud.retail.v2alpha.LoggingConfig.ServiceLogGenerationRule] - // for service level control. - LogGenerationRule default_log_generation_rule = 2; - - // Controls logging configurations more granularly for each supported - // service. - // - // This overrides the - // [default_log_generation_rule][google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule] - // for the services specified. For those not mentioned, they will fallback to - // the default log generation rule. - repeated ServiceLogGenerationRule service_log_generation_rules = 4; -} - -// Metadata that describes a Cloud Retail Project. -message Project { - option (google.api.resource) = { - type: "retail.googleapis.com/RetailProject" - pattern: "projects/{project}/retailProject" - }; - - // Output only. Full resource name of the retail project, such as - // `projects/{project_id_or_number}/retailProject`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Retail API solutions that the project has enrolled. - repeated SolutionType enrolled_solutions = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Project level alert config. -message AlertConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/AlertConfig" - pattern: "projects/{project}/alertConfig" - }; - - // Alert policy for a customer. - message AlertPolicy { - // Recipient contact information. - message Recipient { - // Email address of the recipient. - string email_address = 1; - } - - // The enrollment status enum for alert policy. - enum EnrollStatus { - // Default value. Used for customers who have not responded to the - // alert policy. - ENROLL_STATUS_UNSPECIFIED = 0; - - // Customer is enrolled in this policy. - ENROLLED = 1; - - // Customer declined this policy. - DECLINED = 2; - } - - // The feature that provides alerting capability. - // Supported value: - // - `search-data-quality` for retail search customers. - // - `conv-data-quality` for retail conversation customers. - string alert_group = 1; - - // The enrollment status of a customer. - EnrollStatus enroll_status = 2; - - // Recipients for the alert policy. - // One alert policy should not exceed 20 recipients. - repeated Recipient recipients = 3; - } - - // Required. Immutable. The name of the AlertConfig singleton resource. - // Format: projects/*/alertConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Alert policies for a customer. - // They must be unique by [AlertPolicy.alert_group] - repeated AlertPolicy alert_policies = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project_service.proto.baseline deleted file mode 100644 index c1c4f74360e5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/project_service.proto.baseline +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/project.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProjectServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for settings at Project level. -service ProjectService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the project. - // - // Throws `NOT_FOUND` if the project wasn't initialized for the Retail API - // service. - rpc GetProject(GetProjectRequest) returns (Project) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/retailProject}" - }; - option (google.api.method_signature) = "name"; - } - - // Accepts service terms for this project. - // By making requests to this API, you agree to the terms of service linked - // below. - // https://cloud.google.com/retail/data-use-terms - rpc AcceptTerms(AcceptTermsRequest) returns (Project) { - option (google.api.http) = { - post: "/v2alpha/{project=projects/*/retailProject}:acceptTerms" - body: "*" - }; - option (google.api.method_signature) = "project"; - } - - // The method enrolls a solution of type [Retail - // Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] - // into a project. - // - // The [Recommendations AI solution - // type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] - // is enrolled by default when your project enables Retail API, so you don't - // need to call the enrollSolution method for recommendations. - rpc EnrollSolution(EnrollSolutionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{project=projects/*}:enrollSolution" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.EnrollSolutionResponse" - metadata_type: "google.cloud.retail.v2alpha.EnrollSolutionMetadata" - }; - } - - // Lists all the retail API solutions the project has enrolled. - rpc ListEnrolledSolutions(ListEnrolledSolutionsRequest) - returns (ListEnrolledSolutionsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*}:enrolledSolutions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the - // requested project. - rpc GetLoggingConfig(GetLoggingConfigRequest) returns (LoggingConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/loggingConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of - // the requested project. - rpc UpdateLoggingConfig(UpdateLoggingConfigRequest) returns (LoggingConfig) { - option (google.api.http) = { - patch: "/v2alpha/{logging_config.name=projects/*/loggingConfig}" - body: "logging_config" - }; - option (google.api.method_signature) = "logging_config,update_mask"; - } - - // Get the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] of the - // requested project. - rpc GetAlertConfig(GetAlertConfigRequest) returns (AlertConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/alertConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Update the alert config of the requested project. - rpc UpdateAlertConfig(UpdateAlertConfigRequest) returns (AlertConfig) { - option (google.api.http) = { - patch: "/v2alpha/{alert_config.name=projects/*/alertConfig}" - body: "alert_config" - }; - option (google.api.method_signature) = "alert_config,update_mask"; - } -} - -// Request for GetProject method. -message GetProjectRequest { - // Required. Full resource name of the project. Format: - // `projects/{project_number_or_id}/retailProject` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/RetailProject" - } - ]; -} - -// Request for AcceptTerms method. -message AcceptTermsRequest { - // Required. Full resource name of the project. Format: - // `projects/{project_number_or_id}/retailProject` - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/RetailProject" - } - ]; -} - -// Request for EnrollSolution method. -message EnrollSolutionRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number_or_id}` - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. Solution to enroll. - SolutionType solution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for EnrollSolution method. -message EnrollSolutionResponse { - // Retail API solution that the project has enrolled. - SolutionType enrolled_solution = 1; -} - -// Metadata related to the EnrollSolution method. -// This will be returned by the google.longrunning.Operation.metadata field. -message EnrollSolutionMetadata {} - -// Request for ListEnrolledSolutions method. -message ListEnrolledSolutionsRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number_or_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; -} - -// Response for ListEnrolledSolutions method. -message ListEnrolledSolutionsResponse { - // Retail API solutions that the project has enrolled. - repeated SolutionType enrolled_solutions = 1; -} - -// Request for -// [ProjectService.GetLoggingConfig][google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig] -// method. -message GetLoggingConfigRequest { - // Required. Full LoggingConfig resource name. Format: - // projects/{project_number}/loggingConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/LoggingConfig" - } - ]; -} - -// Request for -// [ProjectService.UpdateLoggingConfig][google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig] -// method. -message UpdateLoggingConfigRequest { - // Required. The [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to - // update. - // - // If the caller does not have permission to update the - // [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to update - // does not exist, a NOT_FOUND error is returned. - LoggingConfig logging_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to update. The - // following are the only supported fields: - // - // * [LoggingConfig.default_log_generation_rule][google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule] - // * [LoggingConfig.service_log_generation_rules][google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [ProjectService.GetAlertConfig][google.cloud.retail.v2alpha.ProjectService.GetAlertConfig] -// method. -message GetAlertConfigRequest { - // Required. Full AlertConfig resource name. Format: - // projects/{project_number}/alertConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AlertConfig" - } - ]; -} - -// Request for -// [ProjectService.UpdateAlertConfig][google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig] -// method. -message UpdateAlertConfigRequest { - // Required. The [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to - // update. - // - // If the caller does not have permission to update the - // [AlertConfig][google.cloud.retail.v2alpha.AlertConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to update - // does not exist, a NOT_FOUND error is returned. - AlertConfig alert_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to update. If not - // set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/promotion.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/promotion.proto.baseline deleted file mode 100644 index 3c9950fdc03b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/promotion.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PromotionProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Promotion information. -message Promotion { - // ID of the promotion. For example, "free gift". - // - // The value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Corresponds to Google Merchant Center property - // [promotion_id](https://support.google.com/merchants/answer/7050148). - string promotion_id = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline deleted file mode 100644 index a2cc7c1c2ab7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PurgeConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Metadata related to the progress of the Purge operation. -// This will be returned by the google.longrunning.Operation.metadata field. -message PurgeMetadata {} - -// Metadata related to the progress of the PurgeProducts operation. -// This will be returned by the google.longrunning.Operation.metadata field. -message PurgeProductsMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; - - // Count of entries that were deleted successfully. - int64 success_count = 3; - - // Count of entries that encountered errors while processing. - int64 failure_count = 4; -} - -// Request message for PurgeProducts method. -message PurgeProductsRequest { - // Required. The resource name of the branch under which the products are - // created. The format is - // `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The filter string to specify the products to be deleted with a - // length limit of 5,000 characters. - // - // Empty string filter is not allowed. "*" implies delete all items in a - // branch. - // - // The eligible fields for filtering are: - // - // * `availability`: Double quoted - // [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // string. - // * `create_time` : in ISO 8601 "zulu" format. - // - // Supported syntax: - // - // * Comparators (">", "<", ">=", "<=", "="). - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" - // * availability = "IN_STOCK" - // - // * Conjunctions ("AND") - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - // - // * Disjunctions ("OR") - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - // - // * Can support nested queries. - // Examples: - // * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - // OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - // - // * Filter Limits: - // * Filter should not contain more than 6 conditions. - // * Max nesting depth should not exceed 2 levels. - // - // Examples queries: - // * Delete back order products created before a timestamp. - // create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Actually perform the purge. - // If `force` is set to false, the method will return the expected purge count - // without deleting any products. - bool force = 3; -} - -// Response of the PurgeProductsRequest. If the long running operation is -// successfully done, then this message is returned by the -// google.longrunning.Operations.response field. -message PurgeProductsResponse { - // The total count of products purged as a result of the operation. - int64 purge_count = 1; - - // A sample of the product names that will be deleted. - // Only populated if `force` is set to false. A max of 100 names will be - // returned and the names are chosen at random. - repeated string purge_sample = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; -} - -// Request message for PurgeUserEvents method. -message PurgeUserEventsRequest { - // Required. The resource name of the catalog under which the events are - // created. The format is - // `projects/${projectId}/locations/global/catalogs/${catalogId}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The filter string to specify the events to be deleted with a - // length limit of 5,000 characters. Empty string filter is not allowed. The - // eligible fields for filtering are: - // - // * `eventType`: Double quoted - // [UserEvent.event_type][google.cloud.retail.v2alpha.UserEvent.event_type] - // string. - // * `eventTime`: in ISO 8601 "zulu" format. - // * `visitorId`: Double quoted string. Specifying this will delete all - // events associated with a visitor. - // * `userId`: Double quoted string. Specifying this will delete all events - // associated with a user. - // - // Examples: - // - // * Deleting all events in a time range: - // `eventTime > "2012-04-23T18:25:43.511Z" - // eventTime < "2012-04-23T18:30:43.511Z"` - // * Deleting specific eventType in time range: - // `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - // * Deleting all events for a specific visitor: - // `visitorId = "visitor1024"` - // - // The filtering fields are assumed to have an implicit AND. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Actually perform the purge. - // If `force` is set to false, the method will return the expected purge count - // without deleting any user events. - bool force = 3; -} - -// Response of the PurgeUserEventsRequest. If the long running operation is -// successfully done, then this message is returned by the -// google.longrunning.Operations.response field. -message PurgeUserEventsResponse { - // The total count of events purged as a result of the operation. - int64 purged_events_count = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/search_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/search_service.proto.baseline deleted file mode 100644 index be49a1957ecc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/search_service.proto.baseline +++ /dev/null @@ -1,1267 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "SearchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; -option (google.api.resource_definition) = { - type: "retail.googleapis.com/Experiment" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}" -}; - -// Service for search. -// -// This feature is only available for users who have Retail Search enabled. -// Enable Retail Search on Cloud Console before using this feature. -service SearchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Performs a search. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc Search(SearchRequest) returns (SearchResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search" - body: "*" - } - }; - } -} - -// Product attribute which structured by an attribute name and value. This -// structure is used in conversational search filters and answers. For example, -// if we have `name=color` and `value=red`, this means that the color is `red`. -message ProductAttributeValue { - // The attribute name. - string name = 1; - - // The attribute value. - string value = 2; -} - -// Product attribute name and numeric interval. -message ProductAttributeInterval { - // The attribute name (e.g. "length") - string name = 1; - - // The numeric interval (e.g. [10, 20)) - Interval interval = 2; -} - -// This field specifies the tile information including an attribute key, -// attribute value. More fields will be added in the future, eg: product id -// or product counts, etc. -message Tile { - // The attribute key and value for the tile. - oneof product_attribute { - // The product attribute key-value. - ProductAttributeValue product_attribute_value = 1; - - // The product attribute key-numeric interval. - ProductAttributeInterval product_attribute_interval = 2; - } - - // The representative product id for this tile. - string representative_product_id = 3; -} - -// Request message for -// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] -// method. -message SearchRequest { - // A facet specification to perform faceted search. - message FacetSpec { - // Specifies how a facet is computed. - message FacetKey { - // Required. Supported textual and numerical facet keys in - // [Product][google.cloud.retail.v2alpha.Product] object, over which the - // facet values are computed. Facet key is case-sensitive. - // - // Allowed facet keys when - // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] - // is not specified: - // - // * textual_field = - // * "brands" - // * "categories" - // * "genders" - // * "ageGroups" - // * "availability" - // * "colorFamilies" - // * "colors" - // * "sizes" - // * "materials" - // * "patterns" - // * "conditions" - // * "attributes.key" - // * "pickupInStore" - // * "shipToStore" - // * "sameDayDelivery" - // * "nextDayDelivery" - // * "customFulfillment1" - // * "customFulfillment2" - // * "customFulfillment3" - // * "customFulfillment4" - // * "customFulfillment5" - // * "inventory(place_id,attributes.key)" - // - // * numerical_field = - // * "price" - // * "discount" - // * "rating" - // * "ratingCount" - // * "attributes.key" - // * "inventory(place_id,price)" - // * "inventory(place_id,original_price)" - // * "inventory(place_id,attributes.key)" - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Set only if values should be bucketized into intervals. Must be set - // for facets with numerical values. Must not be set for facet with text - // values. Maximum number of intervals is 40. - // - // For all numerical facet keys that appear in the list of products from - // the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are - // computed from their distribution weekly. If the model assigns a high - // score to a numerical facet key and its intervals are not specified in - // the search request, these percentiles become the bounds - // for its intervals and are returned in the response. If the - // facet key intervals are specified in the request, then the specified - // intervals are returned instead. - repeated Interval intervals = 2; - - // Only get facet for the given restricted values. For example, when using - // "pickupInStore" as key and set restricted values to - // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on predefined textual fields, custom textual - // attributes and fulfillments. Maximum is 20. - // - // Must be set for the fulfillment facet keys: - // - // * pickupInStore - // - // * shipToStore - // - // * sameDayDelivery - // - // * nextDayDelivery - // - // * customFulfillment1 - // - // * customFulfillment2 - // - // * customFulfillment3 - // - // * customFulfillment4 - // - // * customFulfillment5 - repeated string restricted_values = 3; - - // Only get facet values that start with the given string prefix. For - // example, suppose "categories" has three values "Women > Shoe", - // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the - // "categories" facet gives only "Women > Shoe" and "Women > Dress". - // Only supported on textual fields. Maximum is 10. - repeated string prefixes = 8; - - // Only get facet values that contains the given strings. For example, - // suppose "categories" has three values "Women > Shoe", - // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the - // "categories" facet gives only "Women > Shoe" and "Men > Shoe". - // Only supported on textual fields. Maximum is 10. - repeated string contains = 9; - - // True to make facet keys case insensitive when getting faceting - // values with prefixes or contains; false otherwise. - bool case_insensitive = 10; - - // The order in which - // [SearchResponse.Facet.values][google.cloud.retail.v2alpha.SearchResponse.Facet.values] - // are returned. - // - // Allowed values are: - // - // * "count desc", which means order by - // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] - // descending. - // - // * "value desc", which means order by - // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] - // descending. - // Only applies to textual facets. - // - // If not set, textual values are sorted in [natural - // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical - // intervals are sorted in the order given by - // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals]; - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // are sorted in the order given by - // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restricted_values]. - string order_by = 4; - - // The query that is used to compute facet for the given facet key. - // When provided, it overrides the default behavior of facet - // computation. The query syntax is the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. Notice that there is no limitation - // on - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // when query is specified. - // - // In the response, - // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] - // is always "1" and - // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] - // is the number of results that match the query. - // - // For example, you can set a customized facet for "shipToStore", - // where - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // is "customizedShipToStore", and - // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] - // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". - // Then the facet counts the products that are both in stock and ship - // to store "123". - string query = 5; - - // Returns the min and max value for each numerical facet intervals. - // Ignored for textual facets. - bool return_min_max = 11; - } - - // Required. The facet key specification. - FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Maximum of facet values that should be returned for this facet. If - // unspecified, defaults to 50. The maximum allowed value is 300. Values - // above 300 will be coerced to 300. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 limit = 2; - - // List of keys to exclude when faceting. - // - // By default, - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // is not excluded from the filter unless it is listed in this field. - // - // Listing a facet key in this field allows its values to appear as facet - // results, even when they are filtered out of search results. Using this - // field does not affect what search results are returned. - // - // For example, suppose there are 100 products with the color facet "Red" - // and 200 products with the color facet "Blue". A query containing the - // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // would by default return only "Red" products in the search results, and - // also return "Red" with count 100 as the only color facet. Although there - // are also blue products available, "Blue" would not be shown as an - // available facet value. - // - // If "colorFamilies" is listed in "excludedFilterKeys", then the query - // returns the facet values "Red" with count 100 and "Blue" with count - // 200, because the "colorFamilies" key is now excluded from the filter. - // Because this field doesn't affect search results, the search results - // are still correctly filtered to return only "Red" products. - // - // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - repeated string excluded_filter_keys = 3; - - // Enables dynamic position for this facet. If set to true, the position of - // this facet among all facets in the response is determined by Google - // Retail Search. It is ordered together with dynamic facets if dynamic - // facets is enabled. If set to false, the position of this facet in the - // response is the same as in the request, and it is ranked before - // the facets with dynamic position enable and all dynamic facets. - // - // For example, you may always want to have rating facet returned in - // the response, but it's not necessarily to always display the rating facet - // at the top. In that case, you can set enable_dynamic_position to true so - // that the position of rating facet in response is determined by - // Google Retail Search. - // - // Another example, assuming you have the following facets in the request: - // - // * "rating", enable_dynamic_position = true - // - // * "price", enable_dynamic_position = false - // - // * "brands", enable_dynamic_position = false - // - // And also you have a dynamic facets enable, which generates a facet - // "gender". Then, the final order of the facets in the response can be - // ("price", "brands", "rating", "gender") or ("price", "brands", "gender", - // "rating") depends on how Google Retail Search orders "gender" and - // "rating" facets. However, notice that "price" and "brands" are always - // ranked at first and second position because their enable_dynamic_position - // values are false. - bool enable_dynamic_position = 4; - } - - // The specifications of dynamically generated facets. - message DynamicFacetSpec { - // Enum to control DynamicFacet mode - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // Disable Dynamic Facet. - DISABLED = 1; - - // Automatic mode built by Google Retail Search. - ENABLED = 2; - } - - // Mode of the DynamicFacet feature. - // Defaults to - // [Mode.DISABLED][google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode.DISABLED] - // if it's unset. - Mode mode = 1; - } - - // Boost specification to boost certain items. - message BoostSpec { - // Boost applies to products which match a condition. - message ConditionBoostSpec { - // An expression which specifies a boost condition. The syntax and - // supported fields are the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. - // - // Examples: - // - // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue": - // * (id: ANY("product_1", "product_2")) AND (colorFamilies: - // ANY("Red","Blue")) - string condition = 1; - - // Strength of the condition boost, which should be in [-1, 1]. Negative - // boost means demotion. Default is 0.0. - // - // Setting to 1.0 gives the item a big promotion. However, it does not - // necessarily mean that the boosted item will be the top result at all - // times, nor that other items will be excluded. Results could still be - // shown even when none of them matches the condition. And results that - // are significantly more relevant to the search query can still trump - // your heavily favored but irrelevant items. - // - // Setting to -1.0 gives the item a big demotion. However, results that - // are deeply relevant might still be shown. The item will have an - // upstream battle to get a fairly high ranking, but it is not blocked out - // completely. - // - // Setting to 0.0 means no boost applied. The boosting condition is - // ignored. - float boost = 2; - } - - // Condition boost specifications. If a product matches multiple conditions - // in the specifications, boost scores from these specifications are all - // applied and combined in a non-linear way. Maximum number of - // specifications is 20. - repeated ConditionBoostSpec condition_boost_specs = 1; - - // Whether to skip boostspec validation. If this field is set to true, - // invalid - // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // will be ignored and valid - // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // will still be applied. - optional bool skip_boost_spec_validation = 2; - } - - // Specification to determine under which conditions query expansion should - // occur. - message QueryExpansionSpec { - // Enum describing under which condition query expansion should occur. - enum Condition { - // Unspecified query expansion condition. In this case, server behavior - // defaults to - // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. - CONDITION_UNSPECIFIED = 0; - - // Disabled query expansion. Only the exact search query is used, even if - // [SearchResponse.total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] - // is zero. - DISABLED = 1; - - // Automatic query expansion built by Google Retail Search. - AUTO = 3; - } - - // The condition under which query expansion should occur. Default to - // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. - Condition condition = 1; - - // Whether to pin unexpanded results. If this field is set to true, - // unexpanded products are always at the top of the search results, followed - // by the expanded results. - bool pin_unexpanded_results = 2; - } - - // The specification for personalization. - message PersonalizationSpec { - // The personalization mode of each search request. - enum Mode { - // Default value. In this case, server behavior defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - MODE_UNSPECIFIED = 0; - - // Let CRS decide whether to use personalization based on quality of user - // event data. - AUTO = 1; - - // Disable personalization. - DISABLED = 2; - } - - // Defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - Mode mode = 1; - } - - // The specification for query spell correction. - message SpellCorrectionSpec { - // Enum describing under which mode spell correction should occur. - enum Mode { - // Unspecified spell correction mode. In this case, server behavior - // defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. - MODE_UNSPECIFIED = 0; - - // Google Retail Search will try to find a spell suggestion if there - // is any and put in the - // [SearchResponse.corrected_query][google.cloud.retail.v2alpha.SearchResponse.corrected_query]. - // The spell suggestion will not be used as the search query. - SUGGESTION_ONLY = 1; - - // Automatic spell correction built by Google Retail Search. Search will - // be based on the corrected query if found. - AUTO = 2; - } - - // The mode under which spell correction should take effect to - // replace the original search query. Default to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. - Mode mode = 1; - } - - // This field specifies all conversational related parameters addition to - // traditional retail search. - message ConversationalSearchSpec { - // This field specifies the current user answer during the conversational - // search. This can be either user selected from suggested answers or user - // input plain text. - message UserAnswer { - // This field specifies the selected answers during the conversational - // search. - message SelectedAnswer { - // This field is deprecated and should not be set. - repeated ProductAttributeValue product_attribute_values = 1 - [deprecated = true]; - - // This field specifies the selected answer which is a attribute - // key-value. - ProductAttributeValue product_attribute_value = 2; - } - - // This field specifies the type of user answer. - oneof type { - // This field specifies the incremental input text from the user during - // the conversational search. - string text_answer = 1; - - // This field specifies the selected attributes during the - // conversational search. This should be a subset of - // [ConversationalSearchResult.suggested_answers][]. - SelectedAnswer selected_answer = 2; - } - } - - // This field specifies whether the customer would like to do conversational - // search. If this field is set to true, conversational related extra - // information will be returned from server side, including follow-up - // question, answer options, etc. - bool followup_conversation_requested = 1; - - // This field specifies the conversation id, which maintains the state of - // the conversation between client side and server side. Use the value from - // the previous [ConversationalSearchResult.conversation_id][]. For the - // initial request, this should be empty. - string conversation_id = 2; - - // This field specifies the current user answer during the conversational - // search. This can be either user selected from suggested answers or user - // input plain text. - UserAnswer user_answer = 3; - } - - // This field specifies tile navigation related parameters. - message TileNavigationSpec { - // This field specifies whether the customer would like to request tile - // navigation. - bool tile_navigation_requested = 1; - - // This optional field specifies the tiles which are already clicked in - // client side. While the feature works without this field set, particularly - // for an initial query, it is highly recommended to set this field because - // it can improve the quality of the search response and removes possible - // duplicate tiles. - // - // NOTE: This field is not being used for filtering search - // products. Client side should also put all the applied tiles in - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - repeated Tile applied_tiles = 2; - } - - // The relevance threshold of the search results. The higher relevance - // threshold is, the higher relevant results are shown and the less number of - // results are returned. - enum RelevanceThreshold { - // Default value. In this case, server behavior defaults to - // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH]. - RELEVANCE_THRESHOLD_UNSPECIFIED = 0; - - // High relevance threshold. - HIGH = 1; - - // Medium relevance threshold. - MEDIUM = 2; - - // Low relevance threshold. - LOW = 3; - - // Lowest relevance threshold. - LOWEST = 4; - } - - // The search mode of each search request. - enum SearchMode { - // Default value. In this case both product search and faceted search will - // be performed. Both - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // and - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will be returned. - SEARCH_MODE_UNSPECIFIED = 0; - - // Only product search will be performed. The faceted search will be - // disabled. - // - // Only - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // will be returned. - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will not be returned, even if - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // or - // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] - // is set. - PRODUCT_SEARCH_ONLY = 1; - - // Only faceted search will be performed. The product search will be - // disabled. - // - // When in this mode, one or both of - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // and - // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] - // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will be returned. - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // will not be returned. - FACETED_SEARCH_ONLY = 2; - } - - // Required. The resource name of the Retail Search serving config, such as - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - // or the name of the legacy placement resource, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - // This field is used to identify the serving config name and the set - // of models that are used to make the search. - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // The branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. - // - // Use "default_branch" as the branch ID or leave this field empty, to search - // products under the default branch. - string branch = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Raw search query. - // - // If this field is empty, the request is considered a category browsing - // request and returned results are based on - // [filter][google.cloud.retail.v2alpha.SearchRequest.filter] and - // [page_categories][google.cloud.retail.v2alpha.SearchRequest.page_categories]. - string query = 3; - - // Required. A unique identifier for tracking visitors. For example, this - // could be implemented with an HTTP cookie, which should be able to uniquely - // identify a visitor on a single device. This unique identifier should not - // change if the visitor logs in or out of the website. - // - // This should be the same identifier as - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 4 [(google.api.field_behavior) = REQUIRED]; - - // User information. - UserInfo user_info = 5; - - // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to - // return. If unspecified, defaults to a reasonable value. The maximum allowed - // value is 120. Values above 120 will be coerced to 120. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 page_size = 7; - - // A page token - // [SearchResponse.next_page_token][google.cloud.retail.v2alpha.SearchResponse.next_page_token], - // received from a previous - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 8; - - // A 0-indexed integer that specifies the current offset (that is, starting - // result location, amongst the - // [Product][google.cloud.retail.v2alpha.Product]s deemed by the API as - // relevant) in search results. This field is only considered if - // [page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] is - // unset. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 offset = 9; - - // The filter syntax consists of an expression language for constructing a - // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. For more information, see - // [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - // - // If this field is unrecognizable, an INVALID_ARGUMENT is returned. - string filter = 10; - - // The default filter that is applied when a user performs a search without - // checking any filters on the search page. - // - // The filter applied to every search request when quality improvement such as - // query expansion is needed. In the case a query does not have a sufficient - // amount of results this filter will be used to determine whether or not to - // enable the query expansion flow. The original filter will still be used for - // the query expanded search. - // This field is strongly recommended to achieve high search quality. - // - // For more information about filter syntax, see - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - string canonical_filter = 28; - - // The order in which products are returned. Products can be ordered by - // a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. For - // more information, see - // [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - // - // If this field is unrecognizable, an INVALID_ARGUMENT is returned. - string order_by = 11; - - // Facet specifications for faceted search. If empty, no facets are returned. - // - // A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - repeated FacetSpec facet_specs = 12; - - // Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - // to enable dynamic facets. Do not set this field. - // - // The specification for dynamically generated facets. Notice that only - // textual facets can be dynamically generated. - DynamicFacetSpec dynamic_facet_spec = 21 [deprecated = true]; - - // Boost specification to boost certain products. For more information, see - // [Boost results](https://cloud.google.com/retail/docs/boosting). - // - // Notice that if both - // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // are set, the boost conditions from both places are evaluated. If a search - // request matches multiple boost conditions, the final boost score is equal - // to the sum of the boost scores from all matched boost conditions. - BoostSpec boost_spec = 13; - - // The query expansion specification that specifies the conditions under which - // query expansion occurs. For more information, see [Query - // expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - QueryExpansionSpec query_expansion_spec = 14; - - // The relevance threshold of the search results. - // - // Defaults to - // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], - // which means only the most relevant results are shown, and the least number - // of results are returned. For more information, see [Adjust result - // size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - RelevanceThreshold relevance_threshold = 15; - - // The keys to fetch and rollup the matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s attributes, - // [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo] or - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s attributes. - // The attributes from all the matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s or - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s are merged - // and de-duplicated. Notice that rollup attributes will lead to extra query - // latency. Maximum number of keys is 30. - // - // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a - // fulfillment type and a fulfillment ID must be provided in the format of - // "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - // "pickupInStore" is fulfillment type and "store123" is the store ID. - // - // Supported keys are: - // - // * colorFamilies - // * price - // * originalPrice - // * discount - // * variantId - // * inventory(place_id,price) - // * inventory(place_id,original_price) - // * inventory(place_id,attributes.key), where key is any key in the - // [Product.local_inventories.attributes][google.cloud.retail.v2alpha.LocalInventory.attributes] - // map. - // * attributes.key, where key is any key in the - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. - // * pickupInStore.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "pickup-in-store". - // * shipToStore.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "ship-to-store". - // * sameDayDelivery.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "same-day-delivery". - // * nextDayDelivery.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "next-day-delivery". - // * customFulfillment1.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-1". - // * customFulfillment2.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-2". - // * customFulfillment3.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-3". - // * customFulfillment4.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-4". - // * customFulfillment5.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-5". - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - repeated string variant_rollup_keys = 17; - - // The categories associated with a category page. Must be set for category - // navigation queries to achieve good search quality. The format should be - // the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - repeated string page_categories = 23; - - // The search mode of the search request. If not specified, a single search - // request triggers both product search and faceted search. - SearchMode search_mode = 31; - - // The specification for personalization. - // - // Notice that if both - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec] - // and - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // are set. - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // will override - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec]. - PersonalizationSpec personalization_spec = 32; - - // The labels applied to a resource must meet the following requirements: - // - // * Each resource can have multiple labels, up to a maximum of 64. - // * Each label must be a key-value pair. - // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters and cannot be empty. Values can be empty and have a maximum - // length of 63 characters. - // * Keys and values can contain only lowercase letters, numeric characters, - // underscores, and dashes. All characters must use UTF-8 encoding, and - // international characters are allowed. - // * The key portion of a label must be unique. However, you can use the same - // key with multiple resources. - // * Keys must start with a lowercase letter or international character. - // - // For more information, see [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - // in the Resource Manager documentation. - map labels = 34; - - // The spell correction specification that specifies the mode under - // which spell correction will take effect. - optional SpellCorrectionSpec spell_correction_spec = 35; - - // The entity for customers that may run multiple different entities, domains, - // sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // If this is set, it should be exactly matched with - // [UserEvent.entity][google.cloud.retail.v2alpha.UserEvent.entity] to get - // search results boosted by entity. - string entity = 38; - - // Optional. This field specifies all conversational related parameters - // addition to traditional retail search. - ConversationalSearchSpec conversational_search_spec = 40 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies tile navigation related parameters. - TileNavigationSpec tile_navigation_spec = 41 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - // [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - // information, see [Standardized codes](https://google.aip.dev/143). This - // field helps to better interpret the query. If a value isn't specified, the - // query language code is automatically detected, which may not be accurate. - string language_code = 43 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Unicode country/region code (CLDR) of a location, such as - // "US" and "419" - // [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - // For more information, see [Standardized codes](https://google.aip.dev/143). - // If set, then results will be boosted based on the region_code provided. - string region_code = 44 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An id corresponding to a place, such as a store id or region id. - // When specified, we use the price from the local inventory with the matching - // product's - // [LocalInventory.place_id][google.cloud.retail.v2alpha.LocalInventory.place_id] - // for revenue optimization. - string place_id = 46 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The user attributes that could be used for personalization of - // search results. - // * Populate at most 100 key-value pairs per query. - // * Only supports string keys and repeated string values. - // * Duplcate keys are not allowed within a single query. - // - // Example: - // user_attributes: [ - // { key: "pets" - // value { - // values: "dog" - // values: "cat" - // } - // }, - // { key: "state" - // value { - // values: "CA" - // } - // } - // ] - map user_attributes = 47 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] -// method. -message SearchResponse { - // Represents the search results. - message SearchResult { - // [Product.id][google.cloud.retail.v2alpha.Product.id] of the searched - // [Product][google.cloud.retail.v2alpha.Product]. - string id = 1; - - // The product data snippet in the search response. Only - // [Product.name][google.cloud.retail.v2alpha.Product.name] is guaranteed to - // be populated. - // - // [Product.variants][google.cloud.retail.v2alpha.Product.variants] contains - // the product variants that match the search query. If there are multiple - // product variants matching the query, top 5 most relevant product variants - // are returned and ordered by relevancy. - // - // If relevancy can be deternmined, use - // [matching_variant_fields][google.cloud.retail.v2alpha.SearchResponse.SearchResult.matching_variant_fields] - // to look up matched product variants fields. If relevancy cannot be - // determined, e.g. when searching "shoe" all products in a shoe product can - // be a match, 5 product variants are returned but order is meaningless. - Product product = 2; - - // The count of matched - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. - int32 matching_variant_count = 3; - - // If a [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] matches the search query, - // this map indicates which [Product][google.cloud.retail.v2alpha.Product] - // fields are matched. The key is the - // [Product.name][google.cloud.retail.v2alpha.Product.name], the value is a - // field mask of the matched [Product][google.cloud.retail.v2alpha.Product] - // fields. If matched attributes cannot be determined, this map will be - // empty. - // - // For example, a key "sku1" with field mask - // "products.color_info" indicates there is a match between - // "sku1" [ColorInfo][google.cloud.retail.v2alpha.ColorInfo] and the query. - map matching_variant_fields = 4; - - // The rollup matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] attributes. The key is one - // of the - // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2alpha.SearchRequest.variant_rollup_keys]. - // The values are the merged and de-duplicated - // [Product][google.cloud.retail.v2alpha.Product] attributes. Notice that - // the rollup values are respect filter. For example, when filtering by - // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is - // returned. - // - // For textual and numerical attributes, the rollup values is a list of - // string or double values with type - // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if - // there are two variants with colors "red" and "blue", the rollup values - // are - // - // { key: "colorFamilies" - // value { - // list_value { - // values { string_value: "red" } - // values { string_value: "blue" } - // } - // } - // } - // - // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], the - // rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example, - // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there - // are 10 variants in this product are available in the store "store1". - map variant_rollup_values = 5; - - // Specifies previous events related to this product for this user based on - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] with same - // [SearchRequest.visitor_id][google.cloud.retail.v2alpha.SearchRequest.visitor_id] - // or [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id]. - // - // This is set only when - // [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.mode] - // is - // [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - // - // Possible values: - // - // * `purchased`: Indicates that this product has been purchased before. - repeated string personal_labels = 7; - - // Google provided available scores. - map model_scores = 8; - } - - // A facet result. - message Facet { - // A facet value which contains value names and their count. - message FacetValue { - // A facet value which contains values. - oneof facet_value { - // Text value of a facet, such as "Black" for facet "colorFamilies". - string value = 1; - - // Interval value for a facet, such as [10, 20) for facet "price". - Interval interval = 2; - } - - // Number of items that have this facet value. - int64 count = 3; - - // The minimum value in the - // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. - // Only supported on numerical facets and returned if - // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] - // is true. - double min_value = 5; - - // The maximum value in the - // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. - // Only supported on numerical facets and returned if - // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] - // is true. - double max_value = 6; - } - - // The key for this facet. E.g., "colorFamilies" or "price" or - // "attributes.attr1". - string key = 1; - - // The facet values for this field. - repeated FacetValue values = 2; - - // Whether the facet is dynamically generated. - bool dynamic_facet = 3; - } - - // Information describing query expansion including whether expansion has - // occurred. - message QueryExpansionInfo { - // Bool describing whether query expansion has occurred. - bool expanded_query = 1; - - // Number of pinned results. This field will only be set when expansion - // happens and - // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.pin_unexpanded_results] - // is set to true. - int64 pinned_result_count = 2; - } - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational retail search. - message ConversationalSearchResult { - // Suggested answers to the follow-up question. - message SuggestedAnswer { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // Additional filter that client side need to apply. - message AdditionalFilter { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // Conversation UUID. This field will be stored in client side storage to - // maintain the conversation session with server and will be used for next - // search request's - // [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec.conversation_id] - // to restore conversation state in server. - string conversation_id = 1; - - // The current refined query for the conversational search. This field - // will be used in customer UI that the query in the search bar should be - // replaced with the refined query. For example, if - // [SearchRequest.query][google.cloud.retail.v2alpha.SearchRequest.query] is - // `dress` and next - // [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer] - // is `red color`, which does not match any product attribute value filters, - // the refined query will be `dress, red color`. - string refined_query = 2; - - // This field is deprecated but will be kept for backward compatibility. - // There is expected to have only one additional filter and the value will - // be the same to the same as field `additional_filter`. - repeated AdditionalFilter additional_filters = 3 [deprecated = true]; - - // The follow-up question. e.g., `What is the color?` - string followup_question = 4; - - // The answer options provided to client for the follow-up question. - repeated SuggestedAnswer suggested_answers = 5; - - // This is the incremental additional filters implied from the current - // user answer. User should add the suggested addition filters to the - // previous - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // and use the merged filter in the follow up search request. - AdditionalFilter additional_filter = 6; - } - - // This field specifies all related information for tile navigation that will - // be used in client side. - message TileNavigationResult { - // The current tiles that are used for tile navigation, sorted by - // engagement. - repeated Tile tiles = 1; - } - - // A list of matched items. The order represents the ranking. - repeated SearchResult results = 1; - - // Results of facets requested by user. - repeated Facet facets = 2; - - // The estimated total count of matched items irrespective of pagination. The - // count of [results][google.cloud.retail.v2alpha.SearchResponse.results] - // returned by pagination may be less than the - // [total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] that - // matches. - int32 total_size = 3; - - // Contains the spell corrected query, if found. If the spell correction type - // is AUTOMATIC, then the search results are based on corrected_query. - // Otherwise the original query is used for search. - string corrected_query = 4; - - // A unique search token. This should be included in the - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] logs resulting from this - // search, which enables accurate attribution of search model performance. - string attribution_token = 5; - - // A token that can be sent as - // [SearchRequest.page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 6; - - // Query expansion information for the returned results. - QueryExpansionInfo query_expansion_info = 7; - - // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search is performed, and only - // [redirect_uri][google.cloud.retail.v2alpha.SearchResponse.redirect_uri] and - // [attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] - // are set in the response. - string redirect_uri = 10; - - // The fully qualified resource name of applied - // [controls](https://cloud.google.com/retail/docs/serving-control-rules). - repeated string applied_controls = 12; - - // Metadata for pin controls which were applicable to the request. - // This contains two map fields, one for all matched pins and one for pins - // which were matched but not applied. - // - // The two maps are keyed by pin position, and the values are the product ids - // which were matched to that pin. - PinControlMetadata pin_control_metadata = 22; - - // The invalid - // [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // that are not applied during serving. - repeated SearchRequest.BoostSpec.ConditionBoostSpec - invalid_condition_boost_specs = 14; - - // Metadata related to A/B testing experiment associated with this - // response. Only exists when an experiment is triggered. - repeated ExperimentInfo experiment_info = 17; - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational retail search. - ConversationalSearchResult conversational_search_result = 18; - - // This field specifies all related information for tile navigation that will - // be used in client side. - TileNavigationResult tile_navigation_result = 19; -} - -// Metadata for active A/B testing experiment. -message ExperimentInfo { - // Metadata for active serving config A/B tests. - message ServingConfigExperiment { - // The fully qualified resource name of the original - // [SearchRequest.placement][google.cloud.retail.v2alpha.SearchRequest.placement] - // in the search request prior to reassignment by experiment API. For - // example: `projects/*/locations/*/catalogs/*/servingConfigs/*`. - string original_serving_config = 1 [(google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - }]; - - // The fully qualified resource name of the serving config - // `Experiment.VariantArm.serving_config_id` responsible for generating - // the search response. For example: - // `projects/*/locations/*/catalogs/*/servingConfigs/*`. - string experiment_serving_config = 2 [(google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - }]; - } - - // Information associated with the specific experiment entity being recorded. - oneof experiment_metadata { - // A/B test between existing Cloud Retail Search - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s. - ServingConfigExperiment serving_config_experiment = 2; - } - - // The fully qualified resource name of the experiment that provides the - // serving config under test, should an active experiment exist. For example: - // `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id` - string experiment = 1 [(google.api.resource_reference) = { - type: "retail.googleapis.com/Experiment" - }]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline deleted file mode 100644 index b7fc8c04cf45..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ServingConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures metadata that is used to generate serving time results (e.g. -// search results or recommendation predictions). -message ServingConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/ServingConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" - }; - - // What type of diversity - data or rule based. - enum DiversityType { - // Default value. - DIVERSITY_TYPE_UNSPECIFIED = 0; - - // Rule based diversity. - RULE_BASED_DIVERSITY = 2; - - // Data driven diversity. - DATA_DRIVEN_DIVERSITY = 3; - } - - // Immutable. Fully qualified name - // `projects/*/locations/global/catalogs/*/servingConfig/*` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. The human readable serving config display name. Used in Retail - // UI. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The id of the model in the same - // [Catalog][google.cloud.retail.v2alpha.Catalog] to use at serving time. - // Currently only RecommendationModels are supported: - // https://cloud.google.com/retail/recommendations-ai/docs/create-models - // Can be changed but only to a compatible model (e.g. - // others-you-may-like CTR to others-you-may-like CVR). - // - // Required when - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string model_id = 3; - - // How much price ranking we want in serving results. - // Price reranking causes product items with a similar - // recommendation probability to be ordered by price, with the - // highest-priced items first. This setting could result in a decrease in - // click-through and conversion rates. - // Allowed values are: - // - // * `no-price-reranking` - // * `low-price-reranking` - // * `medium-price-reranking` - // * `high-price-reranking` - // - // If not specified, we choose default based on model type. Default value: - // `no-price-reranking`. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string price_reranking_level = 4; - - // Facet specifications for faceted search. If empty, no facets are returned. - // The ids refer to the ids of [Control][google.cloud.retail.v2alpha.Control] - // resources with only the Facet control set. These controls are assumed to be - // in the same [Catalog][google.cloud.retail.v2alpha.Catalog] as the - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]. - // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string facet_control_ids = 5; - - // The specification for dynamically generated facets. Notice that only - // textual facets can be dynamically generated. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; - - // Condition boost specifications. If a product matches multiple conditions - // in the specifications, boost scores from these specifications are all - // applied and combined in a non-linear way. Maximum number of - // specifications is 100. - // - // Notice that if both - // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // are set, the boost conditions from both places are evaluated. If a search - // request matches multiple boost conditions, the final boost score is equal - // to the sum of the boost scores from all matched boost conditions. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string boost_control_ids = 7; - - // Condition filter specifications. If a product matches multiple conditions - // in the specifications, filters from these specifications are all - // applied and combined via the AND operator. Maximum number of - // specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string filter_control_ids = 9; - - // Condition redirect specifications. Only the first triggered redirect action - // is applied, even if multiple apply. Maximum number of specifications is - // 1000. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string redirect_control_ids = 10; - - // Condition synonyms specifications. If multiple syonyms conditions match, - // all matching synonyms control in the list will execute. Order of controls - // in the list will not matter. Maximum number of specifications is - // 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string twoway_synonyms_control_ids = 18; - - // Condition oneway synonyms specifications. If multiple oneway synonyms - // conditions match, all matching oneway synonyms controls in the list will - // execute. Order of controls in the list will not matter. Maximum number of - // specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string oneway_synonyms_control_ids = 12; - - // Condition do not associate specifications. If multiple do not associate - // conditions match, all matching do not associate controls in the list will - // execute. - // - Order does not matter. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string do_not_associate_control_ids = 13; - - // Condition replacement specifications. - // - Applied according to the order in the list. - // - A previously replaced term can not be re-replaced. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string replacement_control_ids = 14; - - // Condition ignore specifications. If multiple ignore - // conditions match, all matching ignore controls in the list will - // execute. - // - Order does not matter. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string ignore_control_ids = 15; - - // How much diversity to use in recommendation model results e.g. - // `medium-diversity` or `high-diversity`. Currently supported values: - // - // * `no-diversity` - // * `low-diversity` - // * `medium-diversity` - // * `high-diversity` - // * `auto-diversity` - // - // If not specified, we choose default based on recommendation model - // type. Default value: `no-diversity`. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string diversity_level = 8; - - // What kind of diversity to use - data driven or rule based. If unset, the - // server behavior defaults to - // [RULE_BASED_DIVERSITY][google.cloud.retail.v2alpha.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]. - DiversityType diversity_type = 20; - - // Whether to add additional category filters on the `similar-items` model. - // If not specified, we enable it by default. - // Allowed values are: - // - // * `no-category-match`: No additional filtering of original results from - // the model and the customer's filters. - // * `relaxed-category-match`: Only keep results with categories that match - // at least one item categories in the PredictRequests's context item. - // * If customer also sends filters in the PredictRequest, then the results - // will satisfy both conditions (user given and category match). - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string enable_category_filter_level = 16; - - // When the flag is enabled, the products in the denylist will not be filtered - // out in the recommendation filtering results. - bool ignore_recs_denylist = 24; - - // The specification for personalization spec. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - // - // Notice that if both - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec] - // and - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // are set. - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // will override - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec]. - SearchRequest.PersonalizationSpec personalization_spec = 21; - - // Required. Immutable. Specifies the solution types that a serving config can - // be associated with. Currently we support setting only one type of solution. - repeated SolutionType solution_types = 19 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline deleted file mode 100644 index 0f05a20c4f6a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/serving_config.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ServingConfigServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for modifying ServingConfig. -service ServingConfigService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a ServingConfig. - // - // A maximum of 100 - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in - // a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a - // FAILED_PRECONDITION error is returned. - rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" - body: "serving_config" - }; - option (google.api.method_signature) = - "parent,serving_config,serving_config_id"; - } - - // Deletes a ServingConfig. - // - // Returns a NotFound error if the ServingConfig does not exist. - rpc DeleteServingConfig(DeleteServingConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a ServingConfig. - rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - patch: "/v2alpha/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - body: "serving_config" - }; - option (google.api.method_signature) = "serving_config,update_mask"; - } - - // Gets a ServingConfig. - // - // Returns a NotFound error if the ServingConfig does not exist. - rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all ServingConfigs linked to this catalog. - rpc ListServingConfigs(ListServingConfigsRequest) - returns (ListServingConfigsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Enables a Control on the specified ServingConfig. - // The control is added in the last position of the list of controls - // it belongs to (e.g. if it's a facet spec control it will be applied - // in the last position of servingConfig.facetSpecIds) - // Returns a ALREADY_EXISTS error if the control has already been applied. - // Returns a FAILED_PRECONDITION error if the addition could exceed maximum - // number of control allowed for that type of control. - rpc AddControl(AddControlRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" - body: "*" - }; - option (google.api.method_signature) = "serving_config"; - } - - // Disables a Control on the specified ServingConfig. - // The control is removed from the ServingConfig. - // Returns a NOT_FOUND error if the Control is not enabled for the - // ServingConfig. - rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" - body: "*" - }; - option (google.api.method_signature) = "serving_config"; - } -} - -// Request for CreateServingConfig method. -message CreateServingConfigRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The ServingConfig to create. - ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the ServingConfig, which will become the final - // component of the ServingConfig's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-_/. - string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for UpdateServingConfig method. -message UpdateServingConfigRequest { - // Required. The ServingConfig to update. - ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to update. The - // following are NOT supported: - // - // * [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for DeleteServingConfig method. -message DeleteServingConfigRequest { - // Required. The resource name of the ServingConfig to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; -} - -// Request for GetServingConfig method. -message GetServingConfigRequest { - // Required. The resource name of the ServingConfig to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; -} - -// Request for ListServingConfigs method. -message ListServingConfigsRequest { - // Required. The catalog resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 100. If a value greater than 100 is provided, at most 100 results are - // returned. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListServingConfigs` call. - // Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for ListServingConfigs method. -message ListServingConfigsResponse { - // All the ServingConfigs for a given catalog. - repeated ServingConfig serving_configs = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} - -// Request for AddControl method. -message AddControlRequest { - // Required. The source ServingConfig resource name . Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string serving_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; - - // Required. The id of the control to apply. Assumed to be in the same catalog - // as the serving config - if id is not found a NOT_FOUND error is returned. - string control_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for RemoveControl method. -message RemoveControlRequest { - // Required. The source ServingConfig resource name . Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string serving_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; - - // Required. The id of the control to apply. Assumed to be in the same catalog - // as the serving config. - string control_id = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event.proto.baseline deleted file mode 100644 index 28dfc353d2d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event.proto.baseline +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "UserEventProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// UserEvent captures all metadata information Retail API needs to know about -// how end users interact with customers' website. -message UserEvent { - // Required. User event type. Allowed values are: - // - // * `add-to-cart`: Products being added to cart. - // * `remove-from-cart`: Products being removed from cart. - // * `category-page-view`: Special pages such as sale or promotion pages - // viewed. - // * `detail-page-view`: Products detail page viewed. - // * `home-page-view`: Homepage viewed. - // * `purchase-complete`: User finishing a purchase. - // * `search`: Product search. - // * `shopping-cart-page-view`: User viewing a shopping cart. - string event_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A unique identifier for tracking visitors. - // - // For example, this could be implemented with an HTTP cookie, which should be - // able to uniquely identify a visitor on a single device. This unique - // identifier should not change if the visitor log in/out of the website. - // - // Don't set the field to the same fixed ID for different users. This mixes - // the event history of those users together, which results in degraded model - // quality. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // The field should not contain PII or user-data. We recommend to use Google - // Analytics [Client - // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) - // for this field. - string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // A unique identifier for tracking a visitor session with a length limit of - // 128 bytes. A session is an aggregation of an end user behavior in a time - // span. - // - // A general guideline to populate the sesion_id: - // 1. If user has no activity for 30 min, a new session_id should be assigned. - // 2. The session_id should be unique across users, suggest use uuid or add - // visitor_id as prefix. - string session_id = 21; - - // Only required for - // [UserEventService.ImportUserEvents][google.cloud.retail.v2alpha.UserEventService.ImportUserEvents] - // method. Timestamp of when the user event happened. - google.protobuf.Timestamp event_time = 3; - - // A list of identifiers for the independent experiment groups this user event - // belongs to. This is used to distinguish between user events associated with - // different experiment setups (e.g. using Retail API, using different - // recommendation models). - repeated string experiment_ids = 4; - - // Highly recommended for user events that are the result of - // [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]. - // This field enables accurate attribution of recommendation model - // performance. - // - // The value must be a valid - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // for user events that are the result of - // [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]. - // The value must be a valid - // [SearchResponse.attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] - // for user events that are the result of - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This token enables us to accurately attribute page view or purchase back to - // the event and the particular predict response containing this - // clicked/purchased product. If user clicks on product K in the - // recommendation results, pass - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // as a URL parameter to product K's page. When recording events on product - // K's page, log the - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // to this field. - string attribution_token = 5; - - // The main product details related to the event. - // - // This field is optional except for the following event types: - // - // * `add-to-cart` - // * `detail-page-view` - // * `purchase-complete` - // - // In a `search` event, this field represents the products returned to the end - // user on the current page (the end user may have not finished browsing the - // whole page yet). When a new page is returned to the end user, after - // pagination/filtering/ordering even for the same query, a new `search` event - // with different - // [product_details][google.cloud.retail.v2alpha.UserEvent.product_details] is - // desired. The end user may have not finished browsing the whole page yet. - repeated ProductDetail product_details = 6; - - // The main auto-completion details related to the event. - // - // This field should be set for `search` event when autocomplete function is - // enabled and the user clicks a suggestion for search. - CompletionDetail completion_detail = 22; - - // Extra user event features to include in the recommendation model. - // - // If you provide custom attributes for ingested user events, also include - // them in the user events that you associate with prediction requests. Custom - // attribute formatting must be consistent between imported events and events - // provided with prediction requests. This lets the Retail API use - // those custom attributes when training models and serving predictions, which - // helps improve recommendation quality. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * The key must be a UTF-8 encoded string with a length limit of 5,000 - // characters. - // * For text attributes, at most 400 values are allowed. Empty values are not - // allowed. Each value must be a UTF-8 encoded string with a length limit of - // 256 characters. - // * For number attributes, at most 400 values are allowed. - // - // For product recommendations, an example of extra user information is - // traffic_channel, which is how a user arrives at the site. Users can arrive - // at the site by coming to the site directly, coming through Google - // search, or in other ways. - map attributes = 7; - - // The ID or name of the associated shopping cart. This ID is used - // to associate multiple items added or present in the cart before purchase. - // - // This can only be set for `add-to-cart`, `purchase-complete`, or - // `shopping-cart-page-view` events. - string cart_id = 8; - - // A transaction represents the entire purchase transaction. - // - // Required for `purchase-complete` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - PurchaseTransaction purchase_transaction = 9; - - // The user's search query. - // - // See [SearchRequest.query][google.cloud.retail.v2alpha.SearchRequest.query] - // for definition. - // - // The value must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // At least one of - // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or - // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is - // required for `search` events. Other event types should not set this field. - // Otherwise, an INVALID_ARGUMENT error is returned. - string search_query = 10; - - // The filter syntax consists of an expression language for constructing a - // predicate from one or more fields of the products being filtered. - // - // See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for definition and syntax. - // - // The value must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string filter = 16; - - // The order in which products are returned. - // - // See - // [SearchRequest.order_by][google.cloud.retail.v2alpha.SearchRequest.order_by] - // for definition and syntax. - // - // The value must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This can only be set for `search` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - string order_by = 17; - - // An integer that specifies the current offset for pagination (the 0-indexed - // starting location, amongst the products deemed by the API as relevant). - // - // See - // [SearchRequest.offset][google.cloud.retail.v2alpha.SearchRequest.offset] - // for definition. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - // - // This can only be set for `search` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - int32 offset = 18; - - // The categories associated with a category page. - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - // - // Required for `category-page-view` events. At least one of - // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or - // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is - // required for `search` events. Other event types should not set this field. - // Otherwise, an INVALID_ARGUMENT error is returned. - repeated string page_categories = 11; - - // User information. - UserInfo user_info = 12; - - // Complete URL (window.location.href) of the user's current page. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. Maximum length 5,000 - // characters. - string uri = 13; - - // The referrer URL of the current page. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. - string referrer_uri = 14; - - // A unique ID of a web page view. - // - // This should be kept the same for all user events triggered from the same - // pageview. For example, an item detail page view could trigger multiple - // events as the user is browsing the page. The `pageViewId` property should - // be kept the same for all these events so that they can be grouped together - // properly. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. - string page_view_id = 15; - - // The entity for customers that may run multiple different entities, domains, - // sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // We recommend that you set this field to get better per-entity search, - // completion, and prediction results. - string entity = 23; -} - -// Detailed product information associated with a user event. -message ProductDetail { - // Required. [Product][google.cloud.retail.v2alpha.Product] information. - // - // Required field(s): - // - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // - // Optional override field(s): - // - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // - // If any supported optional fields are provided, we will treat them as a full - // override when looking up product information from the catalog. Thus, it is - // important to ensure that the overriding fields are accurate and - // complete. - // - // All other product fields are ignored and instead populated via catalog - // lookup after event ingestion. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // Quantity of the product associated with the user event. - // - // For example, this field will be 2 if two products are added to the shopping - // cart for `purchase-complete` event. Required for `add-to-cart` and - // `purchase-complete` event types. - google.protobuf.Int32Value quantity = 2; -} - -// Detailed completion information including completion attribution token and -// clicked completion info. -message CompletionDetail { - // Completion attribution token in - // [CompleteQueryResponse.attribution_token][google.cloud.retail.v2alpha.CompleteQueryResponse.attribution_token]. - string completion_attribution_token = 1; - - // End user selected - // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion]. - string selected_suggestion = 2; - - // End user selected - // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion] - // position, starting from 0. - int32 selected_position = 3; -} - -// A transaction represents the entire purchase transaction. -message PurchaseTransaction { - // The transaction ID with a length limit of 128 characters. - string id = 1; - - // Required. Total non-zero revenue or grand total associated with the - // transaction. This value include shipping, tax, or other adjustments to - // total revenue that you want to include as part of your revenue - // calculations. - float revenue = 2 [(google.api.field_behavior) = REQUIRED]; - - // All the taxes associated with the transaction. - float tax = 3; - - // All the costs associated with the products. These can be manufacturing - // costs, shipping expenses not borne by the end user, or any other costs, - // such that: - // - // * Profit = - // [revenue][google.cloud.retail.v2alpha.PurchaseTransaction.revenue] - - // [tax][google.cloud.retail.v2alpha.PurchaseTransaction.tax] - - // [cost][google.cloud.retail.v2alpha.PurchaseTransaction.cost] - float cost = 4; - - // Required. Currency code. Use three-character ISO-4217 code. - string currency_code = 5 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline deleted file mode 100644 index fafb91c96f7d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/purge_config.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "UserEventServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for ingesting end user actions on the customer website. -service UserEventService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Writes a single user event. - rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write" - body: "user_event" - }; - } - - // Writes a single user event from the browser. - // - // For larger user event payload over 16 KB, the POST method should be used - // instead, otherwise a 400 Bad Request error is returned. - // - // This method is used only by the Retail API JavaScript pixel and Google Tag - // Manager. Users should not call this method directly. - rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - additional_bindings { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - body: "*" - } - }; - } - - // Deletes permanently all user events specified by the filter provided. - // Depending on the number of events specified by the filter, this operation - // could take hours or days to complete. To test a filter, use the list - // command first. - rpc PurgeUserEvents(PurgeUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.PurgeUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.PurgeMetadata" - }; - } - - // Bulk import of User events. Request processing might be - // synchronous. Events that already exist are skipped. - // Use this method for backfilling historical user events. - // - // `Operation.response` is of type `ImportResponse`. Note that it is - // possible for a subset of the items to be successfully inserted. - // `Operation.metadata` is of type `ImportMetadata`. - rpc ImportUserEvents(ImportUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } - - // Exports user events. - // - // `Operation.response` is of type `ExportResponse`. - // `Operation.metadata` is of type `ExportMetadata`. - rpc ExportUserEvents(ExportUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:export" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } - - // Starts a user-event rejoin operation with latest product catalog. Events - // are not annotated with detailed product information for products that are - // missing from the catalog when the user event is ingested. These - // events are stored as unjoined events with limited usage on training and - // serving. You can use this method to start a join operation on specified - // events with the latest version of product catalog. You can also use this - // method to correct events joined with the wrong product catalog. A rejoin - // operation can take hours or days to complete. - rpc RejoinUserEvents(RejoinUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "RejoinUserEventsResponse" - metadata_type: "RejoinUserEventsMetadata" - }; - } -} - -// Request message for WriteUserEvent method. -message WriteUserEventRequest { - // Required. The parent catalog resource name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. User event to write. - UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // If set to true, the user event will be written asynchronously after - // validation, and the API will respond without waiting for the write. - // Therefore, silent failures can occur even if the API returns success. In - // case of silent failures, error messages can be found in Stackdriver logs. - bool write_async = 3; -} - -// Request message for CollectUserEvent method. -message CollectUserEventRequest { - // The rule that can convert the raw_json to a user event. It is needed - // only when the raw_json is set. - oneof conversion_rule { - // The prebuilt rule name that can convert a specific type of raw_json. - // For example: "ga4_bq" rule for the GA4 user event schema. - string prebuilt_rule = 6; - } - - // Required. The parent catalog name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URL encoded UserEvent proto with a length limit of 2,000,000 - // characters. - string user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // The URL including cgi-parameters but excluding the hash fragment with a - // length limit of 5,000 characters. This is often more useful than the - // referer URL, because many browsers only send the domain for 3rd party - // requests. - string uri = 3; - - // The event timestamp in milliseconds. This prevents browser caching of - // otherwise identical get requests. The name is abbreviated to reduce the - // payload bytes. - int64 ets = 4; - - // An arbitrary serialized JSON string that contains necessary information - // that can comprise a user event. When this field is specified, the - // user_event field will be ignored. Note: line-delimited JSON is not - // supported, a single JSON only. - string raw_json = 5; -} - -// Request message for RejoinUserEvents method. -message RejoinUserEventsRequest { - // The scope of user events to be rejoined with the latest product catalog. - // If the rejoining aims at reducing number of unjoined events, set - // `UserEventRejoinScope` to `UNJOINED_EVENTS`. - // If the rejoining aims at correcting product catalog information in joined - // events, set `UserEventRejoinScope` to `JOINED_EVENTS`. - // If all events needs to be rejoined, set `UserEventRejoinScope` to - // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`. - enum UserEventRejoinScope { - // Rejoin all events with the latest product catalog, including both joined - // events and unjoined events. - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0; - - // Only rejoin joined events with the latest product catalog. - JOINED_EVENTS = 1; - - // Only rejoin unjoined events with the latest product catalog. - UNJOINED_EVENTS = 2; - } - - // Required. The parent catalog resource name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // The type of the user event rejoin to define the scope and range of the user - // events to be rejoined with the latest product catalog. Defaults to - // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - // an invalid integer value. - UserEventRejoinScope user_event_rejoin_scope = 2; -} - -// Response message for `RejoinUserEvents` method. -message RejoinUserEventsResponse { - // Number of user events that were joined with latest product catalog. - int64 rejoined_user_events_count = 1; -} - -// Metadata for `RejoinUserEvents` method. -message RejoinUserEventsMetadata {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline deleted file mode 100644 index 9c43e02cf3d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog, outputConfig) { - // [START retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the parent catalog. - * Expected format: `projects/* /locations/* /catalogs/*` - */ - // const catalog = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned metrics. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned metrics. Use this expression to restrict results to a - * specific time range. - * Currently we expect only one types of fields: - * * `timestamp`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `timestamp` restriction should result in one, contiguous, valid, - * `timestamp` range. - * Some examples of valid filters expressions: - * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - * timestamp < "2012-04-23T18:30:43.511Z"` - * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {AnalyticsServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new AnalyticsServiceClient(); - - async function callExportAnalyticsMetrics() { - // Construct request - const request = { - catalog, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportAnalyticsMetrics(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAnalyticsMetrics(); - // [END retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.get_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.get_branch.js.baseline deleted file mode 100644 index efc057d2f673..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.get_branch.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_BranchService_GetBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the branch to retrieve. - * Format: - * `projects/* /locations/global/catalogs/default_catalog/branches/some_branch_id`. - * "default_branch" can be used as a special branch_id, it returns the - * default branch that has been set for the catalog. - */ - // const name = 'abc123' - /** - * The view to apply to the returned - * Branch google.cloud.retail.v2alpha.Branch. Defaults to - * Branch.BranchView.BASIC if unspecified. - * See documentation of fields of Branch google.cloud.retail.v2alpha.Branch - * to find what fields are excluded from BASIC view. - */ - // const view = {} - - // Imports the Retail library - const {BranchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new BranchServiceClient(); - - async function callGetBranch() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getBranch(request); - console.log(response); - } - - callGetBranch(); - // [END retail_v2alpha_generated_BranchService_GetBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.list_branches.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.list_branches.js.baseline deleted file mode 100644 index 69d4eeeae496..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/branch_service.list_branches.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_BranchService_ListBranches_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name. - */ - // const parent = 'abc123' - /** - * The view to apply to the returned - * Branch google.cloud.retail.v2alpha.Branch. Defaults to - * Branch.BranchView.BASIC if unspecified. - * See documentation of fields of Branch google.cloud.retail.v2alpha.Branch - * to find what fields are excluded from BASIC view. - */ - // const view = {} - - // Imports the Retail library - const {BranchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new BranchServiceClient(); - - async function callListBranches() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listBranches(request); - console.log(response); - } - - callListBranches(); - // [END retail_v2alpha_generated_BranchService_ListBranches_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline deleted file mode 100644 index f84ed8922ee8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, catalogAttribute) { - // [START retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to add. - */ - // const catalogAttribute = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callAddCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - catalogAttribute, - }; - - // Run request - const response = await retailClient.addCatalogAttribute(request); - console.log(response); - } - - callAddCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline deleted file mode 100644 index b40d6e40bc46..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, attributeKeys) { - // [START retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The attributes config resource shared by all catalog attributes - * being deleted. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The attribute name keys of the - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute s to - * delete. A maximum of 1000 catalog attributes can be deleted in a batch. - */ - // const attributeKeys = ['abc','def'] - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callBatchRemoveCatalogAttributes() { - // Construct request - const request = { - attributesConfig, - attributeKeys, - }; - - // Run request - const response = await retailClient.batchRemoveCatalogAttributes(request); - console.log(response); - } - - callBatchRemoveCatalogAttributes(); - // [END retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline deleted file mode 100644 index 44e49aa5ab8d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const name = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetAttributesConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getAttributesConfig(request); - console.log(response); - } - - callGetAttributesConfig(); - // [END retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline deleted file mode 100644 index 4dbf06f4c47f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full CompletionConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - */ - // const name = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetCompletionConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getCompletionConfig(request); - console.log(response); - } - - callGetCompletionConfig(); - // [END retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline deleted file mode 100644 index a3af35b3fff5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetDefaultBranch() { - // Construct request - const request = { - }; - - // Run request - const response = await retailClient.getDefaultBranch(request); - console.log(response); - } - - callGetDefaultBranch(); - // [END retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline deleted file mode 100644 index 103ce7c82f7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_CatalogService_ListCatalogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The account resource name with an associated location. - * If the caller does not have permission to list - * Catalog google.cloud.retail.v2alpha.Catalog s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - */ - // const parent = 'abc123' - /** - * Maximum number of Catalog google.cloud.retail.v2alpha.Catalog s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const pageSize = 1234 - /** - * A page token - * ListCatalogsResponse.next_page_token google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token, - * received from a previous - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callListCatalogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listCatalogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCatalogs(); - // [END retail_v2alpha_generated_CatalogService_ListCatalogs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline deleted file mode 100644 index 78eb55e217f5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, key) { - // [START retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The attribute name key of the - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to remove. - */ - // const key = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callRemoveCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - key, - }; - - // Run request - const response = await retailClient.removeCatalogAttribute(request); - console.log(response); - } - - callRemoveCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline deleted file mode 100644 index 64c61c6d9a3b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, catalogAttribute) { - // [START retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The updated - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute. - */ - // const catalogAttribute = {} - /** - * Indicates which fields in the provided - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to update. - * The following are NOT supported: - * * CatalogAttribute.key google.cloud.retail.v2alpha.CatalogAttribute.key - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callReplaceCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - catalogAttribute, - }; - - // Run request - const response = await retailClient.replaceCatalogAttribute(request); - console.log(response); - } - - callReplaceCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline deleted file mode 100644 index f70eff380adf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - /** - * The final component of the resource name of a branch. - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * If there are no sufficient active products in the targeted branch and - * force google.cloud.retail.v2alpha.SetDefaultBranchRequest.force is not - * set, a FAILED_PRECONDITION error is returned. - */ - // const branchId = 'abc123' - /** - * Some note on this request, this can be retrieved by - * CatalogService.GetDefaultBranch google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch - * before next valid default branch set occurs. - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const note = 'abc123' - /** - * If set to true, it permits switching to a branch with - * branch_id google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id - * even if it has no sufficient active products. - */ - // const force = true - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callSetDefaultBranch() { - // Construct request - const request = { - }; - - // Run request - const response = await retailClient.setDefaultBranch(request); - console.log(response); - } - - callSetDefaultBranch(); - // [END retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline deleted file mode 100644 index d7ca67efb154..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig) { - // [START retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The - * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. - */ - // const attributesConfig = {} - /** - * Indicates which fields in the provided - * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. - * The following is the only supported field: - * * AttributesConfig.catalog_attributes google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateAttributesConfig() { - // Construct request - const request = { - attributesConfig, - }; - - // Run request - const response = await retailClient.updateAttributesConfig(request); - console.log(response); - } - - callUpdateAttributesConfig(); - // [END retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline deleted file mode 100644 index 8c6d7ad64b0d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog) { - // [START retail_v2alpha_generated_CatalogService_UpdateCatalog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Catalog google.cloud.retail.v2alpha.Catalog to update. - * If the caller does not have permission to update the - * Catalog google.cloud.retail.v2alpha.Catalog, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Catalog google.cloud.retail.v2alpha.Catalog to update does not - * exist, a NOT_FOUND error is returned. - */ - // const catalog = {} - /** - * Indicates which fields in the provided - * Catalog google.cloud.retail.v2alpha.Catalog to update. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateCatalog() { - // Construct request - const request = { - catalog, - }; - - // Run request - const response = await retailClient.updateCatalog(request); - console.log(response); - } - - callUpdateCatalog(); - // [END retail_v2alpha_generated_CatalogService_UpdateCatalog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline deleted file mode 100644 index 00ae52266f29..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(completionConfig) { - // [START retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. - * If the caller does not have permission to update the - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig, then a - * PERMISSION_DENIED error is returned. - * If the CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to - * update does not exist, a NOT_FOUND error is returned. - */ - // const completionConfig = {} - /** - * Indicates which fields in the provided - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. - * The following are the only supported fields: - * * CompletionConfig.matching_order google.cloud.retail.v2alpha.CompletionConfig.matching_order - * * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions - * * CompletionConfig.min_prefix_length google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length - * * CompletionConfig.auto_learning google.cloud.retail.v2alpha.CompletionConfig.auto_learning - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateCompletionConfig() { - // Construct request - const request = { - completionConfig, - }; - - // Run request - const response = await retailClient.updateCompletionConfig(request); - console.log(response); - } - - callUpdateCompletionConfig(); - // [END retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.complete_query.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.complete_query.js.baseline deleted file mode 100644 index 6dab2573c618..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.complete_query.js.baseline +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog, query) { - // [START retail_v2alpha_generated_CompletionService_CompleteQuery_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Catalog for which the completion is performed. - * Full resource name of catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - /** - * Required. The query used to generate suggestions. - * The maximum number of allowed characters is 255. - */ - // const query = 'abc123' - /** - * Recommended field. A unique identifier for tracking visitors. For example, - * this could be implemented with an HTTP cookie, which should be able to - * uniquely identify a visitor on a single device. This unique identifier - * should not change if the visitor logs in or out of the website. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * Note that this field applies for `user-data` dataset only. For requests - * with `cloud-retail` dataset, setting this field has no effect. - * The language filters applied to the output suggestions. If set, it should - * contain the language of the query. If not set, suggestions are returned - * without considering language restrictions. This is the BCP-47 language - * code, such as "en-US" or "sr-Latn". For more information, see Tags for - * Identifying Languages (https://tools.ietf.org/html/bcp47). The maximum - * number of language codes is 3. - */ - // const languageCodes = ['abc','def'] - /** - * The device type context for completion suggestions. We recommend that you - * leave this field empty. - * It can apply different suggestions on different device types, e.g. - * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - * types. - * Supported formats: - * * `UNKNOWN_DEVICE_TYPE` - * * `DESKTOP` - * * `MOBILE` - * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - */ - // const deviceType = 'abc123' - /** - * Determines which dataset to use for fetching completion. "user-data" will - * use the dataset imported through - * CompletionService.ImportCompletionData google.cloud.retail.v2alpha.CompletionService.ImportCompletionData. - * `cloud-retail` will use the dataset generated by Cloud Retail based on user - * events. If left empty, completions will be fetched from the `user-data` - * dataset. - * Current supported values: - * * user-data - * * cloud-retail: - * This option requires enabling auto-learning function first. See - * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - */ - // const dataset = 'abc123' - /** - * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value - * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions. - * The maximum allowed max suggestions is 20. If it is set higher, it will be - * capped by 20. - */ - // const maxSuggestions = 1234 - /** - * If true, attribute suggestions are enabled and provided in the response. - * This field is only available for the `cloud-retail` dataset. - */ - // const enableAttributeSuggestions = true - /** - * The entity for customers who run multiple entities, domains, sites, or - * regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it must be an exact match with - * UserEvent.entity google.cloud.retail.v2alpha.UserEvent.entity to get - * per-entity autocomplete results. This field will be applied to - * `completion_results` only. It has no effect on the `attribute_results`. - * Also, this entity should be limited to 256 characters, if too long, it will - * be truncated to 256 characters in both generation and serving time, and may - * lead to mis-match. To ensure it works, please set the entity with string - * within 256 characters. - */ - // const entity = 'abc123' - - // Imports the Retail library - const {CompletionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CompletionServiceClient(); - - async function callCompleteQuery() { - // Construct request - const request = { - catalog, - query, - }; - - // Run request - const response = await retailClient.completeQuery(request); - console.log(response); - } - - callCompleteQuery(); - // [END retail_v2alpha_generated_CompletionService_CompleteQuery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline deleted file mode 100644 index 2cd57a86371f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_CompletionService_ImportCompletionData_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog which the suggestions dataset belongs to. - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - */ - // const notificationPubsubTopic = 'abc123' - - // Imports the Retail library - const {CompletionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CompletionServiceClient(); - - async function callImportCompletionData() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importCompletionData(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportCompletionData(); - // [END retail_v2alpha_generated_CompletionService_ImportCompletionData_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.create_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.create_control.js.baseline deleted file mode 100644 index 4b5581d8ab94..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.create_control.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, control, controlId) { - // [START retail_v2alpha_generated_ControlService_CreateControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent catalog. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The Control to create. - */ - // const control = {} - /** - * Required. The ID to use for the Control, which will become the final - * component of the Control's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-_/. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callCreateControl() { - // Construct request - const request = { - parent, - control, - controlId, - }; - - // Run request - const response = await retailClient.createControl(request); - console.log(response); - } - - callCreateControl(); - // [END retail_v2alpha_generated_ControlService_CreateControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.delete_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.delete_control.js.baseline deleted file mode 100644 index a750939e2d72..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.delete_control.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ControlService_DeleteControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Control to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callDeleteControl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteControl(request); - console.log(response); - } - - callDeleteControl(); - // [END retail_v2alpha_generated_ControlService_DeleteControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.get_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.get_control.js.baseline deleted file mode 100644 index e9e6d97b2c00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.get_control.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ControlService_GetControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Control to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callGetControl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getControl(request); - console.log(response); - } - - callGetControl(); - // [END retail_v2alpha_generated_ControlService_GetControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.list_controls.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.list_controls.js.baseline deleted file mode 100644 index 0745f28de311..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.list_controls.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ControlService_ListControls_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter to apply on the list results. Supported features: - * * List all the products under the parent branch if - * filter google.cloud.retail.v2alpha.ListControlsRequest.filter is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - */ - // const filter = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callListControls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listControlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListControls(); - // [END retail_v2alpha_generated_ControlService_ListControls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.update_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.update_control.js.baseline deleted file mode 100644 index 70bb57c34b5b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/control_service.update_control.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(control) { - // [START retail_v2alpha_generated_ControlService_UpdateControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Control to update. - */ - // const control = {} - /** - * Indicates which fields in the provided - * Control google.cloud.retail.v2alpha.Control to update. The following are - * NOT supported: - * * Control.name google.cloud.retail.v2alpha.Control.name - * If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callUpdateControl() { - // Construct request - const request = { - control, - }; - - // Run request - const response = await retailClient.updateControl(request); - console.log(response); - } - - callUpdateControl(); - // [END retail_v2alpha_generated_ControlService_UpdateControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline deleted file mode 100644 index 36631e659c09..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, branch, visitorId) { - // [START retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` - * or - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * This field is used to identify the serving config name and the set - * of models that will be used to make the search. - */ - // const placement = 'abc123' - /** - * Required. The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - */ - // const branch = 'abc123' - /** - * Optional. Raw search query to be searched for. - * If this field is empty, the request is considered a category browsing - * request. - */ - // const query = 'abc123' - /** - * Optional. The categories associated with a category page. Must be set for - * category navigation queries to achieve good search quality. The format - * should be the same as - * UserEvent.page_categories google.cloud.retail.v2alpha.UserEvent.page_categories; - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : "Sales > 2017 Black Friday Deals". - */ - // const pageCategories = ['abc','def'] - /** - * Optional. This field specifies the conversation id, which maintains the - * state of the conversation between client side and server side. Use the - * value from the previous - * ConversationalSearchResponse.conversation_id google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id. - * For the initial request, this should be empty. - */ - // const conversationId = 'abc123' - /** - * Optional. Search parameters. - */ - // const searchParams = {} - /** - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * This should be the same identifier as - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * Optional. User information. - */ - // const userInfo = {} - /** - * Optional. This field specifies all conversational filtering related - * parameters. - */ - // const conversationalFilteringSpec = {} - - // Imports the Retail library - const {ConversationalSearchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ConversationalSearchServiceClient(); - - async function callConversationalSearch() { - // Construct request - const request = { - placement, - branch, - visitorId, - }; - - // Run request - const stream = await retailClient.conversationalSearch(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callConversationalSearch(); - // [END retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline deleted file mode 100644 index e12f4f4cefdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(requests) { - // [START retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const parent = 'abc123' - /** - * Required. The updates question configs. - */ - // const requests = [1,2,3,4] - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callBatchUpdateGenerativeQuestionConfigs() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await retailClient.batchUpdateGenerativeQuestionConfigs(request); - console.log(response); - } - - callBatchUpdateGenerativeQuestionConfigs(); - // [END retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline deleted file mode 100644 index 6e685411bda8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog) { - // [START retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const catalog = 'abc123' - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callGetGenerativeQuestionsFeatureConfig() { - // Construct request - const request = { - catalog, - }; - - // Run request - const response = await retailClient.getGenerativeQuestionsFeatureConfig(request); - console.log(response); - } - - callGetGenerativeQuestionsFeatureConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline deleted file mode 100644 index e822d297ff53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const parent = 'abc123' - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callListGenerativeQuestionConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listGenerativeQuestionConfigs(request); - console.log(response); - } - - callListGenerativeQuestionConfigs(); - // [END retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline deleted file mode 100644 index 024818377a66..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(generativeQuestionConfig) { - // [START retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The question to update. - */ - // const generativeQuestionConfig = {} - /** - * Optional. Indicates which fields in the provided - * GenerativeQuestionConfig google.cloud.retail.v2alpha.GenerativeQuestionConfig - * to update. The following are NOT supported: - * * GenerativeQuestionConfig.frequency google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency - * If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callUpdateGenerativeQuestionConfig() { - // Construct request - const request = { - generativeQuestionConfig, - }; - - // Run request - const response = await retailClient.updateGenerativeQuestionConfig(request); - console.log(response); - } - - callUpdateGenerativeQuestionConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline deleted file mode 100644 index 91d4053b0d87..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(generativeQuestionsFeatureConfig) { - // [START retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The configuration managing the feature state. - */ - // const generativeQuestionsFeatureConfig = {} - /** - * Optional. Indicates which fields in the provided - * GenerativeQuestionsFeatureConfig google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig - * to update. If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callUpdateGenerativeQuestionsFeatureConfig() { - // Construct request - const request = { - generativeQuestionsFeatureConfig, - }; - - // Run request - const response = await retailClient.updateGenerativeQuestionsFeatureConfig(request); - console.log(response); - } - - callUpdateGenerativeQuestionsFeatureConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline deleted file mode 100644 index f8649ee99fba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, merchantCenterAccountLink) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The branch resource where this MerchantCenterAccountLink will be - * created. Format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - */ - // const parent = 'abc123' - /** - * Required. The - * MerchantCenterAccountLink google.cloud.retail.v2alpha.MerchantCenterAccountLink - * to create. - * If the caller does not have permission to create the - * MerchantCenterAccountLink google.cloud.retail.v2alpha.MerchantCenterAccountLink, - * regardless of whether or not it exists, a PERMISSION_DENIED error is - * returned. - */ - // const merchantCenterAccountLink = {} - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callCreateMerchantCenterAccountLink() { - // Construct request - const request = { - parent, - merchantCenterAccountLink, - }; - - // Run request - const [operation] = await retailClient.createMerchantCenterAccountLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMerchantCenterAccountLink(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline deleted file mode 100644 index c56491c49a01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callDeleteMerchantCenterAccountLink() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteMerchantCenterAccountLink(request); - console.log(response); - } - - callDeleteMerchantCenterAccountLink(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline deleted file mode 100644 index d639bc541b8f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent Catalog of the resource. - * It must match this format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - */ - // const parent = 'abc123' - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callListMerchantCenterAccountLinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listMerchantCenterAccountLinks(request); - console.log(response); - } - - callListMerchantCenterAccountLinks(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.create_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.create_model.js.baseline deleted file mode 100644 index 0402164ec240..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.create_model.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, model) { - // [START retail_v2alpha_generated_ModelService_CreateModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource under which to create the model. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The payload of the Model google.cloud.retail.v2alpha.Model to - * create. - */ - // const model = {} - /** - * Optional. Whether to run a dry run to validate the request (without - * actually creating the model). - */ - // const dryRun = true - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callCreateModel() { - // Construct request - const request = { - parent, - model, - }; - - // Run request - const [operation] = await retailClient.createModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateModel(); - // [END retail_v2alpha_generated_ModelService_CreateModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.delete_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.delete_model.js.baseline deleted file mode 100644 index 07ad1322b3cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.delete_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_DeleteModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * Model google.cloud.retail.v2alpha.Model to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callDeleteModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteModel(request); - console.log(response); - } - - callDeleteModel(); - // [END retail_v2alpha_generated_ModelService_DeleteModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.get_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.get_model.js.baseline deleted file mode 100644 index 1cdf8382276a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.get_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_GetModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * Model google.cloud.retail.v2alpha.Model to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callGetModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getModel(request); - console.log(response); - } - - callGetModel(); - // [END retail_v2alpha_generated_ModelService_GetModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.list_models.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.list_models.js.baseline deleted file mode 100644 index 1e017fbfc2ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.list_models.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ModelService_ListModels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callListModels() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listModelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListModels(); - // [END retail_v2alpha_generated_ModelService_ListModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.pause_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.pause_model.js.baseline deleted file mode 100644 index 5289881227c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.pause_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_PauseModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the model to pause. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callPauseModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.pauseModel(request); - console.log(response); - } - - callPauseModel(); - // [END retail_v2alpha_generated_ModelService_PauseModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.resume_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.resume_model.js.baseline deleted file mode 100644 index 04c06f31b951..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.resume_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_ResumeModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the model to resume. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callResumeModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.resumeModel(request); - console.log(response); - } - - callResumeModel(); - // [END retail_v2alpha_generated_ModelService_ResumeModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.tune_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.tune_model.js.baseline deleted file mode 100644 index bbdfa213703e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.tune_model.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_TuneModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the model to tune. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callTuneModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await retailClient.tuneModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callTuneModel(); - // [END retail_v2alpha_generated_ModelService_TuneModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.update_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.update_model.js.baseline deleted file mode 100644 index c6dc67e85a60..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/model_service.update_model.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(model) { - // [START retail_v2alpha_generated_ModelService_UpdateModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The body of the updated - * Model google.cloud.retail.v2alpha.Model. - */ - // const model = {} - /** - * Optional. Indicates which fields in the provided 'model' to - * update. If not set, by default updates all fields. - */ - // const updateMask = {} - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callUpdateModel() { - // Construct request - const request = { - model, - }; - - // Run request - const response = await retailClient.updateModel(request); - console.log(response); - } - - callUpdateModel(); - // [END retail_v2alpha_generated_ModelService_UpdateModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/prediction_service.predict.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/prediction_service.predict.js.baseline deleted file mode 100644 index cbc0fdb18cfa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/prediction_service.predict.js.baseline +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, userEvent) { - // [START retail_v2alpha_generated_PredictionService_Predict_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the format: - * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` - * or - * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. - * We recommend using the `servingConfigs` resource. `placements` is a legacy - * resource. - * The ID of the Recommendations AI serving config or placement. - * Before you can request predictions from your model, you must create at - * least one serving config or placement for it. For more information, see - * Manage serving configs - * (https://cloud.google.com/retail/docs/manage-configs). - * The full list of available serving configs can be seen at - * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - */ - // const placement = 'abc123' - /** - * Required. Context about the user, what they are looking at and what action - * they took to trigger the predict request. Note that this user event detail - * won't be ingested to userEvent logs. Thus, a separate userEvent write - * request is required for event logging. - * Don't set - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id or - * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id to the - * same fixed ID for different users. If you are trying to receive - * non-personalized recommendations (not recommended; this can negatively - * impact model performance), instead set - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id to - * a random unique ID and leave - * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id unset. - */ - // const userEvent = {} - /** - * Maximum number of results to return. Set this property to the number of - * prediction results needed. If zero, the service will choose a reasonable - * default. The maximum allowed value is 100. Values above 100 will be coerced - * to 100. - */ - // const pageSize = 1234 - /** - * This field is not used; leave it unset. - */ - // const pageToken = 'abc123' - /** - * Filter for restricting prediction results with a length limit of 5,000 - * characters. Accepts values for tags and the `filterOutOfStockItems` flag. - * * Tag expressions. Restricts predictions to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses, and must be separated from the - * tag values by a space. `-"tagA"` is also supported and is equivalent to - * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - * with a size limit of 1,000 characters. - * Note: "Recently viewed" models don't support tag filtering at the - * moment. - * * filterOutOfStockItems. Restricts predictions to products that do not - * have a - * stockState value of OUT_OF_STOCK. - * Examples: - * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - * * filterOutOfStockItems tag=(-"promotional") - * * filterOutOfStockItems - * If your filter blocks all prediction results, the API will return *no* - * results. If instead you want empty result sets to return generic - * (unfiltered) popular products, set `strictFiltering` to False in - * `PredictRequest.params`. Note that the API will never return items with - * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - * If `filterSyntaxV2` is set to true under the `params` field, then - * attribute-based expressions are expected instead of the above described - * tag-based syntax. Examples: - * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - * * (availability: ANY("IN_STOCK")) AND - * (colors: ANY("Red") OR categories: ANY("Phones")) - * For more information, see - * Filter recommendations (https://cloud.google.com/retail/docs/filter-recs). - */ - // const filter = 'abc123' - /** - * Use validate only mode for this prediction query. If set to true, a - * dummy model will be used that returns arbitrary products. - * Note that the validate only mode should only be used for testing the API, - * or if the model is not ready. - */ - // const validateOnly = true - /** - * Additional domain specific parameters for the predictions. - * Allowed values: - * * `returnProduct`: Boolean. If set to true, the associated product - * object will be returned in the `results.metadata` field in the - * prediction response. - * * `returnScore`: Boolean. If set to true, the prediction 'score' - * corresponding to each returned product will be set in the - * `results.metadata` field in the prediction response. The given - * 'score' indicates the probability of a product being clicked/purchased - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular products instead of empty if - * your filter blocks all prediction results. - * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-price-reranking', 'low-price-reranking', - * 'medium-price-reranking', 'high-price-reranking'}. This gives - * request-level control and adjusts prediction results based on product - * price. - * * `diversityLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-diversity', 'low-diversity', - * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - * request-level control and adjusts prediction results based on product - * category. - * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - * field is interpreteted according to the new, attribute-based syntax. - */ - // const params = [1,2,3,4] - /** - * The labels applied to a resource must meet the following requirements: - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * See Google Cloud - * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * for more details. - */ - // const labels = [1,2,3,4] - - // Imports the Retail library - const {PredictionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new PredictionServiceClient(); - - async function callPredict() { - // Construct request - const request = { - placement, - userEvent, - }; - - // Run request - const response = await retailClient.predict(request); - console.log(response); - } - - callPredict(); - // [END retail_v2alpha_generated_PredictionService_Predict_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline deleted file mode 100644 index 3411cd30d24d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, type, placeIds) { - // [START retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * Supported values: - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * This field directly corresponds to - * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. - */ - // const type = 'abc123' - /** - * Required. The IDs for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type, such - * as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery" to be added for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type. - * Duplicate IDs will be automatically ignored. - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * If the total number of place IDs exceeds 2000 for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type after - * adding, then the update will be rejected. - */ - // const placeIds = ['abc','def'] - /** - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - */ - // const addTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callAddFulfillmentPlaces() { - // Construct request - const request = { - product, - type, - placeIds, - }; - - // Run request - const [operation] = await retailClient.addFulfillmentPlaces(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAddFulfillmentPlaces(); - // [END retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline deleted file mode 100644 index 197541e27f40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, localInventories) { - // [START retail_v2alpha_generated_ProductService_AddLocalInventories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 3000 inventories are allowed per - * request. - */ - // const localInventories = [1,2,3,4] - /** - * Indicates which inventory fields in the provided list of - * LocalInventory google.cloud.retail.v2alpha.LocalInventory to update. The - * field is updated to the provided value. - * If a field is set while the place does not have a previous local inventory, - * the local inventory at that store is created. - * If a field is set while the value of that field is not provided, the - * original field value, if it exists, is deleted. - * If the mask is not set or set with empty paths, all inventory fields will - * be updated. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - */ - // const addMask = {} - /** - * The time when the inventory updates are issued. Used to prevent - * out-of-order updates on local inventory fields. If not provided, the - * internal system time will be used. - */ - // const addTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the local inventory will still be processed and retained for at - * most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callAddLocalInventories() { - // Construct request - const request = { - product, - localInventories, - }; - - // Run request - const [operation] = await retailClient.addLocalInventories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAddLocalInventories(); - // [END retail_v2alpha_generated_ProductService_AddLocalInventories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.create_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.create_product.js.baseline deleted file mode 100644 index e0fc3fb88fcd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.create_product.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, product, productId) { - // [START retail_v2alpha_generated_ProductService_CreateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. - */ - // const parent = 'abc123' - /** - * Required. The Product google.cloud.retail.v2alpha.Product to create. - */ - // const product = {} - /** - * Required. The ID to use for the - * Product google.cloud.retail.v2alpha.Product, which will become the final - * component of the Product.name google.cloud.retail.v2alpha.Product.name. - * If the caller does not have permission to create the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * This field must be unique among all - * Product google.cloud.retail.v2alpha.Product s with the same - * parent google.cloud.retail.v2alpha.CreateProductRequest.parent. - * Otherwise, an ALREADY_EXISTS error is returned. - * This field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const productId = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callCreateProduct() { - // Construct request - const request = { - parent, - product, - productId, - }; - - // Run request - const response = await retailClient.createProduct(request); - console.log(response); - } - - callCreateProduct(); - // [END retail_v2alpha_generated_ProductService_CreateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.delete_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.delete_product.js.baseline deleted file mode 100644 index 49a7933a69a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.delete_product.js.baseline +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProductService_DeleteProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to delete the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to delete does not - * exist, a NOT_FOUND error is returned. - * The Product google.cloud.retail.v2alpha.Product to delete can neither be - * a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product member nor a - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product with more than one - * variants google.cloud.retail.v2alpha.Product.Type.VARIANT. Otherwise, an - * INVALID_ARGUMENT error is returned. - * All inventory information for the named - * Product google.cloud.retail.v2alpha.Product will be deleted. - */ - // const name = 'abc123' - /** - * This value only applies to the case when the target product is of type - * PRIMARY. - * When deleting a product of VARIANT/COLLECTION type, this value - * will be ignored. - * When set to true, the subsequent variant products will be - * deleted. - * When set to false, if the primary product has active variant products, an - * error will be returned. - */ - // const force = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callDeleteProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteProduct(request); - console.log(response); - } - - callDeleteProduct(); - // [END retail_v2alpha_generated_ProductService_DeleteProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.export_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.export_products.js.baseline deleted file mode 100644 index 0eec3ac35dbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.export_products.js.baseline +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START retail_v2alpha_generated_ProductService_ExportProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of a Branch google.cloud.retail.v2alpha.Branch, - * and `default_branch` for branch_id component is supported. For example - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - */ - // const parent = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned products. Use this expression to restrict results to a - * specific time range, tag, or stock state or to filter products by product - * type. - * For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - * We expect only four types of fields: - * * `lastModifiedTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `lastModifiedTime` restriction should result in one, contiguous, - * valid, last-modified, time range. - * * `productType`: Supported values are `primary` and `variant`. The - * Boolean operators `OR` and `NOT` are supported if the expression is - * enclosed in parentheses and must be separated from the - * `productType` values by a space. - * * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - * `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - * supported if the expression is enclosed in parentheses and must be - * separated from the `availability` values by a space. - * * `Tag expressions`: Restricts output to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. Also supported is '`-"tagA"`', which - * is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - * UTF-8 encoded strings and have a size limit of 1,000 characters. - * Some examples of valid filters expressions: - * * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * productType = "variant"` - * * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - * tag=(NOT "promotional") - * productType = "primary" lastModifiedTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `availability = (IN_STOCK OR BACKORDER)` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callExportProducts() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportProducts(); - // [END retail_v2alpha_generated_ProductService_ExportProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.get_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.get_product.js.baseline deleted file mode 100644 index 1a1404ba8a54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.get_product.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProductService_GetProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the requested Product google.cloud.retail.v2alpha.Product does not - * exist, a NOT_FOUND error is returned. - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callGetProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getProduct(request); - console.log(response); - } - - callGetProduct(); - // [END retail_v2alpha_generated_ProductService_GetProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.import_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.import_products.js.baseline deleted file mode 100644 index 4d830f636c79..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.import_products.js.baseline +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_ProductService_ImportProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * If no updateMask is specified, requires products.create permission. - * If updateMask is specified, requires products.update permission. - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * The desired location of errors incurred during the Import. - */ - // const errorsConfig = {} - /** - * Indicates which fields in the provided imported `products` to update. If - * not set, all fields are updated. If provided, only the existing product - * fields are updated. Missing products will not be created. - */ - // const updateMask = {} - /** - * The mode of reconciliation between existing products and the products to be - * imported. Defaults to - * ReconciliationMode.INCREMENTAL google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL. - */ - // const reconciliationMode = {} - /** - * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - * to be within the same project as - * ImportProductsRequest.parent google.cloud.retail.v2alpha.ImportProductsRequest.parent. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const notificationPubsubTopic = 'abc123' - /** - * If true, this performs the FULL import even if it would delete a large - * proportion of the products in the default branch, which could potentially - * cause outages if you have live predict/search traffic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const skipDefaultBranchProtection = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callImportProducts() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportProducts(); - // [END retail_v2alpha_generated_ProductService_ImportProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.list_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.list_products.js.baseline deleted file mode 100644 index ee6ee7ef5776..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.list_products.js.baseline +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ProductService_ListProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * If the caller does not have permission to list - * Product google.cloud.retail.v2alpha.Product s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - */ - // const parent = 'abc123' - /** - * Maximum number of Product google.cloud.retail.v2alpha.Product s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * If this field is negative, an INVALID_ARGUMENT error is returned. - */ - // const pageSize = 1234 - /** - * A page token - * ListProductsResponse.next_page_token google.cloud.retail.v2alpha.ListProductsResponse.next_page_token, - * received from a previous - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - /** - * A filter to apply on the list results. Supported features: - * * List all the products under the parent branch if - * filter google.cloud.retail.v2alpha.ListProductsRequest.filter is unset. - * * List - * Product.Type.VARIANT google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s sharing the same - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product. For example: - * `primary_product_id = "some_product_id"` - * * List Product google.cloud.retail.v2alpha.Product s bundled in a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product. - * For example: - * `collection_product_id = "some_product_id"` - * * List Product google.cloud.retail.v2alpha.Product s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * If the specified - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product or - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product does not exist, a NOT_FOUND - * error is returned. - */ - // const filter = 'abc123' - /** - * The fields of Product google.cloud.retail.v2alpha.Product to return in - * the responses. If not set or empty, the following fields are returned: - * * Product.name google.cloud.retail.v2alpha.Product.name - * * Product.id google.cloud.retail.v2alpha.Product.id - * * Product.title google.cloud.retail.v2alpha.Product.title - * * Product.uri google.cloud.retail.v2alpha.Product.uri - * * Product.images google.cloud.retail.v2alpha.Product.images - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.brands google.cloud.retail.v2alpha.Product.brands - * If "*" is provided, all fields are returned. - * Product.name google.cloud.retail.v2alpha.Product.name is always returned - * no matter what mask is set. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - */ - // const readMask = {} - /** - * If true and - * page_token google.cloud.retail.v2alpha.ListProductsRequest.page_token is - * empty, - * ListProductsResponse.total_size google.cloud.retail.v2alpha.ListProductsResponse.total_size - * is set to the total count of matched items irrespective of pagination. - * Notice that setting this field to true affects the performance. - */ - // const requireTotalSize = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callListProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listProductsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProducts(); - // [END retail_v2alpha_generated_ProductService_ListProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.purge_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.purge_products.js.baseline deleted file mode 100644 index 5a199fd150ae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.purge_products.js.baseline +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, filter) { - // [START retail_v2alpha_generated_ProductService_PurgeProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the branch under which the products are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - */ - // const parent = 'abc123' - /** - * Required. The filter string to specify the products to be deleted with a - * length limit of 5,000 characters. - * Empty string filter is not allowed. "*" implies delete all items in a - * branch. - * The eligible fields for filtering are: - * * `availability`: Double quoted - * Product.availability google.cloud.retail.v2alpha.Product.availability - * string. - * * `create_time` : in ISO 8601 "zulu" format. - * Supported syntax: - * * Comparators (">", "<", ">=", "<=", "="). - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" - * * availability = "IN_STOCK" - * * Conjunctions ("AND") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - * * Disjunctions ("OR") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - * * Can support nested queries. - * Examples: - * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - * * Filter Limits: - * * Filter should not contain more than 6 conditions. - * * Max nesting depth should not exceed 2 levels. - * Examples queries: - * * Delete back order products created before a timestamp. - * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - */ - // const filter = 'abc123' - /** - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any products. - */ - // const force = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callPurgeProducts() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const [operation] = await retailClient.purgeProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeProducts(); - // [END retail_v2alpha_generated_ProductService_PurgeProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline deleted file mode 100644 index 415a77e274ae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, type, placeIds) { - // [START retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * Supported values: - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * This field directly corresponds to - * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. - */ - // const type = 'abc123' - /** - * Required. The IDs for this - * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type, - * such as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery", to be removed for this - * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type. - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const placeIds = ['abc','def'] - /** - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - */ - // const removeTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callRemoveFulfillmentPlaces() { - // Construct request - const request = { - product, - type, - placeIds, - }; - - // Run request - const [operation] = await retailClient.removeFulfillmentPlaces(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRemoveFulfillmentPlaces(); - // [END retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline deleted file mode 100644 index fc926b26b84b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, placeIds) { - // [START retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. A list of place IDs to have their inventory deleted. - * At most 3000 place IDs are allowed per request. - */ - // const placeIds = ['abc','def'] - /** - * The time when the inventory deletions are issued. Used to prevent - * out-of-order updates and deletions on local inventory fields. If not - * provided, the internal system time will be used. - */ - // const removeTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the local inventory removal request will still be processed and - * retained for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callRemoveLocalInventories() { - // Construct request - const request = { - product, - placeIds, - }; - - // Run request - const [operation] = await retailClient.removeLocalInventories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRemoveLocalInventories(); - // [END retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.set_inventory.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.set_inventory.js.baseline deleted file mode 100644 index 4b9f69b6648b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.set_inventory.js.baseline +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(inventory) { - // [START retail_v2alpha_generated_ProductService_SetInventory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The inventory information to update. The allowable fields to - * update are: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * The updated inventory fields must be specified in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask. - * If - * SetInventoryRequest.inventory.name google.cloud.retail.v2alpha.Product.name - * is empty or invalid, an INVALID_ARGUMENT error is returned. - * If the caller does not have permission to update the - * Product google.cloud.retail.v2alpha.Product named in - * Product.name google.cloud.retail.v2alpha.Product.name, regardless of - * whether or not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to update does not - * have existing inventory information, the provided inventory information - * will be inserted. - * If the Product google.cloud.retail.v2alpha.Product to update has - * existing inventory information, the provided inventory information will be - * merged while respecting the last update time for each inventory field, - * using the provided or default value for - * SetInventoryRequest.set_time google.cloud.retail.v2alpha.SetInventoryRequest.set_time. - * The caller can replace place IDs for a subset of fulfillment types in the - * following ways: - * * Adds "fulfillment_info" in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask - * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in - * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * The caller can clear all place IDs from a subset of fulfillment types in - * the following ways: - * * Adds "fulfillment_info" in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask - * * Specifies only the desired fulfillment types to clear in - * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * * Checks that only the desired fulfillment info types have empty - * SetInventoryRequest.inventory.fulfillment_info.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * The last update time is recorded for the following inventory fields: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * If a full overwrite of inventory information while ignoring timestamps is - * needed, - * ProductService.UpdateProduct google.cloud.retail.v2alpha.ProductService.UpdateProduct - * should be invoked instead. - */ - // const inventory = {} - /** - * Indicates which inventory fields in the provided - * Product google.cloud.retail.v2alpha.Product to update. - * At least one field must be provided. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - */ - // const setMask = {} - /** - * The time when the request is issued, used to prevent - * out-of-order updates on inventory fields with the last update time - * recorded. If not provided, the internal system time will be used. - */ - // const setTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product with - * name Product.name google.cloud.retail.v2alpha.Product.name is not found, - * the inventory update will still be processed and retained for at most 1 day - * until the Product google.cloud.retail.v2alpha.Product is created. If set - * to false, a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callSetInventory() { - // Construct request - const request = { - inventory, - }; - - // Run request - const [operation] = await retailClient.setInventory(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSetInventory(); - // [END retail_v2alpha_generated_ProductService_SetInventory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.update_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.update_product.js.baseline deleted file mode 100644 index 2d806183c001..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/product_service.update_product.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product) { - // [START retail_v2alpha_generated_ProductService_UpdateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The product to update/create. - * If the caller does not have permission to update the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to update does not - * exist and - * allow_missing google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing - * is not set, a NOT_FOUND error is returned. - */ - // const product = {} - /** - * Indicates which fields in the provided - * Product google.cloud.retail.v2alpha.Product to update. The immutable and - * output only fields are NOT supported. If not set, all supported fields (the - * fields that are neither immutable nor output only) are updated. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * The attribute key can be updated by setting the mask path as - * "attributes.${key_name}". If a key name is present in the mask but not in - * the patching product from the request, this key will be deleted after the - * update. - */ - // const updateMask = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, a new Product google.cloud.retail.v2alpha.Product will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callUpdateProduct() { - // Construct request - const request = { - product, - }; - - // Run request - const response = await retailClient.updateProduct(request); - console.log(response); - } - - callUpdateProduct(); - // [END retail_v2alpha_generated_ProductService_UpdateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.accept_terms.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.accept_terms.js.baseline deleted file mode 100644 index beaaa762b063..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.accept_terms.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project) { - // [START retail_v2alpha_generated_ProjectService_AcceptTerms_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - */ - // const project = 'my-project' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callAcceptTerms() { - // Construct request - const request = { - project, - }; - - // Run request - const response = await retailClient.acceptTerms(request); - console.log(response); - } - - callAcceptTerms(); - // [END retail_v2alpha_generated_ProjectService_AcceptTerms_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.enroll_solution.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.enroll_solution.js.baseline deleted file mode 100644 index 363da5bf3d1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.enroll_solution.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project, solution) { - // [START retail_v2alpha_generated_ProjectService_EnrollSolution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - */ - // const project = 'my-project' - /** - * Required. Solution to enroll. - */ - // const solution = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callEnrollSolution() { - // Construct request - const request = { - project, - solution, - }; - - // Run request - const [operation] = await retailClient.enrollSolution(request); - const [response] = await operation.promise(); - console.log(response); - } - - callEnrollSolution(); - // [END retail_v2alpha_generated_ProjectService_EnrollSolution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_alert_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_alert_config.js.baseline deleted file mode 100644 index 7306229c3755..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_alert_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetAlertConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AlertConfig resource name. Format: - * projects/{project_number}/alertConfig - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetAlertConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getAlertConfig(request); - console.log(response); - } - - callGetAlertConfig(); - // [END retail_v2alpha_generated_ProjectService_GetAlertConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_logging_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_logging_config.js.baseline deleted file mode 100644 index 4f975232e259..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_logging_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetLoggingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full LoggingConfig resource name. Format: - * projects/{project_number}/loggingConfig - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetLoggingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getLoggingConfig(request); - console.log(response); - } - - callGetLoggingConfig(); - // [END retail_v2alpha_generated_ProjectService_GetLoggingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_project.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_project.js.baseline deleted file mode 100644 index df69da2ccd6f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.get_project.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetProject_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetProject() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getProject(request); - console.log(response); - } - - callGetProject(); - // [END retail_v2alpha_generated_ProjectService_GetProject_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline deleted file mode 100644 index 437cbffe0f80..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - */ - // const parent = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callListEnrolledSolutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listEnrolledSolutions(request); - console.log(response); - } - - callListEnrolledSolutions(); - // [END retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_alert_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_alert_config.js.baseline deleted file mode 100644 index b3655da2bb30..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_alert_config.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(alertConfig) { - // [START retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The AlertConfig google.cloud.retail.v2alpha.AlertConfig to - * update. - * If the caller does not have permission to update the - * AlertConfig google.cloud.retail.v2alpha.AlertConfig, then a - * PERMISSION_DENIED error is returned. - * If the AlertConfig google.cloud.retail.v2alpha.AlertConfig to update - * does not exist, a NOT_FOUND error is returned. - */ - // const alertConfig = {} - /** - * Indicates which fields in the provided - * AlertConfig google.cloud.retail.v2alpha.AlertConfig to update. If not - * set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callUpdateAlertConfig() { - // Construct request - const request = { - alertConfig, - }; - - // Run request - const response = await retailClient.updateAlertConfig(request); - console.log(response); - } - - callUpdateAlertConfig(); - // [END retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_logging_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_logging_config.js.baseline deleted file mode 100644 index 1ccf1ecb7578..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/project_service.update_logging_config.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(loggingConfig) { - // [START retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to - * update. - * If the caller does not have permission to update the - * LoggingConfig google.cloud.retail.v2alpha.LoggingConfig, then a - * PERMISSION_DENIED error is returned. - * If the LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to update - * does not exist, a NOT_FOUND error is returned. - */ - // const loggingConfig = {} - /** - * Indicates which fields in the provided - * LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to update. The - * following are the only supported fields: - * * LoggingConfig.default_log_generation_rule google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule - * * LoggingConfig.service_log_generation_rules google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callUpdateLoggingConfig() { - // Construct request - const request = { - loggingConfig, - }; - - // Run request - const response = await retailClient.updateLoggingConfig(request); - console.log(response); - } - - callUpdateLoggingConfig(); - // [END retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/search_service.search.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/search_service.search.js.baseline deleted file mode 100644 index b5b193a56e95..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/search_service.search.js.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, visitorId) { - // [START retail_v2alpha_generated_SearchService_Search_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - */ - // const placement = 'abc123' - /** - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - */ - // const branch = 'abc123' - /** - * Raw search query. - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * filter google.cloud.retail.v2alpha.SearchRequest.filter and - * page_categories google.cloud.retail.v2alpha.SearchRequest.page_categories. - */ - // const query = 'abc123' - /** - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * This should be the same identifier as - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * User information. - */ - // const userInfo = {} - /** - * Maximum number of Product google.cloud.retail.v2alpha.Product s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const pageSize = 1234 - /** - * A page token - * SearchResponse.next_page_token google.cloud.retail.v2alpha.SearchResponse.next_page_token, - * received from a previous - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - /** - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * Product google.cloud.retail.v2alpha.Product s deemed by the API as - * relevant) in search results. This field is only considered if - * page_token google.cloud.retail.v2alpha.SearchRequest.page_token is - * unset. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const offset = 1234 - /** - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * Filter (https://cloud.google.com/retail/docs/filter-and-order#filter). - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - */ - // const filter = 'abc123' - /** - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * For more information about filter syntax, see - * SearchRequest.filter google.cloud.retail.v2alpha.SearchRequest.filter. - */ - // const canonicalFilter = 'abc123' - /** - * The order in which products are returned. Products can be ordered by - * a field in an Product google.cloud.retail.v2alpha.Product object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * Order (https://cloud.google.com/retail/docs/filter-and-order#order). - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - */ - // const orderBy = 'abc123' - /** - * Facet specifications for faceted search. If empty, no facets are returned. - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - */ - // const facetSpecs = [1,2,3,4] - /** - * Boost specification to boost certain products. For more information, see - * Boost results (https://cloud.google.com/retail/docs/boosting). - * Notice that if both - * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids - * and - * SearchRequest.boost_spec google.cloud.retail.v2alpha.SearchRequest.boost_spec - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - */ - // const boostSpec = {} - /** - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see Query - * expansion (https://cloud.google.com/retail/docs/result-size#query_expansion). - */ - // const queryExpansionSpec = {} - /** - * The relevance threshold of the search results. - * Defaults to - * RelevanceThreshold.HIGH google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see Adjust result - * size (https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - */ - // const relevanceThreshold = {} - /** - * The keys to fetch and rollup the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s attributes, - * FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo or - * LocalInventory google.cloud.retail.v2alpha.LocalInventory s attributes. - * The attributes from all the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s or - * LocalInventory google.cloud.retail.v2alpha.LocalInventory s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * For FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * Supported keys are: - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * Product.local_inventories.attributes google.cloud.retail.v2alpha.LocalInventory.attributes - * map. - * * attributes.key, where key is any key in the - * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. - * * pickupInStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "pickup-in-store". - * * shipToStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-1". - * * customFulfillment2.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-2". - * * customFulfillment3.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-3". - * * customFulfillment4.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-4". - * * customFulfillment5.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-5". - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - */ - // const variantRollupKeys = ['abc','def'] - /** - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * UserEvent.page_categories google.cloud.retail.v2alpha.UserEvent.page_categories; - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : "Sales > 2017 Black Friday Deals". - */ - // const pageCategories = ['abc','def'] - /** - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - */ - // const searchMode = {} - /** - * The specification for personalization. - * Notice that if both - * ServingConfig.personalization_spec google.cloud.retail.v2alpha.ServingConfig.personalization_spec - * and - * SearchRequest.personalization_spec google.cloud.retail.v2alpha.SearchRequest.personalization_spec - * are set. - * SearchRequest.personalization_spec google.cloud.retail.v2alpha.SearchRequest.personalization_spec - * will override - * ServingConfig.personalization_spec google.cloud.retail.v2alpha.ServingConfig.personalization_spec. - */ - // const personalizationSpec = {} - /** - * The labels applied to a resource must meet the following requirements: - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * For more information, see Requirements for - * labels (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - */ - // const labels = [1,2,3,4] - /** - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - */ - // const spellCorrectionSpec = {} - /** - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * UserEvent.entity google.cloud.retail.v2alpha.UserEvent.entity to get - * search results boosted by entity. - */ - // const entity = 'abc123' - /** - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - */ - // const conversationalSearchSpec = {} - /** - * Optional. This field specifies tile navigation related parameters. - */ - // const tileNavigationSpec = {} - /** - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * list (https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see Standardized codes (https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - */ - // const languageCode = 'abc123' - /** - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * list (https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see Standardized codes (https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - */ - // const regionCode = 'abc123' - /** - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * LocalInventory.place_id google.cloud.retail.v2alpha.LocalInventory.place_id - * for revenue optimization. - */ - // const placeId = 'abc123' - /** - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * Example: - * user_attributes: - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * - */ - // const userAttributes = [1,2,3,4] - - // Imports the Retail library - const {SearchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new SearchServiceClient(); - - async function callSearch() { - // Construct request - const request = { - placement, - visitorId, - }; - - // Run request - const iterable = retailClient.searchAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearch(); - // [END retail_v2alpha_generated_SearchService_Search_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.add_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.add_control.js.baseline deleted file mode 100644 index 2ed8dd4e1e31..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.add_control.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig, controlId) { - // [START retail_v2alpha_generated_ServingConfigService_AddControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const servingConfig = 'abc123' - /** - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config - if id is not found a NOT_FOUND error is returned. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callAddControl() { - // Construct request - const request = { - servingConfig, - controlId, - }; - - // Run request - const response = await retailClient.addControl(request); - console.log(response); - } - - callAddControl(); - // [END retail_v2alpha_generated_ServingConfigService_AddControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline deleted file mode 100644 index a975ac0cc2ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, servingConfig, servingConfigId) { - // [START retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The ServingConfig to create. - */ - // const servingConfig = {} - /** - * Required. The ID to use for the ServingConfig, which will become the final - * component of the ServingConfig's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-_/. - */ - // const servingConfigId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callCreateServingConfig() { - // Construct request - const request = { - parent, - servingConfig, - servingConfigId, - }; - - // Run request - const response = await retailClient.createServingConfig(request); - console.log(response); - } - - callCreateServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline deleted file mode 100644 index 788d1af83451..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ServingConfig to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callDeleteServingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteServingConfig(request); - console.log(response); - } - - callDeleteServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline deleted file mode 100644 index ef91c60bb422..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ServingConfig to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callGetServingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getServingConfig(request); - console.log(response); - } - - callGetServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline deleted file mode 100644 index 518cfca6d3af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callListServingConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listServingConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServingConfigs(); - // [END retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline deleted file mode 100644 index 4ed14252ad40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig, controlId) { - // [START retail_v2alpha_generated_ServingConfigService_RemoveControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const servingConfig = 'abc123' - /** - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callRemoveControl() { - // Construct request - const request = { - servingConfig, - controlId, - }; - - // Run request - const response = await retailClient.removeControl(request); - console.log(response); - } - - callRemoveControl(); - // [END retail_v2alpha_generated_ServingConfigService_RemoveControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline deleted file mode 100644 index ead6fabcabaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig) { - // [START retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ServingConfig to update. - */ - // const servingConfig = {} - /** - * Indicates which fields in the provided - * ServingConfig google.cloud.retail.v2alpha.ServingConfig to update. The - * following are NOT supported: - * * ServingConfig.name google.cloud.retail.v2alpha.ServingConfig.name - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callUpdateServingConfig() { - // Construct request - const request = { - servingConfig, - }; - - // Run request - const response = await retailClient.updateServingConfig(request); - console.log(response); - } - - callUpdateServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline deleted file mode 100644 index dbc107dcf685..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline +++ /dev/null @@ -1,3607 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-retail", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.retail.v2alpha", - "version": "v2alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async", - "title": "retail exportAnalyticsMetrics Sample", - "origin": "API_DEFINITION", - "description": " Exports analytics metrics. `Operation.response` is of type `ExportAnalyticsMetricsResponse`. `Operation.metadata` is of type `ExportMetadata`.", - "canonical": true, - "file": "analytics_service.export_analytics_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAnalyticsMetrics", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService.ExportAnalyticsMetrics", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AnalyticsServiceClient", - "fullName": "google.cloud.retail.v2alpha.AnalyticsServiceClient" - }, - "method": { - "shortName": "ExportAnalyticsMetrics", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService.ExportAnalyticsMetrics", - "service": { - "shortName": "AnalyticsService", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_BranchService_ListBranches_async", - "title": "retail listBranches Sample", - "origin": "API_DEFINITION", - "description": " Lists all instances of [Branch][google.cloud.retail.v2alpha.Branch] under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "branch_service.list_branches.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBranches", - "fullName": "google.cloud.retail.v2alpha.BranchService.ListBranches", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.retail.v2alpha.BranchView" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListBranchesResponse", - "client": { - "shortName": "BranchServiceClient", - "fullName": "google.cloud.retail.v2alpha.BranchServiceClient" - }, - "method": { - "shortName": "ListBranches", - "fullName": "google.cloud.retail.v2alpha.BranchService.ListBranches", - "service": { - "shortName": "BranchService", - "fullName": "google.cloud.retail.v2alpha.BranchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_BranchService_GetBranch_async", - "title": "retail getBranch Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a [Branch][google.cloud.retail.v2alpha.Branch].", - "canonical": true, - "file": "branch_service.get_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBranch", - "fullName": "google.cloud.retail.v2alpha.BranchService.GetBranch", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.retail.v2alpha.BranchView" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Branch", - "client": { - "shortName": "BranchServiceClient", - "fullName": "google.cloud.retail.v2alpha.BranchServiceClient" - }, - "method": { - "shortName": "GetBranch", - "fullName": "google.cloud.retail.v2alpha.BranchService.GetBranch", - "service": { - "shortName": "BranchService", - "fullName": "google.cloud.retail.v2alpha.BranchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_ListCatalogs_async", - "title": "retail listCatalogs Sample", - "origin": "API_DEFINITION", - "description": " Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.", - "canonical": true, - "file": "catalog_service.list_catalogs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListCatalogsResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCatalog_async", - "title": "retail updateCatalog Sample", - "origin": "API_DEFINITION", - "description": " Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.", - "canonical": true, - "file": "catalog_service.update_catalog.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": ".google.cloud.retail.v2alpha.Catalog" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Catalog", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", - "title": "retail setDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", - "canonical": true, - "file": "catalog_service.set_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "branch_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", - "title": "retail getDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.", - "canonical": true, - "file": "catalog_service.get_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GetDefaultBranchResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetCompletionConfig_async", - "title": "retail getCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].", - "canonical": true, - "file": "catalog_service.get_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async", - "title": "retail updateCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.", - "canonical": true, - "file": "catalog_service.update_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "async": true, - "parameters": [ - { - "name": "completion_config", - "type": ".google.cloud.retail.v2alpha.CompletionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetAttributesConfig_async", - "title": "retail getAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", - "canonical": true, - "file": "catalog_service.get_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async", - "title": "retail updateAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", - "canonical": true, - "file": "catalog_service.update_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": ".google.cloud.retail.v2alpha.AttributesConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async", - "title": "retail addCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "catalog_service.add_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async", - "title": "retail removeCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.remove_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "key", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async", - "title": "retail batchRemoveCatalogAttributes Sample", - "origin": "API_DEFINITION", - "description": " Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", - "canonical": true, - "file": "catalog_service.batch_remove_catalog_attributes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchRemoveCatalogAttributes", - "fullName": "google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "attribute_keys", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "BatchRemoveCatalogAttributes", - "fullName": "google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async", - "title": "retail replaceCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.replace_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", - "title": "retail completeQuery Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.complete_query.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 135, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" - }, - { - "name": "enable_attribute_suggestions", - "type": "TYPE_BOOL" - }, - { - "name": "entity", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompleteQueryResponse", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" - }, - "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", - "title": "retail importCompletionData Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.import_completion_data.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" - }, - "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_CreateControl_async", - "title": "retail createControl Sample", - "origin": "API_DEFINITION", - "description": " Creates a Control. If the [Control][google.cloud.retail.v2alpha.Control] to create already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "control_service.create_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_DeleteControl_async", - "title": "retail deleteControl Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Control. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.delete_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_UpdateControl_async", - "title": "retail updateControl Sample", - "origin": "API_DEFINITION", - "description": " Updates a Control. [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2alpha.Control] to update does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.update_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "async": true, - "parameters": [ - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_GetControl_async", - "title": "retail getControl Sample", - "origin": "API_DEFINITION", - "description": " Gets a Control.", - "canonical": true, - "file": "control_service.get_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_ListControls_async", - "title": "retail listControls Sample", - "origin": "API_DEFINITION", - "description": " Lists all Controls by their parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "control_service.list_controls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListControlsResponse", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async", - "title": "retail conversationalSearch Sample", - "origin": "API_DEFINITION", - "description": " Performs a conversational search. This feature is only available for users who have Conversational Search enabled.", - "canonical": true, - "file": "conversational_search_service.conversational_search.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 120, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ConversationalSearch", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "conversation_id", - "type": "TYPE_STRING" - }, - { - "name": "search_params", - "type": ".google.cloud.retail.v2alpha.ConversationalSearchRequest.SearchParams" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2alpha.UserInfo" - }, - { - "name": "conversational_filtering_spec", - "type": ".google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ConversationalSearchResponse", - "client": { - "shortName": "ConversationalSearchServiceClient", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchServiceClient" - }, - "method": { - "shortName": "ConversationalSearch", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch", - "service": { - "shortName": "ConversationalSearchService", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async", - "title": "retail updateGenerativeQuestionsFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Manages overal generative question feature state -- enables toggling feature on and off.", - "canonical": true, - "file": "generative_question_service.update_generative_questions_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", - "async": true, - "parameters": [ - { - "name": "generative_questions_feature_config", - "type": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "UpdateGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async", - "title": "retail getGenerativeQuestionsFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Manages overal generative question feature state -- enables toggling feature on and off.", - "canonical": true, - "file": "generative_question_service.get_generative_questions_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "GetGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async", - "title": "retail listGenerativeQuestionConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all questions for a given catalog.", - "canonical": true, - "file": "generative_question_service.list_generative_question_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.ListGenerativeQuestionConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "ListGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.ListGenerativeQuestionConfigs", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async", - "title": "retail updateGenerativeQuestionConfig Sample", - "origin": "API_DEFINITION", - "description": " Allows management of individual questions.", - "canonical": true, - "file": "generative_question_service.update_generative_question_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGenerativeQuestionConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionConfig", - "async": true, - "parameters": [ - { - "name": "generative_question_config", - "type": ".google.cloud.retail.v2alpha.GenerativeQuestionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "UpdateGenerativeQuestionConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async", - "title": "retail batchUpdateGenerativeQuestionConfigs Sample", - "origin": "API_DEFINITION", - "description": " Allows management of multiple questions.", - "canonical": true, - "file": "generative_question_service.batch_update_generative_question_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "BatchUpdateGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async", - "title": "retail listMerchantCenterAccountLinks Sample", - "origin": "API_DEFINITION", - "description": " Lists all [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]s under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "merchant_center_account_link_service.list_merchant_center_account_links.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMerchantCenterAccountLinks", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "ListMerchantCenterAccountLinks", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async", - "title": "retail createMerchantCenterAccountLink Sample", - "origin": "API_DEFINITION", - "description": " Creates a [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink].", - "canonical": true, - "file": "merchant_center_account_link_service.create_merchant_center_account_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "merchant_center_account_link", - "type": ".google.cloud.retail.v2alpha.MerchantCenterAccountLink" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "CreateMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async", - "title": "retail deleteMerchantCenterAccountLink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "merchant_center_account_link_service.delete_merchant_center_account_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "DeleteMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_CreateModel_async", - "title": "retail createModel Sample", - "origin": "API_DEFINITION", - "description": " Creates a new model.", - "canonical": true, - "file": "model_service.create_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": ".google.cloud.retail.v2alpha.Model" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "CreateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_GetModel_async", - "title": "retail getModel Sample", - "origin": "API_DEFINITION", - "description": " Gets a model.", - "canonical": true, - "file": "model_service.get_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.GetModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "GetModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.GetModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_PauseModel_async", - "title": "retail pauseModel Sample", - "origin": "API_DEFINITION", - "description": " Pauses the training of an existing model.", - "canonical": true, - "file": "model_service.pause_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "PauseModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_ResumeModel_async", - "title": "retail resumeModel Sample", - "origin": "API_DEFINITION", - "description": " Resumes the training of an existing model.", - "canonical": true, - "file": "model_service.resume_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "ResumeModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_DeleteModel_async", - "title": "retail deleteModel Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing model.", - "canonical": true, - "file": "model_service.delete_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "DeleteModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_ListModels_async", - "title": "retail listModels Sample", - "origin": "API_DEFINITION", - "description": " Lists all the models linked to this event store.", - "canonical": true, - "file": "model_service.list_models.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListModels", - "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListModelsResponse", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "ListModels", - "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_UpdateModel_async", - "title": "retail updateModel Sample", - "origin": "API_DEFINITION", - "description": " Update of model metadata. Only fields that currently can be updated are: `filtering_option` and `periodic_tuning_state`. If other values are provided, this API method ignores them.", - "canonical": true, - "file": "model_service.update_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", - "async": true, - "parameters": [ - { - "name": "model", - "type": ".google.cloud.retail.v2alpha.Model" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "UpdateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_TuneModel_async", - "title": "retail tuneModel Sample", - "origin": "API_DEFINITION", - "description": " Tunes an existing model.", - "canonical": true, - "file": "model_service.tune_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TuneModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "TuneModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", - "title": "retail predict Sample", - "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", - "canonical": true, - "file": "prediction_service.predict.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 179, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.PredictResponse", - "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2alpha.PredictionServiceClient" - }, - "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2alpha.PredictionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_CreateProduct_async", - "title": "retail createProduct Sample", - "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.create_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_GetProduct_async", - "title": "retail getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.get_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ListProducts_async", - "title": "retail listProducts Sample", - "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2alpha.Product]s.", - "canonical": true, - "file": "product_service.list_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 136, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "require_total_size", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListProductsResponse", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_UpdateProduct_async", - "title": "retail updateProduct Sample", - "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.update_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_DeleteProduct_async", - "title": "retail deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", - "title": "retail purgeProducts Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", - "canonical": true, - "file": "product_service.purge_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 96, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", - "title": "retail importProducts Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated.", - "canonical": true, - "file": "product_service.import_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 104, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.ProductInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "reconciliation_mode", - "type": ".google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - }, - { - "name": "skip_default_branch_protection", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ExportProducts_async", - "title": "retail exportProducts Sample", - "origin": "API_DEFINITION", - "description": " Exports multiple [Product][google.cloud.retail.v2alpha.Product]s.", - "canonical": true, - "file": "product_service.export_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 101, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ExportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ExportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ExportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", - "title": "retail setInventory Sample", - "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product is used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information is preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates are not marked as [done][google.longrunning.Operation.done] until they are obsolete.", - "canonical": true, - "file": "product_service.set_inventory.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 123, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "async": true, - "parameters": [ - { - "name": "inventory", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "set_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", - "title": "retail addFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " We recommend that you use the [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] method instead of the [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] method. [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.add_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 111, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "retail removeFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " We recommend that you use the [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] method instead of the [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] method. [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.remove_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", - "title": "retail addLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.add_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 95, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "local_inventories", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "add_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", - "title": "retail removeLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.remove_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetProject_async", - "title": "retail getProject Sample", - "origin": "API_DEFINITION", - "description": " Gets the project. Throws `NOT_FOUND` if the project wasn't initialized for the Retail API service.", - "canonical": true, - "file": "project_service.get_project.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProject", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetProject", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Project", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetProject", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetProject", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_AcceptTerms_async", - "title": "retail acceptTerms Sample", - "origin": "API_DEFINITION", - "description": " Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms", - "canonical": true, - "file": "project_service.accept_terms.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AcceptTerms", - "fullName": "google.cloud.retail.v2alpha.ProjectService.AcceptTerms", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Project", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "AcceptTerms", - "fullName": "google.cloud.retail.v2alpha.ProjectService.AcceptTerms", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_EnrollSolution_async", - "title": "retail enrollSolution Sample", - "origin": "API_DEFINITION", - "description": " The method enrolls a solution of type [Retail Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] into a project. The [Recommendations AI solution type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.", - "canonical": true, - "file": "project_service.enroll_solution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnrollSolution", - "fullName": "google.cloud.retail.v2alpha.ProjectService.EnrollSolution", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "solution", - "type": ".google.cloud.retail.v2alpha.SolutionType" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "EnrollSolution", - "fullName": "google.cloud.retail.v2alpha.ProjectService.EnrollSolution", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async", - "title": "retail listEnrolledSolutions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the retail API solutions the project has enrolled.", - "canonical": true, - "file": "project_service.list_enrolled_solutions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEnrolledSolutions", - "fullName": "google.cloud.retail.v2alpha.ProjectService.ListEnrolledSolutions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "ListEnrolledSolutions", - "fullName": "google.cloud.retail.v2alpha.ProjectService.ListEnrolledSolutions", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetLoggingConfig_async", - "title": "retail getLoggingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the requested project.", - "canonical": true, - "file": "project_service.get_logging_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.LoggingConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async", - "title": "retail updateLoggingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the requested project.", - "canonical": true, - "file": "project_service.update_logging_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig", - "async": true, - "parameters": [ - { - "name": "logging_config", - "type": ".google.cloud.retail.v2alpha.LoggingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.LoggingConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "UpdateLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetAlertConfig_async", - "title": "retail getAlertConfig Sample", - "origin": "API_DEFINITION", - "description": " Get the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] of the requested project.", - "canonical": true, - "file": "project_service.get_alert_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetAlertConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AlertConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetAlertConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async", - "title": "retail updateAlertConfig Sample", - "origin": "API_DEFINITION", - "description": " Update the alert config of the requested project.", - "canonical": true, - "file": "project_service.update_alert_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig", - "async": true, - "parameters": [ - { - "name": "alert_config", - "type": ".google.cloud.retail.v2alpha.AlertConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AlertConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "UpdateAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_SearchService_Search_async", - "title": "retail search Sample", - "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "search_service.search.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 378, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2alpha.UserInfo" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "offset", - "type": "TYPE_INT32" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "canonical_filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "facet_specs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "dynamic_facet_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec" - }, - { - "name": "boost_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.BoostSpec" - }, - { - "name": "query_expansion_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec" - }, - { - "name": "relevance_threshold", - "type": ".google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold" - }, - { - "name": "variant_rollup_keys", - "type": "TYPE_STRING[]" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "search_mode", - "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" - }, - { - "name": "personalization_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "spell_correction_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec" - }, - { - "name": "entity", - "type": "TYPE_STRING" - }, - { - "name": "conversational_search_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec" - }, - { - "name": "tile_navigation_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "region_code", - "type": "TYPE_STRING" - }, - { - "name": "place_id", - "type": "TYPE_STRING" - }, - { - "name": "user_attributes", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.SearchResponse", - "client": { - "shortName": "SearchServiceClient", - "fullName": "google.cloud.retail.v2alpha.SearchServiceClient" - }, - "method": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "service": { - "shortName": "SearchService", - "fullName": "google.cloud.retail.v2alpha.SearchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async", - "title": "retail createServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.", - "canonical": true, - "file": "serving_config_service.create_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "serving_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async", - "title": "retail deleteServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.delete_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async", - "title": "retail updateServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ServingConfig.", - "canonical": true, - "file": "serving_config_service.update_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_GetServingConfig_async", - "title": "retail getServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.get_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async", - "title": "retail listServingConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists all ServingConfigs linked to this catalog.", - "canonical": true, - "file": "serving_config_service.list_serving_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListServingConfigsResponse", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_AddControl_async", - "title": "retail addControl Sample", - "origin": "API_DEFINITION", - "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", - "canonical": true, - "file": "serving_config_service.add_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_RemoveControl_async", - "title": "retail removeControl Sample", - "origin": "API_DEFINITION", - "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", - "canonical": true, - "file": "serving_config_service.remove_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", - "title": "retail writeUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event.", - "canonical": true, - "file": "user_event_service.write_user_event.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - }, - { - "name": "write_async", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.UserEvent", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_CollectUserEvent_async", - "title": "retail collectUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event from the browser. For larger user event payload over 16 KB, the POST method should be used instead, otherwise a 400 Bad Request error is returned. This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.", - "canonical": true, - "file": "user_event_service.collect_user_event.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "async": true, - "parameters": [ - { - "name": "prebuilt_rule", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": "TYPE_STRING" - }, - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "ets", - "type": "TYPE_INT64" - }, - { - "name": "raw_json", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_PurgeUserEvents_async", - "title": "retail purgeUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.", - "canonical": true, - "file": "user_event_service.purge_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_ImportUserEvents_async", - "title": "retail importUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. `Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`.", - "canonical": true, - "file": "user_event_service.import_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.UserEventInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_ExportUserEvents_async", - "title": "retail exportUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Exports user events. `Operation.response` is of type `ExportResponse`. `Operation.metadata` is of type `ExportMetadata`.", - "canonical": true, - "file": "user_event_service.export_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 94, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ExportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "ExportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ExportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", - "title": "retail rejoinUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", - "canonical": true, - "file": "user_event_service.rejoin_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event_rejoin_scope", - "type": ".google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline deleted file mode 100644 index 50cf19d3a225..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, userEvent) { - // [START retail_v2alpha_generated_UserEventService_CollectUserEvent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The prebuilt rule name that can convert a specific type of raw_json. - * For example: "ga4_bq" rule for the GA4 user event schema. - */ - // const prebuiltRule = 'abc123' - /** - * Required. The parent catalog name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. URL encoded UserEvent proto with a length limit of 2,000,000 - * characters. - */ - // const userEvent = 'abc123' - /** - * The URL including cgi-parameters but excluding the hash fragment with a - * length limit of 5,000 characters. This is often more useful than the - * referer URL, because many browsers only send the domain for 3rd party - * requests. - */ - // const uri = 'abc123' - /** - * The event timestamp in milliseconds. This prevents browser caching of - * otherwise identical get requests. The name is abbreviated to reduce the - * payload bytes. - */ - // const ets = 1234 - /** - * An arbitrary serialized JSON string that contains necessary information - * that can comprise a user event. When this field is specified, the - * user_event field will be ignored. Note: line-delimited JSON is not - * supported, a single JSON only. - */ - // const rawJson = 'abc123' - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callCollectUserEvent() { - // Construct request - const request = { - parent, - userEvent, - }; - - // Run request - const response = await retailClient.collectUserEvent(request); - console.log(response); - } - - callCollectUserEvent(); - // [END retail_v2alpha_generated_UserEventService_CollectUserEvent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline deleted file mode 100644 index 3532c6ea39bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START retail_v2alpha_generated_UserEventService_ExportUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of a - * Catalog google.cloud.retail.v2alpha.Catalog. For example - * `projects/1234/locations/global/catalogs/default_catalog` - */ - // const parent = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned user events. Use this expression to restrict results to a - * specific time range or to filter events by eventType. - * For example, `eventTime > "2012-04-23T18:25:43.511Z" - * eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - * eventType=search` - * We expect only three types of fields: - * * `eventTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `eventTime` restriction should result in one, contiguous, valid, - * `eventTime` range. - * * `eventType`: Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. - * * `eventsMissingCatalogItems`: This restricts results - * to events for which catalog items were not found in the catalog. The - * default behavior is to return only those events for which catalog - * items were found. - * Some examples of valid filters expressions: - * * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - * eventType = detail-page-view` - * * Example 3: `eventsMissingCatalogItems - * eventType = (NOT search) eventTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `eventType = (detail-page-view OR search)` - * * Example 6: `eventsMissingCatalogItems` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callExportUserEvents() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportUserEvents(); - // [END retail_v2alpha_generated_UserEventService_ExportUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline deleted file mode 100644 index d52aaaf5add8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_UserEventService_ImportUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. `projects/1234/locations/global/catalogs/default_catalog` - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - */ - // const errorsConfig = {} - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callImportUserEvents() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportUserEvents(); - // [END retail_v2alpha_generated_UserEventService_ImportUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline deleted file mode 100644 index b2f6b62394d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, filter) { - // [START retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the catalog under which the events are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}` - */ - // const parent = 'abc123' - /** - * Required. The filter string to specify the events to be deleted with a - * length limit of 5,000 characters. Empty string filter is not allowed. The - * eligible fields for filtering are: - * * `eventType`: Double quoted - * UserEvent.event_type google.cloud.retail.v2alpha.UserEvent.event_type - * string. - * * `eventTime`: in ISO 8601 "zulu" format. - * * `visitorId`: Double quoted string. Specifying this will delete all - * events associated with a visitor. - * * `userId`: Double quoted string. Specifying this will delete all events - * associated with a user. - * Examples: - * * Deleting all events in a time range: - * `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Deleting specific eventType in time range: - * `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - * * Deleting all events for a specific visitor: - * `visitorId = "visitor1024"` - * The filtering fields are assumed to have an implicit AND. - */ - // const filter = 'abc123' - /** - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any user events. - */ - // const force = true - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callPurgeUserEvents() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const [operation] = await retailClient.purgeUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeUserEvents(); - // [END retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline deleted file mode 100644 index efe1ac903c32..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * The type of the user event rejoin to define the scope and range of the user - * events to be rejoined with the latest product catalog. Defaults to - * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - * an invalid integer value. - */ - // const userEventRejoinScope = {} - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callRejoinUserEvents() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await retailClient.rejoinUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRejoinUserEvents(); - // [END retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline deleted file mode 100644 index 7177026d13ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, userEvent) { - // [START retail_v2alpha_generated_UserEventService_WriteUserEvent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. User event to write. - */ - // const userEvent = {} - /** - * If set to true, the user event will be written asynchronously after - * validation, and the API will respond without waiting for the write. - * Therefore, silent failures can occur even if the API returns success. In - * case of silent failures, error messages can be found in Stackdriver logs. - */ - // const writeAsync = true - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callWriteUserEvent() { - // Construct request - const request = { - parent, - userEvent, - }; - - // Run request - const response = await retailClient.writeUserEvent(request); - console.log(response); - } - - callWriteUserEvent(); - // [END retail_v2alpha_generated_UserEventService_WriteUserEvent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/retail-esm/webpack.config.cjs.baseline deleted file mode 100644 index 4de3e25e3d10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'retail', - filename: './retail.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.OwlBot.yaml.baseline deleted file mode 100644 index 3360262a4374..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/retail/google-cloud-retail-nodejs - dest: /owl-bot-staging/google-cloud-retail - -api-name: retail \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.jsdoc.js.baseline deleted file mode 100644 index d156f1c2eb92..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'retail', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/retail/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/retail/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/retail/README.md.baseline deleted file mode 100644 index 4fadc347e8b3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Vertex AI Search for commerce API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/retail.svg)](https://www.npmjs.org/package/retail) - -Vertex AI Search for commerce API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Vertex AI Search for commerce API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/retail/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Vertex AI Search for commerce API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install retail -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install retail@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=retail.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-retail diff --git a/core/generator/gapic-generator-typescript/baselines/retail/package.json b/core/generator/gapic-generator-typescript/baselines/retail/package.json deleted file mode 100644 index cce57a59a986..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "retail", - "version": "0.1.0", - "description": "Retail client for Node.js", - "repository": "googleapis/nodejs-retail", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google retail", - "retail", - "analytics service", - "branch service", - "catalog service", - "completion service", - "control service", - "conversational search service", - "generative question service", - "merchant center account link service", - "model service", - "prediction service", - "product service", - "project service", - "search service", - "serving config service", - "user event service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline deleted file mode 100644 index 23f0f4743b2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/analytics_service.proto.baseline +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "AnalyticsServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing & accessing retail search business metric. -// Retail recommendation business metric is currently not available. -service AnalyticsService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Exports analytics metrics. - // - // `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - // `Operation.metadata` is of type `ExportMetadata`. - rpc ExportAnalyticsMetrics(ExportAnalyticsMetricsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:exportAnalyticsMetrics" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportAnalyticsMetricsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch.proto.baseline deleted file mode 100644 index 404ff3c67934..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch.proto.baseline +++ /dev/null @@ -1,246 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "BranchProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// A view that specifies different level of fields of a -// [Branch][google.cloud.retail.v2alpha.Branch] to show in responses. -enum BranchView { - // The value when it's unspecified. This defaults to the BASIC view. - BRANCH_VIEW_UNSPECIFIED = 0; - - // Includes basic metadata about the branch, but not statistical fields. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BRANCH_VIEW_BASIC = 1; - - // Includes all fields of a [Branch][google.cloud.retail.v2alpha.Branch]. - BRANCH_VIEW_FULL = 2; -} - -// A data branch that stores all instances of -// [Product][google.cloud.retail.v2alpha.Product]s. -message Branch { - option (google.api.resource) = { - type: "retail.googleapis.com/Branch" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}" - }; - - // A statistic about the number of products in a branch. - message ProductCountStatistic { - // Scope of what products are included for this count. - enum ProductCountScope { - // Default value for enum. This value is not used in the API response. - PRODUCT_COUNT_SCOPE_UNSPECIFIED = 0; - - // Scope for all existing products in the branch. Useful for understanding - // how many products there are in a branch. - ALL_PRODUCTS = 1; - - // Scope for products created or updated in the last 24 hours. - LAST_24_HOUR_UPDATE = 2; - } - - // [ProductCountScope] of the [counts]. - ProductCountScope scope = 1; - - // The number of products in - // [scope][google.cloud.retail.v2alpha.Branch.ProductCountStatistic.scope] - // broken down into different groups. - // - // The key is a group representing a set of products, and the value is the - // number of products in that group. - // Note: keys in this map may change over time. - // - // Possible keys: - // * "primary-in-stock", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // availability. - // - // * "primary-out-of-stock", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // availability. - // - // * "primary-preorder", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.PREORDER][google.cloud.retail.v2alpha.Product.Availability.PREORDER] - // availability. - // - // * "primary-backorder", products have - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // type and - // [Product.Availability.BACKORDER][google.cloud.retail.v2alpha.Product.Availability.BACKORDER] - // availability. - // - // * "variant-in-stock", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // availability. - // - // * "variant-out-of-stock", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // availability. - // - // * "variant-preorder", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.PREORDER][google.cloud.retail.v2alpha.Product.Availability.PREORDER] - // availability. - // - // * "variant-backorder", products have - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // type and - // [Product.Availability.BACKORDER][google.cloud.retail.v2alpha.Product.Availability.BACKORDER] - // availability. - // - // * "price-discounted", products have [Product.price_info.price] < - // [Product.price_info.original_price]. - map counts = 2; - } - - // Metric measured on a group of - // [Product][google.cloud.retail.v2alpha.Product]s against a certain quality - // requirement. Contains the number of products that pass the check and the - // number of products that don't. - message QualityMetric { - // The key that represents a quality requirement rule. - // - // Supported keys: - // * "has-valid-uri": product has a valid and accessible - // [uri][google.cloud.retail.v2alpha.Product.uri]. - // - // * "available-expire-time-conformance": - // [Product.available_time][google.cloud.retail.v2alpha.Product.available_time] - // is early than "now", and - // [Product.expire_time][google.cloud.retail.v2alpha.Product.expire_time] is - // greater than "now". - // - // * "has-searchable-attributes": product has at least one - // [attribute][google.cloud.retail.v2alpha.Product.attributes] set to - // searchable. - // - // * "has-description": product has non-empty - // [description][google.cloud.retail.v2alpha.Product.description]. - // - // * "has-at-least-bigram-title": Product - // [title][google.cloud.retail.v2alpha.Product.title] has at least two - // words. A comprehensive title helps to improve search quality. - // - // * "variant-has-image": the - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] products has - // at least one [image][google.cloud.retail.v2alpha.Product.images]. You may - // ignore this metric if all your products are at - // [primary][google.cloud.retail.v2alpha.Product.Type.PRIMARY] level. - // - // * "variant-has-price-info": the - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] products has - // [price_info][google.cloud.retail.v2alpha.Product.price_info] set. You may - // ignore this metric if all your products are at - // [primary][google.cloud.retail.v2alpha.Product.Type.PRIMARY] level. - // - // * "has-publish-time": product has non-empty - // [publish_time][google.cloud.retail.v2alpha.Product.publish_time]. - string requirement_key = 1; - - // Number of products passing the quality requirement check. We only check - // searchable products. - int32 qualified_product_count = 2; - - // Number of products failing the quality requirement check. We only check - // searchable products. - int32 unqualified_product_count = 3; - - // Value from 0 to 100 representing the suggested percentage of products - // that meet the quality requirements to get good search and recommendation - // performance. 100 * (qualified_product_count) / - // (qualified_product_count + unqualified_product_count) should be greater - // or equal to this suggestion. - double suggested_quality_percent_threshold = 4; - - // A list of a maximum of 100 sample products that do not qualify for - // this requirement. - // - // This field is only populated in the response to - // [BranchService.GetBranch][google.cloud.retail.v2alpha.BranchService.GetBranch] - // API, and is always empty for - // [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches]. - // - // Only the following fields are set in the - // [Product][google.cloud.retail.v2alpha.Product]. - // - // * [Product.name][google.cloud.retail.v2alpha.Product.name] - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // * [Product.title][google.cloud.retail.v2alpha.Product.title] - repeated Product unqualified_sample_products = 5; - } - - // Immutable. Full resource name of the branch, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/branch_id`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. Human readable name of the branch to display in the UI. - string display_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Indicates whether this branch is set as the default branch of - // its parent catalog. - bool is_default = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp of last import through - // [ProductService.ImportProducts][google.cloud.retail.v2alpha.ProductService.ImportProducts]. - // Empty value means no import has been made to this branch. - google.protobuf.Timestamp last_product_import_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Statistics for number of products in the branch, provided for - // different - // [scopes][google.cloud.retail.v2alpha.Branch.ProductCountStatistic.ProductCountScope]. - // - // This field is not populated in [BranchView.BASIC][] view. - repeated ProductCountStatistic product_count_stats = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The quality metrics measured among products of this branch. - // - // See - // [QualityMetric.requirement_key][google.cloud.retail.v2alpha.Branch.QualityMetric.requirement_key] - // for supported metrics. Metrics could be missing if failed to retrieve. - // - // This field is not populated in [BranchView.BASIC][] view. - repeated QualityMetric quality_metrics = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline deleted file mode 100644 index 4015336d687d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/branch_service.proto.baseline +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/branch.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "BranchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for [Branch][google.cloud.retail.v2alpha.Branch] Management -// -// [Branch][google.cloud.retail.v2alpha.Branch]es are automatically created when -// a [Catalog][google.cloud.retail.v2alpha.Catalog] is created. There are fixed -// three branches in each catalog, and may use -// [ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] method -// to get the details of all branches. -service BranchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all instances of [Branch][google.cloud.retail.v2alpha.Branch] under - // the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListBranches(ListBranchesRequest) returns (ListBranchesResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/branches" - }; - option (google.api.method_signature) = "parent"; - } - - // Retrieves a [Branch][google.cloud.retail.v2alpha.Branch]. - rpc GetBranch(GetBranchRequest) returns (Branch) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request for -// [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] -// method. -message ListBranchesRequest { - // Required. The parent catalog resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // The view to apply to the returned - // [Branch][google.cloud.retail.v2alpha.Branch]. Defaults to - // [Branch.BranchView.BASIC] if unspecified. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BranchView view = 2; -} - -// Response for -// [BranchService.ListBranches][google.cloud.retail.v2alpha.BranchService.ListBranches] -// method. -message ListBranchesResponse { - // The Branches. - repeated Branch branches = 1; -} - -// Request for -// [BranchService.GetBranch][google.cloud.retail.v2alpha.BranchService.GetBranch] -// method. -message GetBranchRequest { - // Required. The name of the branch to retrieve. - // Format: - // `projects/*/locations/global/catalogs/default_catalog/branches/some_branch_id`. - // - // "default_branch" can be used as a special branch_id, it returns the - // default branch that has been set for the catalog. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // The view to apply to the returned - // [Branch][google.cloud.retail.v2alpha.Branch]. Defaults to - // [Branch.BranchView.BASIC] if unspecified. - // See documentation of fields of [Branch][google.cloud.retail.v2alpha.Branch] - // to find what fields are excluded from BASIC view. - BranchView view = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog.proto.baseline deleted file mode 100644 index a940c764b0ec..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog.proto.baseline +++ /dev/null @@ -1,606 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CatalogProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures what level the product should be uploaded with regards to -// how users will be send events and how predictions will be made. -message ProductLevelConfig { - // The type of [Product][google.cloud.retail.v2alpha.Product]s allowed to be - // ingested into the catalog. Acceptable values are: - // - // * `primary` (default): You can ingest - // [Product][google.cloud.retail.v2alpha.Product]s of all types. When - // ingesting a [Product][google.cloud.retail.v2alpha.Product], its type will - // default to - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // if unset. - // * `variant` (incompatible with Retail Search): You can only - // ingest - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. This means - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // cannot be empty. - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // If this field is `variant` and - // [merchant_center_product_id_field][google.cloud.retail.v2alpha.ProductLevelConfig.merchant_center_product_id_field] - // is `itemGroupId`, an INVALID_ARGUMENT error is returned. - // - // See [Product - // levels](https://cloud.google.com/retail/docs/catalog#product-levels) - // for more details. - string ingestion_product_type = 1; - - // Which field of [Merchant Center - // Product](/bigquery-transfer/docs/merchant-center-products-schema) should be - // imported as [Product.id][google.cloud.retail.v2alpha.Product.id]. - // Acceptable values are: - // - // * `offerId` (default): Import `offerId` as the product ID. - // * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail - // API will choose one item from the ones with the same `itemGroupId`, and - // use it to represent the item group. - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // If this field is `itemGroupId` and - // [ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // is `variant`, an INVALID_ARGUMENT error is returned. - // - // See [Product - // levels](https://cloud.google.com/retail/docs/catalog#product-levels) - // for more details. - string merchant_center_product_id_field = 2; -} - -// Catalog level attribute config for an attribute. For example, if customers -// want to enable/disable facet for a specific attribute. -message CatalogAttribute { - // Possible options for the facet that corresponds to the current attribute - // config. - message FacetConfig { - // [Facet values][google.cloud.retail.v2alpha.SearchResponse.Facet.values] - // to ignore on [facets][google.cloud.retail.v2alpha.SearchResponse.Facet] - // during the specified time range for the given - // [SearchResponse.Facet.key][google.cloud.retail.v2alpha.SearchResponse.Facet.key] - // attribute. - message IgnoredFacetValues { - // List of facet values to ignore for the following time range. The facet - // values are the same as the attribute values. There is a limit of 10 - // values per instance of IgnoredFacetValues. Each value can have at most - // 128 characters. - repeated string values = 1; - - // Time range for the current list of facet values to ignore. - // If multiple time ranges are specified for an facet value for the - // current attribute, consider all of them. If both are empty, ignore - // always. If start time and end time are set, then start time - // must be before end time. - // If start time is not empty and end time is empty, then will ignore - // these facet values after the start time. - google.protobuf.Timestamp start_time = 2; - - // If start time is empty and end time is not empty, then ignore these - // facet values before end time. - google.protobuf.Timestamp end_time = 3; - } - - // Replaces a set of textual facet values by the same (possibly different) - // merged facet value. Each facet value should appear at most once as a - // value per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]. This - // feature is available only for textual custom attributes. - message MergedFacetValue { - // All the facet values that are replaces by the same - // [merged_value][google.cloud.retail.v2alpha.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value] - // that follows. The maximum number of values per MergedFacetValue is 25. - // Each value can have up to 128 characters. - repeated string values = 1; - - // All the previous values are replaced by this merged facet value. - // This merged_value must be non-empty and can have up to 128 characters. - string merged_value = 2; - } - - // The current facet key (i.e. attribute config) maps into the - // [merged_facet_key][google.cloud.retail.v2alpha.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]. - // A facet key can have at most one child. The current facet key and the - // merged facet key need both to be textual custom attributes or both - // numerical custom attributes (same type). - message MergedFacet { - // The merged facet key should be a valid facet key that is different than - // the facet key of the current catalog attribute. We refer this is - // merged facet key as the child of the current catalog attribute. This - // merged facet key can't be a parent of another facet key (i.e. no - // directed path of length 2). This merged facet key needs to be either a - // textual custom attribute or a numerical custom attribute. - string merged_facet_key = 1; - } - - // Options to rerank based on facet values engaged by the user for the - // current key. That key needs to be a custom textual key and facetable. - // To use this control, you also need to pass all the facet keys engaged by - // the user in the request using the field [SearchRequest.FacetSpec]. In - // particular, if you don't pass the facet keys engaged that you want to - // rerank on, this control won't be effective. Moreover, to obtain better - // results, the facet values that you want to rerank on should be close to - // English (ideally made of words, underscores, and spaces). - message RerankConfig { - // If set to true, then we also rerank the dynamic facets based on the - // facet values engaged by the user for the current attribute key during - // serving. - bool rerank_facet = 1; - - // If empty, rerank on all facet values for the current key. Otherwise, - // will rerank on the facet values from this list only. - repeated string facet_values = 2; - } - - // If you don't set the facet - // [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals] - // in the request to a numerical attribute, then we use the computed - // intervals with rounded bounds obtained from all its product numerical - // attribute values. The computed intervals might not be ideal for some - // attributes. Therefore, we give you the option to overwrite them with the - // facet_intervals field. The maximum of facet intervals per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 40. - // Each interval must have a lower bound or an upper bound. If both bounds - // are provided, then the lower bound must be smaller or equal than the - // upper bound. - repeated Interval facet_intervals = 1; - - // Each instance represents a list of attribute values to ignore as facet - // values for a specific time range. The maximum number of instances per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 25. - repeated IgnoredFacetValues ignored_facet_values = 2; - - // Each instance replaces a list of facet values by a merged facet - // value. If a facet value is not in any list, then it will stay the same. - // To avoid conflicts, only paths of length 1 are accepted. In other words, - // if "dark_blue" merged into "BLUE", then the latter can't merge into - // "blues" because this would create a path of length 2. The maximum number - // of instances of MergedFacetValue per - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] is 100. - // This feature is available only for textual custom attributes. - repeated MergedFacetValue merged_facet_values = 3; - - // Use this field only if you want to merge a facet key into another facet - // key. - MergedFacet merged_facet = 4; - - // Set this field only if you want to rerank based on facet values engaged - // by the user for the current key. This option is only possible for custom - // facetable textual keys. - RerankConfig rerank_config = 5; - } - - // The type of an attribute. - enum AttributeType { - // The type of the attribute is unknown. - // - // Used when type cannot be derived from attribute that is not - // [in_use][google.cloud.retail.v2alpha.CatalogAttribute.in_use]. - UNKNOWN = 0; - - // Textual attribute. - TEXTUAL = 1; - - // Numerical attribute. - NUMERICAL = 2; - } - - // The status of the indexable option of a catalog attribute. - enum IndexableOption { - // Value used when unset. - INDEXABLE_OPTION_UNSPECIFIED = 0; - - // Indexable option enabled for an attribute. - INDEXABLE_ENABLED = 1; - - // Indexable option disabled for an attribute. - INDEXABLE_DISABLED = 2; - } - - // The status of the dynamic facetable option of a catalog attribute. - enum DynamicFacetableOption { - // Value used when unset. - DYNAMIC_FACETABLE_OPTION_UNSPECIFIED = 0; - - // Dynamic facetable option enabled for an attribute. - DYNAMIC_FACETABLE_ENABLED = 1; - - // Dynamic facetable option disabled for an attribute. - DYNAMIC_FACETABLE_DISABLED = 2; - } - - // The status of the searchable option of a catalog attribute. - enum SearchableOption { - // Value used when unset. - SEARCHABLE_OPTION_UNSPECIFIED = 0; - - // Searchable option enabled for an attribute. - SEARCHABLE_ENABLED = 1; - - // Searchable option disabled for an attribute. - SEARCHABLE_DISABLED = 2; - } - - // The status of the exact-searchable option of a catalog attribute. - enum ExactSearchableOption { - // Value used when unset. - EXACT_SEARCHABLE_OPTION_UNSPECIFIED = 0; - - // Exact searchable option enabled for an attribute. - EXACT_SEARCHABLE_ENABLED = 1; - - // Exact searchable option disabled for an attribute. - EXACT_SEARCHABLE_DISABLED = 2; - } - - // The status of the retrievable option of a catalog attribute. - enum RetrievableOption { - // Value used when unset. - RETRIEVABLE_OPTION_UNSPECIFIED = 0; - - // Retrievable option enabled for an attribute. - RETRIEVABLE_ENABLED = 1; - - // Retrievable option disabled for an attribute. - RETRIEVABLE_DISABLED = 2; - } - - // Required. Attribute name. - // For example: `color`, `brands`, `attributes.custom_attribute`, such as - // `attributes.xyz`. - // To be indexable, the attribute name can contain only alpha-numeric - // characters and underscores. For example, an attribute named - // `attributes.abc_xyz` can be indexed, but an attribute named - // `attributes.abc-xyz` cannot be indexed. - // - // If the attribute key starts with `attributes.`, then the attribute is a - // custom attribute. Attributes such as `brands`, `patterns`, and `title` are - // built-in and called system attributes. - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Indicates whether this attribute has been used by any - // products. `True` if at least one - // [Product][google.cloud.retail.v2alpha.Product] is using this attribute in - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - // Otherwise, this field is `False`. - // - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] can be - // pre-loaded by using - // [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute] - // or - // [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] - // APIs. This field is `False` for pre-loaded - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s. - // - // Only pre-loaded [catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are neither - // in use by products nor predefined can be deleted. [Catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are - // either in use by products or are predefined attributes cannot be deleted; - // however, their configuration properties will reset to default values upon - // removal request. - // - // After catalog changes, it takes about 10 minutes for this field to update. - bool in_use = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of this attribute. This is derived from the attribute - // in [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - AttributeType type = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values - // are indexed so that it can be filtered, faceted, or boosted in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // Must be specified when - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - IndexableOption indexable_option = 5; - - // If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic - // facet. Could only be DYNAMIC_FACETABLE_DISABLED if - // [CatalogAttribute.indexable_option][google.cloud.retail.v2alpha.CatalogAttribute.indexable_option] - // is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Must be specified, otherwise throws INVALID_FORMAT error. - DynamicFacetableOption dynamic_facetable_option = 6; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values - // are searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // If SEARCHABLE_ENABLED but attribute type is numerical, attribute values - // will not be searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], - // as there are no text values associated to numerical attributes. - // - // Must be specified, when - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error. - SearchableOption searchable_option = 7; - - // When - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if RECOMMENDATIONS_FILTERING_ENABLED, - // attribute values are filterable for recommendations. - // This option works for categorical features only, - // does not work for numerical features, inventory filtering. - RecommendationsFilteringOption recommendations_filtering_option = 8; - - // If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable. - // This property only applies to textual custom attributes and requires - // indexable set to enabled to enable exact-searchable. If unset, the server - // behavior defaults to - // [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2alpha.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]. - ExactSearchableOption exact_searchable_option = 11; - - // If RETRIEVABLE_ENABLED, attribute values are retrievable in the search - // results. If unset, the server behavior defaults to - // [RETRIEVABLE_DISABLED][google.cloud.retail.v2alpha.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]. - RetrievableOption retrievable_option = 12; - - // Contains facet options. - FacetConfig facet_config = 13; -} - -// Catalog level attribute config. -message AttributesConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/AttributesConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig" - }; - - // Required. Immutable. The fully qualified resource name of the attribute - // config. Format: `projects/*/locations/*/catalogs/*/attributesConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Enable attribute(s) config at catalog level. - // For example, indexable, dynamic_facetable, or searchable for each - // attribute. - // - // The key is catalog attribute's name. - // For example: `color`, `brands`, `attributes.custom_attribute`, such as - // `attributes.xyz`. - // - // The maximum number of catalog attributes allowed in a request is 1000. - map catalog_attributes = 2; - - // Output only. The - // [AttributeConfigLevel][google.cloud.retail.v2alpha.AttributeConfigLevel] - // used for this catalog. - AttributeConfigLevel attribute_config_level = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Catalog level autocomplete config for customers to customize autocomplete -// feature's settings. -message CompletionConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/CompletionConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig" - }; - - // Required. Immutable. Fully qualified name - // `projects/*/locations/*/catalogs/*/completionConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Specifies the matching order for autocomplete suggestions, e.g., a query - // consisting of 'sh' with 'out-of-order' specified would suggest "women's - // shoes", whereas a query of 'red s' with 'exact-prefix' specified would - // suggest "red shoes". Currently supported values: - // - // * 'out-of-order' - // * 'exact-prefix' - // - // Default value: 'exact-prefix'. - string matching_order = 2; - - // The maximum number of autocomplete suggestions returned per term. Default - // value is 20. If left unset or set to 0, then will fallback to default - // value. - // - // Value range is 1 to 20. - int32 max_suggestions = 3; - - // The minimum number of characters needed to be typed in order to get - // suggestions. Default value is 2. If left unset or set to 0, then will - // fallback to default value. - // - // Value range is 1 to 20. - int32 min_prefix_length = 4; - - // If set to true, the auto learning function is enabled. Auto learning uses - // user data to generate suggestions using ML techniques. Default value is - // false. Only after enabling auto learning can users use `cloud-retail` - // data in - // [CompleteQueryRequest][google.cloud.retail.v2alpha.CompleteQueryRequest]. - bool auto_learning = 11; - - // Output only. The source data for the latest import of the autocomplete - // suggestion phrases. - CompletionDataInputConfig suggestions_input_config = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest suggestion terms - // list import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API - // method to retrieve the latest state of the Long Running Operation. - string last_suggestions_import_operation = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The source data for the latest import of the autocomplete - // denylist phrases. - CompletionDataInputConfig denylist_input_config = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest denylist import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to - // retrieve the latest state of the Long Running Operation. - string last_denylist_import_operation = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The source data for the latest import of the autocomplete - // allowlist phrases. - CompletionDataInputConfig allowlist_input_config = 9 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the LRO corresponding to the latest allowlist import. - // - // Can use [GetOperation][google.longrunning.Operations.GetOperation] API to - // retrieve the latest state of the Long Running Operation. - string last_allowlist_import_operation = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represents a link between a Merchant Center account and a branch. -// After a link is established, products from the linked Merchant Center account -// are streamed to the linked branch. -message MerchantCenterLink { - // Required. The linked [Merchant Center account - // ID](https://developers.google.com/shopping-content/guides/accountstatuses). - // The account must be a standalone account or a sub-account of a MCA. - int64 merchant_center_account_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // The branch ID (e.g. 0/1/2) within this catalog that products from - // merchant_center_account_id are streamed to. When updating this field, an - // empty value will use the currently configured default branch. However, - // changing the default branch later on won't change the linked branch here. - // - // A single branch ID can only have one linked Merchant Center account ID. - string branch_id = 2; - - // String representing the destination to import for, all if left empty. - // List of possible values is given in [Included - // destination](https://support.google.com/merchants/answer/7501026). - // List of allowed string values: - // "Shopping_ads", "Buy_on_google_listings", "Display_ads", "Local_inventory - // _ads", "Free_listings", "Free_local_listings" - // NOTE: The string values are case sensitive. - repeated string destinations = 3; - - // Region code of offers to accept. 2-letter Uppercase ISO 3166-1 alpha-2 - // code. List of values can be found - // [here](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry) - // under the `region` tag. If left blank no region filtering will be - // performed. - // - // Example value: `US`. - string region_code = 4; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // ISO 639-1. - // - // This specifies the language of offers in Merchant Center that will be - // accepted. If empty no language filtering will be performed. - // - // Example value: `en`. - string language_code = 5; - - // Criteria for the Merchant Center feeds to be ingested via the link. - // All offers will be ingested if the list is empty. - // Otherwise the offers will be ingested from selected feeds. - repeated MerchantCenterFeedFilter feeds = 6; -} - -// Merchant Center Feed filter criterion. -message MerchantCenterFeedFilter { - // Merchant Center primary feed ID. - // Deprecated: use data_source_id instead. - int64 primary_feed_id = 1 [deprecated = true]; - - // AFM data source ID. - int64 data_source_id = 3; - - // Merchant Center primary feed name. The name is used for the display - // purposes only. - string primary_feed_name = 2; -} - -// Configures Merchant Center linking. -// Links contained in the config will be used to sync data from a Merchant -// Center account to a Cloud Retail branch. -message MerchantCenterLinkingConfig { - // Links between Merchant Center accounts and branches. - repeated MerchantCenterLink links = 1; -} - -// The catalog configuration. -message Catalog { - option (google.api.resource) = { - type: "retail.googleapis.com/Catalog" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}" - }; - - // Required. Immutable. The fully qualified resource name of the catalog. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. Immutable. The catalog display name. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string display_name = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. The product level configuration. - ProductLevelConfig product_level_config = 4 - [(google.api.field_behavior) = REQUIRED]; - - // The Merchant Center linking configuration. - // After a link is added, the data stream from Merchant Center to Cloud Retail - // will be enabled automatically. The requester must have access to the - // Merchant Center account in order to make changes to this field. - MerchantCenterLinkingConfig merchant_center_linking_config = 6; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline deleted file mode 100644 index f05ab3bac7b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/catalog_service.proto.baseline +++ /dev/null @@ -1,528 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/catalog.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CatalogServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing catalog configuration. -service CatalogService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated - // with the project. - rpc ListCatalogs(ListCatalogsRequest) returns (ListCatalogsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*}/catalogs" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s. - rpc UpdateCatalog(UpdateCatalogRequest) returns (Catalog) { - option (google.api.http) = { - patch: "/v2alpha/{catalog.name=projects/*/locations/*/catalogs/*}" - body: "catalog" - }; - option (google.api.method_signature) = "catalog,update_mask"; - } - - // Set a specified branch id as default branch. API methods such as - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // will treat requests using "default_branch" to the actual branch id set as - // default. - // - // For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as - // default, setting - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent - // to setting - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // `projects/*/locations/*/catalogs/*/branches/1`. - // - // Using multiple branches can be useful when developers would like - // to have a staging branch to test and verify for future usage. When it - // becomes ready, developers switch on the staging branch using this API - // while keeping using - // `projects/*/locations/*/catalogs/*/branches/default_branch` as - // [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to - // route the traffic to this staging branch. - // - // CAUTION: If you have live predict/search traffic, switching the default - // branch could potentially cause outages if the ID space of the new branch - // is very different from the old one. - // - // More specifically: - // - // * PredictionService will only return product IDs from branch {newBranch}. - // * SearchService will only return product IDs from branch {newBranch} - // (if branch is not explicitly set). - // * UserEventService will only join events with products from branch - // {newBranch}. - rpc SetDefaultBranch(SetDefaultBranchRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:setDefaultBranch" - body: "*" - }; - option (google.api.method_signature) = "catalog"; - } - - // Get which branch is currently default branch set by - // [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] - // method under a specified parent catalog. - rpc GetDefaultBranch(GetDefaultBranchRequest) - returns (GetDefaultBranchResponse) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:getDefaultBranch" - }; - option (google.api.method_signature) = "catalog"; - } - - // Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]. - rpc GetCompletionConfig(GetCompletionConfigRequest) - returns (CompletionConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/completionConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s. - rpc UpdateCompletionConfig(UpdateCompletionConfigRequest) - returns (CompletionConfig) { - option (google.api.http) = { - patch: "/v2alpha/{completion_config.name=projects/*/locations/*/catalogs/*/completionConfig}" - body: "completion_config" - }; - option (google.api.method_signature) = "completion_config,update_mask"; - } - - // Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - rpc GetAttributesConfig(GetAttributesConfigRequest) - returns (AttributesConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/attributesConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // The catalog attributes in the request will be updated in the catalog, or - // inserted if they do not exist. Existing catalog attributes not included in - // the request will remain unchanged. Attributes that are assigned to - // products, but do not exist at the catalog level, are always included in the - // response. The product attribute is assigned default values for missing - // catalog attribute fields, e.g., searchable and dynamic facetable options. - rpc UpdateAttributesConfig(UpdateAttributesConfigRequest) - returns (AttributesConfig) { - option (google.api.http) = { - patch: "/v2alpha/{attributes_config.name=projects/*/locations/*/catalogs/*/attributesConfig}" - body: "attributes_config" - }; - option (google.api.method_signature) = "attributes_config,update_mask"; - } - - // Adds the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // add already exists, an ALREADY_EXISTS error is returned. - rpc AddCatalogAttribute(AddCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:addCatalogAttribute" - body: "*" - }; - } - - // Removes the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // remove does not exist, a NOT_FOUND error is returned. - rpc RemoveCatalogAttribute(RemoveCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:removeCatalogAttribute" - body: "*" - }; - } - - // Removes all specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. - rpc BatchRemoveCatalogAttributes(BatchRemoveCatalogAttributesRequest) - returns (BatchRemoveCatalogAttributesResponse) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:batchRemoveCatalogAttributes" - body: "*" - }; - } - - // Replaces the specified - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by - // updating the catalog attribute with the same - // [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. - // - // If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to - // replace does not exist, a NOT_FOUND error is returned. - rpc ReplaceCatalogAttribute(ReplaceCatalogAttributeRequest) - returns (AttributesConfig) { - option (google.api.http) = { - post: "/v2alpha/{attributes_config=projects/*/locations/*/catalogs/*/attributesConfig}:replaceCatalogAttribute" - body: "*" - }; - } -} - -// Request for -// [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] -// method. -message ListCatalogsRequest { - // Required. The account resource name with an associated location. - // - // If the caller does not have permission to list - // [Catalog][google.cloud.retail.v2alpha.Catalog]s under this location, - // regardless of whether or not this location exists, a PERMISSION_DENIED - // error is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of [Catalog][google.cloud.retail.v2alpha.Catalog]s to - // return. If unspecified, defaults to 50. The maximum allowed value is 1000. - // Values above 1000 will be coerced to 1000. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 page_size = 2; - - // A page token - // [ListCatalogsResponse.next_page_token][google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token], - // received from a previous - // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 3; -} - -// Response for -// [CatalogService.ListCatalogs][google.cloud.retail.v2alpha.CatalogService.ListCatalogs] -// method. -message ListCatalogsResponse { - // All the customer's [Catalog][google.cloud.retail.v2alpha.Catalog]s. - repeated Catalog catalogs = 1; - - // A token that can be sent as - // [ListCatalogsRequest.page_token][google.cloud.retail.v2alpha.ListCatalogsRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 2; -} - -// Request for -// [CatalogService.UpdateCatalog][google.cloud.retail.v2alpha.CatalogService.UpdateCatalog] -// method. -message UpdateCatalogRequest { - // Required. The [Catalog][google.cloud.retail.v2alpha.Catalog] to update. - // - // If the caller does not have permission to update the - // [Catalog][google.cloud.retail.v2alpha.Catalog], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Catalog][google.cloud.retail.v2alpha.Catalog] to update does not - // exist, a NOT_FOUND error is returned. - Catalog catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Catalog][google.cloud.retail.v2alpha.Catalog] to update. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message to set a specified branch as new default_branch. -message SetDefaultBranchRequest { - // Full resource name of the catalog, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // The final component of the resource name of a branch. - // - // This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - // error is returned. - // - // If there are no sufficient active products in the targeted branch and - // [force][google.cloud.retail.v2alpha.SetDefaultBranchRequest.force] is not - // set, a FAILED_PRECONDITION error is returned. - string branch_id = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Some note on this request, this can be retrieved by - // [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch] - // before next valid default branch set occurs. - // - // This field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string note = 3; - - // If set to true, it permits switching to a branch with - // [branch_id][google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id] - // even if it has no sufficient active products. - bool force = 4; -} - -// Request message to show which branch is currently the default branch. -message GetDefaultBranchRequest { - // The parent catalog resource name, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response message of -// [CatalogService.GetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch]. -message GetDefaultBranchResponse { - // Full resource name of the branch id currently set as default branch. - string branch = 1 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // The time when this branch is set to default. - google.protobuf.Timestamp set_time = 2; - - // This corresponds to - // [SetDefaultBranchRequest.note][google.cloud.retail.v2alpha.SetDefaultBranchRequest.note] - // field, when this branch was set as default. - string note = 3; -} - -// Request for -// [CatalogService.GetCompletionConfig][google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig] -// method. -message GetCompletionConfigRequest { - // Required. Full CompletionConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/CompletionConfig" - } - ]; -} - -// Request for -// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig] -// method. -message UpdateCompletionConfigRequest { - // Required. The - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. - // - // If the caller does not have permission to update the - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to - // update does not exist, a NOT_FOUND error is returned. - CompletionConfig completion_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig] to update. - // The following are the only supported fields: - // - // * [CompletionConfig.matching_order][google.cloud.retail.v2alpha.CompletionConfig.matching_order] - // * [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions] - // * [CompletionConfig.min_prefix_length][google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length] - // * [CompletionConfig.auto_learning][google.cloud.retail.v2alpha.CompletionConfig.auto_learning] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [CatalogService.GetAttributesConfig][google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig] -// method. -message GetAttributesConfigRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; -} - -// Request for -// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig] -// method. -message UpdateAttributesConfigRequest { - // Required. The - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. - AttributesConfig attributes_config = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] to update. - // The following is the only supported field: - // - // * [AttributesConfig.catalog_attributes][google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute] -// method. -message AddCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add. - CatalogAttribute catalog_attribute = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute] -// method. -message RemoveCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The attribute name key of the - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove. - string key = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes] -// method. -message BatchRemoveCatalogAttributesRequest { - // Required. The attributes config resource shared by all catalog attributes - // being deleted. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The attribute name keys of the - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s to - // delete. A maximum of 1000 catalog attributes can be deleted in a batch. - repeated string attribute_keys = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response of the -// [CatalogService.BatchRemoveCatalogAttributes][google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes]. -message BatchRemoveCatalogAttributesResponse { - // Catalog attributes that were deleted. Only pre-loaded [catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are - // neither [in - // use][google.cloud.retail.v2alpha.CatalogAttribute.in_use] by - // products nor predefined can be deleted. - repeated string deleted_catalog_attributes = 1; - - // Catalog attributes that were reset. [Catalog - // attributes][google.cloud.retail.v2alpha.CatalogAttribute] that are either - // [in use][google.cloud.retail.v2alpha.CatalogAttribute.in_use] by products - // or are predefined attributes cannot be deleted; however, their - // configuration properties will reset to default values upon removal request. - repeated string reset_catalog_attributes = 2; -} - -// Request for -// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute] -// method. -message ReplaceCatalogAttributeRequest { - // Required. Full AttributesConfig resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - string attributes_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AttributesConfig" - } - ]; - - // Required. The updated - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]. - CatalogAttribute catalog_attribute = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to update. - // The following are NOT supported: - // - // * [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/common.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/common.proto.baseline deleted file mode 100644 index cee0a42a399a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/common.proto.baseline +++ /dev/null @@ -1,1004 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// At which level we offer configuration for attributes. -enum AttributeConfigLevel { - // Value used when unset. In this case, server behavior defaults to - // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2alpha.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]. - ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0; - - // At this level, we honor the attribute configurations set in - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes]. - PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1; - - // At this level, we honor the attribute configurations set in - // `CatalogConfig.attribute_configs`. - CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2; -} - -// The type of solution. -enum SolutionType { - // Default value. - SOLUTION_TYPE_UNSPECIFIED = 0; - - // Used for Recommendations AI. - SOLUTION_TYPE_RECOMMENDATION = 1; - - // Used for Retail Search. - SOLUTION_TYPE_SEARCH = 2; -} - -// If filtering for recommendations is enabled. -enum RecommendationsFilteringOption { - // Value used when unset. - // In this case, server behavior defaults to - // [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2alpha.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]. - RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0; - - // Recommendation filtering is disabled. - RECOMMENDATIONS_FILTERING_DISABLED = 1; - - // Recommendation filtering is enabled. - RECOMMENDATIONS_FILTERING_ENABLED = 3; -} - -// The use case of Cloud Retail Search. -enum SearchSolutionUseCase { - // The value when it's unspecified. In this case, server behavior defaults to - // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2alpha.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]. - SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0; - - // Search use case. Expects the traffic has a non-empty - // [query][google.cloud.retail.v2alpha.SearchRequest.query]. - SEARCH_SOLUTION_USE_CASE_SEARCH = 1; - - // Browse use case. Expects the traffic has an empty - // [query][google.cloud.retail.v2alpha.SearchRequest.query]. - SEARCH_SOLUTION_USE_CASE_BROWSE = 2; -} - -// Metadata that is used to define a condition that triggers an action. -// A valid condition must specify at least one of 'query_terms' or -// 'products_filter'. If multiple fields are specified, the condition is met if -// all the fields are satisfied e.g. if a set of query terms and product_filter -// are set, then only items matching the product_filter for requests with a -// query matching the query terms wil get boosted. -message Condition { - // Query terms that we want to match on. - message QueryTerm { - // The value of the term to match on. - // Value cannot be empty. - // Value can have at most 3 terms if specified as a partial match. Each - // space separated string is considered as one term. - // For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms - // and not allowed for a partial match. - string value = 1; - - // Whether this is supposed to be a full or partial match. - bool full_match = 2; - } - - // Used for time-dependent conditions. - // Example: Want to have rule applied for week long sale. - message TimeRange { - // Start of time range. Range is inclusive. - google.protobuf.Timestamp start_time = 1; - - // End of time range. Range is inclusive. - google.protobuf.Timestamp end_time = 2; - } - - // A list (up to 10 entries) of terms to match the query on. If not - // specified, match all queries. - // If many query terms are specified, the condition - // is matched if any of the terms is a match (i.e. using the OR operator). - repeated QueryTerm query_terms = 1; - - // Range of time(s) specifying when Condition is active. - // Condition true if any time range matches. - repeated TimeRange active_time_range = 3; - - // Used to support browse uses cases. - // A list (up to 10 entries) of categories or departments. - // The format should be the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - repeated string page_categories = 4; -} - -// A rule is a condition-action pair -// -// * A condition defines when a rule is to be triggered. -// * An action specifies what occurs on that trigger. -// Currently rules only work for [controls][google.cloud.retail.v2alpha.Control] -// with -// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. -message Rule { - // A boost action to apply to results matching condition specified above. - message BoostAction { - // Strength of the condition boost, which must be in [-1, 1]. Negative - // boost means demotion. Default is 0.0. - // - // Setting to 1.0 gives the item a big promotion. However, it does not - // necessarily mean that the boosted item will be the top result at all - // times, nor that other items will be excluded. Results could still be - // shown even when none of them matches the condition. And results that - // are significantly more relevant to the search query can still trump - // your heavily favored but irrelevant items. - // - // Setting to -1.0 gives the item a big demotion. However, results that - // are deeply relevant might still be shown. The item will have an - // upstream battle to get a fairly high ranking, but it is not blocked out - // completely. - // - // Setting to 0.0 means no boost applied. The boosting condition is - // ignored. - float boost = 1; - - // The filter can have a max size of 5000 characters. - // An expression which specifies which products to apply an action to. - // The syntax and supported fields are the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. - // - // Examples: - // - // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* - string products_filter = 2; - } - - // * Rule Condition: - // - No - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // provided is a global match. - // - 1 or more - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // provided are combined with OR operator. - // - // * Action Input: The request query and filter that are applied to the - // retrieved products, in addition to any filters already provided with the - // SearchRequest. The AND operator is used to combine the query's existing - // filters with the filter rule(s). NOTE: May result in 0 results when - // filters conflict. - // - // * Action Result: Filters the returned objects to be ONLY those that passed - // the filter. - message FilterAction { - // A filter to apply on the matching condition results. Supported features: - // - // * [filter][google.cloud.retail.v2alpha.Rule.FilterAction.filter] must be - // set. - // * Filter syntax is identical to - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - // For more - // information, see [Filter](/retail/docs/filter-and-order#filter). - // * To filter products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue":
- // *(id: ANY("product_1", "product_2"))
* - // *AND
* - // *(colorFamilies: ANY("Red", "Blue"))
* - string filter = 1; - } - - // Redirects a shopper to a specific page. - // - // * Rule Condition: - // Must specify - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms]. - // * Action Input: Request Query - // * Action Result: Redirects shopper to provided uri. - message RedirectAction { - // URL must have length equal or less than 2000 characters. - string redirect_uri = 1; - } - - // Creates a set of terms that will be treated as synonyms of each other. - // Example: synonyms of "sneakers" and "shoes": - // - // * "sneakers" will use a synonym of "shoes". - // * "shoes" will use a synonym of "sneakers". - message TwowaySynonymsAction { - // Defines a set of synonyms. - // Can specify up to 100 synonyms. - // Must specify at least 2 synonyms. - repeated string synonyms = 1; - } - - // Maps a set of terms to a set of synonyms. - // Set of synonyms will be treated as synonyms of each query term only. - // `query_terms` will not be treated as synonyms of each other. - // Example: "sneakers" will use a synonym of "shoes". - // "shoes" will not use a synonym of "sneakers". - message OnewaySynonymsAction { - // Terms from the search query. - // Will treat synonyms as their synonyms. - // Not themselves synonyms of the synonyms. - // Can specify up to 100 terms. - repeated string query_terms = 3; - - // Defines a set of synonyms. - // Cannot contain duplicates. - // Can specify up to 100 synonyms. - repeated string synonyms = 4; - - // Will be [deprecated = true] post migration; - repeated string oneway_terms = 2; - } - - // Prevents `query_term` from being associated with specified terms during - // search. - // Example: Don't associate "gShoe" and "cheap". - message DoNotAssociateAction { - // Terms from the search query. - // Will not consider do_not_associate_terms for search if in search query. - // Can specify up to 100 terms. - repeated string query_terms = 2; - - // Cannot contain duplicates or the query term. - // Can specify up to 100 terms. - repeated string do_not_associate_terms = 3; - - // Will be [deprecated = true] post migration; - repeated string terms = 1; - } - - // Replaces a term in the query. Multiple replacement candidates can be - // specified. All `query_terms` will be replaced with the replacement term. - // Example: Replace "gShoe" with "google shoe". - message ReplacementAction { - // Terms from the search query. - // Will be replaced by replacement term. - // Can specify up to 100 terms. - repeated string query_terms = 2; - - // Term that will be used for replacement. - string replacement_term = 3; - - // Will be [deprecated = true] post migration; - string term = 1; - } - - // Prevents a term in the query from being used in search. - // Example: Don't search for "shoddy". - message IgnoreAction { - // Terms to ignore in the search query. - repeated string ignore_terms = 1; - } - - // Force returns an attribute/facet in the request around a certain position - // or above. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Inputs: attribute name, position - // - // * Action Result: Will force return a facet key around a certain position - // or above if the condition is satisfied. - // - // Example: Suppose the query is "shoes", the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is "shoes", the - // [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2alpha.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name] - // is "size" and the - // [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2alpha.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position] - // is 8. - // - // Two cases: a) The facet key "size" is not already in the top 8 slots, then - // the facet "size" will appear at a position close to 8. b) The facet key - // "size" in among the top 8 positions in the request, then it will stay at - // its current rank. - message ForceReturnFacetAction { - // Each facet position adjustment consists of a single attribute name (i.e. - // facet key) along with a specified position. - message FacetPositionAdjustment { - // The attribute name to force return as a facet. Each attribute name - // should be a valid attribute name, be non-empty and contain at most 80 - // characters long. - string attribute_name = 1; - - // This is the position in the request as explained above. It should be - // strictly positive be at most 100. - int32 position = 2; - } - - // Each instance corresponds to a force return attribute for the given - // condition. There can't be more 15 instances here. - repeated FacetPositionAdjustment facet_position_adjustments = 1; - } - - // Removes an attribute/facet in the request if is present. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Input: attribute name - // - // * Action Result: Will remove the attribute (as a facet) from the request - // if it is present. - // - // Example: Suppose the query is "shoes", the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is "shoes" and the attribute name "size", then facet key "size" will be - // removed from the request (if it is present). - message RemoveFacetAction { - // The attribute names (i.e. facet keys) to remove from the dynamic facets - // (if present in the request). There can't be more 3 attribute names. - // Each attribute name should be a valid attribute name, be non-empty and - // contain at most 80 characters. - repeated string attribute_names = 1; - } - - // Pins one or more specified products to a specific position in the - // results. - // - // * Rule Condition: - // Must specify non-empty - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // (for search only) or - // [Condition.page_categories][google.cloud.retail.v2alpha.Condition.page_categories] - // (for browse only), but can't specify both. - // - // * Action Input: mapping of `[pin_position, product_id]` pairs (pin position - // uses 1-based indexing). - // - // * Action Result: Will pin products with matching ids to the position - // specified in the final result order. - // - // Example: Suppose the query is `shoes`, the - // [Condition.query_terms][google.cloud.retail.v2alpha.Condition.query_terms] - // is `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will - // be pinned to the top position in the final results. - // - // If multiple PinActions are matched to a single request the actions will - // be processed from most to least recently updated. - // - // Pins to positions larger than the max allowed page size of 120 are not - // allowed. - message PinAction { - // Required. A map of positions to product_ids. - // - // Partial matches per action are allowed, if a certain position in the map - // is already filled that `[position, product_id]` pair will be ignored - // but the rest may still be applied. This case will only occur if multiple - // pin actions are matched to a single request, as the map guarantees that - // pin positions are unique within the same action. - // - // Duplicate product_ids are not permitted within a single pin map. - // - // The max size of this map is 120, equivalent to the max [request page - // size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body). - map pin_map = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // An action must be provided. - oneof action { - // A boost action. - BoostAction boost_action = 2; - - // Redirects a shopper to a specific page. - RedirectAction redirect_action = 3; - - // Treats specific term as a synonym with a group of terms. - // Group of terms will not be treated as synonyms with the specific term. - OnewaySynonymsAction oneway_synonyms_action = 6; - - // Prevents term from being associated with other terms. - DoNotAssociateAction do_not_associate_action = 7; - - // Replaces specific terms in the query. - ReplacementAction replacement_action = 8; - - // Ignores specific terms from query during search. - IgnoreAction ignore_action = 9; - - // Filters results. - FilterAction filter_action = 10; - - // Treats a set of terms as synonyms of one another. - TwowaySynonymsAction twoway_synonyms_action = 11; - - // Force returns an attribute as a facet in the request. - ForceReturnFacetAction force_return_facet_action = 12; - - // Remove an attribute as a facet in the request (if present). - RemoveFacetAction remove_facet_action = 13; - - // Pins one or more specified products to a specific position in the - // results. - PinAction pin_action = 14; - } - - // Required. The condition that triggers the rule. - // If the condition is empty, the rule will always apply. - Condition condition = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// An intended audience of the [Product][google.cloud.retail.v2alpha.Product] -// for whom it's sold. -message Audience { - // The genders of the audience. Strongly encouraged to use the standard - // values: "male", "female", "unisex". - // - // At most 5 values are allowed. Each value must be a UTF-8 encoded string - // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Google Merchant Center property - // [gender](https://support.google.com/merchants/answer/6324479). Schema.org - // property - // [Product.audience.suggestedGender](https://schema.org/suggestedGender). - repeated string genders = 1; - - // The age groups of the audience. Strongly encouraged to use the standard - // values: "newborn" (up to 3 months old), "infant" (3–12 months old), - // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically - // teens or older). - // - // At most 5 values are allowed. Each value must be a UTF-8 encoded string - // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Google Merchant Center property - // [age_group](https://support.google.com/merchants/answer/6324463). - // Schema.org property - // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and - // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge). - repeated string age_groups = 2; -} - -// The color information of a [Product][google.cloud.retail.v2alpha.Product]. -message ColorInfo { - // The standard color families. Strongly recommended to use the following - // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple", - // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed". - // Normally it is expected to have only 1 color family. May consider using - // single "Mixed" instead of multiple values. - // - // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - // - // The colorFamilies field as a system attribute is not a required field but - // strongly recommended to be specified. Google Search models treat this field - // as more important than a custom product attribute when specified. - repeated string color_families = 1; - - // The color display names, which may be different from standard color family - // names, such as the color aliases used in the website frontend. Normally - // it is expected to have only 1 color. May consider using single "Mixed" - // instead of multiple values. - // - // A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - repeated string colors = 2; -} - -// A custom attribute that is not explicitly modeled in -// [Product][google.cloud.retail.v2alpha.Product]. -message CustomAttribute { - // The textual values of this custom attribute. For example, `["yellow", - // "green"]` when the key is "color". - // - // Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Exactly one of [text][google.cloud.retail.v2alpha.CustomAttribute.text] or - // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be - // set. Otherwise, an INVALID_ARGUMENT error is returned. - repeated string text = 1; - - // The numerical values of this custom attribute. For example, `[2.3, 15.4]` - // when the key is "lengths_cm". - // - // Exactly one of [text][google.cloud.retail.v2alpha.CustomAttribute.text] or - // [numbers][google.cloud.retail.v2alpha.CustomAttribute.numbers] should be - // set. Otherwise, an INVALID_ARGUMENT error is returned. - repeated double numbers = 2; - - // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the - // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about - // product-level attribute configuration, see [Configuration - // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - // If true, custom attribute values are searchable by text queries in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This field is ignored in a - // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. - // - // Only set if type [text][google.cloud.retail.v2alpha.CustomAttribute.text] - // is set. Otherwise, a INVALID_ARGUMENT error is returned. - optional bool searchable = 3 [deprecated = true]; - - // This field is normally ignored unless - // [AttributesConfig.attribute_config_level][google.cloud.retail.v2alpha.AttributesConfig.attribute_config_level] - // of the [Catalog][google.cloud.retail.v2alpha.Catalog] is set to the - // deprecated 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about - // product-level attribute configuration, see [Configuration - // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes). - // If true, custom attribute values are indexed, so that they can be filtered, - // faceted or boosted in - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This field is ignored in a - // [UserEvent][google.cloud.retail.v2alpha.UserEvent]. - // - // See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // for more details. - optional bool indexable = 4 [deprecated = true]; -} - -// Fulfillment information, such as the store IDs for in-store pickup or region -// IDs for different shipping methods. -message FulfillmentInfo { - // The fulfillment type, including commonly used types (such as pickup in - // store and same day delivery), and custom types. Customers have to map - // custom types to their display names before rendering UI. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - string type = 1; - - // The IDs for this [type][google.cloud.retail.v2alpha.FulfillmentInfo.type], - // such as the store IDs for - // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // or the region IDs for - // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - // - // A maximum of 3000 values are allowed. Each value must be a string with a - // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such - // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is - // returned. - repeated string place_ids = 2; -} - -// [Product][google.cloud.retail.v2alpha.Product] image. Recommendations AI and -// Retail Search use product images to improve prediction and search results. -// Product images can be returned in results, and are shown in prediction or -// search previews in the console. Please try to provide correct product images -// and avoid using images with size too small. -message Image { - // Required. URI of the image. - // - // This field must be a valid UTF-8 encoded URI with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Google Merchant Center property - // [image_link](https://support.google.com/merchants/answer/6324350). - // Schema.org property [Product.image](https://schema.org/image). - string uri = 1 [(google.api.field_behavior) = REQUIRED]; - - // Height of the image in number of pixels. - // - // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 height = 2; - - // Width of the image in number of pixels. - // - // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 width = 3; -} - -// A floating point interval. -message Interval { - // The lower bound of the interval. If neither of the min fields are set, then - // the lower bound is negative infinity. - // - // This field must not be larger than max. - // Otherwise, an INVALID_ARGUMENT error is returned. - oneof min { - // Inclusive lower bound. - double minimum = 1; - - // Exclusive lower bound. - double exclusive_minimum = 2; - } - - // The upper bound of the interval. If neither of the max fields are set, then - // the upper bound is positive infinity. - // - // This field must be not smaller than min. - // Otherwise, an INVALID_ARGUMENT error is returned. - oneof max { - // Inclusive upper bound. - double maximum = 3; - - // Exclusive upper bound. - double exclusive_maximum = 4; - } -} - -// The price information of a [Product][google.cloud.retail.v2alpha.Product]. -message PriceInfo { - // The price range of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - message PriceRange { - // The inclusive - // [Product.pricing_info.price][google.cloud.retail.v2alpha.PriceInfo.price] - // interval of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - Interval price = 1; - - // The inclusive - // [Product.pricing_info.original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] - // internal of all - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] having the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id]. - Interval original_price = 2; - } - - // The 3-letter currency code defined in [ISO - // 4217](https://www.iso.org/iso-4217-currency-codes.html). - // - // If this field is an unrecognizable currency code, an INVALID_ARGUMENT - // error is returned. - // - // The - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s with the same - // [Product.primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // must share the same - // [currency_code][google.cloud.retail.v2alpha.PriceInfo.currency_code]. - // Otherwise, a FAILED_PRECONDITION error is returned. - string currency_code = 1; - - // Price of the product. - // - // Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). Schema.org - // property [Offer.price](https://schema.org/price). - float price = 2; - - // Price of the product without any discount. If zero, by default set to be - // the [price][google.cloud.retail.v2alpha.PriceInfo.price]. If set, - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] - // should be greater than or equal to - // [price][google.cloud.retail.v2alpha.PriceInfo.price], otherwise an - // INVALID_ARGUMENT error is thrown. - float original_price = 3; - - // The costs associated with the sale of a particular product. Used for gross - // profit reporting. - // - // * Profit = [price][google.cloud.retail.v2alpha.PriceInfo.price] - - // [cost][google.cloud.retail.v2alpha.PriceInfo.cost] - // - // Google Merchant Center property - // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895). - float cost = 4; - - // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] - // starts to be effective. This can be set as a future timestamp, and the - // [price][google.cloud.retail.v2alpha.PriceInfo.price] is only used for - // search after - // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. - // If so, the - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must - // be set and - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is - // used before - // [price_effective_time][google.cloud.retail.v2alpha.PriceInfo.price_effective_time]. - // - // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is - // always effective because it will cause additional latency during search. - google.protobuf.Timestamp price_effective_time = 5; - - // The timestamp when the [price][google.cloud.retail.v2alpha.PriceInfo.price] - // stops to be effective. The - // [price][google.cloud.retail.v2alpha.PriceInfo.price] is used for search - // before - // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. - // If this field is set, the - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] must - // be set and - // [original_price][google.cloud.retail.v2alpha.PriceInfo.original_price] is - // used after - // [price_expire_time][google.cloud.retail.v2alpha.PriceInfo.price_expire_time]. - // - // Do not set if [price][google.cloud.retail.v2alpha.PriceInfo.price] is - // always effective because it will cause additional latency during search. - google.protobuf.Timestamp price_expire_time = 6; - - // Output only. The price range of all the child - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s grouped together on the - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. Only populated for - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s. - // - // Note: This field is OUTPUT_ONLY for - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. - // Do not set this field in API requests. - PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The rating of a [Product][google.cloud.retail.v2alpha.Product]. -message Rating { - // The total number of ratings. This value is independent of the value of - // [rating_histogram][google.cloud.retail.v2alpha.Rating.rating_histogram]. - // - // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is - // returned. - int32 rating_count = 1; - - // The average rating of the [Product][google.cloud.retail.v2alpha.Product]. - // - // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is - // returned. - float average_rating = 2; - - // List of rating counts per rating value (index = rating - 1). The list is - // empty if there is no rating. If the list is non-empty, its size is - // always 5. Otherwise, an INVALID_ARGUMENT error is returned. - // - // For example, [41, 14, 13, 47, 303]. It means that the - // [Product][google.cloud.retail.v2alpha.Product] got 41 ratings with 1 star, - // 14 ratings with 2 star, and so on. - repeated int32 rating_histogram = 3; -} - -// Information of an end user. -message UserInfo { - // Highly recommended for logged-in users. Unique identifier for logged-in - // user, such as a user name. Don't set for anonymous users. - // - // Always use a hashed value for this ID. - // - // Don't set the field to the same fixed ID for different users. This mixes - // the event history of those users together, which results in degraded - // model quality. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string user_id = 1; - - // The end user's IP address. This field is used to extract location - // information for personalization. - // - // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6 - // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // This should not be set when: - // - // * setting - // [SearchRequest.user_info][google.cloud.retail.v2alpha.SearchRequest.user_info]. - // * using the JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent] - // or if - // [direct_user_request][google.cloud.retail.v2alpha.UserInfo.direct_user_request] - // is set. - string ip_address = 2; - - // User agent as included in the HTTP header. - // The field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This should not be set when using the client side event reporting with - // GTM or JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent] - // or if - // [direct_user_request][google.cloud.retail.v2alpha.UserInfo.direct_user_request] - // is set. - string user_agent = 3; - - // True if the request is made directly from the end user, in which case the - // [ip_address][google.cloud.retail.v2alpha.UserInfo.ip_address] and - // [user_agent][google.cloud.retail.v2alpha.UserInfo.user_agent] can be - // populated from the HTTP request. This flag should be set only if the API - // request is made directly from the end user such as a mobile app (and not if - // a gateway or a server is processing and pushing the user events). - // - // This should not be set when using the JavaScript tag in - // [UserEventService.CollectUserEvent][google.cloud.retail.v2alpha.UserEventService.CollectUserEvent]. - bool direct_user_request = 4; -} - -// The inventory information at a place (e.g. a store) identified -// by a place ID. -message LocalInventory { - // Product availability. If this field is unspecified, the product is - // assumed to be in stock. - enum Availability { - // Default product availability. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK] - // if unset. - AVAILABILITY_UNSPECIFIED = 0; - - // Product in stock. - IN_STOCK = 1; - - // Product out of stock. - OUT_OF_STOCK = 2; - - // Product that is in pre-order state. - PREORDER = 3; - - // Product that is back-ordered (i.e. temporarily out of stock). - BACKORDER = 4; - } - - // Optional. The place ID for the current set of inventory information. - string place_id = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Product price and cost information. - // - // Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). - PriceInfo price_info = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The availability of the - // [Product][google.cloud.retail.v2alpha.Product] at this place_id. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.IN_STOCK]. - // - // For primary products with variants set the availability of the primary as - // [Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.LocalInventory.Availability.OUT_OF_STOCK] - // and set the true availability at the variant level. This way the primary - // product will be considered "in stock" as long as it has at least one - // variant in stock. - // - // For primary products with no variants set the true availability at the - // primary level. - // - // Corresponding properties: Google Merchant Center property - // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org property [Offer.availability](https://schema.org/availability). - // - // This field is currently only used by the Recommendations API. For Search, - // please make use of - // [fulfillment_types][google.cloud.retail.v2alpha.LocalInventory.fulfillment_types] - // or custom attributes for similar behaviour. See [here]( - // https://cloud.google.com/retail/docs/local-inventory-updates#local-inventory-update-methods) - // for more details. - Availability availability = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Additional local inventory attributes, for example, store name, - // promotion tags, etc. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * At most 30 attributes are allowed. - // * The key must be a UTF-8 encoded string with a length limit of 32 - // characters. - // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, - // key0LikeThis or KEY_1_LIKE_THIS. - // * The attribute values must be of the same type (text or number). - // * Only 1 value is allowed for each attribute. - // * For text values, the length limit is 256 UTF-8 characters. - // * The attribute does not support search. The `searchable` field should be - // unset or set to false. - // * The max summed total bytes of custom attribute keys and values per - // product is 5MiB. - map attributes = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Supported fulfillment types. Valid fulfillment type values - // include commonly used types (such as pickup in store and same day - // delivery), and custom types. Customers have to map custom types to their - // display names before rendering UI. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is - // returned. - repeated string fulfillment_types = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Metadata for pinning to be returned in the response. -// This is used for distinguishing between applied vs dropped pins. -message PinControlMetadata { - // List of product ids which have associated pins. - message ProductPins { - // List of product ids which have associated pins. - repeated string product_id = 1; - } - - // Map of all matched pins, keyed by pin position. - map all_matched_pins = 1; - - // Map of pins that were dropped due to overlap with other matching pins, - // keyed by pin position. - map dropped_pins = 2; -} - -// A list of string values. -message StringList { - // String values. - repeated string values = 1; -} - -// A message with a list of double values. -message DoubleList { - // The list of double values. - repeated double values = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline deleted file mode 100644 index 9ff72ed4fc52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/completion_service.proto.baseline +++ /dev/null @@ -1,264 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "CompletionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Autocomplete service for retail. -// -// This feature is only available for users who have Retail Search enabled. -// Enable Retail Search on Cloud Console before using this feature. -service CompletionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Completes the specified prefix with keyword suggestions. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc CompleteQuery(CompleteQueryRequest) returns (CompleteQueryResponse) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}:completeQuery" - }; - } - - // Bulk import of processed completion dataset. - // - // Request processing is asynchronous. Partial updating is not supported. - // - // The operation is successfully finished only after the imported suggestions - // are indexed successfully and ready for serving. The process takes hours. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc ImportCompletionData(ImportCompletionDataRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/completionData:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportCompletionDataResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } -} - -// Autocomplete parameters. -message CompleteQueryRequest { - // Required. Catalog for which the completion is performed. - // - // Full resource name of catalog, such as - // `projects/*/locations/global/catalogs/default_catalog`. - string catalog = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The query used to generate suggestions. - // - // The maximum number of allowed characters is 255. - string query = 2 [(google.api.field_behavior) = REQUIRED]; - - // Recommended field. A unique identifier for tracking visitors. For example, - // this could be implemented with an HTTP cookie, which should be able to - // uniquely identify a visitor on a single device. This unique identifier - // should not change if the visitor logs in or out of the website. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 7; - - // Note that this field applies for `user-data` dataset only. For requests - // with `cloud-retail` dataset, setting this field has no effect. - // - // The language filters applied to the output suggestions. If set, it should - // contain the language of the query. If not set, suggestions are returned - // without considering language restrictions. This is the BCP-47 language - // code, such as "en-US" or "sr-Latn". For more information, see [Tags for - // Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - // number of language codes is 3. - repeated string language_codes = 3; - - // The device type context for completion suggestions. We recommend that you - // leave this field empty. - // - // It can apply different suggestions on different device types, e.g. - // `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - // types. - // - // Supported formats: - // - // * `UNKNOWN_DEVICE_TYPE` - // - // * `DESKTOP` - // - // * `MOBILE` - // - // * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - string device_type = 4; - - // Determines which dataset to use for fetching completion. "user-data" will - // use the dataset imported through - // [CompletionService.ImportCompletionData][google.cloud.retail.v2alpha.CompletionService.ImportCompletionData]. - // `cloud-retail` will use the dataset generated by Cloud Retail based on user - // events. If left empty, completions will be fetched from the `user-data` - // dataset. - // - // Current supported values: - // - // * user-data - // - // * cloud-retail: - // This option requires enabling auto-learning function first. See - // [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - string dataset = 6; - - // Completion max suggestions. If left unset or set to 0, then will fallback - // to the configured value - // [CompletionConfig.max_suggestions][google.cloud.retail.v2alpha.CompletionConfig.max_suggestions]. - // - // The maximum allowed max suggestions is 20. If it is set higher, it will be - // capped by 20. - int32 max_suggestions = 5; - - // If true, attribute suggestions are enabled and provided in the response. - // - // This field is only available for the `cloud-retail` dataset. - bool enable_attribute_suggestions = 9; - - // The entity for customers who run multiple entities, domains, sites, or - // regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // If this is set, it must be an exact match with - // [UserEvent.entity][google.cloud.retail.v2alpha.UserEvent.entity] to get - // per-entity autocomplete results. This field will be applied to - // `completion_results` only. It has no effect on the `attribute_results`. - // Also, this entity should be limited to 256 characters, if too long, it will - // be truncated to 256 characters in both generation and serving time, and may - // lead to mis-match. To ensure it works, please set the entity with string - // within 256 characters. - string entity = 10; -} - -// Response of the autocomplete query. -message CompleteQueryResponse { - // Resource that represents completion results. - message CompletionResult { - // The suggestion for the query. - string suggestion = 1; - - // Custom attributes for the suggestion term. - // - // * For `user-data`, the attributes are additional custom attributes - // ingested through BigQuery. - // - // * For `cloud-retail`, the attributes are product attributes generated - // by Cloud Retail. It requires - // [UserEvent.product_details][google.cloud.retail.v2alpha.UserEvent.product_details] - // is imported properly. - map attributes = 2; - - // Facet information for the suggestion term. Gives the number of items - // resulting from a search with this suggestion term for each facet. - // - // This is an experimental feature for limited customers. If you want to - // receive this facet information, reach out to the Retail support team. - repeated SearchResponse.Facet facets = 3; - - // Total number of products associated with a search with this suggestion. - // - // This is an experimental feature for limited customers. If you want to - // receive this product count information, reach out to the Retail support - // team. - int32 total_product_count = 4; - } - - // Deprecated: Recent search of this user. - message RecentSearchResult { - option deprecated = true; - - // The recent search query. - string recent_search = 1; - } - - // Resource that represents attribute results. - message AttributeResult { - // The list of suggestions for the attribute. - repeated string suggestions = 1; - } - - // Results of the matching suggestions. The result list is ordered and the - // first result is top suggestion. - repeated CompletionResult completion_results = 1; - - // A unique complete token. This should be included in the - // [UserEvent.completion_detail][google.cloud.retail.v2alpha.UserEvent.completion_detail] - // for search events resulting from this completion, which enables accurate - // attribution of complete model performance. - string attribution_token = 2; - - // Deprecated. Matched recent searches of this user. The maximum number of - // recent searches is 10. This field is a restricted feature. If you want to - // enable it, contact Retail Search support. - // - // This feature is only available when - // [CompleteQueryRequest.visitor_id][google.cloud.retail.v2alpha.CompleteQueryRequest.visitor_id] - // field is set and [UserEvent][google.cloud.retail.v2alpha.UserEvent] is - // imported. The recent searches satisfy the follow rules: - // - // * They are ordered from latest to oldest. - // - // * They are matched with - // [CompleteQueryRequest.query][google.cloud.retail.v2alpha.CompleteQueryRequest.query] - // case insensitively. - // - // * They are transformed to lower case. - // - // * They are UTF-8 safe. - // - // Recent searches are deduplicated. More recent searches will be reserved - // when duplication happens. - repeated RecentSearchResult recent_search_results = 3 [deprecated = true]; - - // A map of matched attribute suggestions. This field is only available for - // `cloud-retail` dataset. - // - // Current supported keys: - // - // * `brands` - // - // * `categories` - map attribute_results = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control.proto.baseline deleted file mode 100644 index 5bd5c0d7470b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control.proto.baseline +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ControlProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures dynamic metadata that can be linked to a -// [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] and affect search -// or recommendation results at serving time. -message Control { - option (google.api.resource) = { - type: "retail.googleapis.com/Control" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}" - }; - - // The behavior/type of the control - // - // A behavior/type must be specified on creation. Type cannot be changed once - // specified (e.g. A Rule control will always be a Rule control.). An - // INVALID_ARGUMENT will be returned if either condition is violated. - oneof control { - // A facet specification to perform faceted search. - // - // Note that this field is deprecated and will throw NOT_IMPLEMENTED if - // used for creating a control. - SearchRequest.FacetSpec facet_spec = 3 [deprecated = true]; - - // A rule control - a condition-action pair. - // Enacts a set action when the condition is triggered. - // For example: Boost "gShoe" when query full matches "Running Shoes". - Rule rule = 4; - } - - // Immutable. Fully qualified name - // `projects/*/locations/global/catalogs/*/controls/*` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. The human readable control display name. Used in Retail UI. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is thrown. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. List of [serving - // config][google.cloud.retail.v2alpha.ServingConfig] ids that are associated - // with this control in the same - // [Catalog][google.cloud.retail.v2alpha.Catalog]. - // - // Note the association is managed via the - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig], this is an - // output only denormalized view. - repeated string associated_serving_config_ids = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The solution types that the control is used for. - // Currently we support setting only one type of solution at creation time. - // - // Only `SOLUTION_TYPE_SEARCH` value is supported at the moment. - // If no solution type is provided at creation time, will default to - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated SolutionType solution_types = 6 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Specifies the use case for the control. - // Affects what condition fields can be set. - // Only settable by search controls. - // Will default to - // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2alpha.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH] - // if not specified. Currently only allow one search_solution_use_case per - // control. - repeated SearchSolutionUseCase search_solution_use_case = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control_service.proto.baseline deleted file mode 100644 index 7b659bdb2bce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/control_service.proto.baseline +++ /dev/null @@ -1,185 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/control.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ControlServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for modifying Control. -service ControlService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a Control. - // - // If the [Control][google.cloud.retail.v2alpha.Control] to create already - // exists, an ALREADY_EXISTS error is returned. - rpc CreateControl(CreateControlRequest) returns (Control) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" - body: "control" - }; - option (google.api.method_signature) = "parent,control,control_id"; - } - - // Deletes a Control. - // - // If the [Control][google.cloud.retail.v2alpha.Control] to delete does not - // exist, a NOT_FOUND error is returned. - rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a Control. - // - // [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different - // oneof field, if so an INVALID_ARGUMENT is returned. If the - // [Control][google.cloud.retail.v2alpha.Control] to update does not exist, a - // NOT_FOUND error is returned. - rpc UpdateControl(UpdateControlRequest) returns (Control) { - option (google.api.http) = { - patch: "/v2alpha/{control.name=projects/*/locations/*/catalogs/*/controls/*}" - body: "control" - }; - option (google.api.method_signature) = "control,update_mask"; - } - - // Gets a Control. - rpc GetControl(GetControlRequest) returns (Control) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/controls/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all Controls by their parent - // [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListControls(ListControlsRequest) returns (ListControlsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/controls" - }; - option (google.api.method_signature) = "parent"; - } -} - -// Request for CreateControl method. -message CreateControlRequest { - // Required. Full resource name of parent catalog. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The Control to create. - Control control = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the Control, which will become the final - // component of the Control's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-_/. - string control_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for UpdateControl method. -message UpdateControlRequest { - // Required. The Control to update. - Control control = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Control][google.cloud.retail.v2alpha.Control] to update. The following are - // NOT supported: - // - // * [Control.name][google.cloud.retail.v2alpha.Control.name] - // - // If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for DeleteControl method. -message DeleteControlRequest { - // Required. The resource name of the Control to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } - ]; -} - -// Request for GetControl method. -message GetControlRequest { - // Required. The resource name of the Control to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Control" } - ]; -} - -// Request for ListControls method. -message ListControlsRequest { - // Required. The catalog resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 50. Max allowed value is 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListControls` call. - // Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A filter to apply on the list results. Supported features: - // - // * List all the products under the parent branch if - // [filter][google.cloud.retail.v2alpha.ListControlsRequest.filter] is unset. - // * List controls that are used in a single ServingConfig: - // 'serving_config = "boosted_home_page_cvr"' - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for ListControls method. -message ListControlsResponse { - // All the Controls for a given catalog. - repeated Control controls = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline deleted file mode 100644 index 21e33ba6c4aa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/conversational_search_service.proto.baseline +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ConversationalSearchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for retail conversational search. -// -// This feature is only available for users who have Retail Conversational -// Search enabled. Enable Retail Conversational Search on Cloud Console -// before using this feature. -service ConversationalSearchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Performs a conversational search. - // - // This feature is only available for users who have Conversational Search - // enabled. - rpc ConversationalSearch(ConversationalSearchRequest) - returns (stream ConversationalSearchResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:conversationalSearch" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:conversationalSearch" - body: "*" - } - }; - } -} - -// Request message for -// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] -// method. -message ConversationalSearchRequest { - // Search parameters. - message SearchParams { - // Optional. The filter string to restrict search results. - // - // The syntax of the filter string is the same as - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - string filter = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The canonical filter string to restrict search results. - // - // The syntax of the canonical filter string is the same as - // [SearchRequest.canonical_filter][google.cloud.retail.v2alpha.SearchRequest.canonical_filter]. - string canonical_filter = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The sort string to specify the sorting of search results. - // - // The syntax of the sort string is the same as - // [SearchRequest.sort][]. - string sort_by = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The boost spec to specify the boosting of search results. - // - // The syntax of the boost spec is the same as - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec]. - SearchRequest.BoostSpec boost_spec = 4 - [(google.api.field_behavior) = OPTIONAL]; - } - - // This field specifies the current user answer during the conversational - // filtering search. This can be either user selected from suggested answers - // or user input plain text. - message UserAnswer { - // This field specifies the selected answers during the conversational - // search. - message SelectedAnswer { - // Optional. This field specifies the selected answer which is a attribute - // key-value. - ProductAttributeValue product_attribute_value = 1 - [(google.api.field_behavior) = OPTIONAL]; - } - - // This field specifies the type of user answer. - oneof type { - // This field specifies the incremental input text from the user during - // the conversational search. - string text_answer = 1; - - // Optional. This field specifies the selected answer during the - // conversational search. This should be a subset of - // [ConversationalSearchResponse.followup_question.suggested_answers][]. - SelectedAnswer selected_answer = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - } - - // This field specifies all conversational filtering related parameters - // addition to conversational retail search. - message ConversationalFilteringSpec { - // Enum to control Conversational Filtering mode. - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // Enabled Conversational Filtering without default Conversational Search. - CONVERSATIONAL_FILTER_ONLY = 3; - } - - // Optional. This field is deprecated. Please use - // [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode] - // instead. - bool enable_conversational_filtering = 1 - [deprecated = true, (google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies the current user answer during the - // conversational filtering search. It can be either user selected from - // suggested answers or user input plain text. - UserAnswer user_answer = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Mode to control Conversational Filtering. - // Defaults to - // [Mode.DISABLED][google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED] - // if it's unset. - Mode conversational_filtering_mode = 4 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The resource name of the search engine placement, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search` - // or - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - // This field is used to identify the serving config name and the set - // of models that will be used to make the search. - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. - // - // Use "default_branch" as the branch ID or leave this field empty, to search - // products under the default branch. - string branch = 2 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Optional. Raw search query to be searched for. - // - // If this field is empty, the request is considered a category browsing - // request. - string query = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The categories associated with a category page. Must be set for - // category navigation queries to achieve good search quality. The format - // should be the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - repeated string page_categories = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies the conversation id, which maintains the - // state of the conversation between client side and server side. Use the - // value from the previous - // [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id]. - // For the initial request, this should be empty. - string conversation_id = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Search parameters. - SearchParams search_params = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Required. A unique identifier for tracking visitors. For example, this - // could be implemented with an HTTP cookie, which should be able to uniquely - // identify a visitor on a single device. This unique identifier should not - // change if the visitor logs in or out of the website. - // - // This should be the same identifier as - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 9 [(google.api.field_behavior) = REQUIRED]; - - // Optional. User information. - UserInfo user_info = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies all conversational filtering related - // parameters. - ConversationalFilteringSpec conversational_filtering_spec = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch] -// method. -message ConversationalSearchResponse { - // The conversational followup question generated for Intent refinement. - message FollowupQuestion { - // Suggested answers to the follow-up question. - // If it's numerical attribute, only ProductAttributeInterval will be set. - // If it's textual attribute, only productAttributeValue will be set. - message SuggestedAnswer { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // The conversational followup question generated for Intent refinement. - string followup_question = 1; - - // The answer options provided to client for the follow-up question. - repeated SuggestedAnswer suggested_answers = 2; - } - - // The proposed refined search for intent-refinement/bundled shopping - // conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the - // refined_query from search response will be populated here. - message RefinedSearch { - // The query to be used for search. - string query = 1; - } - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational filtering search. - message ConversationalFilteringResult { - // Additional filter that client side need to apply. - message AdditionalFilter { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // The conversational filtering question. - FollowupQuestion followup_question = 1; - - // This is the incremental additional filters implied from the current - // user answer. User should add the suggested addition filters to the - // previous [ConversationalSearchRequest.search_params.filter][] and - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // and use the merged filter in the follow up requests. - AdditionalFilter additional_filter = 2; - } - - // Conversation UUID. This field will be stored in client side storage to - // maintain the conversation session with server and will be used for next - // search request's - // [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2alpha.ConversationalSearchRequest.conversation_id] - // to restore conversation state in server. - string conversation_id = 4; - - // The proposed refined search queries. They can be used to fetch the relevant - // search results. When using CONVERSATIONAL_FILTER_ONLY mode, the - // refined_query from search response will be populated here. - repeated RefinedSearch refined_search = 6; - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational filtering search. - ConversationalFilteringResult conversational_filtering_result = 7; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/export_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/export_config.proto.baseline deleted file mode 100644 index e5cbf8d00a26..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/export_config.proto.baseline +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ExportConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// The output configuration setting. -message OutputConfig { - // The Google Cloud Storage output destination configuration. - message GcsDestination { - // Required. The output uri prefix for saving output data to json files. - // Some mapping examples are as follows: - // output_uri_prefix sample output(assuming the object is foo.json) - // ======================== ============================================= - // gs://bucket/ gs://bucket/foo.json - // gs://bucket/folder/ gs://bucket/folder/foo.json - // gs://bucket/folder/item_ gs://bucket/folder/item_foo.json - string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The BigQuery output destination configuration. - message BigQueryDestination { - // Required. The ID of a BigQuery Dataset. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The prefix of exported BigQuery tables. - string table_id_prefix = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Describes the table type. The following values are supported: - // - // * `table`: A BigQuery native table. - // * `view`: A virtual table defined by a SQL query. - string table_type = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // The configuration of destination for holding output data. - oneof destination { - // The Google Cloud Storage location where the output is to be written to. - GcsDestination gcs_destination = 1; - - // The BigQuery location where the output is to be written to. - BigQueryDestination bigquery_destination = 2; - } -} - -// Configuration of destination for Export related errors. -message ExportErrorsConfig { - // Required. Errors destination. - oneof destination { - // Google Cloud Storage path for import errors. This must be an empty, - // existing Cloud Storage bucket. Export errors will be written to a file in - // this bucket, one per line, as a JSON-encoded - // `google.rpc.Status` message. - string gcs_prefix = 1; - } -} - -// Request message for ExportProducts method. -message ExportProductsRequest { - // Required. Resource name of a [Branch][google.cloud.retail.v2alpha.Branch], - // and `default_branch` for branch_id component is supported. For example - // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned events. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned products. Use this expression to restrict results to a - // specific time range, tag, or stock state or to filter products by product - // type. - // For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - // - // We expect only four types of fields: - // - // * `lastModifiedTime`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `lastModifiedTime` restriction should result in one, contiguous, - // valid, last-modified, time range. - // - // * `productType`: Supported values are `primary` and `variant`. The - // Boolean operators `OR` and `NOT` are supported if the expression is - // enclosed in parentheses and must be separated from the - // `productType` values by a space. - // - // * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - // `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - // supported if the expression is enclosed in parentheses and must be - // separated from the `availability` values by a space. - // - // * `Tag expressions`: Restricts output to products that match all of the - // specified tags. Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses and the operators are separated - // from the tag values by a space. Also supported is '`-"tagA"`', which - // is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - // UTF-8 encoded strings and have a size limit of 1,000 characters. - // - // Some examples of valid filters expressions: - // - // * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // lastModifiedTime < "2012-04-23T18:30:43.511Z"` - // * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - // productType = "variant"` - // * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - // tag=(NOT "promotional") - // productType = "primary" lastModifiedTime < - // "2018-04-23T18:30:43.511Z"` - // * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - // * Example 5: `availability = (IN_STOCK OR BACKORDER)` - string filter = 3; -} - -// Request message for the `ExportUserEvents` method. -message ExportUserEventsRequest { - // Required. Resource name of a - // [Catalog][google.cloud.retail.v2alpha.Catalog]. For example - // `projects/1234/locations/global/catalogs/default_catalog` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned events. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned user events. Use this expression to restrict results to a - // specific time range or to filter events by eventType. - // For example, `eventTime > "2012-04-23T18:25:43.511Z" - // eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - // eventType=search` - // - // We expect only three types of fields: - // - // * `eventTime`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `eventTime` restriction should result in one, contiguous, valid, - // `eventTime` range. - // - // * `eventType`: Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses and the operators are separated - // from the tag values by a space. - // - // * `eventsMissingCatalogItems`: This restricts results - // to events for which catalog items were not found in the catalog. The - // default behavior is to return only those events for which catalog - // items were found. - // - // Some examples of valid filters expressions: - // - // * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - // eventTime < "2012-04-23T18:30:43.511Z"` - // * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - // eventType = detail-page-view` - // * Example 3: `eventsMissingCatalogItems - // eventType = (NOT search) eventTime < - // "2018-04-23T18:30:43.511Z"` - // * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - // * Example 5: `eventType = (detail-page-view OR search)` - // * Example 6: `eventsMissingCatalogItems` - string filter = 3; -} - -// Request message for the `ExportAnalyticsMetrics` method. -message ExportAnalyticsMetricsRequest { - // Required. Full resource name of the parent catalog. - // Expected format: `projects/*/locations/*/catalogs/*` - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The output location of the data. - OutputConfig output_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // A filtering expression to specify restrictions on returned metrics. - // The expression is a sequence of terms. Each term applies a restriction to - // the returned metrics. Use this expression to restrict results to a - // specific time range. - // - // Currently we expect only one types of fields: - // - // * `timestamp`: This can be specified twice, once with a - // less than operator and once with a greater than operator. The - // `timestamp` restriction should result in one, contiguous, valid, - // `timestamp` range. - // - // Some examples of valid filters expressions: - // - // * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - // timestamp < "2012-04-23T18:30:43.511Z"` - // * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - string filter = 3; -} - -// Metadata related to the progress of the Export operation. This is -// returned by the google.longrunning.Operation.metadata field. -message ExportMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; -} - -// Response of the ExportProductsRequest. If the long running -// operation is done, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportProductsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Response of the ExportUserEventsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportUserEventsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Response of the ExportAnalyticsMetricsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ExportAnalyticsMetricsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // This field is never set. - ExportErrorsConfig errors_config = 2; - - // Output result indicating where the data were exported to. - OutputResult output_result = 3; -} - -// Output result that stores the information about where the exported data is -// stored. -message OutputResult { - // The BigQuery location where the result is stored. - repeated BigQueryOutputResult bigquery_result = 1; - - // The Google Cloud Storage location where the result is stored. - repeated GcsOutputResult gcs_result = 2; -} - -// A BigQuery output result. -message BigQueryOutputResult { - // The ID of a BigQuery Dataset. - string dataset_id = 1; - - // The ID of a BigQuery Table. - string table_id = 2; -} - -// A Gcs output result. -message GcsOutputResult { - // The uri of Gcs output - string output_uri = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline deleted file mode 100644 index e639eccd62ab..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question.proto.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "GenerativeQuestionProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configuration for overall generative question feature state. -message GenerativeQuestionsFeatureConfig { - // Required. Resource name of the affected catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Determines whether questions will be used at serving time. - // Note: This feature cannot be enabled until initial data requirements are - // satisfied. - bool feature_enabled = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Minimum number of products in the response to trigger follow-up - // questions. Value must be 0 or positive. - int32 minimum_products = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Configuration for a single generated question. -message GenerativeQuestionConfig { - // Required. Resource name of the catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The facet to which the question is associated. - string facet = 2 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The LLM generated question. - string generated_question = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The question that will be used at serving time. - // Question can have a max length of 300 bytes. - // When not populated, generated_question should be used. - string final_question = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Values that can be used to answer the question. - repeated string example_values = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The ratio of how often a question was asked. - float frequency = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Whether the question is asked at serving time. - bool allowed_in_conversation = 7 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline deleted file mode 100644 index cbd46d1f8ca7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/generative_question_service.proto.baseline +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/generative_question.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "GenerativeQuestionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for managing LLM generated questions in search serving. -service GenerativeQuestionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Manages overal generative question feature state -- enables toggling - // feature on and off. - rpc UpdateGenerativeQuestionsFeatureConfig( - UpdateGenerativeQuestionsFeatureConfigRequest) - returns (GenerativeQuestionsFeatureConfig) { - option (google.api.http) = { - patch: "/v2alpha/{generative_questions_feature_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature" - body: "generative_questions_feature_config" - }; - option (google.api.method_signature) = - "generative_questions_feature_config,update_mask"; - } - - // Manages overal generative question feature state -- enables toggling - // feature on and off. - rpc GetGenerativeQuestionsFeatureConfig( - GetGenerativeQuestionsFeatureConfigRequest) - returns (GenerativeQuestionsFeatureConfig) { - option (google.api.http) = { - get: "/v2alpha/{catalog=projects/*/locations/*/catalogs/*}/generativeQuestionFeature" - }; - option (google.api.method_signature) = "catalog"; - } - - // Returns all questions for a given catalog. - rpc ListGenerativeQuestionConfigs(ListGenerativeQuestionConfigsRequest) - returns (ListGenerativeQuestionConfigsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/generativeQuestions" - }; - option (google.api.method_signature) = "parent"; - } - - // Allows management of individual questions. - rpc UpdateGenerativeQuestionConfig(UpdateGenerativeQuestionConfigRequest) - returns (GenerativeQuestionConfig) { - option (google.api.http) = { - patch: "/v2alpha/{generative_question_config.catalog=projects/*/locations/*/catalogs/*}/generativeQuestion" - body: "generative_question_config" - }; - option (google.api.method_signature) = - "generative_question_config,update_mask"; - } - - // Allows management of multiple questions. - rpc BatchUpdateGenerativeQuestionConfigs( - BatchUpdateGenerativeQuestionConfigsRequest) - returns (BatchUpdateGenerativeQuestionConfigsResponse) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/generativeQuestion:batchUpdate" - body: "*" - }; - option (google.api.method_signature) = "parent,requests"; - } -} - -// Request for UpdateGenerativeQuestionsFeatureConfig method. -message UpdateGenerativeQuestionsFeatureConfigRequest { - // Required. The configuration managing the feature state. - GenerativeQuestionsFeatureConfig generative_questions_feature_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided - // [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig] - // to update. If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for GetGenerativeQuestionsFeatureConfig method. -message GetGenerativeQuestionsFeatureConfigRequest { - // Required. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string catalog = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Request for ListQuestions method. -message ListGenerativeQuestionConfigsRequest { - // Required. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response for ListQuestions method. -message ListGenerativeQuestionConfigsResponse { - // All the questions for a given catalog. - repeated GenerativeQuestionConfig generative_question_configs = 1; -} - -// Request for UpdateGenerativeQuestionConfig method. -message UpdateGenerativeQuestionConfigRequest { - // Required. The question to update. - GenerativeQuestionConfig generative_question_config = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided - // [GenerativeQuestionConfig][google.cloud.retail.v2alpha.GenerativeQuestionConfig] - // to update. The following are NOT supported: - // - // * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency] - // - // If not set or empty, all supported fields are updated. - google.protobuf.FieldMask update_mask = 4 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for BatchUpdateGenerativeQuestionConfig method. -message BatchUpdateGenerativeQuestionConfigsRequest { - // Optional. Resource name of the parent catalog. - // Format: projects/{project}/locations/{location}/catalogs/{catalog} - string parent = 1 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The updates question configs. - repeated UpdateGenerativeQuestionConfigRequest requests = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Aggregated response for UpdateGenerativeQuestionConfig method. -message BatchUpdateGenerativeQuestionConfigsResponse { - // Optional. The updates question configs. - repeated GenerativeQuestionConfig generative_question_configs = 1 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/import_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/import_config.proto.baseline deleted file mode 100644 index e2137da67b8a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/import_config.proto.baseline +++ /dev/null @@ -1,411 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/type/date.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ImportConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Google Cloud Storage location for input content. -message GcsSource { - // Required. Google Cloud Storage URIs to input files. URI can be up to - // 2000 characters long. URIs can match the full object path (for example, - // `gs://bucket/directory/object.json`) or a pattern matching one or more - // files, such as `gs://bucket/directory/*.json`. A request can - // contain at most 100 files, and each file can be up to 2 GB. See - // [Importing product - // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog) - // for the expected file format and setup instructions. - repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; - - // The schema to use when parsing the data from the source. - // - // Supported values for product imports: - // - // * `product` (default): One JSON - // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must - // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. - // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - // - // Supported values for user events imports: - // - // * `user_event` (default): One JSON - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. - // * `user_event_ga360`: Using - // https://support.google.com/analytics/answer/3437719. - // - // Supported values for control imports: - // - // * `control` (default): One JSON - // [Control][google.cloud.retail.v2alpha.Control] per line. - // - // Supported values for catalog attribute imports: - // - // * `catalog_attribute` (default): One CSV - // [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] per line. - string data_schema = 2; -} - -// BigQuery source import data from. -message BigQuerySource { - // BigQuery table partition info. Leave this empty if the BigQuery table - // is not partitioned. - oneof partition { - // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format. - google.type.Date partition_date = 6; - } - - // The project ID (can be project # or ID) that the BigQuery source is in with - // a length limit of 128 characters. If not specified, inherits the project - // ID from the parent request. - string project_id = 5; - - // Required. The BigQuery data set to copy the data from with a length limit - // of 1,024 characters. - string dataset_id = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The BigQuery table to copy the data from with a length limit of - // 1,024 characters. - string table_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Intermediate Cloud Storage directory used for the import with a length - // limit of 2,000 characters. Can be specified if one wants to have the - // BigQuery export to a specific Cloud Storage directory. - string gcs_staging_dir = 3; - - // The schema to use when parsing the data from the source. - // - // Supported values for product imports: - // - // * `product` (default): One JSON - // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must - // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id]. - // * `product_merchant_center`: See [Importing catalog data from Merchant - // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc). - // - // Supported values for user events imports: - // - // * `user_event` (default): One JSON - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line. - // * `user_event_ga360`: - // The schema is available here: - // https://support.google.com/analytics/answer/3437719. - // * `user_event_ga4`: - // The schema is available here: - // https://support.google.com/analytics/answer/7029846. - // - // Supported values for autocomplete imports: - // - // * `suggestions` (default): One JSON completion suggestion per line. - // * `denylist`: One JSON deny suggestion per line. - // * `allowlist`: One JSON allow suggestion per line. - string data_schema = 4; -} - -// The inline source for the input config for ImportProducts method. -message ProductInlineSource { - // Required. A list of products to update/create. Each product must have a - // valid [Product.id][google.cloud.retail.v2alpha.Product.id]. Recommended max - // of 100 items. - repeated Product products = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The inline source for the input config for ImportUserEvents method. -message UserEventInlineSource { - // Required. A list of user events to import. Recommended max of 10k items. - repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Configuration of destination for Import related errors. -message ImportErrorsConfig { - // Required. Errors destination. - oneof destination { - // Google Cloud Storage prefix for import errors. This must be an empty, - // existing Cloud Storage directory. Import errors are written to - // sharded files in this directory, one per line, as a JSON-encoded - // `google.rpc.Status` message. - string gcs_prefix = 1; - } -} - -// Request message for Import methods. -message ImportProductsRequest { - // Indicates how imported products are reconciled with the existing products - // created or imported before. - enum ReconciliationMode { - // Defaults to INCREMENTAL. - RECONCILIATION_MODE_UNSPECIFIED = 0; - - // Inserts new products or updates existing products. - INCREMENTAL = 1; - - // Calculates diff and replaces the entire product dataset. Existing - // products may be deleted if they are not present in the source location. - FULL = 2; - } - - // Required. - // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - // - // If no updateMask is specified, requires products.create permission. - // If updateMask is specified, requires products.update permission. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Deprecated. This field has no effect. - string request_id = 6 [deprecated = true]; - - // Required. The desired input location of the data. - ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // The desired location of errors incurred during the Import. - ImportErrorsConfig errors_config = 3; - - // Indicates which fields in the provided imported `products` to update. If - // not set, all fields are updated. If provided, only the existing product - // fields are updated. Missing products will not be created. - google.protobuf.FieldMask update_mask = 4; - - // The mode of reconciliation between existing products and the products to be - // imported. Defaults to - // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL]. - ReconciliationMode reconciliation_mode = 5; - - // Full Pub/Sub topic name for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - // to be within the same project as - // [ImportProductsRequest.parent][google.cloud.retail.v2alpha.ImportProductsRequest.parent]. - // Make sure that both - // `cloud-retail-customer-data-access@system.gserviceaccount.com` and - // `service-@gcp-sa-retail.iam.gserviceaccount.com` - // have the `pubsub.topics.publish` IAM permission on the topic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - string notification_pubsub_topic = 7; - - // If true, this performs the FULL import even if it would delete a large - // proportion of the products in the default branch, which could potentially - // cause outages if you have live predict/search traffic. - // - // Only supported when - // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode] - // is set to `FULL`. - bool skip_default_branch_protection = 8; -} - -// Request message for the ImportUserEvents request. -message ImportUserEventsRequest { - // Required. `projects/1234/locations/global/catalogs/default_catalog` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The desired input location of the data. - UserEventInputConfig input_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // The desired location of errors incurred during the Import. Cannot be set - // for inline user event imports. - ImportErrorsConfig errors_config = 3; -} - -// Request message for ImportCompletionData methods. -message ImportCompletionDataRequest { - // Required. The catalog which the suggestions dataset belongs to. - // - // Format: `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The desired input location of the data. - CompletionDataInputConfig input_config = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - string notification_pubsub_topic = 3; -} - -// The input config source for products. -message ProductInputConfig { - // Required. The source of the input. - oneof source { - // The Inline source for the input content for products. - ProductInlineSource product_inline_source = 1; - - // Google Cloud Storage location for the input content. - GcsSource gcs_source = 2; - - // BigQuery input source. - BigQuerySource big_query_source = 3; - } -} - -// The input config source for user events. -message UserEventInputConfig { - // The source of the input. - oneof source { - // Required. The Inline source for the input content for UserEvents. - UserEventInlineSource user_event_inline_source = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. Google Cloud Storage location for the input content. - GcsSource gcs_source = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. BigQuery input source. - BigQuerySource big_query_source = 3 - [(google.api.field_behavior) = REQUIRED]; - } -} - -// The input config source for completion data. -message CompletionDataInputConfig { - // The source of the input. - // - // Supported - // [BigQuerySource.data_schema][google.cloud.retail.v2alpha.BigQuerySource.data_schema] - // values for suggestions imports: - // - // * `suggestions` (default): One JSON completion suggestion per line. - // * `denylist`: One JSON deny suggestion per line. - // * `allowlist`: One JSON allow suggestion per line. - oneof source { - // Required. BigQuery input source. - // - // Add the IAM permission "BigQuery Data Viewer" for - // cloud-retail-customer-data-access@system.gserviceaccount.com before - // using this feature otherwise an error is thrown. - BigQuerySource big_query_source = 1 - [(google.api.field_behavior) = REQUIRED]; - } -} - -// Metadata related to the progress of the Import operation. This is -// returned by the google.longrunning.Operation.metadata field. -message ImportMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; - - // Count of entries that were processed successfully. - int64 success_count = 3; - - // Count of entries that encountered errors while processing. - int64 failure_count = 4; - - // Deprecated. This field is never set. - string request_id = 5 [deprecated = true]; - - // Pub/Sub topic for receiving notification. If this field is set, - // when the import is finished, a notification is sent to - // specified Pub/Sub topic. The message data is JSON string of a - // [Operation][google.longrunning.Operation]. - // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - string notification_pubsub_topic = 6; - - // Metadata related to transform user events. - TransformedUserEventsMetadata transformed_user_events_metadata = 7; -} - -// Metadata related to transform user events operation. -message TransformedUserEventsMetadata { - // Count of entries in the source user events BigQuery table. - int64 source_events_count = 1; - - // Count of entries in the transformed user events BigQuery table, which could - // be different from the actually imported number of user events. - int64 transformed_events_count = 2; -} - -// Response of the -// [ImportProductsRequest][google.cloud.retail.v2alpha.ImportProductsRequest]. -// If the long running operation is done, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ImportProductsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // Echoes the destination for the complete errors in the request if set. - ImportErrorsConfig errors_config = 2; -} - -// Response of the ImportUserEventsRequest. If the long running -// operation was successful, then this message is returned by the -// google.longrunning.Operations.response field if the operation was successful. -message ImportUserEventsResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; - - // Echoes the destination for the complete errors if this field was set in - // the request. - ImportErrorsConfig errors_config = 2; - - // Aggregated statistics of user event import status. - UserEventImportSummary import_summary = 3; -} - -// A summary of import result. The UserEventImportSummary summarizes -// the import status for user events. -message UserEventImportSummary { - // Count of user events imported with complete existing catalog information. - int64 joined_events_count = 1; - - // Count of user events imported, but with catalog information not found - // in the imported catalog. - int64 unjoined_events_count = 2; -} - -// Response of the -// [ImportCompletionDataRequest][google.cloud.retail.v2alpha.ImportCompletionDataRequest]. -// If the long running operation is done, this message is returned by the -// google.longrunning.Operations.response field if the operation is successful. -message ImportCompletionDataResponse { - // A sample of errors encountered while processing the request. - repeated google.rpc.Status error_samples = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline deleted file mode 100644 index 2f6ca4528ac8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto.baseline +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "MerchantCenterAccountLinkProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Represents a link between a Merchant Center account and a branch. -// After a link is established, products from the linked Merchant Center account -// are streamed to the linked branch. -message MerchantCenterAccountLink { - option (google.api.resource) = { - type: "retail.googleapis.com/MerchantCenterAccountLink" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}" - }; - - // Merchant Center Feed filter criterion. - message MerchantCenterFeedFilter { - // Merchant Center primary feed ID. - // Deprecated: use data_source_id instead. - int64 primary_feed_id = 1 [deprecated = true]; - - // AFM data source ID. - int64 data_source_id = 3; - - // Merchant Center primary feed name. The name is used for the display - // purposes only. - string primary_feed_name = 2; - } - - // The state of the link. - enum State { - // Default value. - STATE_UNSPECIFIED = 0; - - // Link is created and LRO is not complete. - PENDING = 1; - - // Link is active. - ACTIVE = 2; - - // Link creation failed. - FAILED = 3; - } - - // Output only. Immutable. Full resource name of the Merchant Center Account - // Link, such as - // `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/merchant_center_account_link`. - string name = 1 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. Immutable. - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // identifier, which is the final component of - // [name][google.cloud.retail.v2alpha.MerchantCenterAccountLink.name]. This - // field is auto generated and follows the convention: - // `BranchId_MerchantCenterAccountId`. - // `projects/*/locations/global/catalogs/default_catalog/merchantCenterAccountLinks/id_1`. - string id = 8 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Required. The linked [Merchant center account - // id](https://developers.google.com/shopping-content/guides/accountstatuses). - // The account must be a standalone account or a sub-account of a MCA. - int64 merchant_center_account_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The branch ID (e.g. 0/1/2) within the catalog that products from - // merchant_center_account_id are streamed to. When updating this field, an - // empty value will use the currently configured default branch. However, - // changing the default branch later on won't change the linked branch here. - // - // A single branch ID can only have one linked Merchant Center account ID. - string branch_id = 3 [(google.api.field_behavior) = REQUIRED]; - - // The FeedLabel used to perform filtering. - // Note: this replaces - // [region_id](https://developers.google.com/shopping-content/reference/rest/v2.1/products#Product.FIELDS.feed_label). - // - // Example value: `US`. - // Example value: `FeedLabel1`. - string feed_label = 4; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // ISO 639-1. - // - // This specifies the language of offers in Merchant Center that will be - // accepted. If empty, no language filtering will be performed. - // - // Example value: `en`. - string language_code = 5; - - // Criteria for the Merchant Center feeds to be ingested via the link. - // All offers will be ingested if the list is empty. - // Otherwise the offers will be ingested from selected feeds. - repeated MerchantCenterFeedFilter feed_filters = 6; - - // Output only. Represents the state of the link. - State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Google Cloud project ID. - string project_id = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. An optional arbitrary string that could be used as a tag for - // tracking link source. - string source = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -// Common metadata related to the progress of the operations. -message CreateMerchantCenterAccountLinkMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline deleted file mode 100644 index 86aa95afbb03..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto.baseline +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/merchant_center_account_link.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "MerchantCenterAccountLinkServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Merchant Center Link service to link a Branch to a Merchant Center Account. -service MerchantCenterAccountLinkService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Lists all - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]s - // under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog]. - rpc ListMerchantCenterAccountLinks(ListMerchantCenterAccountLinksRequest) - returns (ListMerchantCenterAccountLinksResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. - rpc CreateMerchantCenterAccountLink(CreateMerchantCenterAccountLinkRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/merchantCenterAccountLinks" - body: "merchant_center_account_link" - }; - option (google.api.method_signature) = - "parent,merchant_center_account_link"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.MerchantCenterAccountLink" - metadata_type: "google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkMetadata" - }; - } - - // Deletes a - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. - // If the - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // to delete does not exist, a NOT_FOUND error is returned. - rpc DeleteMerchantCenterAccountLink(DeleteMerchantCenterAccountLinkRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/merchantCenterAccountLinks/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request for -// [MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks] -// method. -message ListMerchantCenterAccountLinksRequest { - // Required. The parent Catalog of the resource. - // It must match this format: - // `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; -} - -// Response for -// [MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks] -// method. -message ListMerchantCenterAccountLinksResponse { - // The links. - repeated MerchantCenterAccountLink merchant_center_account_links = 1; -} - -// Request for -// [MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink] -// method. -message CreateMerchantCenterAccountLinkRequest { - // Required. The branch resource where this MerchantCenterAccountLink will be - // created. Format: - // `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] - // to create. - // - // If the caller does not have permission to create the - // [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink], - // regardless of whether or not it exists, a PERMISSION_DENIED error is - // returned. - MerchantCenterAccountLink merchant_center_account_link = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for -// [MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink] -// method. -message DeleteMerchantCenterAccountLinkRequest { - // Required. Full resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/MerchantCenterAccountLink" - } - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model.proto.baseline deleted file mode 100644 index 7dc15eb66576..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model.proto.baseline +++ /dev/null @@ -1,489 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ModelProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Metadata that describes the training and serving parameters of a -// [Model][google.cloud.retail.v2alpha.Model]. A -// [Model][google.cloud.retail.v2alpha.Model] can be associated with a -// [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] and then queried -// through the Predict API. -message Model { - option (google.api.resource) = { - type: "retail.googleapis.com/Model" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}" - }; - - // The PageOptimizationConfig for model training. - // - // This determines how many panels to optimize for, and which serving - // configs to consider for each panel. - // The purpose of this model is to optimize which - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to show on which - // panels in way that optimizes the visitors shopping journey. - message PageOptimizationConfig { - // A candidate to consider for a given panel. Currently only - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] are valid - // candidates. - message Candidate { - oneof candidate { - // This has to be a valid - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] - // identifier. For example, for a ServingConfig with full name: - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/my_candidate_config`, - // this would be `my_candidate_config`. - string serving_config_id = 1; - } - } - - // An individual panel with a list of - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] to consider - // for it. - message Panel { - // Optional. The name to display for the panel. - string display_name = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The candidates to consider on the panel. - repeated Candidate candidates = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Required. The default candidate. If the model fails at serving time, - // we fall back to the default. - Candidate default_candidate = 3 [(google.api.field_behavior) = REQUIRED]; - } - - // Restrictions of expected returned results. - enum Restriction { - // Unspecified value for restriction. - RESTRICTION_UNSPECIFIED = 0; - - // Allow any [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to - // be show on any number of panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity, - // pdp_cvr_no_diversity - // - // `Restriction` = NO_RESTRICTION - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: [] - NO_RESTRICTION = 1; - - // Do not allow the same - // [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] to - // be shown on multiple panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_SERVING_CONFIG_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity_low) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - UNIQUE_SERVING_CONFIG_RESTRICTION = 2; - - // Do not allow multiple - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same - // [Model.name][google.cloud.retail.v2alpha.Model.name] to be show on on - // different panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_MODEL_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - UNIQUE_MODEL_RESTRICTION = 3; - - // Do not allow multiple - // [ServingConfigs][google.cloud.retail.v2alpha.ServingConfig] with same - // [Model.type][google.cloud.retail.v2alpha.Model.type] to be shown on - // different panels. - // - // Example: - // - // `Panel1 candidates`: pdp_ctr, pdp_cvr, home_page_ctr_no_diversity - // - // - // `Panel2 candidates`: home_page_ctr_no_diversity, - // home_page_ctr_diversity_low, - // pdp_cvr_no_diversity - // - // `Restriction` = `UNIQUE_MODEL_RESTRICTION` - // - // `Valid combinations`: - // - // * (pdp_ctr, home_page_ctr_no_diversity) - // * (pdp_ctr, home_page_ctr_diversity) - // * (pdp_cvr, home_page_ctr_no_diversity) - // * (pdp_cvr, home_page_ctr_diversity_low) - // * (home_page_ctr_no_diversity, pdp_cvr_no_diversity) - // - // `Invalid combinations`: - // - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_ctr, pdp_cvr_no_diversity) - // * (pdp_cvr, pdp_cvr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_no_diversity) - // * (home_page_ctr_no_diversity, home_page_ctr_diversity) - UNIQUE_MODEL_TYPE_RESTRICTION = 4; - } - - // Required. The type of [UserEvent][google.cloud.retail.v2alpha.UserEvent] - // this page optimization is shown for. - // - // Each page has an associated event type - this will be the - // corresponding event type for the page that the page optimization - // model is used on. - // - // Supported types: - // - // * `add-to-cart`: Products being added to cart. - // * `detail-page-view`: Products detail page viewed. - // * `home-page-view`: Homepage viewed - // * `category-page-view`: Homepage viewed - // * `shopping-cart-page-view`: User viewing a shopping cart. - // - // `home-page-view` only allows models with type `recommended-for-you`. - // All other page_optimization_event_type allow all - // [Model.types][google.cloud.retail.v2alpha.Model.type]. - string page_optimization_event_type = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Required. A list of panel configurations. - // - // Limit = 5. - repeated Panel panels = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. How to restrict results across panels e.g. can the same - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] be shown on - // multiple panels at once. - // - // If unspecified, default to `UNIQUE_MODEL_RESTRICTION`. - Restriction restriction = 3 [(google.api.field_behavior) = OPTIONAL]; - } - - // Represents an ordered combination of valid serving configs, which - // can be used for `PAGE_OPTIMIZATION` recommendations. - message ServingConfigList { - // Optional. A set of valid serving configs that may be used for - // `PAGE_OPTIMIZATION`. - repeated string serving_config_ids = 1 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Additional configs for the frequently-bought-together model type. - message FrequentlyBoughtTogetherFeaturesConfig { - // Optional. Specifies the context of the model when it is used in predict - // requests. Can only be set for the `frequently-bought-together` type. If - // it isn't specified, it defaults to - // [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2alpha.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]. - ContextProductsType context_products_type = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Additional model features config. - message ModelFeaturesConfig { - oneof type_dedicated_config { - // Additional configs for frequently-bought-together models. - FrequentlyBoughtTogetherFeaturesConfig frequently_bought_together_config = - 1; - } - } - - // The serving state of the model. - enum ServingState { - // Unspecified serving state. - SERVING_STATE_UNSPECIFIED = 0; - - // The model is not serving. - INACTIVE = 1; - - // The model is serving and can be queried. - ACTIVE = 2; - - // The model is trained on tuned hyperparameters and can be - // queried. - TUNED = 3; - } - - // The training state of the model. - enum TrainingState { - // Unspecified training state. - TRAINING_STATE_UNSPECIFIED = 0; - - // The model training is paused. - PAUSED = 1; - - // The model is training. - TRAINING = 2; - } - - // Describes whether periodic tuning is enabled for this model - // or not. Periodic tuning is scheduled at most every three months. You can - // start a tuning process manually by using the `TuneModel` - // method, which starts a tuning process immediately and resets the quarterly - // schedule. Enabling or disabling periodic tuning does not affect any - // current tuning processes. - enum PeriodicTuningState { - // Unspecified default value, should never be explicitly set. - PERIODIC_TUNING_STATE_UNSPECIFIED = 0; - - // The model has periodic tuning disabled. Tuning - // can be reenabled by calling the `EnableModelPeriodicTuning` - // method or by calling the `TuneModel` method. - PERIODIC_TUNING_DISABLED = 1; - - // The model cannot be tuned with periodic tuning OR the - // `TuneModel` method. Hide the options in customer UI and - // reject any requests through the backend self serve API. - ALL_TUNING_DISABLED = 3; - - // The model has periodic tuning enabled. Tuning - // can be disabled by calling the `DisableModelPeriodicTuning` - // method. - PERIODIC_TUNING_ENABLED = 2; - } - - // Describes whether this model have sufficient training data - // to be continuously trained. - enum DataState { - // Unspecified default value, should never be explicitly set. - DATA_STATE_UNSPECIFIED = 0; - - // The model has sufficient training data. - DATA_OK = 1; - - // The model does not have sufficient training data. Error - // messages can be queried via Stackdriver. - DATA_ERROR = 2; - } - - // Use single or multiple context products for recommendations. - enum ContextProductsType { - // Unspecified default value, should never be explicitly set. - // Defaults to - // [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2alpha.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]. - CONTEXT_PRODUCTS_TYPE_UNSPECIFIED = 0; - - // Use only a single product as context for the recommendation. Typically - // used on pages like add-to-cart or product details. - SINGLE_CONTEXT_PRODUCT = 1; - - // Use one or multiple products as context for the recommendation. Typically - // used on shopping cart pages. - MULTIPLE_CONTEXT_PRODUCTS = 2; - } - - // Training configuration specific to a - // [Model.type][google.cloud.retail.v2alpha.Model.type] - currently, only for - // page optimization. - oneof training_config { - // Optional. The page optimization config. - PageOptimizationConfig page_optimization_config = 17 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The fully qualified resource name of the model. - // - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - // catalog_id has char limit of 50. - // recommendation_model_id has char limit of 40. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The display name of the model. - // - // Should be human readable, used to display Recommendation Models in the - // Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024 - // characters. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The training state that the model is in (e.g. - // `TRAINING` or `PAUSED`). - // - // Since part of the cost of running the service - // is frequency of training - this can be used to determine when to train - // model in order to control cost. If not specified: the default value for - // `CreateModel` method is `TRAINING`. The default value for - // `UpdateModel` method is to keep the state the same as before. - TrainingState training_state = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`. - ServingState serving_state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp the Recommendation Model was created at. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Timestamp the Recommendation Model was last updated. E.g. - // if a Recommendation Model was paused - this would be the time the pause was - // initiated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. The type of model e.g. `home-page`. - // - // Currently supported values: `recommended-for-you`, `others-you-may-like`, - // `frequently-bought-together`, `page-optimization`, `similar-items`, - // `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value). - // - // This field together with - // [optimization_objective][google.cloud.retail.v2alpha.Model.optimization_objective] - // describe model metadata to use to control model training and serving. - // See https://cloud.google.com/retail/docs/models - // for more details on what the model metadata control and which combination - // of parameters are valid. For invalid combinations of parameters (e.g. type - // = `frequently-bought-together` and optimization_objective = `ctr`), you - // receive an error 400 if you try to create/update a recommendation with - // this set of knobs. - string type = 7 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The optimization objective e.g. `cvr`. - // - // Currently supported - // values: `ctr`, `cvr`, `revenue-per-order`. - // - // If not specified, we choose default based on model type. - // Default depends on type of recommendation: - // - // `recommended-for-you` => `ctr` - // - // `others-you-may-like` => `ctr` - // - // `frequently-bought-together` => `revenue_per_order` - // - // This field together with - // [optimization_objective][google.cloud.retail.v2alpha.Model.type] - // describe model metadata to use to control model training and serving. - // See https://cloud.google.com/retail/docs/models - // for more details on what the model metadata control and which combination - // of parameters are valid. For invalid combinations of parameters (e.g. type - // = `frequently-bought-together` and optimization_objective = `ctr`), you - // receive an error 400 if you try to create/update a recommendation with - // this set of knobs. - string optimization_objective = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The state of periodic tuning. - // - // The period we use is 3 months - to do a - // one-off tune earlier use the `TuneModel` method. Default value - // is `PERIODIC_TUNING_ENABLED`. - PeriodicTuningState periodic_tuning_state = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The timestamp when the latest successful tune finished. - google.protobuf.Timestamp last_tune_time = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The tune operation associated with the model. - // - // Can be used to determine if there is an ongoing tune for this - // recommendation. Empty field implies no tune is goig on. - string tuning_operation = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of data requirements for this model: `DATA_OK` and - // `DATA_ERROR`. - // - // Recommendation model cannot be trained if the data is in - // `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even - // if serving state is `ACTIVE`: models were trained successfully before, but - // cannot be refreshed because model no longer has sufficient - // data for training. - DataState data_state = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering - // by attributes is enabled for the model. - RecommendationsFilteringOption filtering_option = 18 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. The list of valid serving configs associated with the - // PageOptimizationConfig. - repeated ServingConfigList serving_config_lists = 19 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Additional model features config. - ModelFeaturesConfig model_features_config = 22 - [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model_service.proto.baseline deleted file mode 100644 index 609d3fbd2290..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/model_service.proto.baseline +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/model.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ModelServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for performing CRUD operations on models. -// Recommendation models contain all the metadata necessary to generate a set of -// models for the `Predict()` API. A model is queried -// indirectly via a ServingConfig, which associates a model with a -// given Placement (e.g. Frequently Bought Together on Home Page). -// -// This service allows you to do the following: -// -// * Initiate training of a model. -// * Pause training of an existing model. -// * List all the available models along with their metadata. -// * Control their tuning schedule. -service ModelService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a new model. - rpc CreateModel(CreateModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" - body: "model" - }; - option (google.api.method_signature) = "parent,model"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.Model" - metadata_type: "google.cloud.retail.v2alpha.CreateModelMetadata" - }; - } - - // Gets a model. - rpc GetModel(GetModelRequest) returns (Model) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses the training of an existing model. - rpc PauseModel(PauseModelRequest) returns (Model) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resumes the training of an existing model. - rpc ResumeModel(ResumeModelRequest) returns (Model) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes an existing model. - rpc DeleteModel(DeleteModelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all the models linked to this event store. - rpc ListModels(ListModelsRequest) returns (ListModelsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/models" - }; - option (google.api.method_signature) = "parent"; - } - - // Update of model metadata. Only fields that - // currently can be updated are: `filtering_option` and - // `periodic_tuning_state`. - // If other values are provided, this API method ignores them. - rpc UpdateModel(UpdateModelRequest) returns (Model) { - option (google.api.http) = { - patch: "/v2alpha/{model.name=projects/*/locations/*/catalogs/*/models/*}" - body: "model" - }; - option (google.api.method_signature) = "model,update_mask"; - } - - // Tunes an existing model. - rpc TuneModel(TuneModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{name=projects/*/locations/*/catalogs/*/models/*}:tune" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.TuneModelResponse" - metadata_type: "google.cloud.retail.v2alpha.TuneModelMetadata" - }; - } -} - -// Request for creating a model. -message CreateModelRequest { - // Required. The parent resource under which to create the model. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The payload of the [Model][google.cloud.retail.v2alpha.Model] to - // create. - Model model = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Whether to run a dry run to validate the request (without - // actually creating the model). - bool dry_run = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for updating an existing model. -message UpdateModelRequest { - // Required. The body of the updated - // [Model][google.cloud.retail.v2alpha.Model]. - Model model = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates which fields in the provided 'model' to - // update. If not set, by default updates all fields. - google.protobuf.FieldMask update_mask = 2 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for getting a model. -message GetModelRequest { - // Required. The resource name of the - // [Model][google.cloud.retail.v2alpha.Model] to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Request for pausing training of a model. -message PauseModelRequest { - // Required. The name of the model to pause. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Request for resuming training of a model. -message ResumeModelRequest { - // Required. The name of the model to resume. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for listing models associated with a resource. -message ListModelsRequest { - // Required. The parent for which to list models. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 50. Max allowed value is 1000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListModels` - // call. Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for deleting a model. -message DeleteModelRequest { - // Required. The resource name of the - // [Model][google.cloud.retail.v2alpha.Model] to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Response to a ListModelRequest. -message ListModelsResponse { - // List of Models. - repeated Model models = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} - -// Request to manually start a tuning process now (instead of waiting for -// the periodically scheduled tuning to happen). -message TuneModelRequest { - // Required. The resource name of the model to tune. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Model" } - ]; -} - -// Metadata associated with a create operation. -message CreateModelMetadata { - // The resource name of the model that this create applies to. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string model = 1; -} - -// Metadata associated with a tune operation. -message TuneModelMetadata { - // The resource name of the model that this tune applies to. - // Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - string model = 1; -} - -// Response associated with a tune operation. -message TuneModelResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline deleted file mode 100644 index 2eb3aceb650d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/prediction_service.proto.baseline +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PredictionServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for making recommendation prediction. -service PredictionService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Makes a recommendation prediction. - rpc Predict(PredictRequest) returns (PredictResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:predict" - body: "*" - } - }; - } -} - -// Request message for Predict method. -message PredictRequest { - // Required. Full resource name of the format: - // `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` - // or - // `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. - // We recommend using the `servingConfigs` resource. `placements` is a legacy - // resource. - // The ID of the Recommendations AI serving config or placement. - // Before you can request predictions from your model, you must create at - // least one serving config or placement for it. For more information, see - // [Manage serving configs] - // (https://cloud.google.com/retail/docs/manage-configs). - // - // The full list of available serving configs can be seen at - // https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Context about the user, what they are looking at and what action - // they took to trigger the predict request. Note that this user event detail - // won't be ingested to userEvent logs. Thus, a separate userEvent write - // request is required for event logging. - // - // Don't set - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] or - // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] to the - // same fixed ID for different users. If you are trying to receive - // non-personalized recommendations (not recommended; this can negatively - // impact model performance), instead set - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id] to - // a random unique ID and leave - // [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id] unset. - UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // Maximum number of results to return. Set this property to the number of - // prediction results needed. If zero, the service will choose a reasonable - // default. The maximum allowed value is 100. Values above 100 will be coerced - // to 100. - int32 page_size = 3; - - // This field is not used; leave it unset. - string page_token = 4 [deprecated = true]; - - // Filter for restricting prediction results with a length limit of 5,000 - // characters. Accepts values for tags and the `filterOutOfStockItems` flag. - // - // * Tag expressions. Restricts predictions to products that match all of the - // specified tags. Boolean operators `OR` and `NOT` are supported if the - // expression is enclosed in parentheses, and must be separated from the - // tag values by a space. `-"tagA"` is also supported and is equivalent to - // `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - // with a size limit of 1,000 characters. - // - // Note: "Recently viewed" models don't support tag filtering at the - // moment. - // - // * filterOutOfStockItems. Restricts predictions to products that do not - // have a - // stockState value of OUT_OF_STOCK. - // - // Examples: - // - // * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - // * filterOutOfStockItems tag=(-"promotional") - // * filterOutOfStockItems - // - // If your filter blocks all prediction results, the API will return *no* - // results. If instead you want empty result sets to return generic - // (unfiltered) popular products, set `strictFiltering` to False in - // `PredictRequest.params`. Note that the API will never return items with - // storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - // - // If `filterSyntaxV2` is set to true under the `params` field, then - // attribute-based expressions are expected instead of the above described - // tag-based syntax. Examples: - // - // * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - // * (availability: ANY("IN_STOCK")) AND - // (colors: ANY("Red") OR categories: ANY("Phones")) - // - // For more information, see - // [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - string filter = 5; - - // Use validate only mode for this prediction query. If set to true, a - // dummy model will be used that returns arbitrary products. - // Note that the validate only mode should only be used for testing the API, - // or if the model is not ready. - bool validate_only = 6; - - // Additional domain specific parameters for the predictions. - // - // Allowed values: - // - // * `returnProduct`: Boolean. If set to true, the associated product - // object will be returned in the `results.metadata` field in the - // prediction response. - // * `returnScore`: Boolean. If set to true, the prediction 'score' - // corresponding to each returned product will be set in the - // `results.metadata` field in the prediction response. The given - // 'score' indicates the probability of a product being clicked/purchased - // given the user's context and history. - // * `strictFiltering`: Boolean. True by default. If set to false, the service - // will return generic (unfiltered) popular products instead of empty if - // your filter blocks all prediction results. - // * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - // it needs to be one of {'no-price-reranking', 'low-price-reranking', - // 'medium-price-reranking', 'high-price-reranking'}. This gives - // request-level control and adjusts prediction results based on product - // price. - // * `diversityLevel`: String. Default empty. If set to be non-empty, then - // it needs to be one of {'no-diversity', 'low-diversity', - // 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - // request-level control and adjusts prediction results based on product - // category. - // * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - // field is interpreteted according to the new, attribute-based syntax. - map params = 7; - - // The labels applied to a resource must meet the following requirements: - // - // * Each resource can have multiple labels, up to a maximum of 64. - // * Each label must be a key-value pair. - // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters and cannot be empty. Values can be empty and have a maximum - // length of 63 characters. - // * Keys and values can contain only lowercase letters, numeric characters, - // underscores, and dashes. All characters must use UTF-8 encoding, and - // international characters are allowed. - // * The key portion of a label must be unique. However, you can use the same - // key with multiple resources. - // * Keys must start with a lowercase letter or international character. - // - // See [Google Cloud - // Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - // for more details. - map labels = 8; -} - -// Response message for predict method. -message PredictResponse { - // PredictionResult represents the recommendation prediction results. - message PredictionResult { - // ID of the recommended product - string id = 1; - - // Additional product metadata / annotations. - // - // Possible values: - // - // * `product`: JSON representation of the product. Is set if - // `returnProduct` is set to true in `PredictRequest.params`. - // * `score`: Prediction score in double value. Is set if - // `returnScore` is set to true in `PredictRequest.params`. - map metadata = 2; - } - - // A list of recommended products. The order represents the ranking (from the - // most relevant product to the least). - repeated PredictionResult results = 1; - - // A unique attribution token. This should be included in the - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] logs resulting from this - // recommendation, which enables accurate attribution of recommendation model - // performance. - string attribution_token = 2; - - // IDs of products in the request that were missing from the inventory. - repeated string missing_ids = 3; - - // True if the validateOnly property was set in the request. - bool validate_only = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product.proto.baseline deleted file mode 100644 index 87875ec86153..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product.proto.baseline +++ /dev/null @@ -1,600 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/promotion.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProductProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Product captures all metadata information of items to be recommended or -// searched. -message Product { - option (google.api.resource) = { - type: "retail.googleapis.com/Product" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}" - }; - - // The type of this product. - enum Type { - // Default value. Default to - // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // if unset. - TYPE_UNSPECIFIED = 0; - - // The primary type. - // - // As the primary unit for predicting, indexing and search serving, a - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] is grouped with multiple - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. - PRIMARY = 1; - - // The variant type. - // - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s usually share some common - // attributes on the same - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s, but they have variant - // attributes like different colors, sizes and prices, etc. - VARIANT = 2; - - // The collection type. Collection products are bundled - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s or - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s that are sold together, - // such as a jewelry set with necklaces, earrings and rings, etc. - COLLECTION = 3; - } - - // Product availability. If this field is unspecified, the product is - // assumed to be in stock. - enum Availability { - // Default product availability. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK] - // if unset. - AVAILABILITY_UNSPECIFIED = 0; - - // Product in stock. - IN_STOCK = 1; - - // Product out of stock. - OUT_OF_STOCK = 2; - - // Product that is in pre-order state. - PREORDER = 3; - - // Product that is back-ordered (i.e. temporarily out of stock). - BACKORDER = 4; - } - - oneof expiration { - // Note that this field is applied in the following ways: - // - // * If the [Product][google.cloud.retail.v2alpha.Product] is already - // expired when it is uploaded, this product - // is not indexed for search. - // - // * If the [Product][google.cloud.retail.v2alpha.Product] is not expired - // when it is uploaded, only the - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY]'s and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]'s - // expireTime is respected, and - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]'s - // expireTime is not used. - // - // In general, we suggest the users to delete the stale - // products explicitly, instead of using this field to determine staleness. - // - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] must be - // later than - // [available_time][google.cloud.retail.v2alpha.Product.available_time] and - // [publish_time][google.cloud.retail.v2alpha.Product.publish_time], - // otherwise an INVALID_ARGUMENT error is thrown. - // - // Corresponding properties: Google Merchant Center property - // [expiration_date](https://support.google.com/merchants/answer/6324499). - google.protobuf.Timestamp expire_time = 16; - - // Input only. The TTL (time to live) of the product. Note that this is only - // applicable to - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], - // and ignored for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. In - // general, we suggest the users to delete the stale products explicitly, - // instead of using this field to determine staleness. - // - // If it is set, it must be a non-negative value, and - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is set as - // current timestamp plus [ttl][google.cloud.retail.v2alpha.Product.ttl]. - // The derived - // [expire_time][google.cloud.retail.v2alpha.Product.expire_time] is - // returned in the output and [ttl][google.cloud.retail.v2alpha.Product.ttl] - // is left blank when retrieving the - // [Product][google.cloud.retail.v2alpha.Product]. - // - // If it is set, the product is not available for - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // after current timestamp plus - // [ttl][google.cloud.retail.v2alpha.Product.ttl]. However, the product can - // still be retrieved by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // and - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - google.protobuf.Duration ttl = 17 - [(google.api.field_behavior) = INPUT_ONLY]; - } - - // Immutable. Full resource name of the product, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. [Product][google.cloud.retail.v2alpha.Product] identifier, which - // is the final component of [name][google.cloud.retail.v2alpha.Product.name]. - // For example, this field is "id_1", if - // [name][google.cloud.retail.v2alpha.Product.name] is - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [id](https://support.google.com/merchants/answer/6324405). Schema.org - // property [Product.sku](https://schema.org/sku). - string id = 2 [(google.api.field_behavior) = IMMUTABLE]; - - // Immutable. The type of the product. Default to - // [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2alpha.ProductLevelConfig.ingestion_product_type] - // if unset. - Type type = 3 [(google.api.field_behavior) = IMMUTABLE]; - - // Variant group identifier. Must be an - // [id][google.cloud.retail.v2alpha.Product.id], with the same parent branch - // with this product. Otherwise, an error is thrown. - // - // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s, this field can only be - // empty or set to the same value as - // [id][google.cloud.retail.v2alpha.Product.id]. - // - // For VARIANT [Product][google.cloud.retail.v2alpha.Product]s, this field - // cannot be empty. A maximum of 2,000 products are allowed to share the same - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [item_group_id](https://support.google.com/merchants/answer/6324507). - // Schema.org property - // [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID). - string primary_product_id = 4; - - // The [id][google.cloud.retail.v2alpha.Product.id] of the collection members - // when [type][google.cloud.retail.v2alpha.Product.type] is - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]. - // - // Non-existent product ids are allowed. - // The [type][google.cloud.retail.v2alpha.Product.type] of the members must be - // either [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] or - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] otherwise - // an INVALID_ARGUMENT error is thrown. Should not set it for other types. A - // maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is - // return. - repeated string collection_member_ids = 5; - - // The Global Trade Item Number (GTIN) of the product. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Corresponding properties: Google Merchant Center property - // [gtin](https://support.google.com/merchants/answer/6324461). - // Schema.org property - // [Product.isbn](https://schema.org/isbn), - // [Product.gtin8](https://schema.org/gtin8), - // [Product.gtin12](https://schema.org/gtin12), - // [Product.gtin13](https://schema.org/gtin13), or - // [Product.gtin14](https://schema.org/gtin14). - // - // If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned. - string gtin = 6; - - // Product categories. This field is repeated for supporting one product - // belonging to several parallel categories. Strongly recommended using the - // full path for better search / recommendation quality. - // - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // For example, if a shoes product belongs to both - // ["Shoes & Accessories" -> "Shoes"] and - // ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be - // represented as: - // - // "categories": [ - // "Shoes & Accessories > Shoes", - // "Sports & Fitness > Athletic Clothing > Shoes" - // ] - // - // Must be set for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] otherwise an - // INVALID_ARGUMENT error is returned. - // - // At most 250 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product] unless overridden through - // the Google Cloud console. Empty values are not allowed. Each value must be - // a UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, - // an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [google_product_category][mc_google_product_category]. Schema.org property - // [Product.category] (https://schema.org/category). - // - // [mc_google_product_category]: - // https://support.google.com/merchants/answer/6324436 - repeated string categories = 7; - - // Required. Product title. - // - // This field must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [title](https://support.google.com/merchants/answer/6324415). Schema.org - // property [Product.name](https://schema.org/name). - string title = 8 [(google.api.field_behavior) = REQUIRED]; - - // The brands of the product. - // - // A maximum of 30 brands are allowed unless overridden through the Google - // Cloud console. Each - // brand must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [brand](https://support.google.com/merchants/answer/6324351). Schema.org - // property [Product.brand](https://schema.org/brand). - repeated string brands = 9; - - // Product description. - // - // This field must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [description](https://support.google.com/merchants/answer/6324468). - // Schema.org property [Product.description](https://schema.org/description). - string description = 10; - - // Language of the title/description and other string attributes. Use language - // tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). - // - // For product prediction, this field is ignored and the model automatically - // detects the text language. The - // [Product][google.cloud.retail.v2alpha.Product] can include text in - // different languages, but duplicating - // [Product][google.cloud.retail.v2alpha.Product]s to provide text in multiple - // languages can result in degraded model performance. - // - // For product search this field is in use. It defaults to "en-US" if unset. - string language_code = 11; - - // Highly encouraged. Extra product attributes to be included. For example, - // for products, this could include the store name, vendor, style, color, etc. - // These are very strong signals for recommendation model, thus we highly - // recommend providing the attributes here. - // - // Features that can take on one of a limited number of possible values. Two - // types of features can be set are: - // - // Textual features. some examples would be the brand/maker of a product, or - // country of a customer. Numerical features. Some examples would be the - // height/weight of a product, or age of a customer. - // - // For example: `{ "vendor": {"text": ["vendor123", "vendor456"]}, - // "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]} - // }`. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * Max entries count: 200. - // * The key must be a UTF-8 encoded string with a length limit of 128 - // characters. - // * For indexable attribute, the key must match the pattern: - // `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or - // `KEY_1_LIKE_THIS`. - // * For text attributes, at most 400 values are allowed. Empty values are not - // allowed. Each value must be a non-empty UTF-8 encoded string with a - // length limit of 256 characters. - // * For number attributes, at most 400 values are allowed. - map attributes = 12; - - // Custom tags associated with the product. - // - // At most 250 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. This value must be a UTF-8 - // encoded string with a length limit of 1,000 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // This tag can be used for filtering recommendation results by passing the - // tag as part of the - // [PredictRequest.filter][google.cloud.retail.v2alpha.PredictRequest.filter]. - // - // Corresponding properties: Google Merchant Center property - // [custom_label_0–4](https://support.google.com/merchants/answer/6324473). - repeated string tags = 13; - - // Product price and cost information. - // - // Corresponding properties: Google Merchant Center property - // [price](https://support.google.com/merchants/answer/6324371). - PriceInfo price_info = 14; - - // The rating of this product. - Rating rating = 15; - - // The timestamp when this [Product][google.cloud.retail.v2alpha.Product] - // becomes available for - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // Note that this is only applicable to - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], and - // ignored for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]. - google.protobuf.Timestamp available_time = 18; - - // The online availability of the - // [Product][google.cloud.retail.v2alpha.Product]. Default to - // [Availability.IN_STOCK][google.cloud.retail.v2alpha.Product.Availability.IN_STOCK]. - // - // For primary products with variants set the availability of the primary as - // [Availability.OUT_OF_STOCK][google.cloud.retail.v2alpha.Product.Availability.OUT_OF_STOCK] - // and set the true availability at the variant level. This way the primary - // product will be considered "in stock" as long as it has at least one - // variant in stock. - // - // For primary products with no variants set the true availability at the - // primary level. - // - // Corresponding properties: Google Merchant Center property - // [availability](https://support.google.com/merchants/answer/6324448). - // Schema.org property [Offer.availability](https://schema.org/availability). - Availability availability = 19; - - // The available quantity of the item. - google.protobuf.Int32Value available_quantity = 20; - - // Fulfillment information, such as the store IDs for in-store pickup or - // region IDs for different shipping methods. - // - // All the elements must have distinct - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - // Otherwise, an INVALID_ARGUMENT error is returned. - repeated FulfillmentInfo fulfillment_info = 21; - - // Canonical URL directly linking to the product detail page. - // - // It is strongly recommended to provide a valid uri for the product, - // otherwise the service performance could be significantly degraded. - // - // This field must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [link](https://support.google.com/merchants/answer/6324416). Schema.org - // property [Offer.url](https://schema.org/url). - string uri = 22; - - // Product images for the product. We highly recommend putting the main - // image first. - // - // A maximum of 300 images are allowed. - // - // Corresponding properties: Google Merchant Center property - // [image_link](https://support.google.com/merchants/answer/6324350). - // Schema.org property [Product.image](https://schema.org/image). - repeated Image images = 23; - - // The target group associated with a given audience (e.g. male, veterans, - // car owners, musicians, etc.) of the product. - Audience audience = 24; - - // The color of the product. - // - // Corresponding properties: Google Merchant Center property - // [color](https://support.google.com/merchants/answer/6324487). Schema.org - // property [Product.color](https://schema.org/color). - ColorInfo color_info = 25; - - // The size of the product. To represent different size systems or size types, - // consider using this format: [[[size_system:]size_type:]size_value]. - // - // For example, in "US:MENS:M", "US" represents size system; "MENS" represents - // size type; "M" represents size value. In "GIRLS:27", size system is empty; - // "GIRLS" represents size type; "27" represents size value. In "32 inches", - // both size system and size type are empty, while size value is "32 inches". - // - // A maximum of 20 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [size](https://support.google.com/merchants/answer/6324492), - // [size_type](https://support.google.com/merchants/answer/6324497), and - // [size_system](https://support.google.com/merchants/answer/6324502). - // Schema.org property [Product.size](https://schema.org/size). - repeated string sizes = 26; - - // The material of the product. For example, "leather", "wooden". - // - // A maximum of 20 values are allowed. Each value must be a UTF-8 encoded - // string with a length limit of 200 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [material](https://support.google.com/merchants/answer/6324410). Schema.org - // property [Product.material](https://schema.org/material). - repeated string materials = 27; - - // The pattern or graphic print of the product. For example, "striped", "polka - // dot", "paisley". - // - // A maximum of 20 values are allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [pattern](https://support.google.com/merchants/answer/6324483). Schema.org - // property [Product.pattern](https://schema.org/pattern). - repeated string patterns = 28; - - // The condition of the product. Strongly encouraged to use the standard - // values: "new", "refurbished", "used". - // - // A maximum of 1 value is allowed per - // [Product][google.cloud.retail.v2alpha.Product]. Each value must be a UTF-8 - // encoded string with a length limit of 128 characters. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // Corresponding properties: Google Merchant Center property - // [condition](https://support.google.com/merchants/answer/6324469). - // Schema.org property - // [Offer.itemCondition](https://schema.org/itemCondition). - repeated string conditions = 29; - - // The promotions applied to the product. A maximum of 10 values are allowed - // per [Product][google.cloud.retail.v2alpha.Product]. Only - // [Promotion.promotion_id][google.cloud.retail.v2alpha.Promotion.promotion_id] - // will be used, other fields will be ignored if set. - repeated Promotion promotions = 34; - - // The timestamp when the product is published by the retailer for the first - // time, which indicates the freshness of the products. Note that this field - // is different from - // [available_time][google.cloud.retail.v2alpha.Product.available_time], given - // it purely describes product freshness regardless of when it is available on - // search and recommendation. - google.protobuf.Timestamp publish_time = 33; - - // Indicates which fields in the - // [Product][google.cloud.retail.v2alpha.Product]s are returned in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse]. - // - // Supported fields for all [type][google.cloud.retail.v2alpha.Product.type]s: - // - // * [audience][google.cloud.retail.v2alpha.Product.audience] - // * [availability][google.cloud.retail.v2alpha.Product.availability] - // * [brands][google.cloud.retail.v2alpha.Product.brands] - // * [color_info][google.cloud.retail.v2alpha.Product.color_info] - // * [conditions][google.cloud.retail.v2alpha.Product.conditions] - // * [gtin][google.cloud.retail.v2alpha.Product.gtin] - // * [materials][google.cloud.retail.v2alpha.Product.materials] - // * [name][google.cloud.retail.v2alpha.Product.name] - // * [patterns][google.cloud.retail.v2alpha.Product.patterns] - // * [price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [rating][google.cloud.retail.v2alpha.Product.rating] - // * [sizes][google.cloud.retail.v2alpha.Product.sizes] - // * [title][google.cloud.retail.v2alpha.Product.title] - // * [uri][google.cloud.retail.v2alpha.Product.uri] - // - // Supported fields only for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION]: - // - // * [categories][google.cloud.retail.v2alpha.Product.categories] - // * [description][google.cloud.retail.v2alpha.Product.description] - // * [images][google.cloud.retail.v2alpha.Product.images] - // - // Supported fields only for - // [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT]: - // - // * Only the first image in - // [images][google.cloud.retail.v2alpha.Product.images] - // - // To mark [attributes][google.cloud.retail.v2alpha.Product.attributes] as - // retrievable, include paths of the form "attributes.key" where "key" is the - // key of a custom attribute, as specified in - // [attributes][google.cloud.retail.v2alpha.Product.attributes]. - // - // For [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] and - // [Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION], the - // following fields are always returned in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] by default: - // - // * [name][google.cloud.retail.v2alpha.Product.name] - // - // For [Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT], the - // following fields are always returned in by default: - // - // * [name][google.cloud.retail.v2alpha.Product.name] - // * [color_info][google.cloud.retail.v2alpha.Product.color_info] - // - // Note: Returning more fields in - // [SearchResponse][google.cloud.retail.v2alpha.SearchResponse] can increase - // response payload size and serving latency. - // - // This field is deprecated. Use the retrievable site-wide control instead. - google.protobuf.FieldMask retrievable_fields = 30 [deprecated = true]; - - // Output only. Product variants grouped together on primary product which - // share similar product attributes. It's automatically grouped by - // [primary_product_id][google.cloud.retail.v2alpha.Product.primary_product_id] - // for all the product variants. Only populated for - // [Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]s. - // - // Note: This field is OUTPUT_ONLY for - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct]. - // Do not set this field in API requests. - repeated Product variants = 31 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A list of local inventories specific to different places. - // - // This field can be managed by - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // and - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // APIs if fine-grained, high-volume updates are necessary. - repeated LocalInventory local_inventories = 35 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product_service.proto.baseline deleted file mode 100644 index 2e1297f467fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/product_service.proto.baseline +++ /dev/null @@ -1,1004 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/cloud/retail/v2alpha/purge_config.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProductServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for ingesting [Product][google.cloud.retail.v2alpha.Product] -// information of the customer's website. -service ProductService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a [Product][google.cloud.retail.v2alpha.Product]. - rpc CreateProduct(CreateProductRequest) returns (Product) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" - body: "product" - }; - option (google.api.method_signature) = "parent,product,product_id"; - } - - // Gets a [Product][google.cloud.retail.v2alpha.Product]. - rpc GetProduct(GetProductRequest) returns (Product) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Gets a list of [Product][google.cloud.retail.v2alpha.Product]s. - rpc ListProducts(ListProductsRequest) returns (ListProductsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates a [Product][google.cloud.retail.v2alpha.Product]. - rpc UpdateProduct(UpdateProductRequest) returns (Product) { - option (google.api.http) = { - patch: "/v2alpha/{product.name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - body: "product" - }; - option (google.api.method_signature) = "product,update_mask"; - } - - // Deletes a [Product][google.cloud.retail.v2alpha.Product]. - rpc DeleteProduct(DeleteProductRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/products/**}" - }; - option (google.api.method_signature) = "name"; - } - - // Permanently deletes all selected - // [Product][google.cloud.retail.v2alpha.Product]s under a branch. - // - // This process is asynchronous. If the request is valid, the removal will be - // enqueued and processed offline. Depending on the number of - // [Product][google.cloud.retail.v2alpha.Product]s, this operation could take - // hours to complete. Before the operation completes, some - // [Product][google.cloud.retail.v2alpha.Product]s may still be returned by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, - // this operation could take hours to complete. To get a sample of - // [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set - // [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] - // to false. - rpc PurgeProducts(PurgeProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:purge" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.PurgeProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.PurgeProductsMetadata" - }; - } - - // Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. - // - // Request processing may be synchronous. - // Non-existing items are created. - // - // Note that it is possible for a subset of the - // [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated. - rpc ImportProducts(ImportProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } - - // Exports multiple [Product][google.cloud.retail.v2alpha.Product]s. - rpc ExportProducts(ExportProductsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*/branches/*}/products:export" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportProductsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } - - // Updates inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] while respecting the last - // update timestamps of each inventory field. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update is enqueued - // and processed downstream. As a consequence, when a response is returned, - // updates are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // When inventory is updated with - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], - // the specified inventory field value(s) overwrite any existing value(s) - // while ignoring the last update time for this field. Furthermore, the last - // update times for the specified inventory fields are overwritten by the - // times of the - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // or - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // request. - // - // If no inventory fields are set in - // [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], - // then any pre-existing inventory information for this product is used. - // - // If no inventory fields are set in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], - // then any existing inventory information is preserved. - // - // Pre-existing inventory information can only be updated with - // [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], - // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], - // and - // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. - // - // The returned [Operation][google.longrunning.Operation]s is obsolete after - // one day, and the [GetOperation][google.longrunning.Operations.GetOperation] - // API returns `NOT_FOUND` afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates are not marked as [done][google.longrunning.Operation.done] until - // they are obsolete. - rpc SetInventory(SetInventoryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{inventory.name=projects/*/locations/*/catalogs/*/branches/*/products/**}:setInventory" - body: "*" - }; - option (google.api.method_signature) = "inventory,set_mask"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.SetInventoryResponse" - metadata_type: "google.cloud.retail.v2alpha.SetInventoryMetadata" - }; - } - - // We recommend that you use the - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // method instead of the - // [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] - // method. - // [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] - // achieves the same results but provides more fine-grained control over - // ingesting local inventory data. - // - // Incrementally adds place IDs to - // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, the added place IDs are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc AddFulfillmentPlaces(AddFulfillmentPlacesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addFulfillmentPlaces" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse" - metadata_type: "google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata" - }; - } - - // We recommend that you use the - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // method instead of the - // [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] - // method. - // [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] - // achieves the same results but provides more fine-grained control over - // ingesting local inventory data. - // - // Incrementally removes place IDs from a - // [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // fulfillment information. If the request is valid, the update will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, the removed place IDs are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc RemoveFulfillmentPlaces(RemoveFulfillmentPlacesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeFulfillmentPlaces" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse" - metadata_type: "google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata" - }; - } - - // Updates local inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] at a list of places, while - // respecting the last update timestamps of each inventory field. - // - // This process is asynchronous and does not require the - // [Product][google.cloud.retail.v2alpha.Product] to exist before updating - // inventory information. If the request is valid, the update will be enqueued - // and processed downstream. As a consequence, when a response is returned, - // updates are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Local inventory information can only be modified using this method. - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // has no effect on local inventories. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc AddLocalInventories(AddLocalInventoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:addLocalInventories" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.AddLocalInventoriesResponse" - metadata_type: "google.cloud.retail.v2alpha.AddLocalInventoriesMetadata" - }; - } - - // Remove local inventory information for a - // [Product][google.cloud.retail.v2alpha.Product] at a list of places at a - // removal timestamp. - // - // This process is asynchronous. If the request is valid, the removal will be - // enqueued and processed downstream. As a consequence, when a response is - // returned, removals are not immediately manifested in the - // [Product][google.cloud.retail.v2alpha.Product] queried by - // [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] - // or - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. - // - // Local inventory information can only be removed using this method. - // [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] - // and - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // has no effect on local inventories. - // - // The returned [Operation][google.longrunning.Operation]s will be obsolete - // after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] - // API will return NOT_FOUND afterwards. - // - // If conflicting updates are issued, the - // [Operation][google.longrunning.Operation]s associated with the stale - // updates will not be marked as [done][google.longrunning.Operation.done] - // until being obsolete. - rpc RemoveLocalInventories(RemoveLocalInventoriesRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{product=projects/*/locations/*/catalogs/*/branches/*/products/**}:removeLocalInventories" - body: "*" - }; - option (google.api.method_signature) = "product"; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse" - metadata_type: "google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata" - }; - } -} - -// Request message for -// [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] -// method. -message CreateProductRequest { - // Required. The parent catalog resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The [Product][google.cloud.retail.v2alpha.Product] to create. - Product product = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the - // [Product][google.cloud.retail.v2alpha.Product], which will become the final - // component of the [Product.name][google.cloud.retail.v2alpha.Product.name]. - // - // If the caller does not have permission to create the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // This field must be unique among all - // [Product][google.cloud.retail.v2alpha.Product]s with the same - // [parent][google.cloud.retail.v2alpha.CreateProductRequest.parent]. - // Otherwise, an ALREADY_EXISTS error is returned. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string product_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for -// [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] -// method. -message GetProductRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the requested [Product][google.cloud.retail.v2alpha.Product] does not - // exist, a NOT_FOUND error is returned. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; -} - -// Request message for -// [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] -// method. -message UpdateProductRequest { - // Required. The product to update/create. - // - // If the caller does not have permission to update the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update does not - // exist and - // [allow_missing][google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing] - // is not set, a NOT_FOUND error is returned. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [Product][google.cloud.retail.v2alpha.Product] to update. The immutable and - // output only fields are NOT supported. If not set, all supported fields (the - // fields that are neither immutable nor output only) are updated. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - // - // The attribute key can be updated by setting the mask path as - // "attributes.${key_name}". If a key name is present in the mask but not in - // the patching product from the request, this key will be deleted after the - // update. - google.protobuf.FieldMask update_mask = 2; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, a new [Product][google.cloud.retail.v2alpha.Product] will be - // created. In this situation, `update_mask` is ignored. - bool allow_missing = 3; -} - -// Request message for -// [ProductService.DeleteProduct][google.cloud.retail.v2alpha.ProductService.DeleteProduct] -// method. -message DeleteProductRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to delete the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to delete does not - // exist, a NOT_FOUND error is returned. - // - // The [Product][google.cloud.retail.v2alpha.Product] to delete can neither be - // a - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product] member nor a - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] with more than one - // [variants][google.cloud.retail.v2alpha.Product.Type.VARIANT]. Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // All inventory information for the named - // [Product][google.cloud.retail.v2alpha.Product] will be deleted. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // This value only applies to the case when the target product is of type - // PRIMARY. - // When deleting a product of VARIANT/COLLECTION type, this value - // will be ignored. - // When set to true, the subsequent variant products will be - // deleted. - // When set to false, if the primary product has active variant products, an - // error will be returned. - bool force = 4; -} - -// Request message for -// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] -// method. -message ListProductsRequest { - // Required. The parent branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use - // `default_branch` as the branch ID, to list products under the default - // branch. - // - // If the caller does not have permission to list - // [Product][google.cloud.retail.v2alpha.Product]s under this branch, - // regardless of whether or not this branch exists, a PERMISSION_DENIED error - // is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to - // return. If unspecified, defaults to 100. The maximum allowed value is 1000. - // Values above 1000 will be coerced to 1000. - // - // If this field is negative, an INVALID_ARGUMENT error is returned. - int32 page_size = 2; - - // A page token - // [ListProductsResponse.next_page_token][google.cloud.retail.v2alpha.ListProductsResponse.next_page_token], - // received from a previous - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 3; - - // A filter to apply on the list results. Supported features: - // - // * List all the products under the parent branch if - // [filter][google.cloud.retail.v2alpha.ListProductsRequest.filter] is unset. - // * List - // [Product.Type.VARIANT][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s sharing the same - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product]. For example: - // `primary_product_id = "some_product_id"` - // * List [Product][google.cloud.retail.v2alpha.Product]s bundled in a - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product]. - // For example: - // `collection_product_id = "some_product_id"` - // * List [Product][google.cloud.retail.v2alpha.Product]s with a partibular - // type. For example: - // `type = "PRIMARY"` - // `type = "VARIANT"` - // `type = "COLLECTION"` - // - // If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - // - // If the specified - // [Product.Type.PRIMARY][google.cloud.retail.v2alpha.Product.Type.PRIMARY] - // [Product][google.cloud.retail.v2alpha.Product] or - // [Product.Type.COLLECTION][google.cloud.retail.v2alpha.Product.Type.COLLECTION] - // [Product][google.cloud.retail.v2alpha.Product] does not exist, a NOT_FOUND - // error is returned. - string filter = 4; - - // The fields of [Product][google.cloud.retail.v2alpha.Product] to return in - // the responses. If not set or empty, the following fields are returned: - // - // * [Product.name][google.cloud.retail.v2alpha.Product.name] - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // * [Product.title][google.cloud.retail.v2alpha.Product.title] - // * [Product.uri][google.cloud.retail.v2alpha.Product.uri] - // * [Product.images][google.cloud.retail.v2alpha.Product.images] - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.brands][google.cloud.retail.v2alpha.Product.brands] - // - // If "*" is provided, all fields are returned. - // [Product.name][google.cloud.retail.v2alpha.Product.name] is always returned - // no matter what mask is set. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned. - google.protobuf.FieldMask read_mask = 5; - - // If true and - // [page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] is - // empty, - // [ListProductsResponse.total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] - // is set to the total count of matched items irrespective of pagination. - // - // Notice that setting this field to true affects the performance. - bool require_total_size = 6; -} - -// Response message for -// [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] -// method. -message ListProductsResponse { - // The [Product][google.cloud.retail.v2alpha.Product]s. - repeated Product products = 1; - - // A token that can be sent as - // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 2; - - // The total count of matched [Product][google.cloud.retail.v2alpha.Product]s - // irrespective of pagination. The total number of - // [Product][google.cloud.retail.v2alpha.Product]s returned by pagination may - // be less than the - // [total_size][google.cloud.retail.v2alpha.ListProductsResponse.total_size] - // that matches. - // - // This field is ignored if - // [ListProductsRequest.require_total_size][google.cloud.retail.v2alpha.ListProductsRequest.require_total_size] - // is not set or - // [ListProductsRequest.page_token][google.cloud.retail.v2alpha.ListProductsRequest.page_token] - // is not empty. - int32 total_size = 3; -} - -// Request message for -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryRequest { - // Required. The inventory information to update. The allowable fields to - // update are: - // - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // The updated inventory fields must be specified in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask]. - // - // If - // [SetInventoryRequest.inventory.name][google.cloud.retail.v2alpha.Product.name] - // is empty or invalid, an INVALID_ARGUMENT error is returned. - // - // If the caller does not have permission to update the - // [Product][google.cloud.retail.v2alpha.Product] named in - // [Product.name][google.cloud.retail.v2alpha.Product.name], regardless of - // whether or not it exists, a PERMISSION_DENIED error is returned. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update does not - // have existing inventory information, the provided inventory information - // will be inserted. - // - // If the [Product][google.cloud.retail.v2alpha.Product] to update has - // existing inventory information, the provided inventory information will be - // merged while respecting the last update time for each inventory field, - // using the provided or default value for - // [SetInventoryRequest.set_time][google.cloud.retail.v2alpha.SetInventoryRequest.set_time]. - // - // The caller can replace place IDs for a subset of fulfillment types in the - // following ways: - // - // * Adds "fulfillment_info" in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] - // * Specifies only the desired fulfillment types and corresponding place IDs - // to update in - // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // - // The caller can clear all place IDs from a subset of fulfillment types in - // the following ways: - // - // * Adds "fulfillment_info" in - // [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask] - // * Specifies only the desired fulfillment types to clear in - // [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // * Checks that only the desired fulfillment info types have empty - // [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // - // The last update time is recorded for the following inventory fields: - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // * [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // * [Product.available_quantity][google.cloud.retail.v2alpha.Product.available_quantity] - // * [Product.fulfillment_info][google.cloud.retail.v2alpha.Product.fulfillment_info] - // - // If a full overwrite of inventory information while ignoring timestamps is - // needed, - // [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] - // should be invoked instead. - Product inventory = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which inventory fields in the provided - // [Product][google.cloud.retail.v2alpha.Product] to update. - // - // At least one field must be provided. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned and the entire update will be ignored. - google.protobuf.FieldMask set_mask = 2; - - // The time when the request is issued, used to prevent - // out-of-order updates on inventory fields with the last update time - // recorded. If not provided, the internal system time will be used. - google.protobuf.Timestamp set_time = 3; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] with - // name [Product.name][google.cloud.retail.v2alpha.Product.name] is not found, - // the inventory update will still be processed and retained for at most 1 day - // until the [Product][google.cloud.retail.v2alpha.Product] is created. If set - // to false, a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 4; -} - -// Metadata related to the progress of the SetInventory operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryMetadata {} - -// Response of the SetInventoryRequest. Currently empty because -// there is no meaningful response populated from the -// [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory] -// method. -message SetInventoryResponse {} - -// Request message for -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. The fulfillment type, including commonly used types (such as - // pickup in store and same day delivery), and custom types. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // This field directly corresponds to - // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The IDs for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type], such - // as the store IDs for "pickup-in-store" or the region IDs for - // "same-day-delivery" to be added for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type]. - // Duplicate IDs will be automatically ignored. - // - // At least 1 value is required, and a maximum of 2000 values are allowed. - // Each value must be a string with a length limit of 10 characters, matching - // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - // INVALID_ARGUMENT error is returned. - // - // If the total number of place IDs exceeds 2000 for this - // [type][google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type] after - // adding, then the update will be rejected. - repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; - - // The time when the fulfillment updates are issued, used to prevent - // out-of-order updates on fulfillment information. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp add_time = 4; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the fulfillment information will still be processed and retained - // for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 5; -} - -// Metadata related to the progress of the AddFulfillmentPlaces operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesMetadata {} - -// Response of the AddFulfillmentPlacesRequest. Currently empty because -// there is no meaningful response populated from the -// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] -// method. -message AddFulfillmentPlacesResponse {} - -// Request message for -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. A list of inventory information at difference places. Each place - // is identified by its place ID. At most 3000 inventories are allowed per - // request. - repeated LocalInventory local_inventories = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Indicates which inventory fields in the provided list of - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory] to update. The - // field is updated to the provided value. - // - // If a field is set while the place does not have a previous local inventory, - // the local inventory at that store is created. - // - // If a field is set while the value of that field is not provided, the - // original field value, if it exists, is deleted. - // - // If the mask is not set or set with empty paths, all inventory fields will - // be updated. - // - // If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - // is returned and the entire update will be ignored. - google.protobuf.FieldMask add_mask = 4; - - // The time when the inventory updates are issued. Used to prevent - // out-of-order updates on local inventory fields. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp add_time = 5; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the local inventory will still be processed and retained for at - // most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 6; -} - -// Metadata related to the progress of the AddLocalInventories operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesMetadata {} - -// Response of the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// API. Currently empty because there is no meaningful response populated from -// the -// [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] -// method. -message AddLocalInventoriesResponse {} - -// Request message for -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. A list of place IDs to have their inventory deleted. - // At most 3000 place IDs are allowed per request. - repeated string place_ids = 2 [(google.api.field_behavior) = REQUIRED]; - - // The time when the inventory deletions are issued. Used to prevent - // out-of-order updates and deletions on local inventory fields. If not - // provided, the internal system time will be used. - google.protobuf.Timestamp remove_time = 5; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the local inventory removal request will still be processed and - // retained for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 3; -} - -// Metadata related to the progress of the RemoveLocalInventories operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesMetadata {} - -// Response of the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// API. Currently empty because there is no meaningful response populated from -// the -// [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] -// method. -message RemoveLocalInventoriesResponse {} - -// Request message for -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesRequest { - // Required. Full resource name of - // [Product][google.cloud.retail.v2alpha.Product], such as - // `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - // - // If the caller does not have permission to access the - // [Product][google.cloud.retail.v2alpha.Product], regardless of whether or - // not it exists, a PERMISSION_DENIED error is returned. - string product = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; - - // Required. The fulfillment type, including commonly used types (such as - // pickup in store and same day delivery), and custom types. - // - // Supported values: - // - // * "pickup-in-store" - // * "ship-to-store" - // * "same-day-delivery" - // * "next-day-delivery" - // * "custom-type-1" - // * "custom-type-2" - // * "custom-type-3" - // * "custom-type-4" - // * "custom-type-5" - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - // - // This field directly corresponds to - // [Product.fulfillment_info.type][google.cloud.retail.v2alpha.FulfillmentInfo.type]. - string type = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The IDs for this - // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type], - // such as the store IDs for "pickup-in-store" or the region IDs for - // "same-day-delivery", to be removed for this - // [type][google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type]. - // - // At least 1 value is required, and a maximum of 2000 values are allowed. - // Each value must be a string with a length limit of 10 characters, matching - // the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - // INVALID_ARGUMENT error is returned. - repeated string place_ids = 3 [(google.api.field_behavior) = REQUIRED]; - - // The time when the fulfillment updates are issued, used to prevent - // out-of-order updates on fulfillment information. If not provided, the - // internal system time will be used. - google.protobuf.Timestamp remove_time = 4; - - // If set to true, and the [Product][google.cloud.retail.v2alpha.Product] is - // not found, the fulfillment information will still be processed and retained - // for at most 1 day and processed once the - // [Product][google.cloud.retail.v2alpha.Product] is created. If set to false, - // a NOT_FOUND error is returned if the - // [Product][google.cloud.retail.v2alpha.Product] is not found. - bool allow_missing = 5; -} - -// Metadata related to the progress of the RemoveFulfillmentPlaces operation. -// Currently empty because there is no meaningful metadata populated from the -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesMetadata {} - -// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there -// is no meaningful response populated from the -// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] -// method. -message RemoveFulfillmentPlacesResponse {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project.proto.baseline deleted file mode 100644 index 41da0d53c1b7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project.proto.baseline +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProjectProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Project level logging config to control what level of log will be generated -// and written to Cloud Logging. -message LoggingConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/LoggingConfig" - pattern: "projects/{project}/loggingConfig" - }; - - // The logging configurations for services supporting log generation. - message LogGenerationRule { - // The logging level. - // - // By default it is set to `LOG_WARNINGS_AND_ABOVE`. - LoggingLevel logging_level = 1; - - // The log sample rate for INFO level log entries. You can use this to - // reduce the number of entries generated for INFO level logs. - // - // DO NOT set this field if the - // [logging_level][google.cloud.retail.v2alpha.LoggingConfig.LogGenerationRule.logging_level] - // is not - // [LoggingLevel.LOG_ALL][google.cloud.retail.v2alpha.LoggingConfig.LoggingLevel.LOG_ALL]. - // Otherwise, an INVALID_ARGUMENT error is returned. - // - // Sample rate for INFO logs defaults to 1 when unset (generate and send all - // INFO logs to Cloud Logging). Its value must be greater than 0 and less - // than or equal to 1. - optional float info_log_sample_rate = 2; - } - - // The granular logging configurations for supported services. - message ServiceLogGenerationRule { - // Required. Supported service names: - // "CatalogService", - // "CompletionService", - // "ControlService", - // "MerchantCenterStreaming", - // "ModelService", - // "PredictionService", - // "ProductService", - // "ServingConfigService", - // "UserEventService", - string service_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The log generation rule that applies to this service. - LogGenerationRule log_generation_rule = 3; - } - - // The setting to control log generation. - enum LoggingLevel { - // Default value. Defaults to `LOG_FOR_WARNINGS_AND_ABOVE` if unset. - LOGGING_LEVEL_UNSPECIFIED = 0; - - // No log will be generated and sent to Cloud Logging. - LOGGING_DISABLED = 1; - - // Log for operations resulted in fatal error. - LOG_ERRORS_AND_ABOVE = 2; - - // In addition to `LOG_ERRORS_AND_ABOVE`, also log for operations that have - // soft errors, quality suggestions. - LOG_WARNINGS_AND_ABOVE = 3; - - // Log all operations, including successful ones. - LOG_ALL = 4; - } - - // Required. Immutable. The name of the LoggingConfig singleton resource. - // Format: projects/*/loggingConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // The log generation rule that applies by default to all services - // supporting log generation. It can be overridden by - // [ServiceLogGenerationRule][google.cloud.retail.v2alpha.LoggingConfig.ServiceLogGenerationRule] - // for service level control. - LogGenerationRule default_log_generation_rule = 2; - - // Controls logging configurations more granularly for each supported - // service. - // - // This overrides the - // [default_log_generation_rule][google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule] - // for the services specified. For those not mentioned, they will fallback to - // the default log generation rule. - repeated ServiceLogGenerationRule service_log_generation_rules = 4; -} - -// Metadata that describes a Cloud Retail Project. -message Project { - option (google.api.resource) = { - type: "retail.googleapis.com/RetailProject" - pattern: "projects/{project}/retailProject" - }; - - // Output only. Full resource name of the retail project, such as - // `projects/{project_id_or_number}/retailProject`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Retail API solutions that the project has enrolled. - repeated SolutionType enrolled_solutions = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Project level alert config. -message AlertConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/AlertConfig" - pattern: "projects/{project}/alertConfig" - }; - - // Alert policy for a customer. - message AlertPolicy { - // Recipient contact information. - message Recipient { - // Email address of the recipient. - string email_address = 1; - } - - // The enrollment status enum for alert policy. - enum EnrollStatus { - // Default value. Used for customers who have not responded to the - // alert policy. - ENROLL_STATUS_UNSPECIFIED = 0; - - // Customer is enrolled in this policy. - ENROLLED = 1; - - // Customer declined this policy. - DECLINED = 2; - } - - // The feature that provides alerting capability. - // Supported value: - // - `search-data-quality` for retail search customers. - // - `conv-data-quality` for retail conversation customers. - string alert_group = 1; - - // The enrollment status of a customer. - EnrollStatus enroll_status = 2; - - // Recipients for the alert policy. - // One alert policy should not exceed 20 recipients. - repeated Recipient recipients = 3; - } - - // Required. Immutable. The name of the AlertConfig singleton resource. - // Format: projects/*/alertConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Alert policies for a customer. - // They must be unique by [AlertPolicy.alert_group] - repeated AlertPolicy alert_policies = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project_service.proto.baseline deleted file mode 100644 index c1c4f74360e5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/project_service.proto.baseline +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/project.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ProjectServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for settings at Project level. -service ProjectService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Gets the project. - // - // Throws `NOT_FOUND` if the project wasn't initialized for the Retail API - // service. - rpc GetProject(GetProjectRequest) returns (Project) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/retailProject}" - }; - option (google.api.method_signature) = "name"; - } - - // Accepts service terms for this project. - // By making requests to this API, you agree to the terms of service linked - // below. - // https://cloud.google.com/retail/data-use-terms - rpc AcceptTerms(AcceptTermsRequest) returns (Project) { - option (google.api.http) = { - post: "/v2alpha/{project=projects/*/retailProject}:acceptTerms" - body: "*" - }; - option (google.api.method_signature) = "project"; - } - - // The method enrolls a solution of type [Retail - // Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] - // into a project. - // - // The [Recommendations AI solution - // type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] - // is enrolled by default when your project enables Retail API, so you don't - // need to call the enrollSolution method for recommendations. - rpc EnrollSolution(EnrollSolutionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{project=projects/*}:enrollSolution" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.EnrollSolutionResponse" - metadata_type: "google.cloud.retail.v2alpha.EnrollSolutionMetadata" - }; - } - - // Lists all the retail API solutions the project has enrolled. - rpc ListEnrolledSolutions(ListEnrolledSolutionsRequest) - returns (ListEnrolledSolutionsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*}:enrolledSolutions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the - // requested project. - rpc GetLoggingConfig(GetLoggingConfigRequest) returns (LoggingConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/loggingConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of - // the requested project. - rpc UpdateLoggingConfig(UpdateLoggingConfigRequest) returns (LoggingConfig) { - option (google.api.http) = { - patch: "/v2alpha/{logging_config.name=projects/*/loggingConfig}" - body: "logging_config" - }; - option (google.api.method_signature) = "logging_config,update_mask"; - } - - // Get the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] of the - // requested project. - rpc GetAlertConfig(GetAlertConfigRequest) returns (AlertConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/alertConfig}" - }; - option (google.api.method_signature) = "name"; - } - - // Update the alert config of the requested project. - rpc UpdateAlertConfig(UpdateAlertConfigRequest) returns (AlertConfig) { - option (google.api.http) = { - patch: "/v2alpha/{alert_config.name=projects/*/alertConfig}" - body: "alert_config" - }; - option (google.api.method_signature) = "alert_config,update_mask"; - } -} - -// Request for GetProject method. -message GetProjectRequest { - // Required. Full resource name of the project. Format: - // `projects/{project_number_or_id}/retailProject` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/RetailProject" - } - ]; -} - -// Request for AcceptTerms method. -message AcceptTermsRequest { - // Required. Full resource name of the project. Format: - // `projects/{project_number_or_id}/retailProject` - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/RetailProject" - } - ]; -} - -// Request for EnrollSolution method. -message EnrollSolutionRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number_or_id}` - string project = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. Solution to enroll. - SolutionType solution = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for EnrollSolution method. -message EnrollSolutionResponse { - // Retail API solution that the project has enrolled. - SolutionType enrolled_solution = 1; -} - -// Metadata related to the EnrollSolution method. -// This will be returned by the google.longrunning.Operation.metadata field. -message EnrollSolutionMetadata {} - -// Request for ListEnrolledSolutions method. -message ListEnrolledSolutionsRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number_or_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; -} - -// Response for ListEnrolledSolutions method. -message ListEnrolledSolutionsResponse { - // Retail API solutions that the project has enrolled. - repeated SolutionType enrolled_solutions = 1; -} - -// Request for -// [ProjectService.GetLoggingConfig][google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig] -// method. -message GetLoggingConfigRequest { - // Required. Full LoggingConfig resource name. Format: - // projects/{project_number}/loggingConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/LoggingConfig" - } - ]; -} - -// Request for -// [ProjectService.UpdateLoggingConfig][google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig] -// method. -message UpdateLoggingConfigRequest { - // Required. The [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to - // update. - // - // If the caller does not have permission to update the - // [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to update - // does not exist, a NOT_FOUND error is returned. - LoggingConfig logging_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] to update. The - // following are the only supported fields: - // - // * [LoggingConfig.default_log_generation_rule][google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule] - // * [LoggingConfig.service_log_generation_rules][google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for -// [ProjectService.GetAlertConfig][google.cloud.retail.v2alpha.ProjectService.GetAlertConfig] -// method. -message GetAlertConfigRequest { - // Required. Full AlertConfig resource name. Format: - // projects/{project_number}/alertConfig - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/AlertConfig" - } - ]; -} - -// Request for -// [ProjectService.UpdateAlertConfig][google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig] -// method. -message UpdateAlertConfigRequest { - // Required. The [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to - // update. - // - // If the caller does not have permission to update the - // [AlertConfig][google.cloud.retail.v2alpha.AlertConfig], then a - // PERMISSION_DENIED error is returned. - // - // If the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to update - // does not exist, a NOT_FOUND error is returned. - AlertConfig alert_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] to update. If not - // set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/promotion.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/promotion.proto.baseline deleted file mode 100644 index 3c9950fdc03b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/promotion.proto.baseline +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PromotionProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Promotion information. -message Promotion { - // ID of the promotion. For example, "free gift". - // - // The value must be a UTF-8 encoded string with a length limit of 128 - // characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example, - // id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is - // returned. - // - // Corresponds to Google Merchant Center property - // [promotion_id](https://support.google.com/merchants/answer/7050148). - string promotion_id = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline deleted file mode 100644 index a2cc7c1c2ab7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/purge_config.proto.baseline +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "PurgeConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Metadata related to the progress of the Purge operation. -// This will be returned by the google.longrunning.Operation.metadata field. -message PurgeMetadata {} - -// Metadata related to the progress of the PurgeProducts operation. -// This will be returned by the google.longrunning.Operation.metadata field. -message PurgeProductsMetadata { - // Operation create time. - google.protobuf.Timestamp create_time = 1; - - // Operation last update time. If the operation is done, this is also the - // finish time. - google.protobuf.Timestamp update_time = 2; - - // Count of entries that were deleted successfully. - int64 success_count = 3; - - // Count of entries that encountered errors while processing. - int64 failure_count = 4; -} - -// Request message for PurgeProducts method. -message PurgeProductsRequest { - // Required. The resource name of the branch under which the products are - // created. The format is - // `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Required. The filter string to specify the products to be deleted with a - // length limit of 5,000 characters. - // - // Empty string filter is not allowed. "*" implies delete all items in a - // branch. - // - // The eligible fields for filtering are: - // - // * `availability`: Double quoted - // [Product.availability][google.cloud.retail.v2alpha.Product.availability] - // string. - // * `create_time` : in ISO 8601 "zulu" format. - // - // Supported syntax: - // - // * Comparators (">", "<", ">=", "<=", "="). - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" - // * availability = "IN_STOCK" - // - // * Conjunctions ("AND") - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - // - // * Disjunctions ("OR") - // Examples: - // * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - // - // * Can support nested queries. - // Examples: - // * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - // OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - // - // * Filter Limits: - // * Filter should not contain more than 6 conditions. - // * Max nesting depth should not exceed 2 levels. - // - // Examples queries: - // * Delete back order products created before a timestamp. - // create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Actually perform the purge. - // If `force` is set to false, the method will return the expected purge count - // without deleting any products. - bool force = 3; -} - -// Response of the PurgeProductsRequest. If the long running operation is -// successfully done, then this message is returned by the -// google.longrunning.Operations.response field. -message PurgeProductsResponse { - // The total count of products purged as a result of the operation. - int64 purge_count = 1; - - // A sample of the product names that will be deleted. - // Only populated if `force` is set to false. A max of 100 names will be - // returned and the names are chosen at random. - repeated string purge_sample = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Product" } - ]; -} - -// Request message for PurgeUserEvents method. -message PurgeUserEventsRequest { - // Required. The resource name of the catalog under which the events are - // created. The format is - // `projects/${projectId}/locations/global/catalogs/${catalogId}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The filter string to specify the events to be deleted with a - // length limit of 5,000 characters. Empty string filter is not allowed. The - // eligible fields for filtering are: - // - // * `eventType`: Double quoted - // [UserEvent.event_type][google.cloud.retail.v2alpha.UserEvent.event_type] - // string. - // * `eventTime`: in ISO 8601 "zulu" format. - // * `visitorId`: Double quoted string. Specifying this will delete all - // events associated with a visitor. - // * `userId`: Double quoted string. Specifying this will delete all events - // associated with a user. - // - // Examples: - // - // * Deleting all events in a time range: - // `eventTime > "2012-04-23T18:25:43.511Z" - // eventTime < "2012-04-23T18:30:43.511Z"` - // * Deleting specific eventType in time range: - // `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - // * Deleting all events for a specific visitor: - // `visitorId = "visitor1024"` - // - // The filtering fields are assumed to have an implicit AND. - string filter = 2 [(google.api.field_behavior) = REQUIRED]; - - // Actually perform the purge. - // If `force` is set to false, the method will return the expected purge count - // without deleting any user events. - bool force = 3; -} - -// Response of the PurgeUserEventsRequest. If the long running operation is -// successfully done, then this message is returned by the -// google.longrunning.Operations.response field. -message PurgeUserEventsResponse { - // The total count of events purged as a result of the operation. - int64 purged_events_count = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/search_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/search_service.proto.baseline deleted file mode 100644 index be49a1957ecc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/search_service.proto.baseline +++ /dev/null @@ -1,1267 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/struct.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "SearchServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; -option (google.api.resource_definition) = { - type: "retail.googleapis.com/Experiment" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}" -}; - -// Service for search. -// -// This feature is only available for users who have Retail Search enabled. -// Enable Retail Search on Cloud Console before using this feature. -service SearchService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Performs a search. - // - // This feature is only available for users who have Retail Search enabled. - // Enable Retail Search on Cloud Console before using this feature. - rpc Search(SearchRequest) returns (SearchResponse) { - option (google.api.http) = { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/placements/*}:search" - body: "*" - additional_bindings { - post: "/v2alpha/{placement=projects/*/locations/*/catalogs/*/servingConfigs/*}:search" - body: "*" - } - }; - } -} - -// Product attribute which structured by an attribute name and value. This -// structure is used in conversational search filters and answers. For example, -// if we have `name=color` and `value=red`, this means that the color is `red`. -message ProductAttributeValue { - // The attribute name. - string name = 1; - - // The attribute value. - string value = 2; -} - -// Product attribute name and numeric interval. -message ProductAttributeInterval { - // The attribute name (e.g. "length") - string name = 1; - - // The numeric interval (e.g. [10, 20)) - Interval interval = 2; -} - -// This field specifies the tile information including an attribute key, -// attribute value. More fields will be added in the future, eg: product id -// or product counts, etc. -message Tile { - // The attribute key and value for the tile. - oneof product_attribute { - // The product attribute key-value. - ProductAttributeValue product_attribute_value = 1; - - // The product attribute key-numeric interval. - ProductAttributeInterval product_attribute_interval = 2; - } - - // The representative product id for this tile. - string representative_product_id = 3; -} - -// Request message for -// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] -// method. -message SearchRequest { - // A facet specification to perform faceted search. - message FacetSpec { - // Specifies how a facet is computed. - message FacetKey { - // Required. Supported textual and numerical facet keys in - // [Product][google.cloud.retail.v2alpha.Product] object, over which the - // facet values are computed. Facet key is case-sensitive. - // - // Allowed facet keys when - // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] - // is not specified: - // - // * textual_field = - // * "brands" - // * "categories" - // * "genders" - // * "ageGroups" - // * "availability" - // * "colorFamilies" - // * "colors" - // * "sizes" - // * "materials" - // * "patterns" - // * "conditions" - // * "attributes.key" - // * "pickupInStore" - // * "shipToStore" - // * "sameDayDelivery" - // * "nextDayDelivery" - // * "customFulfillment1" - // * "customFulfillment2" - // * "customFulfillment3" - // * "customFulfillment4" - // * "customFulfillment5" - // * "inventory(place_id,attributes.key)" - // - // * numerical_field = - // * "price" - // * "discount" - // * "rating" - // * "ratingCount" - // * "attributes.key" - // * "inventory(place_id,price)" - // * "inventory(place_id,original_price)" - // * "inventory(place_id,attributes.key)" - string key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Set only if values should be bucketized into intervals. Must be set - // for facets with numerical values. Must not be set for facet with text - // values. Maximum number of intervals is 40. - // - // For all numerical facet keys that appear in the list of products from - // the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are - // computed from their distribution weekly. If the model assigns a high - // score to a numerical facet key and its intervals are not specified in - // the search request, these percentiles become the bounds - // for its intervals and are returned in the response. If the - // facet key intervals are specified in the request, then the specified - // intervals are returned instead. - repeated Interval intervals = 2; - - // Only get facet for the given restricted values. For example, when using - // "pickupInStore" as key and set restricted values to - // ["store123", "store456"], only facets for "store123" and "store456" are - // returned. Only supported on predefined textual fields, custom textual - // attributes and fulfillments. Maximum is 20. - // - // Must be set for the fulfillment facet keys: - // - // * pickupInStore - // - // * shipToStore - // - // * sameDayDelivery - // - // * nextDayDelivery - // - // * customFulfillment1 - // - // * customFulfillment2 - // - // * customFulfillment3 - // - // * customFulfillment4 - // - // * customFulfillment5 - repeated string restricted_values = 3; - - // Only get facet values that start with the given string prefix. For - // example, suppose "categories" has three values "Women > Shoe", - // "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the - // "categories" facet gives only "Women > Shoe" and "Women > Dress". - // Only supported on textual fields. Maximum is 10. - repeated string prefixes = 8; - - // Only get facet values that contains the given strings. For example, - // suppose "categories" has three values "Women > Shoe", - // "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the - // "categories" facet gives only "Women > Shoe" and "Men > Shoe". - // Only supported on textual fields. Maximum is 10. - repeated string contains = 9; - - // True to make facet keys case insensitive when getting faceting - // values with prefixes or contains; false otherwise. - bool case_insensitive = 10; - - // The order in which - // [SearchResponse.Facet.values][google.cloud.retail.v2alpha.SearchResponse.Facet.values] - // are returned. - // - // Allowed values are: - // - // * "count desc", which means order by - // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] - // descending. - // - // * "value desc", which means order by - // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] - // descending. - // Only applies to textual facets. - // - // If not set, textual values are sorted in [natural - // order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical - // intervals are sorted in the order given by - // [FacetSpec.FacetKey.intervals][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.intervals]; - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // are sorted in the order given by - // [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.restricted_values]. - string order_by = 4; - - // The query that is used to compute facet for the given facet key. - // When provided, it overrides the default behavior of facet - // computation. The query syntax is the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. Notice that there is no limitation - // on - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // when query is specified. - // - // In the response, - // [SearchResponse.Facet.values.value][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.value] - // is always "1" and - // [SearchResponse.Facet.values.count][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.count] - // is the number of results that match the query. - // - // For example, you can set a customized facet for "shipToStore", - // where - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // is "customizedShipToStore", and - // [FacetKey.query][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.query] - // is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")". - // Then the facet counts the products that are both in stock and ship - // to store "123". - string query = 5; - - // Returns the min and max value for each numerical facet intervals. - // Ignored for textual facets. - bool return_min_max = 11; - } - - // Required. The facet key specification. - FacetKey facet_key = 1 [(google.api.field_behavior) = REQUIRED]; - - // Maximum of facet values that should be returned for this facet. If - // unspecified, defaults to 50. The maximum allowed value is 300. Values - // above 300 will be coerced to 300. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 limit = 2; - - // List of keys to exclude when faceting. - // - // By default, - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // is not excluded from the filter unless it is listed in this field. - // - // Listing a facet key in this field allows its values to appear as facet - // results, even when they are filtered out of search results. Using this - // field does not affect what search results are returned. - // - // For example, suppose there are 100 products with the color facet "Red" - // and 200 products with the color facet "Blue". A query containing the - // filter "colorFamilies:ANY("Red")" and having "colorFamilies" as - // [FacetKey.key][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.key] - // would by default return only "Red" products in the search results, and - // also return "Red" with count 100 as the only color facet. Although there - // are also blue products available, "Blue" would not be shown as an - // available facet value. - // - // If "colorFamilies" is listed in "excludedFilterKeys", then the query - // returns the facet values "Red" with count 100 and "Blue" with count - // 200, because the "colorFamilies" key is now excluded from the filter. - // Because this field doesn't affect search results, the search results - // are still correctly filtered to return only "Red" products. - // - // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - repeated string excluded_filter_keys = 3; - - // Enables dynamic position for this facet. If set to true, the position of - // this facet among all facets in the response is determined by Google - // Retail Search. It is ordered together with dynamic facets if dynamic - // facets is enabled. If set to false, the position of this facet in the - // response is the same as in the request, and it is ranked before - // the facets with dynamic position enable and all dynamic facets. - // - // For example, you may always want to have rating facet returned in - // the response, but it's not necessarily to always display the rating facet - // at the top. In that case, you can set enable_dynamic_position to true so - // that the position of rating facet in response is determined by - // Google Retail Search. - // - // Another example, assuming you have the following facets in the request: - // - // * "rating", enable_dynamic_position = true - // - // * "price", enable_dynamic_position = false - // - // * "brands", enable_dynamic_position = false - // - // And also you have a dynamic facets enable, which generates a facet - // "gender". Then, the final order of the facets in the response can be - // ("price", "brands", "rating", "gender") or ("price", "brands", "gender", - // "rating") depends on how Google Retail Search orders "gender" and - // "rating" facets. However, notice that "price" and "brands" are always - // ranked at first and second position because their enable_dynamic_position - // values are false. - bool enable_dynamic_position = 4; - } - - // The specifications of dynamically generated facets. - message DynamicFacetSpec { - // Enum to control DynamicFacet mode - enum Mode { - // Default value. - MODE_UNSPECIFIED = 0; - - // Disable Dynamic Facet. - DISABLED = 1; - - // Automatic mode built by Google Retail Search. - ENABLED = 2; - } - - // Mode of the DynamicFacet feature. - // Defaults to - // [Mode.DISABLED][google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec.Mode.DISABLED] - // if it's unset. - Mode mode = 1; - } - - // Boost specification to boost certain items. - message BoostSpec { - // Boost applies to products which match a condition. - message ConditionBoostSpec { - // An expression which specifies a boost condition. The syntax and - // supported fields are the same as a filter expression. See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for detail syntax and limitations. - // - // Examples: - // - // * To boost products with product ID "product_1" or "product_2", and - // color - // "Red" or "Blue": - // * (id: ANY("product_1", "product_2")) AND (colorFamilies: - // ANY("Red","Blue")) - string condition = 1; - - // Strength of the condition boost, which should be in [-1, 1]. Negative - // boost means demotion. Default is 0.0. - // - // Setting to 1.0 gives the item a big promotion. However, it does not - // necessarily mean that the boosted item will be the top result at all - // times, nor that other items will be excluded. Results could still be - // shown even when none of them matches the condition. And results that - // are significantly more relevant to the search query can still trump - // your heavily favored but irrelevant items. - // - // Setting to -1.0 gives the item a big demotion. However, results that - // are deeply relevant might still be shown. The item will have an - // upstream battle to get a fairly high ranking, but it is not blocked out - // completely. - // - // Setting to 0.0 means no boost applied. The boosting condition is - // ignored. - float boost = 2; - } - - // Condition boost specifications. If a product matches multiple conditions - // in the specifications, boost scores from these specifications are all - // applied and combined in a non-linear way. Maximum number of - // specifications is 20. - repeated ConditionBoostSpec condition_boost_specs = 1; - - // Whether to skip boostspec validation. If this field is set to true, - // invalid - // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // will be ignored and valid - // [BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // will still be applied. - optional bool skip_boost_spec_validation = 2; - } - - // Specification to determine under which conditions query expansion should - // occur. - message QueryExpansionSpec { - // Enum describing under which condition query expansion should occur. - enum Condition { - // Unspecified query expansion condition. In this case, server behavior - // defaults to - // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. - CONDITION_UNSPECIFIED = 0; - - // Disabled query expansion. Only the exact search query is used, even if - // [SearchResponse.total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] - // is zero. - DISABLED = 1; - - // Automatic query expansion built by Google Retail Search. - AUTO = 3; - } - - // The condition under which query expansion should occur. Default to - // [Condition.DISABLED][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.Condition.DISABLED]. - Condition condition = 1; - - // Whether to pin unexpanded results. If this field is set to true, - // unexpanded products are always at the top of the search results, followed - // by the expanded results. - bool pin_unexpanded_results = 2; - } - - // The specification for personalization. - message PersonalizationSpec { - // The personalization mode of each search request. - enum Mode { - // Default value. In this case, server behavior defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - MODE_UNSPECIFIED = 0; - - // Let CRS decide whether to use personalization based on quality of user - // event data. - AUTO = 1; - - // Disable personalization. - DISABLED = 2; - } - - // Defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - Mode mode = 1; - } - - // The specification for query spell correction. - message SpellCorrectionSpec { - // Enum describing under which mode spell correction should occur. - enum Mode { - // Unspecified spell correction mode. In this case, server behavior - // defaults to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. - MODE_UNSPECIFIED = 0; - - // Google Retail Search will try to find a spell suggestion if there - // is any and put in the - // [SearchResponse.corrected_query][google.cloud.retail.v2alpha.SearchResponse.corrected_query]. - // The spell suggestion will not be used as the search query. - SUGGESTION_ONLY = 1; - - // Automatic spell correction built by Google Retail Search. Search will - // be based on the corrected query if found. - AUTO = 2; - } - - // The mode under which spell correction should take effect to - // replace the original search query. Default to - // [Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. - Mode mode = 1; - } - - // This field specifies all conversational related parameters addition to - // traditional retail search. - message ConversationalSearchSpec { - // This field specifies the current user answer during the conversational - // search. This can be either user selected from suggested answers or user - // input plain text. - message UserAnswer { - // This field specifies the selected answers during the conversational - // search. - message SelectedAnswer { - // This field is deprecated and should not be set. - repeated ProductAttributeValue product_attribute_values = 1 - [deprecated = true]; - - // This field specifies the selected answer which is a attribute - // key-value. - ProductAttributeValue product_attribute_value = 2; - } - - // This field specifies the type of user answer. - oneof type { - // This field specifies the incremental input text from the user during - // the conversational search. - string text_answer = 1; - - // This field specifies the selected attributes during the - // conversational search. This should be a subset of - // [ConversationalSearchResult.suggested_answers][]. - SelectedAnswer selected_answer = 2; - } - } - - // This field specifies whether the customer would like to do conversational - // search. If this field is set to true, conversational related extra - // information will be returned from server side, including follow-up - // question, answer options, etc. - bool followup_conversation_requested = 1; - - // This field specifies the conversation id, which maintains the state of - // the conversation between client side and server side. Use the value from - // the previous [ConversationalSearchResult.conversation_id][]. For the - // initial request, this should be empty. - string conversation_id = 2; - - // This field specifies the current user answer during the conversational - // search. This can be either user selected from suggested answers or user - // input plain text. - UserAnswer user_answer = 3; - } - - // This field specifies tile navigation related parameters. - message TileNavigationSpec { - // This field specifies whether the customer would like to request tile - // navigation. - bool tile_navigation_requested = 1; - - // This optional field specifies the tiles which are already clicked in - // client side. While the feature works without this field set, particularly - // for an initial query, it is highly recommended to set this field because - // it can improve the quality of the search response and removes possible - // duplicate tiles. - // - // NOTE: This field is not being used for filtering search - // products. Client side should also put all the applied tiles in - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - repeated Tile applied_tiles = 2; - } - - // The relevance threshold of the search results. The higher relevance - // threshold is, the higher relevant results are shown and the less number of - // results are returned. - enum RelevanceThreshold { - // Default value. In this case, server behavior defaults to - // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH]. - RELEVANCE_THRESHOLD_UNSPECIFIED = 0; - - // High relevance threshold. - HIGH = 1; - - // Medium relevance threshold. - MEDIUM = 2; - - // Low relevance threshold. - LOW = 3; - - // Lowest relevance threshold. - LOWEST = 4; - } - - // The search mode of each search request. - enum SearchMode { - // Default value. In this case both product search and faceted search will - // be performed. Both - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // and - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will be returned. - SEARCH_MODE_UNSPECIFIED = 0; - - // Only product search will be performed. The faceted search will be - // disabled. - // - // Only - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // will be returned. - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will not be returned, even if - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // or - // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] - // is set. - PRODUCT_SEARCH_ONLY = 1; - - // Only faceted search will be performed. The product search will be - // disabled. - // - // When in this mode, one or both of - // [SearchRequest.facet_specs][google.cloud.retail.v2alpha.SearchRequest.facet_specs] - // and - // [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2alpha.SearchRequest.dynamic_facet_spec] - // should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only - // [SearchResponse.Facet][google.cloud.retail.v2alpha.SearchResponse.Facet] - // will be returned. - // [SearchResponse.SearchResult][google.cloud.retail.v2alpha.SearchResponse.SearchResult] - // will not be returned. - FACETED_SEARCH_ONLY = 2; - } - - // Required. The resource name of the Retail Search serving config, such as - // `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - // or the name of the legacy placement resource, such as - // `projects/*/locations/global/catalogs/default_catalog/placements/default_search`. - // This field is used to identify the serving config name and the set - // of models that are used to make the search. - string placement = 1 [(google.api.field_behavior) = REQUIRED]; - - // The branch resource name, such as - // `projects/*/locations/global/catalogs/default_catalog/branches/0`. - // - // Use "default_branch" as the branch ID or leave this field empty, to search - // products under the default branch. - string branch = 2 [ - (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" } - ]; - - // Raw search query. - // - // If this field is empty, the request is considered a category browsing - // request and returned results are based on - // [filter][google.cloud.retail.v2alpha.SearchRequest.filter] and - // [page_categories][google.cloud.retail.v2alpha.SearchRequest.page_categories]. - string query = 3; - - // Required. A unique identifier for tracking visitors. For example, this - // could be implemented with an HTTP cookie, which should be able to uniquely - // identify a visitor on a single device. This unique identifier should not - // change if the visitor logs in or out of the website. - // - // This should be the same identifier as - // [UserEvent.visitor_id][google.cloud.retail.v2alpha.UserEvent.visitor_id]. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string visitor_id = 4 [(google.api.field_behavior) = REQUIRED]; - - // User information. - UserInfo user_info = 5; - - // Maximum number of [Product][google.cloud.retail.v2alpha.Product]s to - // return. If unspecified, defaults to a reasonable value. The maximum allowed - // value is 120. Values above 120 will be coerced to 120. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 page_size = 7; - - // A page token - // [SearchResponse.next_page_token][google.cloud.retail.v2alpha.SearchResponse.next_page_token], - // received from a previous - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // call. Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] - // must match the call that provided the page token. Otherwise, an - // INVALID_ARGUMENT error is returned. - string page_token = 8; - - // A 0-indexed integer that specifies the current offset (that is, starting - // result location, amongst the - // [Product][google.cloud.retail.v2alpha.Product]s deemed by the API as - // relevant) in search results. This field is only considered if - // [page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] is - // unset. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - int32 offset = 9; - - // The filter syntax consists of an expression language for constructing a - // predicate from one or more fields of the products being filtered. Filter - // expression is case-sensitive. For more information, see - // [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - // - // If this field is unrecognizable, an INVALID_ARGUMENT is returned. - string filter = 10; - - // The default filter that is applied when a user performs a search without - // checking any filters on the search page. - // - // The filter applied to every search request when quality improvement such as - // query expansion is needed. In the case a query does not have a sufficient - // amount of results this filter will be used to determine whether or not to - // enable the query expansion flow. The original filter will still be used for - // the query expanded search. - // This field is strongly recommended to achieve high search quality. - // - // For more information about filter syntax, see - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter]. - string canonical_filter = 28; - - // The order in which products are returned. Products can be ordered by - // a field in an [Product][google.cloud.retail.v2alpha.Product] object. Leave - // it unset if ordered by relevance. OrderBy expression is case-sensitive. For - // more information, see - // [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - // - // If this field is unrecognizable, an INVALID_ARGUMENT is returned. - string order_by = 11; - - // Facet specifications for faceted search. If empty, no facets are returned. - // - // A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - repeated FacetSpec facet_specs = 12; - - // Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - // to enable dynamic facets. Do not set this field. - // - // The specification for dynamically generated facets. Notice that only - // textual facets can be dynamically generated. - DynamicFacetSpec dynamic_facet_spec = 21 [deprecated = true]; - - // Boost specification to boost certain products. For more information, see - // [Boost results](https://cloud.google.com/retail/docs/boosting). - // - // Notice that if both - // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // are set, the boost conditions from both places are evaluated. If a search - // request matches multiple boost conditions, the final boost score is equal - // to the sum of the boost scores from all matched boost conditions. - BoostSpec boost_spec = 13; - - // The query expansion specification that specifies the conditions under which - // query expansion occurs. For more information, see [Query - // expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - QueryExpansionSpec query_expansion_spec = 14; - - // The relevance threshold of the search results. - // - // Defaults to - // [RelevanceThreshold.HIGH][google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH], - // which means only the most relevant results are shown, and the least number - // of results are returned. For more information, see [Adjust result - // size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - RelevanceThreshold relevance_threshold = 15; - - // The keys to fetch and rollup the matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s attributes, - // [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo] or - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s attributes. - // The attributes from all the matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s or - // [LocalInventory][google.cloud.retail.v2alpha.LocalInventory]s are merged - // and de-duplicated. Notice that rollup attributes will lead to extra query - // latency. Maximum number of keys is 30. - // - // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], a - // fulfillment type and a fulfillment ID must be provided in the format of - // "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - // "pickupInStore" is fulfillment type and "store123" is the store ID. - // - // Supported keys are: - // - // * colorFamilies - // * price - // * originalPrice - // * discount - // * variantId - // * inventory(place_id,price) - // * inventory(place_id,original_price) - // * inventory(place_id,attributes.key), where key is any key in the - // [Product.local_inventories.attributes][google.cloud.retail.v2alpha.LocalInventory.attributes] - // map. - // * attributes.key, where key is any key in the - // [Product.attributes][google.cloud.retail.v2alpha.Product.attributes] map. - // * pickupInStore.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "pickup-in-store". - // * shipToStore.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "ship-to-store". - // * sameDayDelivery.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "same-day-delivery". - // * nextDayDelivery.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "next-day-delivery". - // * customFulfillment1.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-1". - // * customFulfillment2.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-2". - // * customFulfillment3.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-3". - // * customFulfillment4.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-4". - // * customFulfillment5.id, where id is any - // [FulfillmentInfo.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids] - // for - // [FulfillmentInfo.type][google.cloud.retail.v2alpha.FulfillmentInfo.type] - // "custom-type-5". - // - // If this field is set to an invalid value other than these, an - // INVALID_ARGUMENT error is returned. - repeated string variant_rollup_keys = 17; - - // The categories associated with a category page. Must be set for category - // navigation queries to achieve good search quality. The format should be - // the same as - // [UserEvent.page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories]; - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - repeated string page_categories = 23; - - // The search mode of the search request. If not specified, a single search - // request triggers both product search and faceted search. - SearchMode search_mode = 31; - - // The specification for personalization. - // - // Notice that if both - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec] - // and - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // are set. - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // will override - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec]. - PersonalizationSpec personalization_spec = 32; - - // The labels applied to a resource must meet the following requirements: - // - // * Each resource can have multiple labels, up to a maximum of 64. - // * Each label must be a key-value pair. - // * Keys have a minimum length of 1 character and a maximum length of 63 - // characters and cannot be empty. Values can be empty and have a maximum - // length of 63 characters. - // * Keys and values can contain only lowercase letters, numeric characters, - // underscores, and dashes. All characters must use UTF-8 encoding, and - // international characters are allowed. - // * The key portion of a label must be unique. However, you can use the same - // key with multiple resources. - // * Keys must start with a lowercase letter or international character. - // - // For more information, see [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - // in the Resource Manager documentation. - map labels = 34; - - // The spell correction specification that specifies the mode under - // which spell correction will take effect. - optional SpellCorrectionSpec spell_correction_spec = 35; - - // The entity for customers that may run multiple different entities, domains, - // sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // If this is set, it should be exactly matched with - // [UserEvent.entity][google.cloud.retail.v2alpha.UserEvent.entity] to get - // search results boosted by entity. - string entity = 38; - - // Optional. This field specifies all conversational related parameters - // addition to traditional retail search. - ConversationalSearchSpec conversational_search_spec = 40 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field specifies tile navigation related parameters. - TileNavigationSpec tile_navigation_spec = 41 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - // [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - // information, see [Standardized codes](https://google.aip.dev/143). This - // field helps to better interpret the query. If a value isn't specified, the - // query language code is automatically detected, which may not be accurate. - string language_code = 43 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Unicode country/region code (CLDR) of a location, such as - // "US" and "419" - // [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - // For more information, see [Standardized codes](https://google.aip.dev/143). - // If set, then results will be boosted based on the region_code provided. - string region_code = 44 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. An id corresponding to a place, such as a store id or region id. - // When specified, we use the price from the local inventory with the matching - // product's - // [LocalInventory.place_id][google.cloud.retail.v2alpha.LocalInventory.place_id] - // for revenue optimization. - string place_id = 46 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The user attributes that could be used for personalization of - // search results. - // * Populate at most 100 key-value pairs per query. - // * Only supports string keys and repeated string values. - // * Duplcate keys are not allowed within a single query. - // - // Example: - // user_attributes: [ - // { key: "pets" - // value { - // values: "dog" - // values: "cat" - // } - // }, - // { key: "state" - // value { - // values: "CA" - // } - // } - // ] - map user_attributes = 47 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for -// [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search] -// method. -message SearchResponse { - // Represents the search results. - message SearchResult { - // [Product.id][google.cloud.retail.v2alpha.Product.id] of the searched - // [Product][google.cloud.retail.v2alpha.Product]. - string id = 1; - - // The product data snippet in the search response. Only - // [Product.name][google.cloud.retail.v2alpha.Product.name] is guaranteed to - // be populated. - // - // [Product.variants][google.cloud.retail.v2alpha.Product.variants] contains - // the product variants that match the search query. If there are multiple - // product variants matching the query, top 5 most relevant product variants - // are returned and ordered by relevancy. - // - // If relevancy can be deternmined, use - // [matching_variant_fields][google.cloud.retail.v2alpha.SearchResponse.SearchResult.matching_variant_fields] - // to look up matched product variants fields. If relevancy cannot be - // determined, e.g. when searching "shoe" all products in a shoe product can - // be a match, 5 product variants are returned but order is meaningless. - Product product = 2; - - // The count of matched - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product]s. - int32 matching_variant_count = 3; - - // If a [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] matches the search query, - // this map indicates which [Product][google.cloud.retail.v2alpha.Product] - // fields are matched. The key is the - // [Product.name][google.cloud.retail.v2alpha.Product.name], the value is a - // field mask of the matched [Product][google.cloud.retail.v2alpha.Product] - // fields. If matched attributes cannot be determined, this map will be - // empty. - // - // For example, a key "sku1" with field mask - // "products.color_info" indicates there is a match between - // "sku1" [ColorInfo][google.cloud.retail.v2alpha.ColorInfo] and the query. - map matching_variant_fields = 4; - - // The rollup matching - // [variant][google.cloud.retail.v2alpha.Product.Type.VARIANT] - // [Product][google.cloud.retail.v2alpha.Product] attributes. The key is one - // of the - // [SearchRequest.variant_rollup_keys][google.cloud.retail.v2alpha.SearchRequest.variant_rollup_keys]. - // The values are the merged and de-duplicated - // [Product][google.cloud.retail.v2alpha.Product] attributes. Notice that - // the rollup values are respect filter. For example, when filtering by - // "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is - // returned. - // - // For textual and numerical attributes, the rollup values is a list of - // string or double values with type - // [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if - // there are two variants with colors "red" and "blue", the rollup values - // are - // - // { key: "colorFamilies" - // value { - // list_value { - // values { string_value: "red" } - // values { string_value: "blue" } - // } - // } - // } - // - // For [FulfillmentInfo][google.cloud.retail.v2alpha.FulfillmentInfo], the - // rollup values is a double value with type - // [google.protobuf.Value][google.protobuf.Value]. For example, - // `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there - // are 10 variants in this product are available in the store "store1". - map variant_rollup_values = 5; - - // Specifies previous events related to this product for this user based on - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] with same - // [SearchRequest.visitor_id][google.cloud.retail.v2alpha.SearchRequest.visitor_id] - // or [UserInfo.user_id][google.cloud.retail.v2alpha.UserInfo.user_id]. - // - // This is set only when - // [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.mode] - // is - // [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec.Mode.AUTO]. - // - // Possible values: - // - // * `purchased`: Indicates that this product has been purchased before. - repeated string personal_labels = 7; - - // Google provided available scores. - map model_scores = 8; - } - - // A facet result. - message Facet { - // A facet value which contains value names and their count. - message FacetValue { - // A facet value which contains values. - oneof facet_value { - // Text value of a facet, such as "Black" for facet "colorFamilies". - string value = 1; - - // Interval value for a facet, such as [10, 20) for facet "price". - Interval interval = 2; - } - - // Number of items that have this facet value. - int64 count = 3; - - // The minimum value in the - // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. - // Only supported on numerical facets and returned if - // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] - // is true. - double min_value = 5; - - // The maximum value in the - // [FacetValue.interval][google.cloud.retail.v2alpha.SearchResponse.Facet.FacetValue.interval]. - // Only supported on numerical facets and returned if - // [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2alpha.SearchRequest.FacetSpec.FacetKey.return_min_max] - // is true. - double max_value = 6; - } - - // The key for this facet. E.g., "colorFamilies" or "price" or - // "attributes.attr1". - string key = 1; - - // The facet values for this field. - repeated FacetValue values = 2; - - // Whether the facet is dynamically generated. - bool dynamic_facet = 3; - } - - // Information describing query expansion including whether expansion has - // occurred. - message QueryExpansionInfo { - // Bool describing whether query expansion has occurred. - bool expanded_query = 1; - - // Number of pinned results. This field will only be set when expansion - // happens and - // [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec.pin_unexpanded_results] - // is set to true. - int64 pinned_result_count = 2; - } - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational retail search. - message ConversationalSearchResult { - // Suggested answers to the follow-up question. - message SuggestedAnswer { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // Additional filter that client side need to apply. - message AdditionalFilter { - // Product attribute value, including an attribute key and an - // attribute value. Other types can be added here in the future. - ProductAttributeValue product_attribute_value = 1; - } - - // Conversation UUID. This field will be stored in client side storage to - // maintain the conversation session with server and will be used for next - // search request's - // [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec.conversation_id] - // to restore conversation state in server. - string conversation_id = 1; - - // The current refined query for the conversational search. This field - // will be used in customer UI that the query in the search bar should be - // replaced with the refined query. For example, if - // [SearchRequest.query][google.cloud.retail.v2alpha.SearchRequest.query] is - // `dress` and next - // [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer] - // is `red color`, which does not match any product attribute value filters, - // the refined query will be `dress, red color`. - string refined_query = 2; - - // This field is deprecated but will be kept for backward compatibility. - // There is expected to have only one additional filter and the value will - // be the same to the same as field `additional_filter`. - repeated AdditionalFilter additional_filters = 3 [deprecated = true]; - - // The follow-up question. e.g., `What is the color?` - string followup_question = 4; - - // The answer options provided to client for the follow-up question. - repeated SuggestedAnswer suggested_answers = 5; - - // This is the incremental additional filters implied from the current - // user answer. User should add the suggested addition filters to the - // previous - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter], - // and use the merged filter in the follow up search request. - AdditionalFilter additional_filter = 6; - } - - // This field specifies all related information for tile navigation that will - // be used in client side. - message TileNavigationResult { - // The current tiles that are used for tile navigation, sorted by - // engagement. - repeated Tile tiles = 1; - } - - // A list of matched items. The order represents the ranking. - repeated SearchResult results = 1; - - // Results of facets requested by user. - repeated Facet facets = 2; - - // The estimated total count of matched items irrespective of pagination. The - // count of [results][google.cloud.retail.v2alpha.SearchResponse.results] - // returned by pagination may be less than the - // [total_size][google.cloud.retail.v2alpha.SearchResponse.total_size] that - // matches. - int32 total_size = 3; - - // Contains the spell corrected query, if found. If the spell correction type - // is AUTOMATIC, then the search results are based on corrected_query. - // Otherwise the original query is used for search. - string corrected_query = 4; - - // A unique search token. This should be included in the - // [UserEvent][google.cloud.retail.v2alpha.UserEvent] logs resulting from this - // search, which enables accurate attribution of search model performance. - string attribution_token = 5; - - // A token that can be sent as - // [SearchRequest.page_token][google.cloud.retail.v2alpha.SearchRequest.page_token] - // to retrieve the next page. If this field is omitted, there are no - // subsequent pages. - string next_page_token = 6; - - // Query expansion information for the returned results. - QueryExpansionInfo query_expansion_info = 7; - - // The URI of a customer-defined redirect page. If redirect action is - // triggered, no search is performed, and only - // [redirect_uri][google.cloud.retail.v2alpha.SearchResponse.redirect_uri] and - // [attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] - // are set in the response. - string redirect_uri = 10; - - // The fully qualified resource name of applied - // [controls](https://cloud.google.com/retail/docs/serving-control-rules). - repeated string applied_controls = 12; - - // Metadata for pin controls which were applicable to the request. - // This contains two map fields, one for all matched pins and one for pins - // which were matched but not applied. - // - // The two maps are keyed by pin position, and the values are the product ids - // which were matched to that pin. - PinControlMetadata pin_control_metadata = 22; - - // The invalid - // [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2alpha.SearchRequest.BoostSpec.condition_boost_specs] - // that are not applied during serving. - repeated SearchRequest.BoostSpec.ConditionBoostSpec - invalid_condition_boost_specs = 14; - - // Metadata related to A/B testing experiment associated with this - // response. Only exists when an experiment is triggered. - repeated ExperimentInfo experiment_info = 17; - - // This field specifies all related information that is needed on client - // side for UI rendering of conversational retail search. - ConversationalSearchResult conversational_search_result = 18; - - // This field specifies all related information for tile navigation that will - // be used in client side. - TileNavigationResult tile_navigation_result = 19; -} - -// Metadata for active A/B testing experiment. -message ExperimentInfo { - // Metadata for active serving config A/B tests. - message ServingConfigExperiment { - // The fully qualified resource name of the original - // [SearchRequest.placement][google.cloud.retail.v2alpha.SearchRequest.placement] - // in the search request prior to reassignment by experiment API. For - // example: `projects/*/locations/*/catalogs/*/servingConfigs/*`. - string original_serving_config = 1 [(google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - }]; - - // The fully qualified resource name of the serving config - // `Experiment.VariantArm.serving_config_id` responsible for generating - // the search response. For example: - // `projects/*/locations/*/catalogs/*/servingConfigs/*`. - string experiment_serving_config = 2 [(google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - }]; - } - - // Information associated with the specific experiment entity being recorded. - oneof experiment_metadata { - // A/B test between existing Cloud Retail Search - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s. - ServingConfigExperiment serving_config_experiment = 2; - } - - // The fully qualified resource name of the experiment that provides the - // serving config under test, should an active experiment exist. For example: - // `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id` - string experiment = 1 [(google.api.resource_reference) = { - type: "retail.googleapis.com/Experiment" - }]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline deleted file mode 100644 index b7fc8c04cf45..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config.proto.baseline +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/search_service.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ServingConfigProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Configures metadata that is used to generate serving time results (e.g. -// search results or recommendation predictions). -message ServingConfig { - option (google.api.resource) = { - type: "retail.googleapis.com/ServingConfig" - pattern: "projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}" - }; - - // What type of diversity - data or rule based. - enum DiversityType { - // Default value. - DIVERSITY_TYPE_UNSPECIFIED = 0; - - // Rule based diversity. - RULE_BASED_DIVERSITY = 2; - - // Data driven diversity. - DATA_DRIVEN_DIVERSITY = 3; - } - - // Immutable. Fully qualified name - // `projects/*/locations/global/catalogs/*/servingConfig/*` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Required. The human readable serving config display name. Used in Retail - // UI. - // - // This field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The id of the model in the same - // [Catalog][google.cloud.retail.v2alpha.Catalog] to use at serving time. - // Currently only RecommendationModels are supported: - // https://cloud.google.com/retail/recommendations-ai/docs/create-models - // Can be changed but only to a compatible model (e.g. - // others-you-may-like CTR to others-you-may-like CVR). - // - // Required when - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string model_id = 3; - - // How much price ranking we want in serving results. - // Price reranking causes product items with a similar - // recommendation probability to be ordered by price, with the - // highest-priced items first. This setting could result in a decrease in - // click-through and conversion rates. - // Allowed values are: - // - // * `no-price-reranking` - // * `low-price-reranking` - // * `medium-price-reranking` - // * `high-price-reranking` - // - // If not specified, we choose default based on model type. Default value: - // `no-price-reranking`. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string price_reranking_level = 4; - - // Facet specifications for faceted search. If empty, no facets are returned. - // The ids refer to the ids of [Control][google.cloud.retail.v2alpha.Control] - // resources with only the Facet control set. These controls are assumed to be - // in the same [Catalog][google.cloud.retail.v2alpha.Catalog] as the - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]. - // A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error - // is returned. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string facet_control_ids = 5; - - // The specification for dynamically generated facets. Notice that only - // textual facets can be dynamically generated. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - SearchRequest.DynamicFacetSpec dynamic_facet_spec = 6; - - // Condition boost specifications. If a product matches multiple conditions - // in the specifications, boost scores from these specifications are all - // applied and combined in a non-linear way. Maximum number of - // specifications is 100. - // - // Notice that if both - // [ServingConfig.boost_control_ids][google.cloud.retail.v2alpha.ServingConfig.boost_control_ids] - // and - // [SearchRequest.boost_spec][google.cloud.retail.v2alpha.SearchRequest.boost_spec] - // are set, the boost conditions from both places are evaluated. If a search - // request matches multiple boost conditions, the final boost score is equal - // to the sum of the boost scores from all matched boost conditions. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string boost_control_ids = 7; - - // Condition filter specifications. If a product matches multiple conditions - // in the specifications, filters from these specifications are all - // applied and combined via the AND operator. Maximum number of - // specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string filter_control_ids = 9; - - // Condition redirect specifications. Only the first triggered redirect action - // is applied, even if multiple apply. Maximum number of specifications is - // 1000. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string redirect_control_ids = 10; - - // Condition synonyms specifications. If multiple syonyms conditions match, - // all matching synonyms control in the list will execute. Order of controls - // in the list will not matter. Maximum number of specifications is - // 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string twoway_synonyms_control_ids = 18; - - // Condition oneway synonyms specifications. If multiple oneway synonyms - // conditions match, all matching oneway synonyms controls in the list will - // execute. Order of controls in the list will not matter. Maximum number of - // specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string oneway_synonyms_control_ids = 12; - - // Condition do not associate specifications. If multiple do not associate - // conditions match, all matching do not associate controls in the list will - // execute. - // - Order does not matter. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string do_not_associate_control_ids = 13; - - // Condition replacement specifications. - // - Applied according to the order in the list. - // - A previously replaced term can not be re-replaced. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string replacement_control_ids = 14; - - // Condition ignore specifications. If multiple ignore - // conditions match, all matching ignore controls in the list will - // execute. - // - Order does not matter. - // - Maximum number of specifications is 100. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - repeated string ignore_control_ids = 15; - - // How much diversity to use in recommendation model results e.g. - // `medium-diversity` or `high-diversity`. Currently supported values: - // - // * `no-diversity` - // * `low-diversity` - // * `medium-diversity` - // * `high-diversity` - // * `auto-diversity` - // - // If not specified, we choose default based on recommendation model - // type. Default value: `no-diversity`. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string diversity_level = 8; - - // What kind of diversity to use - data driven or rule based. If unset, the - // server behavior defaults to - // [RULE_BASED_DIVERSITY][google.cloud.retail.v2alpha.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]. - DiversityType diversity_type = 20; - - // Whether to add additional category filters on the `similar-items` model. - // If not specified, we enable it by default. - // Allowed values are: - // - // * `no-category-match`: No additional filtering of original results from - // the model and the customer's filters. - // * `relaxed-category-match`: Only keep results with categories that match - // at least one item categories in the PredictRequests's context item. - // * If customer also sends filters in the PredictRequest, then the results - // will satisfy both conditions (user given and category match). - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION]. - string enable_category_filter_level = 16; - - // When the flag is enabled, the products in the denylist will not be filtered - // out in the recommendation filtering results. - bool ignore_recs_denylist = 24; - - // The specification for personalization spec. - // - // Can only be set if - // [solution_types][google.cloud.retail.v2alpha.ServingConfig.solution_types] - // is - // [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH]. - // - // Notice that if both - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec] - // and - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // are set. - // [SearchRequest.personalization_spec][google.cloud.retail.v2alpha.SearchRequest.personalization_spec] - // will override - // [ServingConfig.personalization_spec][google.cloud.retail.v2alpha.ServingConfig.personalization_spec]. - SearchRequest.PersonalizationSpec personalization_spec = 21; - - // Required. Immutable. Specifies the solution types that a serving config can - // be associated with. Currently we support setting only one type of solution. - repeated SolutionType solution_types = 19 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline deleted file mode 100644 index 0f05a20c4f6a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/serving_config_service.proto.baseline +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/serving_config.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "ServingConfigServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for modifying ServingConfig. -service ServingConfigService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a ServingConfig. - // - // A maximum of 100 - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in - // a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a - // FAILED_PRECONDITION error is returned. - rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" - body: "serving_config" - }; - option (google.api.method_signature) = - "parent,serving_config,serving_config_id"; - } - - // Deletes a ServingConfig. - // - // Returns a NotFound error if the ServingConfig does not exist. - rpc DeleteServingConfig(DeleteServingConfigRequest) - returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a ServingConfig. - rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - patch: "/v2alpha/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - body: "serving_config" - }; - option (google.api.method_signature) = "serving_config,update_mask"; - } - - // Gets a ServingConfig. - // - // Returns a NotFound error if the ServingConfig does not exist. - rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { - option (google.api.http) = { - get: "/v2alpha/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all ServingConfigs linked to this catalog. - rpc ListServingConfigs(ListServingConfigsRequest) - returns (ListServingConfigsResponse) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" - }; - option (google.api.method_signature) = "parent"; - } - - // Enables a Control on the specified ServingConfig. - // The control is added in the last position of the list of controls - // it belongs to (e.g. if it's a facet spec control it will be applied - // in the last position of servingConfig.facetSpecIds) - // Returns a ALREADY_EXISTS error if the control has already been applied. - // Returns a FAILED_PRECONDITION error if the addition could exceed maximum - // number of control allowed for that type of control. - rpc AddControl(AddControlRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" - body: "*" - }; - option (google.api.method_signature) = "serving_config"; - } - - // Disables a Control on the specified ServingConfig. - // The control is removed from the ServingConfig. - // Returns a NOT_FOUND error if the Control is not enabled for the - // ServingConfig. - rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { - option (google.api.http) = { - post: "/v2alpha/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" - body: "*" - }; - option (google.api.method_signature) = "serving_config"; - } -} - -// Request for CreateServingConfig method. -message CreateServingConfigRequest { - // Required. Full resource name of parent. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Required. The ServingConfig to create. - ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID to use for the ServingConfig, which will become the final - // component of the ServingConfig's resource name. - // - // This value should be 4-63 characters, and valid characters - // are /[a-z][0-9]-_/. - string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for UpdateServingConfig method. -message UpdateServingConfigRequest { - // Required. The ServingConfig to update. - ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; - - // Indicates which fields in the provided - // [ServingConfig][google.cloud.retail.v2alpha.ServingConfig] to update. The - // following are NOT supported: - // - // * [ServingConfig.name][google.cloud.retail.v2alpha.ServingConfig.name] - // - // If not set, all supported fields are updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request for DeleteServingConfig method. -message DeleteServingConfigRequest { - // Required. The resource name of the ServingConfig to delete. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; -} - -// Request for GetServingConfig method. -message GetServingConfigRequest { - // Required. The resource name of the ServingConfig to get. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; -} - -// Request for ListServingConfigs method. -message ListServingConfigsRequest { - // Required. The catalog resource name. Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } - ]; - - // Optional. Maximum number of results to return. If unspecified, defaults - // to 100. If a value greater than 100 is provided, at most 100 results are - // returned. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A page token, received from a previous `ListServingConfigs` call. - // Provide this to retrieve the subsequent page. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response for ListServingConfigs method. -message ListServingConfigsResponse { - // All the ServingConfigs for a given catalog. - repeated ServingConfig serving_configs = 1; - - // Pagination token, if not returned indicates the last page. - string next_page_token = 2; -} - -// Request for AddControl method. -message AddControlRequest { - // Required. The source ServingConfig resource name . Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string serving_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; - - // Required. The id of the control to apply. Assumed to be in the same catalog - // as the serving config - if id is not found a NOT_FOUND error is returned. - string control_id = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for RemoveControl method. -message RemoveControlRequest { - // Required. The source ServingConfig resource name . Format: - // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - string serving_config = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "retail.googleapis.com/ServingConfig" - } - ]; - - // Required. The id of the control to apply. Assumed to be in the same catalog - // as the serving config. - string control_id = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event.proto.baseline deleted file mode 100644 index 28dfc353d2d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event.proto.baseline +++ /dev/null @@ -1,353 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/field_behavior.proto"; -import "google/cloud/retail/v2alpha/common.proto"; -import "google/cloud/retail/v2alpha/product.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "UserEventProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// UserEvent captures all metadata information Retail API needs to know about -// how end users interact with customers' website. -message UserEvent { - // Required. User event type. Allowed values are: - // - // * `add-to-cart`: Products being added to cart. - // * `remove-from-cart`: Products being removed from cart. - // * `category-page-view`: Special pages such as sale or promotion pages - // viewed. - // * `detail-page-view`: Products detail page viewed. - // * `home-page-view`: Homepage viewed. - // * `purchase-complete`: User finishing a purchase. - // * `search`: Product search. - // * `shopping-cart-page-view`: User viewing a shopping cart. - string event_type = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A unique identifier for tracking visitors. - // - // For example, this could be implemented with an HTTP cookie, which should be - // able to uniquely identify a visitor on a single device. This unique - // identifier should not change if the visitor log in/out of the website. - // - // Don't set the field to the same fixed ID for different users. This mixes - // the event history of those users together, which results in degraded model - // quality. - // - // The field must be a UTF-8 encoded string with a length limit of 128 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // The field should not contain PII or user-data. We recommend to use Google - // Analytics [Client - // ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) - // for this field. - string visitor_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // A unique identifier for tracking a visitor session with a length limit of - // 128 bytes. A session is an aggregation of an end user behavior in a time - // span. - // - // A general guideline to populate the sesion_id: - // 1. If user has no activity for 30 min, a new session_id should be assigned. - // 2. The session_id should be unique across users, suggest use uuid or add - // visitor_id as prefix. - string session_id = 21; - - // Only required for - // [UserEventService.ImportUserEvents][google.cloud.retail.v2alpha.UserEventService.ImportUserEvents] - // method. Timestamp of when the user event happened. - google.protobuf.Timestamp event_time = 3; - - // A list of identifiers for the independent experiment groups this user event - // belongs to. This is used to distinguish between user events associated with - // different experiment setups (e.g. using Retail API, using different - // recommendation models). - repeated string experiment_ids = 4; - - // Highly recommended for user events that are the result of - // [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]. - // This field enables accurate attribution of recommendation model - // performance. - // - // The value must be a valid - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // for user events that are the result of - // [PredictionService.Predict][google.cloud.retail.v2alpha.PredictionService.Predict]. - // The value must be a valid - // [SearchResponse.attribution_token][google.cloud.retail.v2alpha.SearchResponse.attribution_token] - // for user events that are the result of - // [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search]. - // - // This token enables us to accurately attribute page view or purchase back to - // the event and the particular predict response containing this - // clicked/purchased product. If user clicks on product K in the - // recommendation results, pass - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // as a URL parameter to product K's page. When recording events on product - // K's page, log the - // [PredictResponse.attribution_token][google.cloud.retail.v2alpha.PredictResponse.attribution_token] - // to this field. - string attribution_token = 5; - - // The main product details related to the event. - // - // This field is optional except for the following event types: - // - // * `add-to-cart` - // * `detail-page-view` - // * `purchase-complete` - // - // In a `search` event, this field represents the products returned to the end - // user on the current page (the end user may have not finished browsing the - // whole page yet). When a new page is returned to the end user, after - // pagination/filtering/ordering even for the same query, a new `search` event - // with different - // [product_details][google.cloud.retail.v2alpha.UserEvent.product_details] is - // desired. The end user may have not finished browsing the whole page yet. - repeated ProductDetail product_details = 6; - - // The main auto-completion details related to the event. - // - // This field should be set for `search` event when autocomplete function is - // enabled and the user clicks a suggestion for search. - CompletionDetail completion_detail = 22; - - // Extra user event features to include in the recommendation model. - // - // If you provide custom attributes for ingested user events, also include - // them in the user events that you associate with prediction requests. Custom - // attribute formatting must be consistent between imported events and events - // provided with prediction requests. This lets the Retail API use - // those custom attributes when training models and serving predictions, which - // helps improve recommendation quality. - // - // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT - // error is returned: - // - // * The key must be a UTF-8 encoded string with a length limit of 5,000 - // characters. - // * For text attributes, at most 400 values are allowed. Empty values are not - // allowed. Each value must be a UTF-8 encoded string with a length limit of - // 256 characters. - // * For number attributes, at most 400 values are allowed. - // - // For product recommendations, an example of extra user information is - // traffic_channel, which is how a user arrives at the site. Users can arrive - // at the site by coming to the site directly, coming through Google - // search, or in other ways. - map attributes = 7; - - // The ID or name of the associated shopping cart. This ID is used - // to associate multiple items added or present in the cart before purchase. - // - // This can only be set for `add-to-cart`, `purchase-complete`, or - // `shopping-cart-page-view` events. - string cart_id = 8; - - // A transaction represents the entire purchase transaction. - // - // Required for `purchase-complete` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - PurchaseTransaction purchase_transaction = 9; - - // The user's search query. - // - // See [SearchRequest.query][google.cloud.retail.v2alpha.SearchRequest.query] - // for definition. - // - // The value must be a UTF-8 encoded string with a length limit of 5,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // At least one of - // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or - // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is - // required for `search` events. Other event types should not set this field. - // Otherwise, an INVALID_ARGUMENT error is returned. - string search_query = 10; - - // The filter syntax consists of an expression language for constructing a - // predicate from one or more fields of the products being filtered. - // - // See - // [SearchRequest.filter][google.cloud.retail.v2alpha.SearchRequest.filter] - // for definition and syntax. - // - // The value must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - string filter = 16; - - // The order in which products are returned. - // - // See - // [SearchRequest.order_by][google.cloud.retail.v2alpha.SearchRequest.order_by] - // for definition and syntax. - // - // The value must be a UTF-8 encoded string with a length limit of 1,000 - // characters. Otherwise, an INVALID_ARGUMENT error is returned. - // - // This can only be set for `search` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - string order_by = 17; - - // An integer that specifies the current offset for pagination (the 0-indexed - // starting location, amongst the products deemed by the API as relevant). - // - // See - // [SearchRequest.offset][google.cloud.retail.v2alpha.SearchRequest.offset] - // for definition. - // - // If this field is negative, an INVALID_ARGUMENT is returned. - // - // This can only be set for `search` events. Other event types should not set - // this field. Otherwise, an INVALID_ARGUMENT error is returned. - int32 offset = 18; - - // The categories associated with a category page. - // - // To represent full path of category, use '>' sign to separate different - // hierarchies. If '>' is part of the category name, replace it with - // other character(s). - // - // Category pages include special pages such as sales or promotions. For - // instance, a special sale page may have the category hierarchy: - // "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - // - // Required for `category-page-view` events. At least one of - // [search_query][google.cloud.retail.v2alpha.UserEvent.search_query] or - // [page_categories][google.cloud.retail.v2alpha.UserEvent.page_categories] is - // required for `search` events. Other event types should not set this field. - // Otherwise, an INVALID_ARGUMENT error is returned. - repeated string page_categories = 11; - - // User information. - UserInfo user_info = 12; - - // Complete URL (window.location.href) of the user's current page. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. Maximum length 5,000 - // characters. - string uri = 13; - - // The referrer URL of the current page. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. - string referrer_uri = 14; - - // A unique ID of a web page view. - // - // This should be kept the same for all user events triggered from the same - // pageview. For example, an item detail page view could trigger multiple - // events as the user is browsing the page. The `pageViewId` property should - // be kept the same for all these events so that they can be grouped together - // properly. - // - // When using the client side event reporting with JavaScript pixel and Google - // Tag Manager, this value is filled in automatically. - string page_view_id = 15; - - // The entity for customers that may run multiple different entities, domains, - // sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - // `google.com`, `youtube.com`, etc. - // We recommend that you set this field to get better per-entity search, - // completion, and prediction results. - string entity = 23; -} - -// Detailed product information associated with a user event. -message ProductDetail { - // Required. [Product][google.cloud.retail.v2alpha.Product] information. - // - // Required field(s): - // - // * [Product.id][google.cloud.retail.v2alpha.Product.id] - // - // Optional override field(s): - // - // * [Product.price_info][google.cloud.retail.v2alpha.Product.price_info] - // - // If any supported optional fields are provided, we will treat them as a full - // override when looking up product information from the catalog. Thus, it is - // important to ensure that the overriding fields are accurate and - // complete. - // - // All other product fields are ignored and instead populated via catalog - // lookup after event ingestion. - Product product = 1 [(google.api.field_behavior) = REQUIRED]; - - // Quantity of the product associated with the user event. - // - // For example, this field will be 2 if two products are added to the shopping - // cart for `purchase-complete` event. Required for `add-to-cart` and - // `purchase-complete` event types. - google.protobuf.Int32Value quantity = 2; -} - -// Detailed completion information including completion attribution token and -// clicked completion info. -message CompletionDetail { - // Completion attribution token in - // [CompleteQueryResponse.attribution_token][google.cloud.retail.v2alpha.CompleteQueryResponse.attribution_token]. - string completion_attribution_token = 1; - - // End user selected - // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion]. - string selected_suggestion = 2; - - // End user selected - // [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2alpha.CompleteQueryResponse.CompletionResult.suggestion] - // position, starting from 0. - int32 selected_position = 3; -} - -// A transaction represents the entire purchase transaction. -message PurchaseTransaction { - // The transaction ID with a length limit of 128 characters. - string id = 1; - - // Required. Total non-zero revenue or grand total associated with the - // transaction. This value include shipping, tax, or other adjustments to - // total revenue that you want to include as part of your revenue - // calculations. - float revenue = 2 [(google.api.field_behavior) = REQUIRED]; - - // All the taxes associated with the transaction. - float tax = 3; - - // All the costs associated with the products. These can be manufacturing - // costs, shipping expenses not borne by the end user, or any other costs, - // such that: - // - // * Profit = - // [revenue][google.cloud.retail.v2alpha.PurchaseTransaction.revenue] - - // [tax][google.cloud.retail.v2alpha.PurchaseTransaction.tax] - - // [cost][google.cloud.retail.v2alpha.PurchaseTransaction.cost] - float cost = 4; - - // Required. Currency code. Use three-character ISO-4217 code. - string currency_code = 5 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline deleted file mode 100644 index fafb91c96f7d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/protos/google/cloud/retail/v2alpha/user_event_service.proto.baseline +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2025 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.retail.v2alpha; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/httpbody.proto"; -import "google/api/resource.proto"; -import "google/cloud/retail/v2alpha/export_config.proto"; -import "google/cloud/retail/v2alpha/import_config.proto"; -import "google/cloud/retail/v2alpha/purge_config.proto"; -import "google/cloud/retail/v2alpha/user_event.proto"; -import "google/longrunning/operations.proto"; - -option csharp_namespace = "Google.Cloud.Retail.V2Alpha"; -option go_package = "cloud.google.com/go/retail/apiv2alpha/retailpb;retailpb"; -option java_multiple_files = true; -option java_outer_classname = "UserEventServiceProto"; -option java_package = "com.google.cloud.retail.v2alpha"; -option objc_class_prefix = "RETAIL"; -option php_namespace = "Google\\Cloud\\Retail\\V2alpha"; -option ruby_package = "Google::Cloud::Retail::V2alpha"; - -// Service for ingesting end user actions on the customer website. -service UserEventService { - option (google.api.default_host) = "retail.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Writes a single user event. - rpc WriteUserEvent(WriteUserEventRequest) returns (UserEvent) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:write" - body: "user_event" - }; - } - - // Writes a single user event from the browser. - // - // For larger user event payload over 16 KB, the POST method should be used - // instead, otherwise a 400 Bad Request error is returned. - // - // This method is used only by the Retail API JavaScript pixel and Google Tag - // Manager. Users should not call this method directly. - rpc CollectUserEvent(CollectUserEventRequest) returns (google.api.HttpBody) { - option (google.api.http) = { - get: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - additional_bindings { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:collect" - body: "*" - } - }; - } - - // Deletes permanently all user events specified by the filter provided. - // Depending on the number of events specified by the filter, this operation - // could take hours or days to complete. To test a filter, use the list - // command first. - rpc PurgeUserEvents(PurgeUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:purge" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.PurgeUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.PurgeMetadata" - }; - } - - // Bulk import of User events. Request processing might be - // synchronous. Events that already exist are skipped. - // Use this method for backfilling historical user events. - // - // `Operation.response` is of type `ImportResponse`. Note that it is - // possible for a subset of the items to be successfully inserted. - // `Operation.metadata` is of type `ImportMetadata`. - rpc ImportUserEvents(ImportUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:import" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ImportUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.ImportMetadata" - }; - } - - // Exports user events. - // - // `Operation.response` is of type `ExportResponse`. - // `Operation.metadata` is of type `ExportMetadata`. - rpc ExportUserEvents(ExportUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:export" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "google.cloud.retail.v2alpha.ExportUserEventsResponse" - metadata_type: "google.cloud.retail.v2alpha.ExportMetadata" - }; - } - - // Starts a user-event rejoin operation with latest product catalog. Events - // are not annotated with detailed product information for products that are - // missing from the catalog when the user event is ingested. These - // events are stored as unjoined events with limited usage on training and - // serving. You can use this method to start a join operation on specified - // events with the latest version of product catalog. You can also use this - // method to correct events joined with the wrong product catalog. A rejoin - // operation can take hours or days to complete. - rpc RejoinUserEvents(RejoinUserEventsRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v2alpha/{parent=projects/*/locations/*/catalogs/*}/userEvents:rejoin" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "RejoinUserEventsResponse" - metadata_type: "RejoinUserEventsMetadata" - }; - } -} - -// Request message for WriteUserEvent method. -message WriteUserEventRequest { - // Required. The parent catalog resource name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. User event to write. - UserEvent user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // If set to true, the user event will be written asynchronously after - // validation, and the API will respond without waiting for the write. - // Therefore, silent failures can occur even if the API returns success. In - // case of silent failures, error messages can be found in Stackdriver logs. - bool write_async = 3; -} - -// Request message for CollectUserEvent method. -message CollectUserEventRequest { - // The rule that can convert the raw_json to a user event. It is needed - // only when the raw_json is set. - oneof conversion_rule { - // The prebuilt rule name that can convert a specific type of raw_json. - // For example: "ga4_bq" rule for the GA4 user event schema. - string prebuilt_rule = 6; - } - - // Required. The parent catalog name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. URL encoded UserEvent proto with a length limit of 2,000,000 - // characters. - string user_event = 2 [(google.api.field_behavior) = REQUIRED]; - - // The URL including cgi-parameters but excluding the hash fragment with a - // length limit of 5,000 characters. This is often more useful than the - // referer URL, because many browsers only send the domain for 3rd party - // requests. - string uri = 3; - - // The event timestamp in milliseconds. This prevents browser caching of - // otherwise identical get requests. The name is abbreviated to reduce the - // payload bytes. - int64 ets = 4; - - // An arbitrary serialized JSON string that contains necessary information - // that can comprise a user event. When this field is specified, the - // user_event field will be ignored. Note: line-delimited JSON is not - // supported, a single JSON only. - string raw_json = 5; -} - -// Request message for RejoinUserEvents method. -message RejoinUserEventsRequest { - // The scope of user events to be rejoined with the latest product catalog. - // If the rejoining aims at reducing number of unjoined events, set - // `UserEventRejoinScope` to `UNJOINED_EVENTS`. - // If the rejoining aims at correcting product catalog information in joined - // events, set `UserEventRejoinScope` to `JOINED_EVENTS`. - // If all events needs to be rejoined, set `UserEventRejoinScope` to - // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`. - enum UserEventRejoinScope { - // Rejoin all events with the latest product catalog, including both joined - // events and unjoined events. - USER_EVENT_REJOIN_SCOPE_UNSPECIFIED = 0; - - // Only rejoin joined events with the latest product catalog. - JOINED_EVENTS = 1; - - // Only rejoin unjoined events with the latest product catalog. - UNJOINED_EVENTS = 2; - } - - // Required. The parent catalog resource name, such as - // `projects/1234/locations/global/catalogs/default_catalog`. - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // The type of the user event rejoin to define the scope and range of the user - // events to be rejoined with the latest product catalog. Defaults to - // `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - // an invalid integer value. - UserEventRejoinScope user_event_rejoin_scope = 2; -} - -// Response message for `RejoinUserEvents` method. -message RejoinUserEventsResponse { - // Number of user events that were joined with latest product catalog. - int64 rejoined_user_events_count = 1; -} - -// Metadata for `RejoinUserEvents` method. -message RejoinUserEventsMetadata {} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline deleted file mode 100644 index 9c43e02cf3d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/analytics_service.export_analytics_metrics.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog, outputConfig) { - // [START retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the parent catalog. - * Expected format: `projects/* /locations/* /catalogs/*` - */ - // const catalog = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned metrics. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned metrics. Use this expression to restrict results to a - * specific time range. - * Currently we expect only one types of fields: - * * `timestamp`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `timestamp` restriction should result in one, contiguous, valid, - * `timestamp` range. - * Some examples of valid filters expressions: - * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - * timestamp < "2012-04-23T18:30:43.511Z"` - * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {AnalyticsServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new AnalyticsServiceClient(); - - async function callExportAnalyticsMetrics() { - // Construct request - const request = { - catalog, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportAnalyticsMetrics(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportAnalyticsMetrics(); - // [END retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.get_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.get_branch.js.baseline deleted file mode 100644 index efc057d2f673..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.get_branch.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_BranchService_GetBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the branch to retrieve. - * Format: - * `projects/* /locations/global/catalogs/default_catalog/branches/some_branch_id`. - * "default_branch" can be used as a special branch_id, it returns the - * default branch that has been set for the catalog. - */ - // const name = 'abc123' - /** - * The view to apply to the returned - * Branch google.cloud.retail.v2alpha.Branch. Defaults to - * Branch.BranchView.BASIC if unspecified. - * See documentation of fields of Branch google.cloud.retail.v2alpha.Branch - * to find what fields are excluded from BASIC view. - */ - // const view = {} - - // Imports the Retail library - const {BranchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new BranchServiceClient(); - - async function callGetBranch() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getBranch(request); - console.log(response); - } - - callGetBranch(); - // [END retail_v2alpha_generated_BranchService_GetBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.list_branches.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.list_branches.js.baseline deleted file mode 100644 index 69d4eeeae496..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/branch_service.list_branches.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_BranchService_ListBranches_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name. - */ - // const parent = 'abc123' - /** - * The view to apply to the returned - * Branch google.cloud.retail.v2alpha.Branch. Defaults to - * Branch.BranchView.BASIC if unspecified. - * See documentation of fields of Branch google.cloud.retail.v2alpha.Branch - * to find what fields are excluded from BASIC view. - */ - // const view = {} - - // Imports the Retail library - const {BranchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new BranchServiceClient(); - - async function callListBranches() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listBranches(request); - console.log(response); - } - - callListBranches(); - // [END retail_v2alpha_generated_BranchService_ListBranches_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline deleted file mode 100644 index f84ed8922ee8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.add_catalog_attribute.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, catalogAttribute) { - // [START retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to add. - */ - // const catalogAttribute = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callAddCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - catalogAttribute, - }; - - // Run request - const response = await retailClient.addCatalogAttribute(request); - console.log(response); - } - - callAddCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline deleted file mode 100644 index b40d6e40bc46..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, attributeKeys) { - // [START retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The attributes config resource shared by all catalog attributes - * being deleted. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The attribute name keys of the - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute s to - * delete. A maximum of 1000 catalog attributes can be deleted in a batch. - */ - // const attributeKeys = ['abc','def'] - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callBatchRemoveCatalogAttributes() { - // Construct request - const request = { - attributesConfig, - attributeKeys, - }; - - // Run request - const response = await retailClient.batchRemoveCatalogAttributes(request); - console.log(response); - } - - callBatchRemoveCatalogAttributes(); - // [END retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline deleted file mode 100644 index 44e49aa5ab8d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_attributes_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const name = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetAttributesConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getAttributesConfig(request); - console.log(response); - } - - callGetAttributesConfig(); - // [END retail_v2alpha_generated_CatalogService_GetAttributesConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline deleted file mode 100644 index 4dbf06f4c47f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_completion_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full CompletionConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - */ - // const name = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetCompletionConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getCompletionConfig(request); - console.log(response); - } - - callGetCompletionConfig(); - // [END retail_v2alpha_generated_CatalogService_GetCompletionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline deleted file mode 100644 index a3af35b3fff5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.get_default_branch.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callGetDefaultBranch() { - // Construct request - const request = { - }; - - // Run request - const response = await retailClient.getDefaultBranch(request); - console.log(response); - } - - callGetDefaultBranch(); - // [END retail_v2alpha_generated_CatalogService_GetDefaultBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline deleted file mode 100644 index 103ce7c82f7f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.list_catalogs.js.baseline +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_CatalogService_ListCatalogs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The account resource name with an associated location. - * If the caller does not have permission to list - * Catalog google.cloud.retail.v2alpha.Catalog s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - */ - // const parent = 'abc123' - /** - * Maximum number of Catalog google.cloud.retail.v2alpha.Catalog s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const pageSize = 1234 - /** - * A page token - * ListCatalogsResponse.next_page_token google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token, - * received from a previous - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * CatalogService.ListCatalogs google.cloud.retail.v2alpha.CatalogService.ListCatalogs - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callListCatalogs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listCatalogsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListCatalogs(); - // [END retail_v2alpha_generated_CatalogService_ListCatalogs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline deleted file mode 100644 index 78eb55e217f5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, key) { - // [START retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The attribute name key of the - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to remove. - */ - // const key = 'abc123' - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callRemoveCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - key, - }; - - // Run request - const response = await retailClient.removeCatalogAttribute(request); - console.log(response); - } - - callRemoveCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline deleted file mode 100644 index 64c61c6d9a3b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig, catalogAttribute) { - // [START retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - */ - // const attributesConfig = 'abc123' - /** - * Required. The updated - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute. - */ - // const catalogAttribute = {} - /** - * Indicates which fields in the provided - * CatalogAttribute google.cloud.retail.v2alpha.CatalogAttribute to update. - * The following are NOT supported: - * * CatalogAttribute.key google.cloud.retail.v2alpha.CatalogAttribute.key - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callReplaceCatalogAttribute() { - // Construct request - const request = { - attributesConfig, - catalogAttribute, - }; - - // Run request - const response = await retailClient.replaceCatalogAttribute(request); - console.log(response); - } - - callReplaceCatalogAttribute(); - // [END retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline deleted file mode 100644 index f70eff380adf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.set_default_branch.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - /** - * The final component of the resource name of a branch. - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * If there are no sufficient active products in the targeted branch and - * force google.cloud.retail.v2alpha.SetDefaultBranchRequest.force is not - * set, a FAILED_PRECONDITION error is returned. - */ - // const branchId = 'abc123' - /** - * Some note on this request, this can be retrieved by - * CatalogService.GetDefaultBranch google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch - * before next valid default branch set occurs. - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const note = 'abc123' - /** - * If set to true, it permits switching to a branch with - * branch_id google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id - * even if it has no sufficient active products. - */ - // const force = true - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callSetDefaultBranch() { - // Construct request - const request = { - }; - - // Run request - const response = await retailClient.setDefaultBranch(request); - console.log(response); - } - - callSetDefaultBranch(); - // [END retail_v2alpha_generated_CatalogService_SetDefaultBranch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline deleted file mode 100644 index d7ca67efb154..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_attributes_config.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(attributesConfig) { - // [START retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The - * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. - */ - // const attributesConfig = {} - /** - * Indicates which fields in the provided - * AttributesConfig google.cloud.retail.v2alpha.AttributesConfig to update. - * The following is the only supported field: - * * AttributesConfig.catalog_attributes google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateAttributesConfig() { - // Construct request - const request = { - attributesConfig, - }; - - // Run request - const response = await retailClient.updateAttributesConfig(request); - console.log(response); - } - - callUpdateAttributesConfig(); - // [END retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline deleted file mode 100644 index 8c6d7ad64b0d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_catalog.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog) { - // [START retail_v2alpha_generated_CatalogService_UpdateCatalog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Catalog google.cloud.retail.v2alpha.Catalog to update. - * If the caller does not have permission to update the - * Catalog google.cloud.retail.v2alpha.Catalog, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Catalog google.cloud.retail.v2alpha.Catalog to update does not - * exist, a NOT_FOUND error is returned. - */ - // const catalog = {} - /** - * Indicates which fields in the provided - * Catalog google.cloud.retail.v2alpha.Catalog to update. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateCatalog() { - // Construct request - const request = { - catalog, - }; - - // Run request - const response = await retailClient.updateCatalog(request); - console.log(response); - } - - callUpdateCatalog(); - // [END retail_v2alpha_generated_CatalogService_UpdateCatalog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline deleted file mode 100644 index 00ae52266f29..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/catalog_service.update_completion_config.js.baseline +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(completionConfig) { - // [START retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. - * If the caller does not have permission to update the - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig, then a - * PERMISSION_DENIED error is returned. - * If the CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to - * update does not exist, a NOT_FOUND error is returned. - */ - // const completionConfig = {} - /** - * Indicates which fields in the provided - * CompletionConfig google.cloud.retail.v2alpha.CompletionConfig to update. - * The following are the only supported fields: - * * CompletionConfig.matching_order google.cloud.retail.v2alpha.CompletionConfig.matching_order - * * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions - * * CompletionConfig.min_prefix_length google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length - * * CompletionConfig.auto_learning google.cloud.retail.v2alpha.CompletionConfig.auto_learning - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {CatalogServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CatalogServiceClient(); - - async function callUpdateCompletionConfig() { - // Construct request - const request = { - completionConfig, - }; - - // Run request - const response = await retailClient.updateCompletionConfig(request); - console.log(response); - } - - callUpdateCompletionConfig(); - // [END retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.complete_query.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.complete_query.js.baseline deleted file mode 100644 index 6dab2573c618..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.complete_query.js.baseline +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog, query) { - // [START retail_v2alpha_generated_CompletionService_CompleteQuery_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Catalog for which the completion is performed. - * Full resource name of catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - */ - // const catalog = 'abc123' - /** - * Required. The query used to generate suggestions. - * The maximum number of allowed characters is 255. - */ - // const query = 'abc123' - /** - * Recommended field. A unique identifier for tracking visitors. For example, - * this could be implemented with an HTTP cookie, which should be able to - * uniquely identify a visitor on a single device. This unique identifier - * should not change if the visitor logs in or out of the website. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * Note that this field applies for `user-data` dataset only. For requests - * with `cloud-retail` dataset, setting this field has no effect. - * The language filters applied to the output suggestions. If set, it should - * contain the language of the query. If not set, suggestions are returned - * without considering language restrictions. This is the BCP-47 language - * code, such as "en-US" or "sr-Latn". For more information, see Tags for - * Identifying Languages (https://tools.ietf.org/html/bcp47). The maximum - * number of language codes is 3. - */ - // const languageCodes = ['abc','def'] - /** - * The device type context for completion suggestions. We recommend that you - * leave this field empty. - * It can apply different suggestions on different device types, e.g. - * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - * types. - * Supported formats: - * * `UNKNOWN_DEVICE_TYPE` - * * `DESKTOP` - * * `MOBILE` - * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - */ - // const deviceType = 'abc123' - /** - * Determines which dataset to use for fetching completion. "user-data" will - * use the dataset imported through - * CompletionService.ImportCompletionData google.cloud.retail.v2alpha.CompletionService.ImportCompletionData. - * `cloud-retail` will use the dataset generated by Cloud Retail based on user - * events. If left empty, completions will be fetched from the `user-data` - * dataset. - * Current supported values: - * * user-data - * * cloud-retail: - * This option requires enabling auto-learning function first. See - * guidelines (https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - */ - // const dataset = 'abc123' - /** - * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value - * CompletionConfig.max_suggestions google.cloud.retail.v2alpha.CompletionConfig.max_suggestions. - * The maximum allowed max suggestions is 20. If it is set higher, it will be - * capped by 20. - */ - // const maxSuggestions = 1234 - /** - * If true, attribute suggestions are enabled and provided in the response. - * This field is only available for the `cloud-retail` dataset. - */ - // const enableAttributeSuggestions = true - /** - * The entity for customers who run multiple entities, domains, sites, or - * regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it must be an exact match with - * UserEvent.entity google.cloud.retail.v2alpha.UserEvent.entity to get - * per-entity autocomplete results. This field will be applied to - * `completion_results` only. It has no effect on the `attribute_results`. - * Also, this entity should be limited to 256 characters, if too long, it will - * be truncated to 256 characters in both generation and serving time, and may - * lead to mis-match. To ensure it works, please set the entity with string - * within 256 characters. - */ - // const entity = 'abc123' - - // Imports the Retail library - const {CompletionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CompletionServiceClient(); - - async function callCompleteQuery() { - // Construct request - const request = { - catalog, - query, - }; - - // Run request - const response = await retailClient.completeQuery(request); - console.log(response); - } - - callCompleteQuery(); - // [END retail_v2alpha_generated_CompletionService_CompleteQuery_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline deleted file mode 100644 index 2cd57a86371f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/completion_service.import_completion_data.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_CompletionService_ImportCompletionData_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog which the suggestions dataset belongs to. - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - */ - // const notificationPubsubTopic = 'abc123' - - // Imports the Retail library - const {CompletionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new CompletionServiceClient(); - - async function callImportCompletionData() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importCompletionData(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportCompletionData(); - // [END retail_v2alpha_generated_CompletionService_ImportCompletionData_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.create_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.create_control.js.baseline deleted file mode 100644 index 4b5581d8ab94..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.create_control.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, control, controlId) { - // [START retail_v2alpha_generated_ControlService_CreateControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent catalog. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The Control to create. - */ - // const control = {} - /** - * Required. The ID to use for the Control, which will become the final - * component of the Control's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-_/. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callCreateControl() { - // Construct request - const request = { - parent, - control, - controlId, - }; - - // Run request - const response = await retailClient.createControl(request); - console.log(response); - } - - callCreateControl(); - // [END retail_v2alpha_generated_ControlService_CreateControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.delete_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.delete_control.js.baseline deleted file mode 100644 index a750939e2d72..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.delete_control.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ControlService_DeleteControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Control to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callDeleteControl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteControl(request); - console.log(response); - } - - callDeleteControl(); - // [END retail_v2alpha_generated_ControlService_DeleteControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.get_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.get_control.js.baseline deleted file mode 100644 index e9e6d97b2c00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.get_control.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ControlService_GetControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Control to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callGetControl() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getControl(request); - console.log(response); - } - - callGetControl(); - // [END retail_v2alpha_generated_ControlService_GetControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.list_controls.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.list_controls.js.baseline deleted file mode 100644 index 0745f28de311..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.list_controls.js.baseline +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ControlService_ListControls_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - /** - * Optional. A filter to apply on the list results. Supported features: - * * List all the products under the parent branch if - * filter google.cloud.retail.v2alpha.ListControlsRequest.filter is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - */ - // const filter = 'abc123' - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callListControls() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listControlsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListControls(); - // [END retail_v2alpha_generated_ControlService_ListControls_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.update_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.update_control.js.baseline deleted file mode 100644 index 70bb57c34b5b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/control_service.update_control.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(control) { - // [START retail_v2alpha_generated_ControlService_UpdateControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Control to update. - */ - // const control = {} - /** - * Indicates which fields in the provided - * Control google.cloud.retail.v2alpha.Control to update. The following are - * NOT supported: - * * Control.name google.cloud.retail.v2alpha.Control.name - * If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ControlServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ControlServiceClient(); - - async function callUpdateControl() { - // Construct request - const request = { - control, - }; - - // Run request - const response = await retailClient.updateControl(request); - console.log(response); - } - - callUpdateControl(); - // [END retail_v2alpha_generated_ControlService_UpdateControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline deleted file mode 100644 index 36631e659c09..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/conversational_search_service.conversational_search.js.baseline +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, branch, visitorId) { - // [START retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` - * or - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * This field is used to identify the serving config name and the set - * of models that will be used to make the search. - */ - // const placement = 'abc123' - /** - * Required. The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - */ - // const branch = 'abc123' - /** - * Optional. Raw search query to be searched for. - * If this field is empty, the request is considered a category browsing - * request. - */ - // const query = 'abc123' - /** - * Optional. The categories associated with a category page. Must be set for - * category navigation queries to achieve good search quality. The format - * should be the same as - * UserEvent.page_categories google.cloud.retail.v2alpha.UserEvent.page_categories; - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : "Sales > 2017 Black Friday Deals". - */ - // const pageCategories = ['abc','def'] - /** - * Optional. This field specifies the conversation id, which maintains the - * state of the conversation between client side and server side. Use the - * value from the previous - * ConversationalSearchResponse.conversation_id google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id. - * For the initial request, this should be empty. - */ - // const conversationId = 'abc123' - /** - * Optional. Search parameters. - */ - // const searchParams = {} - /** - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * This should be the same identifier as - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * Optional. User information. - */ - // const userInfo = {} - /** - * Optional. This field specifies all conversational filtering related - * parameters. - */ - // const conversationalFilteringSpec = {} - - // Imports the Retail library - const {ConversationalSearchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ConversationalSearchServiceClient(); - - async function callConversationalSearch() { - // Construct request - const request = { - placement, - branch, - visitorId, - }; - - // Run request - const stream = await retailClient.conversationalSearch(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callConversationalSearch(); - // [END retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline deleted file mode 100644 index e12f4f4cefdc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(requests) { - // [START retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const parent = 'abc123' - /** - * Required. The updates question configs. - */ - // const requests = [1,2,3,4] - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callBatchUpdateGenerativeQuestionConfigs() { - // Construct request - const request = { - requests, - }; - - // Run request - const response = await retailClient.batchUpdateGenerativeQuestionConfigs(request); - console.log(response); - } - - callBatchUpdateGenerativeQuestionConfigs(); - // [END retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline deleted file mode 100644 index 6e685411bda8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(catalog) { - // [START retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const catalog = 'abc123' - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callGetGenerativeQuestionsFeatureConfig() { - // Construct request - const request = { - catalog, - }; - - // Run request - const response = await retailClient.getGenerativeQuestionsFeatureConfig(request); - console.log(response); - } - - callGetGenerativeQuestionsFeatureConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline deleted file mode 100644 index e822d297ff53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - */ - // const parent = 'abc123' - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callListGenerativeQuestionConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listGenerativeQuestionConfigs(request); - console.log(response); - } - - callListGenerativeQuestionConfigs(); - // [END retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline deleted file mode 100644 index 024818377a66..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_question_config.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(generativeQuestionConfig) { - // [START retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The question to update. - */ - // const generativeQuestionConfig = {} - /** - * Optional. Indicates which fields in the provided - * GenerativeQuestionConfig google.cloud.retail.v2alpha.GenerativeQuestionConfig - * to update. The following are NOT supported: - * * GenerativeQuestionConfig.frequency google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency - * If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callUpdateGenerativeQuestionConfig() { - // Construct request - const request = { - generativeQuestionConfig, - }; - - // Run request - const response = await retailClient.updateGenerativeQuestionConfig(request); - console.log(response); - } - - callUpdateGenerativeQuestionConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline deleted file mode 100644 index 91d4053b0d87..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(generativeQuestionsFeatureConfig) { - // [START retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The configuration managing the feature state. - */ - // const generativeQuestionsFeatureConfig = {} - /** - * Optional. Indicates which fields in the provided - * GenerativeQuestionsFeatureConfig google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig - * to update. If not set or empty, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {GenerativeQuestionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new GenerativeQuestionServiceClient(); - - async function callUpdateGenerativeQuestionsFeatureConfig() { - // Construct request - const request = { - generativeQuestionsFeatureConfig, - }; - - // Run request - const response = await retailClient.updateGenerativeQuestionsFeatureConfig(request); - console.log(response); - } - - callUpdateGenerativeQuestionsFeatureConfig(); - // [END retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline deleted file mode 100644 index f8649ee99fba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, merchantCenterAccountLink) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The branch resource where this MerchantCenterAccountLink will be - * created. Format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - */ - // const parent = 'abc123' - /** - * Required. The - * MerchantCenterAccountLink google.cloud.retail.v2alpha.MerchantCenterAccountLink - * to create. - * If the caller does not have permission to create the - * MerchantCenterAccountLink google.cloud.retail.v2alpha.MerchantCenterAccountLink, - * regardless of whether or not it exists, a PERMISSION_DENIED error is - * returned. - */ - // const merchantCenterAccountLink = {} - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callCreateMerchantCenterAccountLink() { - // Construct request - const request = { - parent, - merchantCenterAccountLink, - }; - - // Run request - const [operation] = await retailClient.createMerchantCenterAccountLink(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateMerchantCenterAccountLink(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline deleted file mode 100644 index c56491c49a01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callDeleteMerchantCenterAccountLink() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteMerchantCenterAccountLink(request); - console.log(response); - } - - callDeleteMerchantCenterAccountLink(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline deleted file mode 100644 index d639bc541b8f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent Catalog of the resource. - * It must match this format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - */ - // const parent = 'abc123' - - // Imports the Retail library - const {MerchantCenterAccountLinkServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new MerchantCenterAccountLinkServiceClient(); - - async function callListMerchantCenterAccountLinks() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listMerchantCenterAccountLinks(request); - console.log(response); - } - - callListMerchantCenterAccountLinks(); - // [END retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.create_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.create_model.js.baseline deleted file mode 100644 index 0402164ec240..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.create_model.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, model) { - // [START retail_v2alpha_generated_ModelService_CreateModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource under which to create the model. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The payload of the Model google.cloud.retail.v2alpha.Model to - * create. - */ - // const model = {} - /** - * Optional. Whether to run a dry run to validate the request (without - * actually creating the model). - */ - // const dryRun = true - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callCreateModel() { - // Construct request - const request = { - parent, - model, - }; - - // Run request - const [operation] = await retailClient.createModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateModel(); - // [END retail_v2alpha_generated_ModelService_CreateModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.delete_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.delete_model.js.baseline deleted file mode 100644 index 07ad1322b3cb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.delete_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_DeleteModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * Model google.cloud.retail.v2alpha.Model to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callDeleteModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteModel(request); - console.log(response); - } - - callDeleteModel(); - // [END retail_v2alpha_generated_ModelService_DeleteModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.get_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.get_model.js.baseline deleted file mode 100644 index 1cdf8382276a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.get_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_GetModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the - * Model google.cloud.retail.v2alpha.Model to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callGetModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getModel(request); - console.log(response); - } - - callGetModel(); - // [END retail_v2alpha_generated_ModelService_GetModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.list_models.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.list_models.js.baseline deleted file mode 100644 index 1e017fbfc2ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.list_models.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ModelService_ListModels_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callListModels() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listModelsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListModels(); - // [END retail_v2alpha_generated_ModelService_ListModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.pause_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.pause_model.js.baseline deleted file mode 100644 index 5289881227c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.pause_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_PauseModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the model to pause. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callPauseModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.pauseModel(request); - console.log(response); - } - - callPauseModel(); - // [END retail_v2alpha_generated_ModelService_PauseModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.resume_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.resume_model.js.baseline deleted file mode 100644 index 04c06f31b951..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.resume_model.js.baseline +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_ResumeModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the model to resume. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callResumeModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.resumeModel(request); - console.log(response); - } - - callResumeModel(); - // [END retail_v2alpha_generated_ModelService_ResumeModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.tune_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.tune_model.js.baseline deleted file mode 100644 index bbdfa213703e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.tune_model.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ModelService_TuneModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the model to tune. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callTuneModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await retailClient.tuneModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callTuneModel(); - // [END retail_v2alpha_generated_ModelService_TuneModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.update_model.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.update_model.js.baseline deleted file mode 100644 index c6dc67e85a60..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/model_service.update_model.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(model) { - // [START retail_v2alpha_generated_ModelService_UpdateModel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The body of the updated - * Model google.cloud.retail.v2alpha.Model. - */ - // const model = {} - /** - * Optional. Indicates which fields in the provided 'model' to - * update. If not set, by default updates all fields. - */ - // const updateMask = {} - - // Imports the Retail library - const {ModelServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ModelServiceClient(); - - async function callUpdateModel() { - // Construct request - const request = { - model, - }; - - // Run request - const response = await retailClient.updateModel(request); - console.log(response); - } - - callUpdateModel(); - // [END retail_v2alpha_generated_ModelService_UpdateModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/prediction_service.predict.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/prediction_service.predict.js.baseline deleted file mode 100644 index cbc0fdb18cfa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/prediction_service.predict.js.baseline +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, userEvent) { - // [START retail_v2alpha_generated_PredictionService_Predict_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the format: - * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` - * or - * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. - * We recommend using the `servingConfigs` resource. `placements` is a legacy - * resource. - * The ID of the Recommendations AI serving config or placement. - * Before you can request predictions from your model, you must create at - * least one serving config or placement for it. For more information, see - * Manage serving configs - * (https://cloud.google.com/retail/docs/manage-configs). - * The full list of available serving configs can be seen at - * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - */ - // const placement = 'abc123' - /** - * Required. Context about the user, what they are looking at and what action - * they took to trigger the predict request. Note that this user event detail - * won't be ingested to userEvent logs. Thus, a separate userEvent write - * request is required for event logging. - * Don't set - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id or - * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id to the - * same fixed ID for different users. If you are trying to receive - * non-personalized recommendations (not recommended; this can negatively - * impact model performance), instead set - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id to - * a random unique ID and leave - * UserInfo.user_id google.cloud.retail.v2alpha.UserInfo.user_id unset. - */ - // const userEvent = {} - /** - * Maximum number of results to return. Set this property to the number of - * prediction results needed. If zero, the service will choose a reasonable - * default. The maximum allowed value is 100. Values above 100 will be coerced - * to 100. - */ - // const pageSize = 1234 - /** - * This field is not used; leave it unset. - */ - // const pageToken = 'abc123' - /** - * Filter for restricting prediction results with a length limit of 5,000 - * characters. Accepts values for tags and the `filterOutOfStockItems` flag. - * * Tag expressions. Restricts predictions to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses, and must be separated from the - * tag values by a space. `-"tagA"` is also supported and is equivalent to - * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - * with a size limit of 1,000 characters. - * Note: "Recently viewed" models don't support tag filtering at the - * moment. - * * filterOutOfStockItems. Restricts predictions to products that do not - * have a - * stockState value of OUT_OF_STOCK. - * Examples: - * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - * * filterOutOfStockItems tag=(-"promotional") - * * filterOutOfStockItems - * If your filter blocks all prediction results, the API will return *no* - * results. If instead you want empty result sets to return generic - * (unfiltered) popular products, set `strictFiltering` to False in - * `PredictRequest.params`. Note that the API will never return items with - * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - * If `filterSyntaxV2` is set to true under the `params` field, then - * attribute-based expressions are expected instead of the above described - * tag-based syntax. Examples: - * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - * * (availability: ANY("IN_STOCK")) AND - * (colors: ANY("Red") OR categories: ANY("Phones")) - * For more information, see - * Filter recommendations (https://cloud.google.com/retail/docs/filter-recs). - */ - // const filter = 'abc123' - /** - * Use validate only mode for this prediction query. If set to true, a - * dummy model will be used that returns arbitrary products. - * Note that the validate only mode should only be used for testing the API, - * or if the model is not ready. - */ - // const validateOnly = true - /** - * Additional domain specific parameters for the predictions. - * Allowed values: - * * `returnProduct`: Boolean. If set to true, the associated product - * object will be returned in the `results.metadata` field in the - * prediction response. - * * `returnScore`: Boolean. If set to true, the prediction 'score' - * corresponding to each returned product will be set in the - * `results.metadata` field in the prediction response. The given - * 'score' indicates the probability of a product being clicked/purchased - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular products instead of empty if - * your filter blocks all prediction results. - * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-price-reranking', 'low-price-reranking', - * 'medium-price-reranking', 'high-price-reranking'}. This gives - * request-level control and adjusts prediction results based on product - * price. - * * `diversityLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-diversity', 'low-diversity', - * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - * request-level control and adjusts prediction results based on product - * category. - * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - * field is interpreteted according to the new, attribute-based syntax. - */ - // const params = [1,2,3,4] - /** - * The labels applied to a resource must meet the following requirements: - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * See Google Cloud - * Document (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * for more details. - */ - // const labels = [1,2,3,4] - - // Imports the Retail library - const {PredictionServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new PredictionServiceClient(); - - async function callPredict() { - // Construct request - const request = { - placement, - userEvent, - }; - - // Run request - const response = await retailClient.predict(request); - console.log(response); - } - - callPredict(); - // [END retail_v2alpha_generated_PredictionService_Predict_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline deleted file mode 100644 index 3411cd30d24d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_fulfillment_places.js.baseline +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, type, placeIds) { - // [START retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * Supported values: - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * This field directly corresponds to - * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. - */ - // const type = 'abc123' - /** - * Required. The IDs for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type, such - * as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery" to be added for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type. - * Duplicate IDs will be automatically ignored. - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * If the total number of place IDs exceeds 2000 for this - * type google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type after - * adding, then the update will be rejected. - */ - // const placeIds = ['abc','def'] - /** - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - */ - // const addTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callAddFulfillmentPlaces() { - // Construct request - const request = { - product, - type, - placeIds, - }; - - // Run request - const [operation] = await retailClient.addFulfillmentPlaces(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAddFulfillmentPlaces(); - // [END retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline deleted file mode 100644 index 197541e27f40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.add_local_inventories.js.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, localInventories) { - // [START retail_v2alpha_generated_ProductService_AddLocalInventories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 3000 inventories are allowed per - * request. - */ - // const localInventories = [1,2,3,4] - /** - * Indicates which inventory fields in the provided list of - * LocalInventory google.cloud.retail.v2alpha.LocalInventory to update. The - * field is updated to the provided value. - * If a field is set while the place does not have a previous local inventory, - * the local inventory at that store is created. - * If a field is set while the value of that field is not provided, the - * original field value, if it exists, is deleted. - * If the mask is not set or set with empty paths, all inventory fields will - * be updated. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - */ - // const addMask = {} - /** - * The time when the inventory updates are issued. Used to prevent - * out-of-order updates on local inventory fields. If not provided, the - * internal system time will be used. - */ - // const addTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the local inventory will still be processed and retained for at - * most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callAddLocalInventories() { - // Construct request - const request = { - product, - localInventories, - }; - - // Run request - const [operation] = await retailClient.addLocalInventories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAddLocalInventories(); - // [END retail_v2alpha_generated_ProductService_AddLocalInventories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.create_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.create_product.js.baseline deleted file mode 100644 index e0fc3fb88fcd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.create_product.js.baseline +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, product, productId) { - // [START retail_v2alpha_generated_ProductService_CreateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. - */ - // const parent = 'abc123' - /** - * Required. The Product google.cloud.retail.v2alpha.Product to create. - */ - // const product = {} - /** - * Required. The ID to use for the - * Product google.cloud.retail.v2alpha.Product, which will become the final - * component of the Product.name google.cloud.retail.v2alpha.Product.name. - * If the caller does not have permission to create the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * This field must be unique among all - * Product google.cloud.retail.v2alpha.Product s with the same - * parent google.cloud.retail.v2alpha.CreateProductRequest.parent. - * Otherwise, an ALREADY_EXISTS error is returned. - * This field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const productId = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callCreateProduct() { - // Construct request - const request = { - parent, - product, - productId, - }; - - // Run request - const response = await retailClient.createProduct(request); - console.log(response); - } - - callCreateProduct(); - // [END retail_v2alpha_generated_ProductService_CreateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.delete_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.delete_product.js.baseline deleted file mode 100644 index 49a7933a69a3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.delete_product.js.baseline +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProductService_DeleteProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to delete the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to delete does not - * exist, a NOT_FOUND error is returned. - * The Product google.cloud.retail.v2alpha.Product to delete can neither be - * a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product member nor a - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product with more than one - * variants google.cloud.retail.v2alpha.Product.Type.VARIANT. Otherwise, an - * INVALID_ARGUMENT error is returned. - * All inventory information for the named - * Product google.cloud.retail.v2alpha.Product will be deleted. - */ - // const name = 'abc123' - /** - * This value only applies to the case when the target product is of type - * PRIMARY. - * When deleting a product of VARIANT/COLLECTION type, this value - * will be ignored. - * When set to true, the subsequent variant products will be - * deleted. - * When set to false, if the primary product has active variant products, an - * error will be returned. - */ - // const force = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callDeleteProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteProduct(request); - console.log(response); - } - - callDeleteProduct(); - // [END retail_v2alpha_generated_ProductService_DeleteProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.export_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.export_products.js.baseline deleted file mode 100644 index 0eec3ac35dbc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.export_products.js.baseline +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START retail_v2alpha_generated_ProductService_ExportProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of a Branch google.cloud.retail.v2alpha.Branch, - * and `default_branch` for branch_id component is supported. For example - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - */ - // const parent = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned products. Use this expression to restrict results to a - * specific time range, tag, or stock state or to filter products by product - * type. - * For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - * We expect only four types of fields: - * * `lastModifiedTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `lastModifiedTime` restriction should result in one, contiguous, - * valid, last-modified, time range. - * * `productType`: Supported values are `primary` and `variant`. The - * Boolean operators `OR` and `NOT` are supported if the expression is - * enclosed in parentheses and must be separated from the - * `productType` values by a space. - * * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - * `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - * supported if the expression is enclosed in parentheses and must be - * separated from the `availability` values by a space. - * * `Tag expressions`: Restricts output to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. Also supported is '`-"tagA"`', which - * is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - * UTF-8 encoded strings and have a size limit of 1,000 characters. - * Some examples of valid filters expressions: - * * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * productType = "variant"` - * * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - * tag=(NOT "promotional") - * productType = "primary" lastModifiedTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `availability = (IN_STOCK OR BACKORDER)` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callExportProducts() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportProducts(); - // [END retail_v2alpha_generated_ProductService_ExportProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.get_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.get_product.js.baseline deleted file mode 100644 index 1a1404ba8a54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.get_product.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProductService_GetProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the requested Product google.cloud.retail.v2alpha.Product does not - * exist, a NOT_FOUND error is returned. - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callGetProduct() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getProduct(request); - console.log(response); - } - - callGetProduct(); - // [END retail_v2alpha_generated_ProductService_GetProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.import_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.import_products.js.baseline deleted file mode 100644 index 4d830f636c79..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.import_products.js.baseline +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_ProductService_ImportProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * If no updateMask is specified, requires products.create permission. - * If updateMask is specified, requires products.update permission. - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * The desired location of errors incurred during the Import. - */ - // const errorsConfig = {} - /** - * Indicates which fields in the provided imported `products` to update. If - * not set, all fields are updated. If provided, only the existing product - * fields are updated. Missing products will not be created. - */ - // const updateMask = {} - /** - * The mode of reconciliation between existing products and the products to be - * imported. Defaults to - * ReconciliationMode.INCREMENTAL google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL. - */ - // const reconciliationMode = {} - /** - * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * Operation google.longrunning.Operation. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - * to be within the same project as - * ImportProductsRequest.parent google.cloud.retail.v2alpha.ImportProductsRequest.parent. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const notificationPubsubTopic = 'abc123' - /** - * If true, this performs the FULL import even if it would delete a large - * proportion of the products in the default branch, which could potentially - * cause outages if you have live predict/search traffic. - * Only supported when - * ImportProductsRequest.reconciliation_mode google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode - * is set to `FULL`. - */ - // const skipDefaultBranchProtection = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callImportProducts() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportProducts(); - // [END retail_v2alpha_generated_ProductService_ImportProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.list_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.list_products.js.baseline deleted file mode 100644 index ee6ee7ef5776..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.list_products.js.baseline +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ProductService_ListProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * If the caller does not have permission to list - * Product google.cloud.retail.v2alpha.Product s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - */ - // const parent = 'abc123' - /** - * Maximum number of Product google.cloud.retail.v2alpha.Product s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * If this field is negative, an INVALID_ARGUMENT error is returned. - */ - // const pageSize = 1234 - /** - * A page token - * ListProductsResponse.next_page_token google.cloud.retail.v2alpha.ListProductsResponse.next_page_token, - * received from a previous - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * ProductService.ListProducts google.cloud.retail.v2alpha.ProductService.ListProducts - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - /** - * A filter to apply on the list results. Supported features: - * * List all the products under the parent branch if - * filter google.cloud.retail.v2alpha.ListProductsRequest.filter is unset. - * * List - * Product.Type.VARIANT google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s sharing the same - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product. For example: - * `primary_product_id = "some_product_id"` - * * List Product google.cloud.retail.v2alpha.Product s bundled in a - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product. - * For example: - * `collection_product_id = "some_product_id"` - * * List Product google.cloud.retail.v2alpha.Product s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * If the specified - * Product.Type.PRIMARY google.cloud.retail.v2alpha.Product.Type.PRIMARY - * Product google.cloud.retail.v2alpha.Product or - * Product.Type.COLLECTION google.cloud.retail.v2alpha.Product.Type.COLLECTION - * Product google.cloud.retail.v2alpha.Product does not exist, a NOT_FOUND - * error is returned. - */ - // const filter = 'abc123' - /** - * The fields of Product google.cloud.retail.v2alpha.Product to return in - * the responses. If not set or empty, the following fields are returned: - * * Product.name google.cloud.retail.v2alpha.Product.name - * * Product.id google.cloud.retail.v2alpha.Product.id - * * Product.title google.cloud.retail.v2alpha.Product.title - * * Product.uri google.cloud.retail.v2alpha.Product.uri - * * Product.images google.cloud.retail.v2alpha.Product.images - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.brands google.cloud.retail.v2alpha.Product.brands - * If "*" is provided, all fields are returned. - * Product.name google.cloud.retail.v2alpha.Product.name is always returned - * no matter what mask is set. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - */ - // const readMask = {} - /** - * If true and - * page_token google.cloud.retail.v2alpha.ListProductsRequest.page_token is - * empty, - * ListProductsResponse.total_size google.cloud.retail.v2alpha.ListProductsResponse.total_size - * is set to the total count of matched items irrespective of pagination. - * Notice that setting this field to true affects the performance. - */ - // const requireTotalSize = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callListProducts() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listProductsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListProducts(); - // [END retail_v2alpha_generated_ProductService_ListProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.purge_products.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.purge_products.js.baseline deleted file mode 100644 index 5a199fd150ae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.purge_products.js.baseline +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, filter) { - // [START retail_v2alpha_generated_ProductService_PurgeProducts_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the branch under which the products are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - */ - // const parent = 'abc123' - /** - * Required. The filter string to specify the products to be deleted with a - * length limit of 5,000 characters. - * Empty string filter is not allowed. "*" implies delete all items in a - * branch. - * The eligible fields for filtering are: - * * `availability`: Double quoted - * Product.availability google.cloud.retail.v2alpha.Product.availability - * string. - * * `create_time` : in ISO 8601 "zulu" format. - * Supported syntax: - * * Comparators (">", "<", ">=", "<=", "="). - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" - * * availability = "IN_STOCK" - * * Conjunctions ("AND") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - * * Disjunctions ("OR") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - * * Can support nested queries. - * Examples: - * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - * * Filter Limits: - * * Filter should not contain more than 6 conditions. - * * Max nesting depth should not exceed 2 levels. - * Examples queries: - * * Delete back order products created before a timestamp. - * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - */ - // const filter = 'abc123' - /** - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any products. - */ - // const force = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callPurgeProducts() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const [operation] = await retailClient.purgeProducts(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeProducts(); - // [END retail_v2alpha_generated_ProductService_PurgeProducts_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline deleted file mode 100644 index 415a77e274ae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_fulfillment_places.js.baseline +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, type, placeIds) { - // [START retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * Supported values: - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * This field directly corresponds to - * Product.fulfillment_info.type google.cloud.retail.v2alpha.FulfillmentInfo.type. - */ - // const type = 'abc123' - /** - * Required. The IDs for this - * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type, - * such as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery", to be removed for this - * type google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type. - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const placeIds = ['abc','def'] - /** - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - */ - // const removeTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callRemoveFulfillmentPlaces() { - // Construct request - const request = { - product, - type, - placeIds, - }; - - // Run request - const [operation] = await retailClient.removeFulfillmentPlaces(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRemoveFulfillmentPlaces(); - // [END retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline deleted file mode 100644 index fc926b26b84b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.remove_local_inventories.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product, placeIds) { - // [START retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of - * Product google.cloud.retail.v2alpha.Product, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * If the caller does not have permission to access the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - */ - // const product = 'abc123' - /** - * Required. A list of place IDs to have their inventory deleted. - * At most 3000 place IDs are allowed per request. - */ - // const placeIds = ['abc','def'] - /** - * The time when the inventory deletions are issued. Used to prevent - * out-of-order updates and deletions on local inventory fields. If not - * provided, the internal system time will be used. - */ - // const removeTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, the local inventory removal request will still be processed and - * retained for at most 1 day and processed once the - * Product google.cloud.retail.v2alpha.Product is created. If set to false, - * a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callRemoveLocalInventories() { - // Construct request - const request = { - product, - placeIds, - }; - - // Run request - const [operation] = await retailClient.removeLocalInventories(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRemoveLocalInventories(); - // [END retail_v2alpha_generated_ProductService_RemoveLocalInventories_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.set_inventory.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.set_inventory.js.baseline deleted file mode 100644 index 4b9f69b6648b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.set_inventory.js.baseline +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(inventory) { - // [START retail_v2alpha_generated_ProductService_SetInventory_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The inventory information to update. The allowable fields to - * update are: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * The updated inventory fields must be specified in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask. - * If - * SetInventoryRequest.inventory.name google.cloud.retail.v2alpha.Product.name - * is empty or invalid, an INVALID_ARGUMENT error is returned. - * If the caller does not have permission to update the - * Product google.cloud.retail.v2alpha.Product named in - * Product.name google.cloud.retail.v2alpha.Product.name, regardless of - * whether or not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to update does not - * have existing inventory information, the provided inventory information - * will be inserted. - * If the Product google.cloud.retail.v2alpha.Product to update has - * existing inventory information, the provided inventory information will be - * merged while respecting the last update time for each inventory field, - * using the provided or default value for - * SetInventoryRequest.set_time google.cloud.retail.v2alpha.SetInventoryRequest.set_time. - * The caller can replace place IDs for a subset of fulfillment types in the - * following ways: - * * Adds "fulfillment_info" in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask - * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in - * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * The caller can clear all place IDs from a subset of fulfillment types in - * the following ways: - * * Adds "fulfillment_info" in - * SetInventoryRequest.set_mask google.cloud.retail.v2alpha.SetInventoryRequest.set_mask - * * Specifies only the desired fulfillment types to clear in - * SetInventoryRequest.inventory.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * * Checks that only the desired fulfillment info types have empty - * SetInventoryRequest.inventory.fulfillment_info.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * The last update time is recorded for the following inventory fields: - * * Product.price_info google.cloud.retail.v2alpha.Product.price_info - * * Product.availability google.cloud.retail.v2alpha.Product.availability - * * Product.available_quantity google.cloud.retail.v2alpha.Product.available_quantity - * * Product.fulfillment_info google.cloud.retail.v2alpha.Product.fulfillment_info - * If a full overwrite of inventory information while ignoring timestamps is - * needed, - * ProductService.UpdateProduct google.cloud.retail.v2alpha.ProductService.UpdateProduct - * should be invoked instead. - */ - // const inventory = {} - /** - * Indicates which inventory fields in the provided - * Product google.cloud.retail.v2alpha.Product to update. - * At least one field must be provided. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - */ - // const setMask = {} - /** - * The time when the request is issued, used to prevent - * out-of-order updates on inventory fields with the last update time - * recorded. If not provided, the internal system time will be used. - */ - // const setTime = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product with - * name Product.name google.cloud.retail.v2alpha.Product.name is not found, - * the inventory update will still be processed and retained for at most 1 day - * until the Product google.cloud.retail.v2alpha.Product is created. If set - * to false, a NOT_FOUND error is returned if the - * Product google.cloud.retail.v2alpha.Product is not found. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callSetInventory() { - // Construct request - const request = { - inventory, - }; - - // Run request - const [operation] = await retailClient.setInventory(request); - const [response] = await operation.promise(); - console.log(response); - } - - callSetInventory(); - // [END retail_v2alpha_generated_ProductService_SetInventory_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.update_product.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.update_product.js.baseline deleted file mode 100644 index 2d806183c001..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/product_service.update_product.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(product) { - // [START retail_v2alpha_generated_ProductService_UpdateProduct_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The product to update/create. - * If the caller does not have permission to update the - * Product google.cloud.retail.v2alpha.Product, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * If the Product google.cloud.retail.v2alpha.Product to update does not - * exist and - * allow_missing google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing - * is not set, a NOT_FOUND error is returned. - */ - // const product = {} - /** - * Indicates which fields in the provided - * Product google.cloud.retail.v2alpha.Product to update. The immutable and - * output only fields are NOT supported. If not set, all supported fields (the - * fields that are neither immutable nor output only) are updated. - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * The attribute key can be updated by setting the mask path as - * "attributes.${key_name}". If a key name is present in the mask but not in - * the patching product from the request, this key will be deleted after the - * update. - */ - // const updateMask = {} - /** - * If set to true, and the Product google.cloud.retail.v2alpha.Product is - * not found, a new Product google.cloud.retail.v2alpha.Product will be - * created. In this situation, `update_mask` is ignored. - */ - // const allowMissing = true - - // Imports the Retail library - const {ProductServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProductServiceClient(); - - async function callUpdateProduct() { - // Construct request - const request = { - product, - }; - - // Run request - const response = await retailClient.updateProduct(request); - console.log(response); - } - - callUpdateProduct(); - // [END retail_v2alpha_generated_ProductService_UpdateProduct_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.accept_terms.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.accept_terms.js.baseline deleted file mode 100644 index beaaa762b063..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.accept_terms.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project) { - // [START retail_v2alpha_generated_ProjectService_AcceptTerms_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - */ - // const project = 'my-project' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callAcceptTerms() { - // Construct request - const request = { - project, - }; - - // Run request - const response = await retailClient.acceptTerms(request); - console.log(response); - } - - callAcceptTerms(); - // [END retail_v2alpha_generated_ProjectService_AcceptTerms_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.enroll_solution.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.enroll_solution.js.baseline deleted file mode 100644 index 363da5bf3d1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.enroll_solution.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(project, solution) { - // [START retail_v2alpha_generated_ProjectService_EnrollSolution_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - */ - // const project = 'my-project' - /** - * Required. Solution to enroll. - */ - // const solution = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callEnrollSolution() { - // Construct request - const request = { - project, - solution, - }; - - // Run request - const [operation] = await retailClient.enrollSolution(request); - const [response] = await operation.promise(); - console.log(response); - } - - callEnrollSolution(); - // [END retail_v2alpha_generated_ProjectService_EnrollSolution_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_alert_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_alert_config.js.baseline deleted file mode 100644 index 7306229c3755..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_alert_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetAlertConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full AlertConfig resource name. Format: - * projects/{project_number}/alertConfig - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetAlertConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getAlertConfig(request); - console.log(response); - } - - callGetAlertConfig(); - // [END retail_v2alpha_generated_ProjectService_GetAlertConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_logging_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_logging_config.js.baseline deleted file mode 100644 index 4f975232e259..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_logging_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetLoggingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full LoggingConfig resource name. Format: - * projects/{project_number}/loggingConfig - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetLoggingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getLoggingConfig(request); - console.log(response); - } - - callGetLoggingConfig(); - // [END retail_v2alpha_generated_ProjectService_GetLoggingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_project.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_project.js.baseline deleted file mode 100644 index df69da2ccd6f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.get_project.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ProjectService_GetProject_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callGetProject() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getProject(request); - console.log(response); - } - - callGetProject(); - // [END retail_v2alpha_generated_ProjectService_GetProject_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline deleted file mode 100644 index 437cbffe0f80..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.list_enrolled_solutions.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - */ - // const parent = 'abc123' - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callListEnrolledSolutions() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await retailClient.listEnrolledSolutions(request); - console.log(response); - } - - callListEnrolledSolutions(); - // [END retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_alert_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_alert_config.js.baseline deleted file mode 100644 index b3655da2bb30..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_alert_config.js.baseline +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(alertConfig) { - // [START retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The AlertConfig google.cloud.retail.v2alpha.AlertConfig to - * update. - * If the caller does not have permission to update the - * AlertConfig google.cloud.retail.v2alpha.AlertConfig, then a - * PERMISSION_DENIED error is returned. - * If the AlertConfig google.cloud.retail.v2alpha.AlertConfig to update - * does not exist, a NOT_FOUND error is returned. - */ - // const alertConfig = {} - /** - * Indicates which fields in the provided - * AlertConfig google.cloud.retail.v2alpha.AlertConfig to update. If not - * set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callUpdateAlertConfig() { - // Construct request - const request = { - alertConfig, - }; - - // Run request - const response = await retailClient.updateAlertConfig(request); - console.log(response); - } - - callUpdateAlertConfig(); - // [END retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_logging_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_logging_config.js.baseline deleted file mode 100644 index 1ccf1ecb7578..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/project_service.update_logging_config.js.baseline +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(loggingConfig) { - // [START retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to - * update. - * If the caller does not have permission to update the - * LoggingConfig google.cloud.retail.v2alpha.LoggingConfig, then a - * PERMISSION_DENIED error is returned. - * If the LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to update - * does not exist, a NOT_FOUND error is returned. - */ - // const loggingConfig = {} - /** - * Indicates which fields in the provided - * LoggingConfig google.cloud.retail.v2alpha.LoggingConfig to update. The - * following are the only supported fields: - * * LoggingConfig.default_log_generation_rule google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule - * * LoggingConfig.service_log_generation_rules google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ProjectServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ProjectServiceClient(); - - async function callUpdateLoggingConfig() { - // Construct request - const request = { - loggingConfig, - }; - - // Run request - const response = await retailClient.updateLoggingConfig(request); - console.log(response); - } - - callUpdateLoggingConfig(); - // [END retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/search_service.search.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/search_service.search.js.baseline deleted file mode 100644 index b5b193a56e95..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/search_service.search.js.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(placement, visitorId) { - // [START retail_v2alpha_generated_SearchService_Search_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - */ - // const placement = 'abc123' - /** - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - */ - // const branch = 'abc123' - /** - * Raw search query. - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * filter google.cloud.retail.v2alpha.SearchRequest.filter and - * page_categories google.cloud.retail.v2alpha.SearchRequest.page_categories. - */ - // const query = 'abc123' - /** - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * This should be the same identifier as - * UserEvent.visitor_id google.cloud.retail.v2alpha.UserEvent.visitor_id. - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - */ - // const visitorId = 'abc123' - /** - * User information. - */ - // const userInfo = {} - /** - * Maximum number of Product google.cloud.retail.v2alpha.Product s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const pageSize = 1234 - /** - * A page token - * SearchResponse.next_page_token google.cloud.retail.v2alpha.SearchResponse.next_page_token, - * received from a previous - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search - * call. Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * SearchService.Search google.cloud.retail.v2alpha.SearchService.Search - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - */ - // const pageToken = 'abc123' - /** - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * Product google.cloud.retail.v2alpha.Product s deemed by the API as - * relevant) in search results. This field is only considered if - * page_token google.cloud.retail.v2alpha.SearchRequest.page_token is - * unset. - * If this field is negative, an INVALID_ARGUMENT is returned. - */ - // const offset = 1234 - /** - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * Filter (https://cloud.google.com/retail/docs/filter-and-order#filter). - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - */ - // const filter = 'abc123' - /** - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * For more information about filter syntax, see - * SearchRequest.filter google.cloud.retail.v2alpha.SearchRequest.filter. - */ - // const canonicalFilter = 'abc123' - /** - * The order in which products are returned. Products can be ordered by - * a field in an Product google.cloud.retail.v2alpha.Product object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * Order (https://cloud.google.com/retail/docs/filter-and-order#order). - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - */ - // const orderBy = 'abc123' - /** - * Facet specifications for faceted search. If empty, no facets are returned. - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - */ - // const facetSpecs = [1,2,3,4] - /** - * Boost specification to boost certain products. For more information, see - * Boost results (https://cloud.google.com/retail/docs/boosting). - * Notice that if both - * ServingConfig.boost_control_ids google.cloud.retail.v2alpha.ServingConfig.boost_control_ids - * and - * SearchRequest.boost_spec google.cloud.retail.v2alpha.SearchRequest.boost_spec - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - */ - // const boostSpec = {} - /** - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see Query - * expansion (https://cloud.google.com/retail/docs/result-size#query_expansion). - */ - // const queryExpansionSpec = {} - /** - * The relevance threshold of the search results. - * Defaults to - * RelevanceThreshold.HIGH google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see Adjust result - * size (https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - */ - // const relevanceThreshold = {} - /** - * The keys to fetch and rollup the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s attributes, - * FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo or - * LocalInventory google.cloud.retail.v2alpha.LocalInventory s attributes. - * The attributes from all the matching - * variant google.cloud.retail.v2alpha.Product.Type.VARIANT - * Product google.cloud.retail.v2alpha.Product s or - * LocalInventory google.cloud.retail.v2alpha.LocalInventory s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * For FulfillmentInfo google.cloud.retail.v2alpha.FulfillmentInfo, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * Supported keys are: - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * Product.local_inventories.attributes google.cloud.retail.v2alpha.LocalInventory.attributes - * map. - * * attributes.key, where key is any key in the - * Product.attributes google.cloud.retail.v2alpha.Product.attributes map. - * * pickupInStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "pickup-in-store". - * * shipToStore.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-1". - * * customFulfillment2.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-2". - * * customFulfillment3.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-3". - * * customFulfillment4.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-4". - * * customFulfillment5.id, where id is any - * FulfillmentInfo.place_ids google.cloud.retail.v2alpha.FulfillmentInfo.place_ids - * for - * FulfillmentInfo.type google.cloud.retail.v2alpha.FulfillmentInfo.type - * "custom-type-5". - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - */ - // const variantRollupKeys = ['abc','def'] - /** - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * UserEvent.page_categories google.cloud.retail.v2alpha.UserEvent.page_categories; - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : "Sales > 2017 Black Friday Deals". - */ - // const pageCategories = ['abc','def'] - /** - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - */ - // const searchMode = {} - /** - * The specification for personalization. - * Notice that if both - * ServingConfig.personalization_spec google.cloud.retail.v2alpha.ServingConfig.personalization_spec - * and - * SearchRequest.personalization_spec google.cloud.retail.v2alpha.SearchRequest.personalization_spec - * are set. - * SearchRequest.personalization_spec google.cloud.retail.v2alpha.SearchRequest.personalization_spec - * will override - * ServingConfig.personalization_spec google.cloud.retail.v2alpha.ServingConfig.personalization_spec. - */ - // const personalizationSpec = {} - /** - * The labels applied to a resource must meet the following requirements: - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * For more information, see Requirements for - * labels (https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - */ - // const labels = [1,2,3,4] - /** - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - */ - // const spellCorrectionSpec = {} - /** - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * UserEvent.entity google.cloud.retail.v2alpha.UserEvent.entity to get - * search results boosted by entity. - */ - // const entity = 'abc123' - /** - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - */ - // const conversationalSearchSpec = {} - /** - * Optional. This field specifies tile navigation related parameters. - */ - // const tileNavigationSpec = {} - /** - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * list (https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see Standardized codes (https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - */ - // const languageCode = 'abc123' - /** - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * list (https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see Standardized codes (https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - */ - // const regionCode = 'abc123' - /** - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * LocalInventory.place_id google.cloud.retail.v2alpha.LocalInventory.place_id - * for revenue optimization. - */ - // const placeId = 'abc123' - /** - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * Example: - * user_attributes: - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * - */ - // const userAttributes = [1,2,3,4] - - // Imports the Retail library - const {SearchServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new SearchServiceClient(); - - async function callSearch() { - // Construct request - const request = { - placement, - visitorId, - }; - - // Run request - const iterable = retailClient.searchAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callSearch(); - // [END retail_v2alpha_generated_SearchService_Search_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.add_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.add_control.js.baseline deleted file mode 100644 index 2ed8dd4e1e31..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.add_control.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig, controlId) { - // [START retail_v2alpha_generated_ServingConfigService_AddControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const servingConfig = 'abc123' - /** - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config - if id is not found a NOT_FOUND error is returned. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callAddControl() { - // Construct request - const request = { - servingConfig, - controlId, - }; - - // Run request - const response = await retailClient.addControl(request); - console.log(response); - } - - callAddControl(); - // [END retail_v2alpha_generated_ServingConfigService_AddControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline deleted file mode 100644 index a975ac0cc2ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.create_serving_config.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, servingConfig, servingConfigId) { - // [START retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Full resource name of parent. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Required. The ServingConfig to create. - */ - // const servingConfig = {} - /** - * Required. The ID to use for the ServingConfig, which will become the final - * component of the ServingConfig's resource name. - * This value should be 4-63 characters, and valid characters - * are /[a-z][0-9]-_/. - */ - // const servingConfigId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callCreateServingConfig() { - // Construct request - const request = { - parent, - servingConfig, - servingConfigId, - }; - - // Run request - const response = await retailClient.createServingConfig(request); - console.log(response); - } - - callCreateServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline deleted file mode 100644 index 788d1af83451..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.delete_serving_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ServingConfig to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callDeleteServingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.deleteServingConfig(request); - console.log(response); - } - - callDeleteServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline deleted file mode 100644 index ef91c60bb422..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.get_serving_config.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the ServingConfig to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const name = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callGetServingConfig() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await retailClient.getServingConfig(request); - console.log(response); - } - - callGetServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_GetServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline deleted file mode 100644 index 518cfca6d3af..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.list_serving_configs.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - */ - // const parent = 'abc123' - /** - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - */ - // const pageSize = 1234 - /** - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - */ - // const pageToken = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callListServingConfigs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = retailClient.listServingConfigsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListServingConfigs(); - // [END retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline deleted file mode 100644 index 4ed14252ad40..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.remove_control.js.baseline +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig, controlId) { - // [START retail_v2alpha_generated_ServingConfigService_RemoveControl_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - */ - // const servingConfig = 'abc123' - /** - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config. - */ - // const controlId = 'abc123' - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callRemoveControl() { - // Construct request - const request = { - servingConfig, - controlId, - }; - - // Run request - const response = await retailClient.removeControl(request); - console.log(response); - } - - callRemoveControl(); - // [END retail_v2alpha_generated_ServingConfigService_RemoveControl_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline deleted file mode 100644 index ead6fabcabaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/serving_config_service.update_serving_config.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(servingConfig) { - // [START retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ServingConfig to update. - */ - // const servingConfig = {} - /** - * Indicates which fields in the provided - * ServingConfig google.cloud.retail.v2alpha.ServingConfig to update. The - * following are NOT supported: - * * ServingConfig.name google.cloud.retail.v2alpha.ServingConfig.name - * If not set, all supported fields are updated. - */ - // const updateMask = {} - - // Imports the Retail library - const {ServingConfigServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new ServingConfigServiceClient(); - - async function callUpdateServingConfig() { - // Construct request - const request = { - servingConfig, - }; - - // Run request - const response = await retailClient.updateServingConfig(request); - console.log(response); - } - - callUpdateServingConfig(); - // [END retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline deleted file mode 100644 index dbc107dcf685..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/snippet_metadata_google.cloud.retail.v2alpha.json.baseline +++ /dev/null @@ -1,3607 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-retail", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.retail.v2alpha", - "version": "v2alpha" - } - ] - }, - "snippets": [ - { - "regionTag": "retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async", - "title": "retail exportAnalyticsMetrics Sample", - "origin": "API_DEFINITION", - "description": " Exports analytics metrics. `Operation.response` is of type `ExportAnalyticsMetricsResponse`. `Operation.metadata` is of type `ExportMetadata`.", - "canonical": true, - "file": "analytics_service.export_analytics_metrics.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportAnalyticsMetrics", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService.ExportAnalyticsMetrics", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "AnalyticsServiceClient", - "fullName": "google.cloud.retail.v2alpha.AnalyticsServiceClient" - }, - "method": { - "shortName": "ExportAnalyticsMetrics", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService.ExportAnalyticsMetrics", - "service": { - "shortName": "AnalyticsService", - "fullName": "google.cloud.retail.v2alpha.AnalyticsService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_BranchService_ListBranches_async", - "title": "retail listBranches Sample", - "origin": "API_DEFINITION", - "description": " Lists all instances of [Branch][google.cloud.retail.v2alpha.Branch] under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "branch_service.list_branches.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBranches", - "fullName": "google.cloud.retail.v2alpha.BranchService.ListBranches", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.retail.v2alpha.BranchView" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListBranchesResponse", - "client": { - "shortName": "BranchServiceClient", - "fullName": "google.cloud.retail.v2alpha.BranchServiceClient" - }, - "method": { - "shortName": "ListBranches", - "fullName": "google.cloud.retail.v2alpha.BranchService.ListBranches", - "service": { - "shortName": "BranchService", - "fullName": "google.cloud.retail.v2alpha.BranchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_BranchService_GetBranch_async", - "title": "retail getBranch Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a [Branch][google.cloud.retail.v2alpha.Branch].", - "canonical": true, - "file": "branch_service.get_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBranch", - "fullName": "google.cloud.retail.v2alpha.BranchService.GetBranch", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "view", - "type": ".google.cloud.retail.v2alpha.BranchView" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Branch", - "client": { - "shortName": "BranchServiceClient", - "fullName": "google.cloud.retail.v2alpha.BranchServiceClient" - }, - "method": { - "shortName": "GetBranch", - "fullName": "google.cloud.retail.v2alpha.BranchService.GetBranch", - "service": { - "shortName": "BranchService", - "fullName": "google.cloud.retail.v2alpha.BranchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_ListCatalogs_async", - "title": "retail listCatalogs Sample", - "origin": "API_DEFINITION", - "description": " Lists all the [Catalog][google.cloud.retail.v2alpha.Catalog]s associated with the project.", - "canonical": true, - "file": "catalog_service.list_catalogs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListCatalogsResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "ListCatalogs", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ListCatalogs", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCatalog_async", - "title": "retail updateCatalog Sample", - "origin": "API_DEFINITION", - "description": " Updates the [Catalog][google.cloud.retail.v2alpha.Catalog]s.", - "canonical": true, - "file": "catalog_service.update_catalog.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": ".google.cloud.retail.v2alpha.Catalog" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Catalog", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateCatalog", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCatalog", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_SetDefaultBranch_async", - "title": "retail setDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Set a specified branch id as default branch. API methods such as [SearchService.Search][google.cloud.retail.v2alpha.SearchService.Search], [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct], [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts] will treat requests using \"default_branch\" to the actual branch id set as default. For example, if `projects/*/locations/*/catalogs/*/branches/1` is set as default, setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/default_branch` is equivalent to setting [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to `projects/*/locations/*/catalogs/*/branches/1`. Using multiple branches can be useful when developers would like to have a staging branch to test and verify for future usage. When it becomes ready, developers switch on the staging branch using this API while keeping using `projects/*/locations/*/catalogs/*/branches/default_branch` as [SearchRequest.branch][google.cloud.retail.v2alpha.SearchRequest.branch] to route the traffic to this staging branch. CAUTION: If you have live predict/search traffic, switching the default branch could potentially cause outages if the ID space of the new branch is very different from the old one. More specifically: * PredictionService will only return product IDs from branch {newBranch}. * SearchService will only return product IDs from branch {newBranch} (if branch is not explicitly set). * UserEventService will only join events with products from branch {newBranch}.", - "canonical": true, - "file": "catalog_service.set_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "branch_id", - "type": "TYPE_STRING" - }, - { - "name": "note", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "SetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetDefaultBranch_async", - "title": "retail getDefaultBranch Sample", - "origin": "API_DEFINITION", - "description": " Get which branch is currently default branch set by [CatalogService.SetDefaultBranch][google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch] method under a specified parent catalog.", - "canonical": true, - "file": "catalog_service.get_default_branch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GetDefaultBranchResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetDefaultBranch", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetCompletionConfig_async", - "title": "retail getCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig].", - "canonical": true, - "file": "catalog_service.get_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async", - "title": "retail updateCompletionConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [CompletionConfig][google.cloud.retail.v2alpha.CompletionConfig]s.", - "canonical": true, - "file": "catalog_service.update_completion_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 70, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "async": true, - "parameters": [ - { - "name": "completion_config", - "type": ".google.cloud.retail.v2alpha.CompletionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompletionConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateCompletionConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateCompletionConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_GetAttributesConfig_async", - "title": "retail getAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets an [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", - "canonical": true, - "file": "catalog_service.get_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "GetAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.GetAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async", - "title": "retail updateAttributesConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. The catalog attributes in the request will be updated in the catalog, or inserted if they do not exist. Existing catalog attributes not included in the request will remain unchanged. Attributes that are assigned to products, but do not exist at the catalog level, are always included in the response. The product attribute is assigned default values for missing catalog attribute fields, e.g., searchable and dynamic facetable options.", - "canonical": true, - "file": "catalog_service.update_attributes_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": ".google.cloud.retail.v2alpha.AttributesConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "UpdateAttributesConfig", - "fullName": "google.cloud.retail.v2alpha.CatalogService.UpdateAttributesConfig", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async", - "title": "retail addCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Adds the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to add already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "catalog_service.add_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "AddCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.AddCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async", - "title": "retail removeCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Removes the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to remove does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.remove_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "key", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "RemoveCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.RemoveCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async", - "title": "retail batchRemoveCatalogAttributes Sample", - "origin": "API_DEFINITION", - "description": " Removes all specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute]s from the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig].", - "canonical": true, - "file": "catalog_service.batch_remove_catalog_attributes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchRemoveCatalogAttributes", - "fullName": "google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "attribute_keys", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "BatchRemoveCatalogAttributes", - "fullName": "google.cloud.retail.v2alpha.CatalogService.BatchRemoveCatalogAttributes", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async", - "title": "retail replaceCatalogAttribute Sample", - "origin": "API_DEFINITION", - "description": " Replaces the specified [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] in the [AttributesConfig][google.cloud.retail.v2alpha.AttributesConfig] by updating the catalog attribute with the same [CatalogAttribute.key][google.cloud.retail.v2alpha.CatalogAttribute.key]. If the [CatalogAttribute][google.cloud.retail.v2alpha.CatalogAttribute] to replace does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "catalog_service.replace_catalog_attribute.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "async": true, - "parameters": [ - { - "name": "attributes_config", - "type": "TYPE_STRING" - }, - { - "name": "catalog_attribute", - "type": ".google.cloud.retail.v2alpha.CatalogAttribute" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AttributesConfig", - "client": { - "shortName": "CatalogServiceClient", - "fullName": "google.cloud.retail.v2alpha.CatalogServiceClient" - }, - "method": { - "shortName": "ReplaceCatalogAttribute", - "fullName": "google.cloud.retail.v2alpha.CatalogService.ReplaceCatalogAttribute", - "service": { - "shortName": "CatalogService", - "fullName": "google.cloud.retail.v2alpha.CatalogService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_CompleteQuery_async", - "title": "retail completeQuery Sample", - "origin": "API_DEFINITION", - "description": " Completes the specified prefix with keyword suggestions. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.complete_query.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 135, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "device_type", - "type": "TYPE_STRING" - }, - { - "name": "dataset", - "type": "TYPE_STRING" - }, - { - "name": "max_suggestions", - "type": "TYPE_INT32" - }, - { - "name": "enable_attribute_suggestions", - "type": "TYPE_BOOL" - }, - { - "name": "entity", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.CompleteQueryResponse", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" - }, - "method": { - "shortName": "CompleteQuery", - "fullName": "google.cloud.retail.v2alpha.CompletionService.CompleteQuery", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_CompletionService_ImportCompletionData_async", - "title": "retail importCompletionData Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of processed completion dataset. Request processing is asynchronous. Partial updating is not supported. The operation is successfully finished only after the imported suggestions are indexed successfully and ready for serving. The process takes hours. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "completion_service.import_completion_data.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.CompletionDataInputConfig" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "CompletionServiceClient", - "fullName": "google.cloud.retail.v2alpha.CompletionServiceClient" - }, - "method": { - "shortName": "ImportCompletionData", - "fullName": "google.cloud.retail.v2alpha.CompletionService.ImportCompletionData", - "service": { - "shortName": "CompletionService", - "fullName": "google.cloud.retail.v2alpha.CompletionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_CreateControl_async", - "title": "retail createControl Sample", - "origin": "API_DEFINITION", - "description": " Creates a Control. If the [Control][google.cloud.retail.v2alpha.Control] to create already exists, an ALREADY_EXISTS error is returned.", - "canonical": true, - "file": "control_service.create_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "CreateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.CreateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_DeleteControl_async", - "title": "retail deleteControl Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Control. If the [Control][google.cloud.retail.v2alpha.Control] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.delete_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "DeleteControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.DeleteControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_UpdateControl_async", - "title": "retail updateControl Sample", - "origin": "API_DEFINITION", - "description": " Updates a Control. [Control][google.cloud.retail.v2alpha.Control] cannot be set to a different oneof field, if so an INVALID_ARGUMENT is returned. If the [Control][google.cloud.retail.v2alpha.Control] to update does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "control_service.update_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "async": true, - "parameters": [ - { - "name": "control", - "type": ".google.cloud.retail.v2alpha.Control" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "UpdateControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.UpdateControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_GetControl_async", - "title": "retail getControl Sample", - "origin": "API_DEFINITION", - "description": " Gets a Control.", - "canonical": true, - "file": "control_service.get_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Control", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "GetControl", - "fullName": "google.cloud.retail.v2alpha.ControlService.GetControl", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ControlService_ListControls_async", - "title": "retail listControls Sample", - "origin": "API_DEFINITION", - "description": " Lists all Controls by their parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "control_service.list_controls.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListControlsResponse", - "client": { - "shortName": "ControlServiceClient", - "fullName": "google.cloud.retail.v2alpha.ControlServiceClient" - }, - "method": { - "shortName": "ListControls", - "fullName": "google.cloud.retail.v2alpha.ControlService.ListControls", - "service": { - "shortName": "ControlService", - "fullName": "google.cloud.retail.v2alpha.ControlService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async", - "title": "retail conversationalSearch Sample", - "origin": "API_DEFINITION", - "description": " Performs a conversational search. This feature is only available for users who have Conversational Search enabled.", - "canonical": true, - "file": "conversational_search_service.conversational_search.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 120, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ConversationalSearch", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "conversation_id", - "type": "TYPE_STRING" - }, - { - "name": "search_params", - "type": ".google.cloud.retail.v2alpha.ConversationalSearchRequest.SearchParams" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2alpha.UserInfo" - }, - { - "name": "conversational_filtering_spec", - "type": ".google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ConversationalSearchResponse", - "client": { - "shortName": "ConversationalSearchServiceClient", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchServiceClient" - }, - "method": { - "shortName": "ConversationalSearch", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService.ConversationalSearch", - "service": { - "shortName": "ConversationalSearchService", - "fullName": "google.cloud.retail.v2alpha.ConversationalSearchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async", - "title": "retail updateGenerativeQuestionsFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Manages overal generative question feature state -- enables toggling feature on and off.", - "canonical": true, - "file": "generative_question_service.update_generative_questions_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", - "async": true, - "parameters": [ - { - "name": "generative_questions_feature_config", - "type": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "UpdateGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionsFeatureConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async", - "title": "retail getGenerativeQuestionsFeatureConfig Sample", - "origin": "API_DEFINITION", - "description": " Manages overal generative question feature state -- enables toggling feature on and off.", - "canonical": true, - "file": "generative_question_service.get_generative_questions_feature_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", - "async": true, - "parameters": [ - { - "name": "catalog", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "GetGenerativeQuestionsFeatureConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.GetGenerativeQuestionsFeatureConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async", - "title": "retail listGenerativeQuestionConfigs Sample", - "origin": "API_DEFINITION", - "description": " Returns all questions for a given catalog.", - "canonical": true, - "file": "generative_question_service.list_generative_question_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.ListGenerativeQuestionConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "ListGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.ListGenerativeQuestionConfigs", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async", - "title": "retail updateGenerativeQuestionConfig Sample", - "origin": "API_DEFINITION", - "description": " Allows management of individual questions.", - "canonical": true, - "file": "generative_question_service.update_generative_question_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateGenerativeQuestionConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionConfig", - "async": true, - "parameters": [ - { - "name": "generative_question_config", - "type": ".google.cloud.retail.v2alpha.GenerativeQuestionConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.GenerativeQuestionConfig", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "UpdateGenerativeQuestionConfig", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.UpdateGenerativeQuestionConfig", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async", - "title": "retail batchUpdateGenerativeQuestionConfigs Sample", - "origin": "API_DEFINITION", - "description": " Allows management of multiple questions.", - "canonical": true, - "file": "generative_question_service.batch_update_generative_question_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchUpdateGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "requests", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse", - "client": { - "shortName": "GenerativeQuestionServiceClient", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionServiceClient" - }, - "method": { - "shortName": "BatchUpdateGenerativeQuestionConfigs", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService.BatchUpdateGenerativeQuestionConfigs", - "service": { - "shortName": "GenerativeQuestionService", - "fullName": "google.cloud.retail.v2alpha.GenerativeQuestionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async", - "title": "retail listMerchantCenterAccountLinks Sample", - "origin": "API_DEFINITION", - "description": " Lists all [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]s under the specified parent [Catalog][google.cloud.retail.v2alpha.Catalog].", - "canonical": true, - "file": "merchant_center_account_link_service.list_merchant_center_account_links.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListMerchantCenterAccountLinks", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "ListMerchantCenterAccountLinks", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.ListMerchantCenterAccountLinks", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async", - "title": "retail createMerchantCenterAccountLink Sample", - "origin": "API_DEFINITION", - "description": " Creates a [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink].", - "canonical": true, - "file": "merchant_center_account_link_service.create_merchant_center_account_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "merchant_center_account_link", - "type": ".google.cloud.retail.v2alpha.MerchantCenterAccountLink" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "CreateMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.CreateMerchantCenterAccountLink", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async", - "title": "retail deleteMerchantCenterAccountLink Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink]. If the [MerchantCenterAccountLink][google.cloud.retail.v2alpha.MerchantCenterAccountLink] to delete does not exist, a NOT_FOUND error is returned.", - "canonical": true, - "file": "merchant_center_account_link_service.delete_merchant_center_account_link.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "MerchantCenterAccountLinkServiceClient", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkServiceClient" - }, - "method": { - "shortName": "DeleteMerchantCenterAccountLink", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService.DeleteMerchantCenterAccountLink", - "service": { - "shortName": "MerchantCenterAccountLinkService", - "fullName": "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_CreateModel_async", - "title": "retail createModel Sample", - "origin": "API_DEFINITION", - "description": " Creates a new model.", - "canonical": true, - "file": "model_service.create_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": ".google.cloud.retail.v2alpha.Model" - }, - { - "name": "dry_run", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "CreateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.CreateModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_GetModel_async", - "title": "retail getModel Sample", - "origin": "API_DEFINITION", - "description": " Gets a model.", - "canonical": true, - "file": "model_service.get_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.GetModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "GetModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.GetModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_PauseModel_async", - "title": "retail pauseModel Sample", - "origin": "API_DEFINITION", - "description": " Pauses the training of an existing model.", - "canonical": true, - "file": "model_service.pause_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "PauseModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.PauseModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_ResumeModel_async", - "title": "retail resumeModel Sample", - "origin": "API_DEFINITION", - "description": " Resumes the training of an existing model.", - "canonical": true, - "file": "model_service.resume_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "ResumeModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.ResumeModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_DeleteModel_async", - "title": "retail deleteModel Sample", - "origin": "API_DEFINITION", - "description": " Deletes an existing model.", - "canonical": true, - "file": "model_service.delete_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "DeleteModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.DeleteModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_ListModels_async", - "title": "retail listModels Sample", - "origin": "API_DEFINITION", - "description": " Lists all the models linked to this event store.", - "canonical": true, - "file": "model_service.list_models.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListModels", - "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListModelsResponse", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "ListModels", - "fullName": "google.cloud.retail.v2alpha.ModelService.ListModels", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_UpdateModel_async", - "title": "retail updateModel Sample", - "origin": "API_DEFINITION", - "description": " Update of model metadata. Only fields that currently can be updated are: `filtering_option` and `periodic_tuning_state`. If other values are provided, this API method ignores them.", - "canonical": true, - "file": "model_service.update_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", - "async": true, - "parameters": [ - { - "name": "model", - "type": ".google.cloud.retail.v2alpha.Model" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Model", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "UpdateModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.UpdateModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ModelService_TuneModel_async", - "title": "retail tuneModel Sample", - "origin": "API_DEFINITION", - "description": " Tunes an existing model.", - "canonical": true, - "file": "model_service.tune_model.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TuneModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ModelServiceClient", - "fullName": "google.cloud.retail.v2alpha.ModelServiceClient" - }, - "method": { - "shortName": "TuneModel", - "fullName": "google.cloud.retail.v2alpha.ModelService.TuneModel", - "service": { - "shortName": "ModelService", - "fullName": "google.cloud.retail.v2alpha.ModelService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_PredictionService_Predict_async", - "title": "retail predict Sample", - "origin": "API_DEFINITION", - "description": " Makes a recommendation prediction.", - "canonical": true, - "file": "prediction_service.predict.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 179, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "params", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.PredictResponse", - "client": { - "shortName": "PredictionServiceClient", - "fullName": "google.cloud.retail.v2alpha.PredictionServiceClient" - }, - "method": { - "shortName": "Predict", - "fullName": "google.cloud.retail.v2alpha.PredictionService.Predict", - "service": { - "shortName": "PredictionService", - "fullName": "google.cloud.retail.v2alpha.PredictionService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_CreateProduct_async", - "title": "retail createProduct Sample", - "origin": "API_DEFINITION", - "description": " Creates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.create_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "product_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "CreateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.CreateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_GetProduct_async", - "title": "retail getProduct Sample", - "origin": "API_DEFINITION", - "description": " Gets a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.get_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "GetProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.GetProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ListProducts_async", - "title": "retail listProducts Sample", - "origin": "API_DEFINITION", - "description": " Gets a list of [Product][google.cloud.retail.v2alpha.Product]s.", - "canonical": true, - "file": "product_service.list_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 136, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "read_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "require_total_size", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListProductsResponse", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ListProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ListProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_UpdateProduct_async", - "title": "retail updateProduct Sample", - "origin": "API_DEFINITION", - "description": " Updates a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.update_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "async": true, - "parameters": [ - { - "name": "product", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Product", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "UpdateProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.UpdateProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_DeleteProduct_async", - "title": "retail deleteProduct Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Product][google.cloud.retail.v2alpha.Product].", - "canonical": true, - "file": "product_service.delete_product.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 81, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "DeleteProduct", - "fullName": "google.cloud.retail.v2alpha.ProductService.DeleteProduct", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_PurgeProducts_async", - "title": "retail purgeProducts Sample", - "origin": "API_DEFINITION", - "description": " Permanently deletes all selected [Product][google.cloud.retail.v2alpha.Product]s under a branch. This process is asynchronous. If the request is valid, the removal will be enqueued and processed offline. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. Before the operation completes, some [Product][google.cloud.retail.v2alpha.Product]s may still be returned by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Depending on the number of [Product][google.cloud.retail.v2alpha.Product]s, this operation could take hours to complete. To get a sample of [Product][google.cloud.retail.v2alpha.Product]s that would be deleted, set [PurgeProductsRequest.force][google.cloud.retail.v2alpha.PurgeProductsRequest.force] to false.", - "canonical": true, - "file": "product_service.purge_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 96, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "PurgeProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.PurgeProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ImportProducts_async", - "title": "retail importProducts Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of multiple [Product][google.cloud.retail.v2alpha.Product]s. Request processing may be synchronous. Non-existing items are created. Note that it is possible for a subset of the [Product][google.cloud.retail.v2alpha.Product]s to be successfully updated.", - "canonical": true, - "file": "product_service.import_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 104, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.ProductInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "reconciliation_mode", - "type": ".google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode" - }, - { - "name": "notification_pubsub_topic", - "type": "TYPE_STRING" - }, - { - "name": "skip_default_branch_protection", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ImportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ImportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_ExportProducts_async", - "title": "retail exportProducts Sample", - "origin": "API_DEFINITION", - "description": " Exports multiple [Product][google.cloud.retail.v2alpha.Product]s.", - "canonical": true, - "file": "product_service.export_products.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 101, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ExportProducts", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "ExportProducts", - "fullName": "google.cloud.retail.v2alpha.ProductService.ExportProducts", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_SetInventory_async", - "title": "retail setInventory Sample", - "origin": "API_DEFINITION", - "description": " Updates inventory information for a [Product][google.cloud.retail.v2alpha.Product] while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update is enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. When inventory is updated with [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct], the specified inventory field value(s) overwrite any existing value(s) while ignoring the last update time for this field. Furthermore, the last update times for the specified inventory fields are overwritten by the times of the [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] or [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] request. If no inventory fields are set in [CreateProductRequest.product][google.cloud.retail.v2alpha.CreateProductRequest.product], then any pre-existing inventory information for this product is used. If no inventory fields are set in [SetInventoryRequest.set_mask][google.cloud.retail.v2alpha.SetInventoryRequest.set_mask], then any existing inventory information is preserved. Pre-existing inventory information can only be updated with [ProductService.SetInventory][google.cloud.retail.v2alpha.ProductService.SetInventory], [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces], and [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces]. The returned [Operation][google.longrunning.Operation]s is obsolete after one day, and the [GetOperation][google.longrunning.Operations.GetOperation] API returns `NOT_FOUND` afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates are not marked as [done][google.longrunning.Operation.done] until they are obsolete.", - "canonical": true, - "file": "product_service.set_inventory.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 123, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "async": true, - "parameters": [ - { - "name": "inventory", - "type": ".google.cloud.retail.v2alpha.Product" - }, - { - "name": "set_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "set_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "SetInventory", - "fullName": "google.cloud.retail.v2alpha.ProductService.SetInventory", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async", - "title": "retail addFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " We recommend that you use the [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] method instead of the [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces] method. [ProductService.AddLocalInventories][google.cloud.retail.v2alpha.ProductService.AddLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally adds place IDs to [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the added place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.add_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 111, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "AddFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async", - "title": "retail removeFulfillmentPlaces Sample", - "origin": "API_DEFINITION", - "description": " We recommend that you use the [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] method instead of the [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces] method. [ProductService.RemoveLocalInventories][google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories] achieves the same results but provides more fine-grained control over ingesting local inventory data. Incrementally removes place IDs from a [Product.fulfillment_info.place_ids][google.cloud.retail.v2alpha.FulfillmentInfo.place_ids]. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating fulfillment information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, the removed place IDs are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.remove_fulfillment_places.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 107, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "type", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "RemoveFulfillmentPlaces", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_AddLocalInventories_async", - "title": "retail addLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Updates local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places, while respecting the last update timestamps of each inventory field. This process is asynchronous and does not require the [Product][google.cloud.retail.v2alpha.Product] to exist before updating inventory information. If the request is valid, the update will be enqueued and processed downstream. As a consequence, when a response is returned, updates are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be modified using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.add_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 95, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "local_inventories", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "add_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "add_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "AddLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.AddLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProductService_RemoveLocalInventories_async", - "title": "retail removeLocalInventories Sample", - "origin": "API_DEFINITION", - "description": " Remove local inventory information for a [Product][google.cloud.retail.v2alpha.Product] at a list of places at a removal timestamp. This process is asynchronous. If the request is valid, the removal will be enqueued and processed downstream. As a consequence, when a response is returned, removals are not immediately manifested in the [Product][google.cloud.retail.v2alpha.Product] queried by [ProductService.GetProduct][google.cloud.retail.v2alpha.ProductService.GetProduct] or [ProductService.ListProducts][google.cloud.retail.v2alpha.ProductService.ListProducts]. Local inventory information can only be removed using this method. [ProductService.CreateProduct][google.cloud.retail.v2alpha.ProductService.CreateProduct] and [ProductService.UpdateProduct][google.cloud.retail.v2alpha.ProductService.UpdateProduct] has no effect on local inventories. The returned [Operation][google.longrunning.Operation]s will be obsolete after 1 day, and [GetOperation][google.longrunning.Operations.GetOperation] API will return NOT_FOUND afterwards. If conflicting updates are issued, the [Operation][google.longrunning.Operation]s associated with the stale updates will not be marked as [done][google.longrunning.Operation.done] until being obsolete.", - "canonical": true, - "file": "product_service.remove_local_inventories.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "async": true, - "parameters": [ - { - "name": "product", - "type": "TYPE_STRING" - }, - { - "name": "place_ids", - "type": "TYPE_STRING[]" - }, - { - "name": "remove_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "allow_missing", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProductServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProductServiceClient" - }, - "method": { - "shortName": "RemoveLocalInventories", - "fullName": "google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories", - "service": { - "shortName": "ProductService", - "fullName": "google.cloud.retail.v2alpha.ProductService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetProject_async", - "title": "retail getProject Sample", - "origin": "API_DEFINITION", - "description": " Gets the project. Throws `NOT_FOUND` if the project wasn't initialized for the Retail API service.", - "canonical": true, - "file": "project_service.get_project.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetProject", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetProject", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Project", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetProject", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetProject", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_AcceptTerms_async", - "title": "retail acceptTerms Sample", - "origin": "API_DEFINITION", - "description": " Accepts service terms for this project. By making requests to this API, you agree to the terms of service linked below. https://cloud.google.com/retail/data-use-terms", - "canonical": true, - "file": "project_service.accept_terms.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AcceptTerms", - "fullName": "google.cloud.retail.v2alpha.ProjectService.AcceptTerms", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.Project", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "AcceptTerms", - "fullName": "google.cloud.retail.v2alpha.ProjectService.AcceptTerms", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_EnrollSolution_async", - "title": "retail enrollSolution Sample", - "origin": "API_DEFINITION", - "description": " The method enrolls a solution of type [Retail Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] into a project. The [Recommendations AI solution type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] is enrolled by default when your project enables Retail API, so you don't need to call the enrollSolution method for recommendations.", - "canonical": true, - "file": "project_service.enroll_solution.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnrollSolution", - "fullName": "google.cloud.retail.v2alpha.ProjectService.EnrollSolution", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "solution", - "type": ".google.cloud.retail.v2alpha.SolutionType" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "EnrollSolution", - "fullName": "google.cloud.retail.v2alpha.ProjectService.EnrollSolution", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async", - "title": "retail listEnrolledSolutions Sample", - "origin": "API_DEFINITION", - "description": " Lists all the retail API solutions the project has enrolled.", - "canonical": true, - "file": "project_service.list_enrolled_solutions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEnrolledSolutions", - "fullName": "google.cloud.retail.v2alpha.ProjectService.ListEnrolledSolutions", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "ListEnrolledSolutions", - "fullName": "google.cloud.retail.v2alpha.ProjectService.ListEnrolledSolutions", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetLoggingConfig_async", - "title": "retail getLoggingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the requested project.", - "canonical": true, - "file": "project_service.get_logging_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.LoggingConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetLoggingConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async", - "title": "retail updateLoggingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates the [LoggingConfig][google.cloud.retail.v2alpha.LoggingConfig] of the requested project.", - "canonical": true, - "file": "project_service.update_logging_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig", - "async": true, - "parameters": [ - { - "name": "logging_config", - "type": ".google.cloud.retail.v2alpha.LoggingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.LoggingConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "UpdateLoggingConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateLoggingConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_GetAlertConfig_async", - "title": "retail getAlertConfig Sample", - "origin": "API_DEFINITION", - "description": " Get the [AlertConfig][google.cloud.retail.v2alpha.AlertConfig] of the requested project.", - "canonical": true, - "file": "project_service.get_alert_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetAlertConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AlertConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "GetAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.GetAlertConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async", - "title": "retail updateAlertConfig Sample", - "origin": "API_DEFINITION", - "description": " Update the alert config of the requested project.", - "canonical": true, - "file": "project_service.update_alert_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig", - "async": true, - "parameters": [ - { - "name": "alert_config", - "type": ".google.cloud.retail.v2alpha.AlertConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.AlertConfig", - "client": { - "shortName": "ProjectServiceClient", - "fullName": "google.cloud.retail.v2alpha.ProjectServiceClient" - }, - "method": { - "shortName": "UpdateAlertConfig", - "fullName": "google.cloud.retail.v2alpha.ProjectService.UpdateAlertConfig", - "service": { - "shortName": "ProjectService", - "fullName": "google.cloud.retail.v2alpha.ProjectService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_SearchService_Search_async", - "title": "retail search Sample", - "origin": "API_DEFINITION", - "description": " Performs a search. This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.", - "canonical": true, - "file": "search_service.search.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 378, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "async": true, - "parameters": [ - { - "name": "placement", - "type": "TYPE_STRING" - }, - { - "name": "branch", - "type": "TYPE_STRING" - }, - { - "name": "query", - "type": "TYPE_STRING" - }, - { - "name": "visitor_id", - "type": "TYPE_STRING" - }, - { - "name": "user_info", - "type": ".google.cloud.retail.v2alpha.UserInfo" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "offset", - "type": "TYPE_INT32" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "canonical_filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - }, - { - "name": "facet_specs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "dynamic_facet_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec" - }, - { - "name": "boost_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.BoostSpec" - }, - { - "name": "query_expansion_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec" - }, - { - "name": "relevance_threshold", - "type": ".google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold" - }, - { - "name": "variant_rollup_keys", - "type": "TYPE_STRING[]" - }, - { - "name": "page_categories", - "type": "TYPE_STRING[]" - }, - { - "name": "search_mode", - "type": ".google.cloud.retail.v2alpha.SearchRequest.SearchMode" - }, - { - "name": "personalization_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "spell_correction_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec" - }, - { - "name": "entity", - "type": "TYPE_STRING" - }, - { - "name": "conversational_search_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec" - }, - { - "name": "tile_navigation_spec", - "type": ".google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec" - }, - { - "name": "language_code", - "type": "TYPE_STRING" - }, - { - "name": "region_code", - "type": "TYPE_STRING" - }, - { - "name": "place_id", - "type": "TYPE_STRING" - }, - { - "name": "user_attributes", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.retail.v2alpha.SearchResponse", - "client": { - "shortName": "SearchServiceClient", - "fullName": "google.cloud.retail.v2alpha.SearchServiceClient" - }, - "method": { - "shortName": "Search", - "fullName": "google.cloud.retail.v2alpha.SearchService.Search", - "service": { - "shortName": "SearchService", - "fullName": "google.cloud.retail.v2alpha.SearchService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async", - "title": "retail createServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Creates a ServingConfig. A maximum of 100 [ServingConfig][google.cloud.retail.v2alpha.ServingConfig]s are allowed in a [Catalog][google.cloud.retail.v2alpha.Catalog], otherwise a FAILED_PRECONDITION error is returned.", - "canonical": true, - "file": "serving_config_service.create_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "serving_config_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "CreateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.CreateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async", - "title": "retail deleteServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.delete_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "DeleteServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.DeleteServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async", - "title": "retail updateServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Updates a ServingConfig.", - "canonical": true, - "file": "serving_config_service.update_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": ".google.cloud.retail.v2alpha.ServingConfig" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "UpdateServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.UpdateServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_GetServingConfig_async", - "title": "retail getServingConfig Sample", - "origin": "API_DEFINITION", - "description": " Gets a ServingConfig. Returns a NotFound error if the ServingConfig does not exist.", - "canonical": true, - "file": "serving_config_service.get_serving_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "GetServingConfig", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.GetServingConfig", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async", - "title": "retail listServingConfigs Sample", - "origin": "API_DEFINITION", - "description": " Lists all ServingConfigs linked to this catalog.", - "canonical": true, - "file": "serving_config_service.list_serving_configs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ListServingConfigsResponse", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "ListServingConfigs", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.ListServingConfigs", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_AddControl_async", - "title": "retail addControl Sample", - "origin": "API_DEFINITION", - "description": " Enables a Control on the specified ServingConfig. The control is added in the last position of the list of controls it belongs to (e.g. if it's a facet spec control it will be applied in the last position of servingConfig.facetSpecIds) Returns a ALREADY_EXISTS error if the control has already been applied. Returns a FAILED_PRECONDITION error if the addition could exceed maximum number of control allowed for that type of control.", - "canonical": true, - "file": "serving_config_service.add_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "AddControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.AddControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_ServingConfigService_RemoveControl_async", - "title": "retail removeControl Sample", - "origin": "API_DEFINITION", - "description": " Disables a Control on the specified ServingConfig. The control is removed from the ServingConfig. Returns a NOT_FOUND error if the Control is not enabled for the ServingConfig.", - "canonical": true, - "file": "serving_config_service.remove_control.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "async": true, - "parameters": [ - { - "name": "serving_config", - "type": "TYPE_STRING" - }, - { - "name": "control_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.retail.v2alpha.ServingConfig", - "client": { - "shortName": "ServingConfigServiceClient", - "fullName": "google.cloud.retail.v2alpha.ServingConfigServiceClient" - }, - "method": { - "shortName": "RemoveControl", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService.RemoveControl", - "service": { - "shortName": "ServingConfigService", - "fullName": "google.cloud.retail.v2alpha.ServingConfigService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_WriteUserEvent_async", - "title": "retail writeUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event.", - "canonical": true, - "file": "user_event_service.write_user_event.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": ".google.cloud.retail.v2alpha.UserEvent" - }, - { - "name": "write_async", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.retail.v2alpha.UserEvent", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "WriteUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.WriteUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_CollectUserEvent_async", - "title": "retail collectUserEvent Sample", - "origin": "API_DEFINITION", - "description": " Writes a single user event from the browser. For larger user event payload over 16 KB, the POST method should be used instead, otherwise a 400 Bad Request error is returned. This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.", - "canonical": true, - "file": "user_event_service.collect_user_event.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "async": true, - "parameters": [ - { - "name": "prebuilt_rule", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event", - "type": "TYPE_STRING" - }, - { - "name": "uri", - "type": "TYPE_STRING" - }, - { - "name": "ets", - "type": "TYPE_INT64" - }, - { - "name": "raw_json", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.api.HttpBody", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "CollectUserEvent", - "fullName": "google.cloud.retail.v2alpha.UserEventService.CollectUserEvent", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_PurgeUserEvents_async", - "title": "retail purgeUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.", - "canonical": true, - "file": "user_event_service.purge_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "PurgeUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.PurgeUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_ImportUserEvents_async", - "title": "retail importUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events. `Operation.response` is of type `ImportResponse`. Note that it is possible for a subset of the items to be successfully inserted. `Operation.metadata` is of type `ImportMetadata`.", - "canonical": true, - "file": "user_event_service.import_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "input_config", - "type": ".google.cloud.retail.v2alpha.UserEventInputConfig" - }, - { - "name": "errors_config", - "type": ".google.cloud.retail.v2alpha.ImportErrorsConfig" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "ImportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ImportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_ExportUserEvents_async", - "title": "retail exportUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Exports user events. `Operation.response` is of type `ExportResponse`. `Operation.metadata` is of type `ExportMetadata`.", - "canonical": true, - "file": "user_event_service.export_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 94, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ExportUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "output_config", - "type": ".google.cloud.retail.v2alpha.OutputConfig" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "ExportUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.ExportUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - }, - { - "regionTag": "retail_v2alpha_generated_UserEventService_RejoinUserEvents_async", - "title": "retail rejoinUserEvents Sample", - "origin": "API_DEFINITION", - "description": " Starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.", - "canonical": true, - "file": "user_event_service.rejoin_user_events.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "user_event_rejoin_scope", - "type": ".google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "UserEventServiceClient", - "fullName": "google.cloud.retail.v2alpha.UserEventServiceClient" - }, - "method": { - "shortName": "RejoinUserEvents", - "fullName": "google.cloud.retail.v2alpha.UserEventService.RejoinUserEvents", - "service": { - "shortName": "UserEventService", - "fullName": "google.cloud.retail.v2alpha.UserEventService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline deleted file mode 100644 index 50cf19d3a225..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.collect_user_event.js.baseline +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, userEvent) { - // [START retail_v2alpha_generated_UserEventService_CollectUserEvent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The prebuilt rule name that can convert a specific type of raw_json. - * For example: "ga4_bq" rule for the GA4 user event schema. - */ - // const prebuiltRule = 'abc123' - /** - * Required. The parent catalog name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. URL encoded UserEvent proto with a length limit of 2,000,000 - * characters. - */ - // const userEvent = 'abc123' - /** - * The URL including cgi-parameters but excluding the hash fragment with a - * length limit of 5,000 characters. This is often more useful than the - * referer URL, because many browsers only send the domain for 3rd party - * requests. - */ - // const uri = 'abc123' - /** - * The event timestamp in milliseconds. This prevents browser caching of - * otherwise identical get requests. The name is abbreviated to reduce the - * payload bytes. - */ - // const ets = 1234 - /** - * An arbitrary serialized JSON string that contains necessary information - * that can comprise a user event. When this field is specified, the - * user_event field will be ignored. Note: line-delimited JSON is not - * supported, a single JSON only. - */ - // const rawJson = 'abc123' - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callCollectUserEvent() { - // Construct request - const request = { - parent, - userEvent, - }; - - // Run request - const response = await retailClient.collectUserEvent(request); - console.log(response); - } - - callCollectUserEvent(); - // [END retail_v2alpha_generated_UserEventService_CollectUserEvent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline deleted file mode 100644 index 3532c6ea39bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.export_user_events.js.baseline +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, outputConfig) { - // [START retail_v2alpha_generated_UserEventService_ExportUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Resource name of a - * Catalog google.cloud.retail.v2alpha.Catalog. For example - * `projects/1234/locations/global/catalogs/default_catalog` - */ - // const parent = 'abc123' - /** - * Required. The output location of the data. - */ - // const outputConfig = {} - /** - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned user events. Use this expression to restrict results to a - * specific time range or to filter events by eventType. - * For example, `eventTime > "2012-04-23T18:25:43.511Z" - * eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - * eventType=search` - * We expect only three types of fields: - * * `eventTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `eventTime` restriction should result in one, contiguous, valid, - * `eventTime` range. - * * `eventType`: Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. - * * `eventsMissingCatalogItems`: This restricts results - * to events for which catalog items were not found in the catalog. The - * default behavior is to return only those events for which catalog - * items were found. - * Some examples of valid filters expressions: - * * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - * eventType = detail-page-view` - * * Example 3: `eventsMissingCatalogItems - * eventType = (NOT search) eventTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `eventType = (detail-page-view OR search)` - * * Example 6: `eventsMissingCatalogItems` - */ - // const filter = 'abc123' - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callExportUserEvents() { - // Construct request - const request = { - parent, - outputConfig, - }; - - // Run request - const [operation] = await retailClient.exportUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportUserEvents(); - // [END retail_v2alpha_generated_UserEventService_ExportUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline deleted file mode 100644 index d52aaaf5add8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.import_user_events.js.baseline +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, inputConfig) { - // [START retail_v2alpha_generated_UserEventService_ImportUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. `projects/1234/locations/global/catalogs/default_catalog` - */ - // const parent = 'abc123' - /** - * Required. The desired input location of the data. - */ - // const inputConfig = {} - /** - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - */ - // const errorsConfig = {} - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callImportUserEvents() { - // Construct request - const request = { - parent, - inputConfig, - }; - - // Run request - const [operation] = await retailClient.importUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callImportUserEvents(); - // [END retail_v2alpha_generated_UserEventService_ImportUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline deleted file mode 100644 index b2f6b62394d0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.purge_user_events.js.baseline +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, filter) { - // [START retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the catalog under which the events are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}` - */ - // const parent = 'abc123' - /** - * Required. The filter string to specify the events to be deleted with a - * length limit of 5,000 characters. Empty string filter is not allowed. The - * eligible fields for filtering are: - * * `eventType`: Double quoted - * UserEvent.event_type google.cloud.retail.v2alpha.UserEvent.event_type - * string. - * * `eventTime`: in ISO 8601 "zulu" format. - * * `visitorId`: Double quoted string. Specifying this will delete all - * events associated with a visitor. - * * `userId`: Double quoted string. Specifying this will delete all events - * associated with a user. - * Examples: - * * Deleting all events in a time range: - * `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Deleting specific eventType in time range: - * `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - * * Deleting all events for a specific visitor: - * `visitorId = "visitor1024"` - * The filtering fields are assumed to have an implicit AND. - */ - // const filter = 'abc123' - /** - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any user events. - */ - // const force = true - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callPurgeUserEvents() { - // Construct request - const request = { - parent, - filter, - }; - - // Run request - const [operation] = await retailClient.purgeUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callPurgeUserEvents(); - // [END retail_v2alpha_generated_UserEventService_PurgeUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline deleted file mode 100644 index efe1ac903c32..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.rejoin_user_events.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * The type of the user event rejoin to define the scope and range of the user - * events to be rejoined with the latest product catalog. Defaults to - * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - * an invalid integer value. - */ - // const userEventRejoinScope = {} - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callRejoinUserEvents() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await retailClient.rejoinUserEvents(request); - const [response] = await operation.promise(); - console.log(response); - } - - callRejoinUserEvents(); - // [END retail_v2alpha_generated_UserEventService_RejoinUserEvents_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline deleted file mode 100644 index 7177026d13ed..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/samples/generated/v2alpha/user_event_service.write_user_event.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, userEvent) { - // [START retail_v2alpha_generated_UserEventService_WriteUserEvent_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - */ - // const parent = 'abc123' - /** - * Required. User event to write. - */ - // const userEvent = {} - /** - * If set to true, the user event will be written asynchronously after - * validation, and the API will respond without waiting for the write. - * Therefore, silent failures can occur even if the API returns success. In - * case of silent failures, error messages can be found in Stackdriver logs. - */ - // const writeAsync = true - - // Imports the Retail library - const {UserEventServiceClient} = require('retail').v2alpha; - - // Instantiates a client - const retailClient = new UserEventServiceClient(); - - async function callWriteUserEvent() { - // Construct request - const request = { - parent, - userEvent, - }; - - // Run request - const response = await retailClient.writeUserEvent(request); - console.log(response); - } - - callWriteUserEvent(); - // [END retail_v2alpha_generated_UserEventService_WriteUserEvent_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/index.ts.baseline deleted file mode 100644 index 781726dc39b8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/index.ts.baseline +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2alpha from './v2alpha'; -const AnalyticsServiceClient = v2alpha.AnalyticsServiceClient; -type AnalyticsServiceClient = v2alpha.AnalyticsServiceClient; -const BranchServiceClient = v2alpha.BranchServiceClient; -type BranchServiceClient = v2alpha.BranchServiceClient; -const CatalogServiceClient = v2alpha.CatalogServiceClient; -type CatalogServiceClient = v2alpha.CatalogServiceClient; -const CompletionServiceClient = v2alpha.CompletionServiceClient; -type CompletionServiceClient = v2alpha.CompletionServiceClient; -const ControlServiceClient = v2alpha.ControlServiceClient; -type ControlServiceClient = v2alpha.ControlServiceClient; -const ConversationalSearchServiceClient = v2alpha.ConversationalSearchServiceClient; -type ConversationalSearchServiceClient = v2alpha.ConversationalSearchServiceClient; -const GenerativeQuestionServiceClient = v2alpha.GenerativeQuestionServiceClient; -type GenerativeQuestionServiceClient = v2alpha.GenerativeQuestionServiceClient; -const MerchantCenterAccountLinkServiceClient = v2alpha.MerchantCenterAccountLinkServiceClient; -type MerchantCenterAccountLinkServiceClient = v2alpha.MerchantCenterAccountLinkServiceClient; -const ModelServiceClient = v2alpha.ModelServiceClient; -type ModelServiceClient = v2alpha.ModelServiceClient; -const PredictionServiceClient = v2alpha.PredictionServiceClient; -type PredictionServiceClient = v2alpha.PredictionServiceClient; -const ProductServiceClient = v2alpha.ProductServiceClient; -type ProductServiceClient = v2alpha.ProductServiceClient; -const ProjectServiceClient = v2alpha.ProjectServiceClient; -type ProjectServiceClient = v2alpha.ProjectServiceClient; -const SearchServiceClient = v2alpha.SearchServiceClient; -type SearchServiceClient = v2alpha.SearchServiceClient; -const ServingConfigServiceClient = v2alpha.ServingConfigServiceClient; -type ServingConfigServiceClient = v2alpha.ServingConfigServiceClient; -const UserEventServiceClient = v2alpha.UserEventServiceClient; -type UserEventServiceClient = v2alpha.UserEventServiceClient; -export {v2alpha, AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient}; -export default {v2alpha, AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client.ts.baseline deleted file mode 100644 index 15a667095bee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client.ts.baseline +++ /dev/null @@ -1,1144 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/analytics_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './analytics_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for managing & accessing retail search business metric. - * Retail recommendation business metric is currently not available. - * @class - * @memberof v2alpha - */ -export class AnalyticsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - analyticsServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of AnalyticsServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 AnalyticsServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof AnalyticsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const exportAnalyticsMetricsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportAnalyticsMetricsResponse') as gax.protobuf.Type; - const exportAnalyticsMetricsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - exportAnalyticsMetrics: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportAnalyticsMetricsResponse.decode.bind(exportAnalyticsMetricsResponse), - exportAnalyticsMetricsMetadata.decode.bind(exportAnalyticsMetricsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.AnalyticsService', gapicConfig as gax.ClientConfig, - 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.analyticsServiceStub) { - return this.analyticsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.AnalyticsService. - this.analyticsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.AnalyticsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.AnalyticsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const analyticsServiceStubMethods = - ['exportAnalyticsMetrics']; - for (const methodName of analyticsServiceStubMethods) { - const callPromise = this.analyticsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.analyticsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Exports analytics metrics. - * - * `Operation.response` is of type `ExportAnalyticsMetricsResponse`. - * `Operation.metadata` is of type `ExportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Full resource name of the parent catalog. - * Expected format: `projects/* /locations/* /catalogs/*` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned metrics. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned metrics. Use this expression to restrict results to a - * specific time range. - * - * Currently we expect only one types of fields: - * - * * `timestamp`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `timestamp` restriction should result in one, contiguous, valid, - * `timestamp` range. - * - * Some examples of valid filters expressions: - * - * * Example 1: `timestamp > "2012-04-23T18:25:43.511Z" - * timestamp < "2012-04-23T18:30:43.511Z"` - * * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/analytics_service.export_analytics_metrics.js - * region_tag:retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async - */ - exportAnalyticsMetrics( - request?: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportAnalyticsMetrics( - request: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAnalyticsMetrics( - request: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportAnalyticsMetrics( - request?: protos.google.cloud.retail.v2alpha.IExportAnalyticsMetricsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportAnalyticsMetrics response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('exportAnalyticsMetrics request %j', request); - return this.innerApiCalls.exportAnalyticsMetrics(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportAnalyticsMetrics response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportAnalyticsMetrics()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/analytics_service.export_analytics_metrics.js - * region_tag:retail_v2alpha_generated_AnalyticsService_ExportAnalyticsMetrics_async - */ - async checkExportAnalyticsMetricsProgress(name: string): Promise>{ - this._log.info('exportAnalyticsMetrics long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportAnalyticsMetrics, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.analyticsServiceStub && !this._terminated) { - return this.analyticsServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client_config.json.baseline deleted file mode 100644 index 80e172e83da1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_client_config.json.baseline +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.AnalyticsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ExportAnalyticsMetrics": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/analytics_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client.ts.baseline deleted file mode 100644 index 82511e0f7474..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client.ts.baseline +++ /dev/null @@ -1,1194 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/branch_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './branch_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for {@link protos.google.cloud.retail.v2alpha.Branch|Branch} Management - * - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}es are automatically created when - * a {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} is created. There are fixed - * three branches in each catalog, and may use - * {@link protos.google.cloud.retail.v2alpha.BranchService.ListBranches|ListBranches} method - * to get the details of all branches. - * @class - * @memberof v2alpha - */ -export class BranchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - branchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of BranchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 BranchServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof BranchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.BranchService', gapicConfig as gax.ClientConfig, - 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.branchServiceStub) { - return this.branchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.BranchService. - this.branchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.BranchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.BranchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const branchServiceStubMethods = - ['listBranches', 'getBranch']; - for (const methodName of branchServiceStubMethods) { - const callPromise = this.branchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.branchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Lists all instances of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} under - * the specified parent {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name. - * @param {google.cloud.retail.v2alpha.BranchView} request.view - * The view to apply to the returned - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. Defaults to - * [Branch.BranchView.BASIC] if unspecified. - * See documentation of fields of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} - * to find what fields are excluded from BASIC view. - * @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 {@link protos.google.cloud.retail.v2alpha.ListBranchesResponse|ListBranchesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/branch_service.list_branches.js - * region_tag:retail_v2alpha_generated_BranchService_ListBranches_async - */ - listBranches( - request?: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, {}|undefined - ]>; - listBranches( - request: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): void; - listBranches( - request: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): void; - listBranches( - request?: protos.google.cloud.retail.v2alpha.IListBranchesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listBranches request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listBranches response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listBranches(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListBranchesResponse, - protos.google.cloud.retail.v2alpha.IListBranchesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listBranches response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the branch to retrieve. - * Format: - * `projects/* /locations/global/catalogs/default_catalog/branches/some_branch_id`. - * - * "default_branch" can be used as a special branch_id, it returns the - * default branch that has been set for the catalog. - * @param {google.cloud.retail.v2alpha.BranchView} request.view - * The view to apply to the returned - * {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. Defaults to - * [Branch.BranchView.BASIC] if unspecified. - * See documentation of fields of {@link protos.google.cloud.retail.v2alpha.Branch|Branch} - * to find what fields are excluded from BASIC view. - * @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 {@link protos.google.cloud.retail.v2alpha.Branch|Branch}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/branch_service.get_branch.js - * region_tag:retail_v2alpha_generated_BranchService_GetBranch_async - */ - getBranch( - request?: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, {}|undefined - ]>; - getBranch( - request: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): void; - getBranch( - request: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): void; - getBranch( - request?: protos.google.cloud.retail.v2alpha.IGetBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBranch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBranch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBranch, - protos.google.cloud.retail.v2alpha.IGetBranchRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.branchServiceStub && !this._terminated) { - return this.branchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client_config.json.baseline deleted file mode 100644 index 92fe8a070c6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_client_config.json.baseline +++ /dev/null @@ -1,45 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.BranchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListBranches": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetBranch": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/branch_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client.ts.baseline deleted file mode 100644 index e9df6a9d3547..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client.ts.baseline +++ /dev/null @@ -1,2464 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/catalog_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './catalog_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for managing catalog configuration. - * @class - * @memberof v2alpha - */ -export class CatalogServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - catalogServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CatalogServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 CatalogServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CatalogServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listCatalogs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'catalogs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.CatalogService', gapicConfig as gax.ClientConfig, - 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.catalogServiceStub) { - return this.catalogServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.CatalogService. - this.catalogServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.CatalogService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.CatalogService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const catalogServiceStubMethods = - ['listCatalogs', 'updateCatalog', 'setDefaultBranch', 'getDefaultBranch', 'getCompletionConfig', 'updateCompletionConfig', 'getAttributesConfig', 'updateAttributesConfig', 'addCatalogAttribute', 'removeCatalogAttribute', 'batchRemoveCatalogAttributes', 'replaceCatalogAttribute']; - for (const methodName of catalogServiceStubMethods) { - const callPromise = this.catalogServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.catalogServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Updates the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Catalog} request.catalog - * Required. The {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update does not - * exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} to update. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * 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 {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_catalog.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateCatalog_async - */ - updateCatalog( - request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, {}|undefined - ]>; - updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): void; - updateCatalog( - request: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): void; - updateCatalog( - request?: protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog.name': request.catalog!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCatalog request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCatalog response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCatalog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICatalog, - protos.google.cloud.retail.v2alpha.IUpdateCatalogRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCatalog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Set a specified branch id as default branch. API methods such as - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * will treat requests using "default_branch" to the actual branch id set as - * default. - * - * For example, if `projects/* /locations/* /catalogs/* /branches/1` is set as - * default, setting - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * `projects/* /locations/* /catalogs/* /branches/default_branch` is equivalent - * to setting - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * `projects/* /locations/* /catalogs/* /branches/1`. - * - * Using multiple branches can be useful when developers would like - * to have a staging branch to test and verify for future usage. When it - * becomes ready, developers switch on the staging branch using this API - * while keeping using - * `projects/* /locations/* /catalogs/* /branches/default_branch` as - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.branch|SearchRequest.branch} to - * route the traffic to this staging branch. - * - * CAUTION: If you have live predict/search traffic, switching the default - * branch could potentially cause outages if the ID space of the new branch - * is very different from the old one. - * - * More specifically: - * - * * PredictionService will only return product IDs from branch {newBranch}. - * * SearchService will only return product IDs from branch {newBranch} - * (if branch is not explicitly set). - * * UserEventService will only join events with products from branch - * {newBranch}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Full resource name of the catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.branchId - * The final component of the resource name of a branch. - * - * This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT - * error is returned. - * - * If there are no sufficient active products in the targeted branch and - * {@link protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest.force|force} is not - * set, a FAILED_PRECONDITION error is returned. - * @param {string} request.note - * Some note on this request, this can be retrieved by - * {@link protos.google.cloud.retail.v2alpha.CatalogService.GetDefaultBranch|CatalogService.GetDefaultBranch} - * before next valid default branch set occurs. - * - * This field must be a UTF-8 encoded string with a length limit of 1,000 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {boolean} request.force - * If set to true, it permits switching to a branch with - * {@link protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest.branch_id|branch_id} - * even if it has no sufficient active products. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.set_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_SetDefaultBranch_async - */ - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, {}|undefined - ]>; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - setDefaultBranch( - request: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - setDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('setDefaultBranch request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('setDefaultBranch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.setDefaultBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.ISetDefaultBranchRequest|undefined, - {}|undefined - ]) => { - this._log.info('setDefaultBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get which branch is currently default branch set by - * {@link protos.google.cloud.retail.v2alpha.CatalogService.SetDefaultBranch|CatalogService.SetDefaultBranch} - * method under a specified parent catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @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 {@link protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse|GetDefaultBranchResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_default_branch.js - * region_tag:retail_v2alpha_generated_CatalogService_GetDefaultBranch_async - */ - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, {}|undefined - ]>; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - getDefaultBranch( - request: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): void; - getDefaultBranch( - request?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getDefaultBranch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDefaultBranch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getDefaultBranch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse, - protos.google.cloud.retail.v2alpha.IGetDefaultBranchRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDefaultBranch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full CompletionConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig` - * @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 {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_completion_config.js - * region_tag:retail_v2alpha_generated_CatalogService_GetCompletionConfig_async - */ - getCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, {}|undefined - ]>; - getCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - getCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - getCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getCompletionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getCompletionConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getCompletionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IGetCompletionConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getCompletionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.CompletionConfig} request.completionConfig - * Required. The - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to - * update does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig} to update. - * The following are the only supported fields: - * - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.matching_order|CompletionConfig.matching_order} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.min_prefix_length|CompletionConfig.min_prefix_length} - * * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.auto_learning|CompletionConfig.auto_learning} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.CompletionConfig|CompletionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_completion_config.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateCompletionConfig_async - */ - updateCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, {}|undefined - ]>; - updateCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateCompletionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateCompletionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'completion_config.name': request.completionConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateCompletionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateCompletionConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateCompletionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompletionConfig, - protos.google.cloud.retail.v2alpha.IUpdateCompletionConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateCompletionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets an {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.get_attributes_config.js - * region_tag:retail_v2alpha_generated_CatalogService_GetAttributesConfig_async - */ - getAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, {}|undefined - ]>; - getAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - getAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAttributesConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAttributesConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getAttributesConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IGetAttributesConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAttributesConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * The catalog attributes in the request will be updated in the catalog, or - * inserted if they do not exist. Existing catalog attributes not included in - * the request will remain unchanged. Attributes that are assigned to - * products, but do not exist at the catalog level, are always included in the - * response. The product attribute is assigned default values for missing - * catalog attribute fields, e.g., searchable and dynamic facetable options. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.AttributesConfig} request.attributesConfig - * Required. The - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} to update. - * The following is the only supported field: - * - * * {@link protos.google.cloud.retail.v2alpha.AttributesConfig.catalog_attributes|AttributesConfig.catalog_attributes} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.update_attributes_config.js - * region_tag:retail_v2alpha_generated_CatalogService_UpdateAttributesConfig_async - */ - updateAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, {}|undefined - ]>; - updateAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAttributesConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAttributesConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config.name': request.attributesConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAttributesConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAttributesConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateAttributesConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IUpdateAttributesConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAttributesConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Adds the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * add already exists, an ALREADY_EXISTS error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute - * Required. The - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to add. - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.add_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_AddCatalogAttribute_async - */ - addCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, {}|undefined - ]>; - addCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - addCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - addCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('addCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.addCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IAddCatalogAttributeRequest|undefined, - {}|undefined - ]) => { - this._log.info('addCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Removes the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} from the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * remove does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {string} request.key - * Required. The attribute name key of the - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to remove. - * @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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.remove_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_RemoveCatalogAttribute_async - */ - removeCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, {}|undefined - ]>; - removeCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - removeCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - removeCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('removeCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('removeCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.removeCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IRemoveCatalogAttributeRequest|undefined, - {}|undefined - ]) => { - this._log.info('removeCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Removes all specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}s from the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. The attributes config resource shared by all catalog attributes - * being deleted. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {string[]} request.attributeKeys - * Required. The attribute name keys of the - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}s to - * delete. A maximum of 1000 catalog attributes can be deleted in a batch. - * @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 {@link protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse|BatchRemoveCatalogAttributesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.batch_remove_catalog_attributes.js - * region_tag:retail_v2alpha_generated_CatalogService_BatchRemoveCatalogAttributes_async - */ - batchRemoveCatalogAttributes( - request?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, {}|undefined - ]>; - batchRemoveCatalogAttributes( - request: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): void; - batchRemoveCatalogAttributes( - request: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): void; - batchRemoveCatalogAttributes( - request?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchRemoveCatalogAttributes request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchRemoveCatalogAttributes response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.batchRemoveCatalogAttributes(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse, - protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesRequest|undefined, - {}|undefined - ]) => { - this._log.info('batchRemoveCatalogAttributes response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Replaces the specified - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} in the - * {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig} by - * updating the catalog attribute with the same - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key}. - * - * If the {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to - * replace does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.attributesConfig - * Required. Full AttributesConfig resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig` - * @param {google.cloud.retail.v2alpha.CatalogAttribute} request.catalogAttribute - * Required. The updated - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute}. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute|CatalogAttribute} to update. - * The following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.CatalogAttribute.key|CatalogAttribute.key} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AttributesConfig|AttributesConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/catalog_service.replace_catalog_attribute.js - * region_tag:retail_v2alpha_generated_CatalogService_ReplaceCatalogAttribute_async - */ - replaceCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, {}|undefined - ]>; - replaceCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - replaceCatalogAttribute( - request: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): void; - replaceCatalogAttribute( - request?: protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'attributes_config': request.attributesConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('replaceCatalogAttribute request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('replaceCatalogAttribute response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.replaceCatalogAttribute(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAttributesConfig, - protos.google.cloud.retail.v2alpha.IReplaceCatalogAttributeRequest|undefined, - {}|undefined - ]) => { - this._log.info('replaceCatalogAttribute response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all the {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s associated - * with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error 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 Array of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listCatalogsAsync()` - * 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. - */ - listCatalogs( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]>; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): void; - listCatalogs( - request: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): void; - listCatalogs( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.ICatalog>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listCatalogs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listCatalogs request %j', request); - return this.innerApiCalls - .listCatalogs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.ICatalog[], - protos.google.cloud.retail.v2alpha.IListCatalogsRequest|null, - protos.google.cloud.retail.v2alpha.IListCatalogsResponse - ]) => { - this._log.info('listCatalogs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listCatalogs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error 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 {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog} 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 `listCatalogsAsync()` - * 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. - */ - listCatalogsStream( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCatalogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCatalogs stream %j', request); - return this.descriptors.page.listCatalogs.createStream( - this.innerApiCalls.listCatalogs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listCatalogs`, 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. The account resource name with an associated location. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s under this location, - * regardless of whether or not this location exists, a PERMISSION_DENIED - * error is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}s to - * return. If unspecified, defaults to 50. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListCatalogsResponse.next_page_token|ListCatalogsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.CatalogService.ListCatalogs|CatalogService.ListCatalogs} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @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.cloud.retail.v2alpha.Catalog|Catalog}. 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 include:samples/generated/v2alpha/catalog_service.list_catalogs.js - * region_tag:retail_v2alpha_generated_CatalogService_ListCatalogs_async - */ - listCatalogsAsync( - request?: protos.google.cloud.retail.v2alpha.IListCatalogsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listCatalogs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listCatalogs iterate %j', request); - return this.descriptors.page.listCatalogs.asyncIterate( - this.innerApiCalls['listCatalogs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.catalogServiceStub && !this._terminated) { - return this.catalogServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client_config.json.baseline deleted file mode 100644 index 430dc2ec64ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_client_config.json.baseline +++ /dev/null @@ -1,95 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.CatalogService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListCatalogs": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateCatalog": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "SetDefaultBranch": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetDefaultBranch": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetCompletionConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateCompletionConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "GetAttributesConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "UpdateAttributesConfig": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "AddCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "RemoveCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "BatchRemoveCatalogAttributes": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "ReplaceCatalogAttribute": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/catalog_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client.ts.baseline deleted file mode 100644 index f7a11c51a79b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client.ts.baseline +++ /dev/null @@ -1,1317 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/completion_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './completion_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Autocomplete service for retail. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * @class - * @memberof v2alpha - */ -export class CompletionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - completionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CompletionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 CompletionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CompletionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const importCompletionDataResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportCompletionDataResponse') as gax.protobuf.Type; - const importCompletionDataMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - importCompletionData: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importCompletionDataResponse.decode.bind(importCompletionDataResponse), - importCompletionDataMetadata.decode.bind(importCompletionDataMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.CompletionService', gapicConfig as gax.ClientConfig, - 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.completionServiceStub) { - return this.completionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.CompletionService. - this.completionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.CompletionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.CompletionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const completionServiceStubMethods = - ['completeQuery', 'importCompletionData']; - for (const methodName of completionServiceStubMethods) { - const callPromise = this.completionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.completionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Completes the specified prefix with keyword suggestions. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Catalog for which the completion is performed. - * - * Full resource name of catalog, such as - * `projects/* /locations/global/catalogs/default_catalog`. - * @param {string} request.query - * Required. The query used to generate suggestions. - * - * The maximum number of allowed characters is 255. - * @param {string} request.visitorId - * Recommended field. A unique identifier for tracking visitors. For example, - * this could be implemented with an HTTP cookie, which should be able to - * uniquely identify a visitor on a single device. This unique identifier - * should not change if the visitor logs in or out of the website. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {string[]} request.languageCodes - * Note that this field applies for `user-data` dataset only. For requests - * with `cloud-retail` dataset, setting this field has no effect. - * - * The language filters applied to the output suggestions. If set, it should - * contain the language of the query. If not set, suggestions are returned - * without considering language restrictions. This is the BCP-47 language - * code, such as "en-US" or "sr-Latn". For more information, see [Tags for - * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum - * number of language codes is 3. - * @param {string} request.deviceType - * The device type context for completion suggestions. We recommend that you - * leave this field empty. - * - * It can apply different suggestions on different device types, e.g. - * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device - * types. - * - * Supported formats: - * - * * `UNKNOWN_DEVICE_TYPE` - * - * * `DESKTOP` - * - * * `MOBILE` - * - * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. - * @param {string} request.dataset - * Determines which dataset to use for fetching completion. "user-data" will - * use the dataset imported through - * {@link protos.google.cloud.retail.v2alpha.CompletionService.ImportCompletionData|CompletionService.ImportCompletionData}. - * `cloud-retail` will use the dataset generated by Cloud Retail based on user - * events. If left empty, completions will be fetched from the `user-data` - * dataset. - * - * Current supported values: - * - * * user-data - * - * * cloud-retail: - * This option requires enabling auto-learning function first. See - * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). - * @param {number} request.maxSuggestions - * Completion max suggestions. If left unset or set to 0, then will fallback - * to the configured value - * {@link protos.google.cloud.retail.v2alpha.CompletionConfig.max_suggestions|CompletionConfig.max_suggestions}. - * - * The maximum allowed max suggestions is 20. If it is set higher, it will be - * capped by 20. - * @param {boolean} request.enableAttributeSuggestions - * If true, attribute suggestions are enabled and provided in the response. - * - * This field is only available for the `cloud-retail` dataset. - * @param {string} request.entity - * The entity for customers who run multiple entities, domains, sites, or - * regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it must be an exact match with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * per-entity autocomplete results. This field will be applied to - * `completion_results` only. It has no effect on the `attribute_results`. - * Also, this entity should be limited to 256 characters, if too long, it will - * be truncated to 256 characters in both generation and serving time, and may - * lead to mis-match. To ensure it works, please set the entity with string - * within 256 characters. - * @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 {@link protos.google.cloud.retail.v2alpha.CompleteQueryResponse|CompleteQueryResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.complete_query.js - * region_tag:retail_v2alpha_generated_CompletionService_CompleteQuery_async - */ - completeQuery( - request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, {}|undefined - ]>; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): void; - completeQuery( - request: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): void; - completeQuery( - request?: protos.google.cloud.retail.v2alpha.ICompleteQueryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('completeQuery request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('completeQuery response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.completeQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ICompleteQueryResponse, - protos.google.cloud.retail.v2alpha.ICompleteQueryRequest|undefined, - {}|undefined - ]) => { - this._log.info('completeQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Bulk import of processed completion dataset. - * - * Request processing is asynchronous. Partial updating is not supported. - * - * The operation is successfully finished only after the imported suggestions - * are indexed successfully and ready for serving. The process takes hours. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog which the suggestions dataset belongs to. - * - * Format: `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.CompletionDataInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {string} request.notificationPubsubTopic - * Pub/Sub topic for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * {@link protos.google.longrunning.Operation|Operation}. - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js - * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async - */ - importCompletionData( - request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importCompletionData( - request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importCompletionData( - request: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importCompletionData( - request?: protos.google.cloud.retail.v2alpha.IImportCompletionDataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importCompletionData response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('importCompletionData request %j', request); - return this.innerApiCalls.importCompletionData(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importCompletionData response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importCompletionData()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/completion_service.import_completion_data.js - * region_tag:retail_v2alpha_generated_CompletionService_ImportCompletionData_async - */ - async checkImportCompletionDataProgress(name: string): Promise>{ - this._log.info('importCompletionData long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importCompletionData, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.completionServiceStub && !this._terminated) { - return this.completionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client_config.json.baseline deleted file mode 100644 index ac2795a5fb1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_client_config.json.baseline +++ /dev/null @@ -1,45 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.CompletionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CompleteQuery": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "ImportCompletionData": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/completion_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client.ts.baseline deleted file mode 100644 index 1c2779ad8eba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client.ts.baseline +++ /dev/null @@ -1,1619 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/control_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './control_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for modifying Control. - * @class - * @memberof v2alpha - */ -export class ControlServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - controlServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ControlServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ControlServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ControlServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listControls: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'controls') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ControlService', gapicConfig as gax.ClientConfig, - 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.controlServiceStub) { - return this.controlServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ControlService. - this.controlServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ControlService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ControlService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const controlServiceStubMethods = - ['createControl', 'deleteControl', 'updateControl', 'getControl', 'listControls']; - for (const methodName of controlServiceStubMethods) { - const callPromise = this.controlServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.controlServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a Control. - * - * If the {@link protos.google.cloud.retail.v2alpha.Control|Control} to create already - * exists, an ALREADY_EXISTS error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent catalog. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.Control} request.control - * Required. The Control to create. - * @param {string} request.controlId - * Required. The ID to use for the Control, which will become the final - * component of the Control's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-_/. - * @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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.create_control.js - * region_tag:retail_v2alpha_generated_ControlService_CreateControl_async - */ - createControl( - request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, {}|undefined - ]>; - createControl( - request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): void; - createControl( - request: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): void; - createControl( - request?: protos.google.cloud.retail.v2alpha.ICreateControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.ICreateControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('createControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a Control. - * - * If the {@link protos.google.cloud.retail.v2alpha.Control|Control} to delete does not - * exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Control to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.delete_control.js - * region_tag:retail_v2alpha_generated_ControlService_DeleteControl_async - */ - deleteControl( - request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, {}|undefined - ]>; - deleteControl( - request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): void; - deleteControl( - request: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): void; - deleteControl( - request?: protos.google.cloud.retail.v2alpha.IDeleteControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteControl request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a Control. - * - * {@link protos.google.cloud.retail.v2alpha.Control|Control} cannot be set to a different - * oneof field, if so an INVALID_ARGUMENT is returned. If the - * {@link protos.google.cloud.retail.v2alpha.Control|Control} to update does not exist, a - * NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Control} request.control - * Required. The Control to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Control|Control} to update. The following are - * NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.Control.name|Control.name} - * - * If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.update_control.js - * region_tag:retail_v2alpha_generated_ControlService_UpdateControl_async - */ - updateControl( - request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, {}|undefined - ]>; - updateControl( - request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): void; - updateControl( - request: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): void; - updateControl( - request?: protos.google.cloud.retail.v2alpha.IUpdateControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'control.name': request.control!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IUpdateControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a Control. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Control to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_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 {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/control_service.get_control.js - * region_tag:retail_v2alpha_generated_ControlService_GetControl_async - */ - getControl( - request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, {}|undefined - ]>; - getControl( - request: protos.google.cloud.retail.v2alpha.IGetControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): void; - getControl( - request: protos.google.cloud.retail.v2alpha.IGetControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): void; - getControl( - request?: protos.google.cloud.retail.v2alpha.IGetControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IControl, - protos.google.cloud.retail.v2alpha.IGetControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('getControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all Controls by their parent - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Control|Control}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listControlsAsync()` - * 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. - */ - listControls( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]>; - listControls( - request: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): void; - listControls( - request: protos.google.cloud.retail.v2alpha.IListControlsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): void; - listControls( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>): - Promise<[ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListControlsRequest, - protos.google.cloud.retail.v2alpha.IListControlsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IControl>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listControls values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listControls request %j', request); - return this.innerApiCalls - .listControls(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IControl[], - protos.google.cloud.retail.v2alpha.IListControlsRequest|null, - protos.google.cloud.retail.v2alpha.IListControlsResponse - ]) => { - this._log.info('listControls values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listControls`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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.cloud.retail.v2alpha.Control|Control} 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 `listControlsAsync()` - * 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. - */ - listControlsStream( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listControls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listControls stream %j', request); - return this.descriptors.page.listControls.createStream( - this.innerApiCalls.listControls as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listControls`, 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. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListControls` call. - * Provide this to retrieve the subsequent page. - * @param {string} [request.filter] - * Optional. A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListControlsRequest.filter|filter} is unset. - * * List controls that are used in a single ServingConfig: - * 'serving_config = "boosted_home_page_cvr"' - * @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.cloud.retail.v2alpha.Control|Control}. 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 include:samples/generated/v2alpha/control_service.list_controls.js - * region_tag:retail_v2alpha_generated_ControlService_ListControls_async - */ - listControlsAsync( - request?: protos.google.cloud.retail.v2alpha.IListControlsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listControls']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listControls iterate %j', request); - return this.descriptors.page.listControls.asyncIterate( - this.innerApiCalls['listControls'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.controlServiceStub && !this._terminated) { - return this.controlServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client_config.json.baseline deleted file mode 100644 index 9a86d786b232..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ControlService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListControls": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/control_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client.ts.baseline deleted file mode 100644 index 8f3f06d2f6c3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client.ts.baseline +++ /dev/null @@ -1,1090 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; -import {PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/conversational_search_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './conversational_search_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for retail conversational search. - * - * This feature is only available for users who have Retail Conversational - * Search enabled. Enable Retail Conversational Search on Cloud Console - * before using this feature. - * @class - * @memberof v2alpha - */ -export class ConversationalSearchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - conversationalSearchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ConversationalSearchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ConversationalSearchServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ConversationalSearchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - conversationalSearch: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ConversationalSearchService', gapicConfig as gax.ClientConfig, - 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.conversationalSearchServiceStub) { - return this.conversationalSearchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ConversationalSearchService. - this.conversationalSearchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ConversationalSearchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ConversationalSearchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const conversationalSearchServiceStubMethods = - ['conversationalSearch']; - for (const methodName of conversationalSearchServiceStubMethods) { - const callPromise = this.conversationalSearchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.stream[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.conversationalSearchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Performs a conversational search. - * - * This feature is only available for users who have Conversational Search - * enabled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the search engine placement, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search` - * or - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * This field is used to identify the serving config name and the set - * of models that will be used to make the search. - * @param {string} request.branch - * Required. The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} [request.query] - * Optional. Raw search query to be searched for. - * - * If this field is empty, the request is considered a category browsing - * request. - * @param {string[]} [request.pageCategories] - * Optional. The categories associated with a category page. Must be set for - * category navigation queries to achieve good search quality. The format - * should be the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {string} [request.conversationId] - * Optional. This field specifies the conversation id, which maintains the - * state of the conversation between client side and server side. Use the - * value from the previous - * {@link protos.google.cloud.retail.v2alpha.ConversationalSearchResponse.conversation_id|ConversationalSearchResponse.conversation_id}. - * For the initial request, this should be empty. - * @param {google.cloud.retail.v2alpha.ConversationalSearchRequest.SearchParams} [request.searchParams] - * Optional. Search parameters. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} [request.userInfo] - * Optional. User information. - * @param {google.cloud.retail.v2alpha.ConversationalSearchRequest.ConversationalFilteringSpec} [request.conversationalFilteringSpec] - * Optional. This field specifies all conversational filtering related - * parameters. - * @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 {@link protos.google.cloud.retail.v2alpha.ConversationalSearchResponse|ConversationalSearchResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/conversational_search_service.conversational_search.js - * region_tag:retail_v2alpha_generated_ConversationalSearchService_ConversationalSearch_async - */ - conversationalSearch( - request?: protos.google.cloud.retail.v2alpha.IConversationalSearchRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('conversationalSearch stream %j', options); - return this.innerApiCalls.conversationalSearch(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.conversationalSearchServiceStub && !this._terminated) { - return this.conversationalSearchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client_config.json.baseline deleted file mode 100644 index 02ce954afabc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ConversationalSearchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ConversationalSearch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/conversational_search_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client.ts.baseline deleted file mode 100644 index 90b5eaee4ce1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client.ts.baseline +++ /dev/null @@ -1,1471 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/generative_question_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './generative_question_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for managing LLM generated questions in search serving. - * @class - * @memberof v2alpha - */ -export class GenerativeQuestionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - generativeQuestionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of GenerativeQuestionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 GenerativeQuestionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof GenerativeQuestionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.GenerativeQuestionService', gapicConfig as gax.ClientConfig, - 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.generativeQuestionServiceStub) { - return this.generativeQuestionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.GenerativeQuestionService. - this.generativeQuestionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.GenerativeQuestionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.GenerativeQuestionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const generativeQuestionServiceStubMethods = - ['updateGenerativeQuestionsFeatureConfig', 'getGenerativeQuestionsFeatureConfig', 'listGenerativeQuestionConfigs', 'updateGenerativeQuestionConfig', 'batchUpdateGenerativeQuestionConfigs']; - for (const methodName of generativeQuestionServiceStubMethods) { - const callPromise = this.generativeQuestionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.generativeQuestionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Manages overal generative question feature state -- enables toggling - * feature on and off. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig} request.generativeQuestionsFeatureConfig - * Required. The configuration managing the feature state. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig} - * to update. If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.update_generative_questions_feature_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionsFeatureConfig_async - */ - updateGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>; - updateGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'generative_questions_feature_config.catalog': request.generativeQuestionsFeatureConfig!.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGenerativeQuestionsFeatureConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGenerativeQuestionsFeatureConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateGenerativeQuestionsFeatureConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionsFeatureConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateGenerativeQuestionsFeatureConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Manages overal generative question feature state -- enables toggling - * feature on and off. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.catalog - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig|GenerativeQuestionsFeatureConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.get_generative_questions_feature_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_GetGenerativeQuestionsFeatureConfig_async - */ - getGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>; - getGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - getGenerativeQuestionsFeatureConfig( - request: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): void; - getGenerativeQuestionsFeatureConfig( - request?: protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'catalog': request.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGenerativeQuestionsFeatureConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGenerativeQuestionsFeatureConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getGenerativeQuestionsFeatureConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig, - protos.google.cloud.retail.v2alpha.IGetGenerativeQuestionsFeatureConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGenerativeQuestionsFeatureConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns all questions for a given catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @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 {@link protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse|ListGenerativeQuestionConfigsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.list_generative_question_configs.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_ListGenerativeQuestionConfigs_async - */ - listGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>; - listGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - listGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - listGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listGenerativeQuestionConfigs request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listGenerativeQuestionConfigs response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listGenerativeQuestionConfigs(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listGenerativeQuestionConfigs response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Allows management of individual questions. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.GenerativeQuestionConfig} request.generativeQuestionConfig - * Required. The question to update. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig|GenerativeQuestionConfig} - * to update. The following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig.frequency|GenerativeQuestionConfig.frequency} - * - * If not set or empty, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig|GenerativeQuestionConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.update_generative_question_config.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_UpdateGenerativeQuestionConfig_async - */ - updateGenerativeQuestionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, {}|undefined - ]>; - updateGenerativeQuestionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): void; - updateGenerativeQuestionConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'generative_question_config.catalog': request.generativeQuestionConfig!.catalog ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateGenerativeQuestionConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateGenerativeQuestionConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateGenerativeQuestionConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig, - protos.google.cloud.retail.v2alpha.IUpdateGenerativeQuestionConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateGenerativeQuestionConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Allows management of multiple questions. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.parent] - * Optional. Resource name of the parent catalog. - * Format: projects/{project}/locations/{location}/catalogs/{catalog} - * @param {number[]} request.requests - * Required. The updates question configs. - * @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 {@link protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse|BatchUpdateGenerativeQuestionConfigsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/generative_question_service.batch_update_generative_question_configs.js - * region_tag:retail_v2alpha_generated_GenerativeQuestionService_BatchUpdateGenerativeQuestionConfigs_async - */ - batchUpdateGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>; - batchUpdateGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateGenerativeQuestionConfigs( - request: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): void; - batchUpdateGenerativeQuestionConfigs( - request?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('batchUpdateGenerativeQuestionConfigs request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('batchUpdateGenerativeQuestionConfigs response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.batchUpdateGenerativeQuestionConfigs(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse, - protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsRequest|undefined, - {}|undefined - ]) => { - this._log.info('batchUpdateGenerativeQuestionConfigs response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.generativeQuestionServiceStub && !this._terminated) { - return this.generativeQuestionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client_config.json.baseline deleted file mode 100644 index 7742daee3e52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.GenerativeQuestionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "UpdateGenerativeQuestionsFeatureConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGenerativeQuestionsFeatureConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGenerativeQuestionConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateGenerativeQuestionConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchUpdateGenerativeQuestionConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/generative_question_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/index.ts.baseline deleted file mode 100644 index 24776f3d0790..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -export {AnalyticsServiceClient} from './analytics_service_client'; -export {BranchServiceClient} from './branch_service_client'; -export {CatalogServiceClient} from './catalog_service_client'; -export {CompletionServiceClient} from './completion_service_client'; -export {ControlServiceClient} from './control_service_client'; -export {ConversationalSearchServiceClient} from './conversational_search_service_client'; -export {GenerativeQuestionServiceClient} from './generative_question_service_client'; -export {MerchantCenterAccountLinkServiceClient} from './merchant_center_account_link_service_client'; -export {ModelServiceClient} from './model_service_client'; -export {PredictionServiceClient} from './prediction_service_client'; -export {ProductServiceClient} from './product_service_client'; -export {ProjectServiceClient} from './project_service_client'; -export {SearchServiceClient} from './search_service_client'; -export {ServingConfigServiceClient} from './serving_config_service_client'; -export {UserEventServiceClient} from './user_event_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client.ts.baseline deleted file mode 100644 index be13d9272727..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client.ts.baseline +++ /dev/null @@ -1,1328 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/merchant_center_account_link_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './merchant_center_account_link_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Merchant Center Link service to link a Branch to a Merchant Center Account. - * @class - * @memberof v2alpha - */ -export class MerchantCenterAccountLinkServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - merchantCenterAccountLinkServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MerchantCenterAccountLinkServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 MerchantCenterAccountLinkServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MerchantCenterAccountLinkServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createMerchantCenterAccountLinkResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.MerchantCenterAccountLink') as gax.protobuf.Type; - const createMerchantCenterAccountLinkMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createMerchantCenterAccountLink: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createMerchantCenterAccountLinkResponse.decode.bind(createMerchantCenterAccountLinkResponse), - createMerchantCenterAccountLinkMetadata.decode.bind(createMerchantCenterAccountLinkMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.MerchantCenterAccountLinkService', gapicConfig as gax.ClientConfig, - 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.merchantCenterAccountLinkServiceStub) { - return this.merchantCenterAccountLinkServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.MerchantCenterAccountLinkService. - this.merchantCenterAccountLinkServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.MerchantCenterAccountLinkService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.MerchantCenterAccountLinkService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const merchantCenterAccountLinkServiceStubMethods = - ['listMerchantCenterAccountLinks', 'createMerchantCenterAccountLink', 'deleteMerchantCenterAccountLink']; - for (const methodName of merchantCenterAccountLinkServiceStubMethods) { - const callPromise = this.merchantCenterAccountLinkServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.merchantCenterAccountLinkServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Lists all - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}s - * under the specified parent {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent Catalog of the resource. - * It must match this format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_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 {@link protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse|ListMerchantCenterAccountLinksResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.list_merchant_center_account_links.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_ListMerchantCenterAccountLinks_async - */ - listMerchantCenterAccountLinks( - request?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, {}|undefined - ]>; - listMerchantCenterAccountLinks( - request: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): void; - listMerchantCenterAccountLinks( - request: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): void; - listMerchantCenterAccountLinks( - request?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listMerchantCenterAccountLinks request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listMerchantCenterAccountLinks response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listMerchantCenterAccountLinks(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse, - protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksRequest|undefined, - {}|undefined - ]) => { - this._log.info('listMerchantCenterAccountLinks response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}. - * If the - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink} - * to delete does not exist, a NOT_FOUND error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/merchantCenterAccountLinks/{merchant_center_account_link_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.delete_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_DeleteMerchantCenterAccountLink_async - */ - deleteMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, {}|undefined - ]>; - deleteMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): void; - deleteMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): void; - deleteMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteMerchantCenterAccountLink request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteMerchantCenterAccountLink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteMerchantCenterAccountLink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteMerchantCenterAccountLinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteMerchantCenterAccountLink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The branch resource where this MerchantCenterAccountLink will be - * created. Format: - * `projects/{PROJECT_NUMBER}/locations/global/catalogs/{CATALOG_ID}` - * @param {google.cloud.retail.v2alpha.MerchantCenterAccountLink} request.merchantCenterAccountLink - * Required. The - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink} - * to create. - * - * If the caller does not have permission to create the - * {@link protos.google.cloud.retail.v2alpha.MerchantCenterAccountLink|MerchantCenterAccountLink}, - * regardless of whether or not it exists, a PERMISSION_DENIED error 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async - */ - createMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMerchantCenterAccountLink( - request: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createMerchantCenterAccountLink( - request?: protos.google.cloud.retail.v2alpha.ICreateMerchantCenterAccountLinkRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createMerchantCenterAccountLink response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('createMerchantCenterAccountLink request %j', request); - return this.innerApiCalls.createMerchantCenterAccountLink(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createMerchantCenterAccountLink response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createMerchantCenterAccountLink()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/merchant_center_account_link_service.create_merchant_center_account_link.js - * region_tag:retail_v2alpha_generated_MerchantCenterAccountLinkService_CreateMerchantCenterAccountLink_async - */ - async checkCreateMerchantCenterAccountLinkProgress(name: string): Promise>{ - this._log.info('createMerchantCenterAccountLink long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createMerchantCenterAccountLink, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.merchantCenterAccountLinkServiceStub && !this._terminated) { - return this.merchantCenterAccountLinkServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline deleted file mode 100644 index 218d843e54f6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.MerchantCenterAccountLinkService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListMerchantCenterAccountLinks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateMerchantCenterAccountLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteMerchantCenterAccountLink": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/merchant_center_account_link_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client.ts.baseline deleted file mode 100644 index f0b115cd6681..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client.ts.baseline +++ /dev/null @@ -1,1951 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/model_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './model_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for performing CRUD operations on models. - * Recommendation models contain all the metadata necessary to generate a set of - * models for the `Predict()` API. A model is queried - * indirectly via a ServingConfig, which associates a model with a - * given Placement (e.g. Frequently Bought Together on Home Page). - * - * This service allows you to do the following: - * - * * Initiate training of a model. - * * Pause training of an existing model. - * * List all the available models along with their metadata. - * * Control their tuning schedule. - * @class - * @memberof v2alpha - */ -export class ModelServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - modelServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ModelServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ModelServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ModelServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listModels: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'models') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createModelResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.Model') as gax.protobuf.Type; - const createModelMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.CreateModelMetadata') as gax.protobuf.Type; - const tuneModelResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.TuneModelResponse') as gax.protobuf.Type; - const tuneModelMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.TuneModelMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createModelResponse.decode.bind(createModelResponse), - createModelMetadata.decode.bind(createModelMetadata)), - tuneModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - tuneModelResponse.decode.bind(tuneModelResponse), - tuneModelMetadata.decode.bind(tuneModelMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ModelService', gapicConfig as gax.ClientConfig, - 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.modelServiceStub) { - return this.modelServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ModelService. - this.modelServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ModelService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ModelService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const modelServiceStubMethods = - ['createModel', 'getModel', 'pauseModel', 'resumeModel', 'deleteModel', 'listModels', 'updateModel', 'tuneModel']; - for (const methodName of modelServiceStubMethods) { - const callPromise = this.modelServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.modelServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.retail.v2alpha.Model|Model} to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.get_model.js - * region_tag:retail_v2alpha_generated_ModelService_GetModel_async - */ - getModel( - request?: protos.google.cloud.retail.v2alpha.IGetModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, {}|undefined - ]>; - getModel( - request: protos.google.cloud.retail.v2alpha.IGetModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request: protos.google.cloud.retail.v2alpha.IGetModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): void; - getModel( - request?: protos.google.cloud.retail.v2alpha.IGetModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IGetModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('getModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Pauses the training of an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the model to pause. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.pause_model.js - * region_tag:retail_v2alpha_generated_ModelService_PauseModel_async - */ - pauseModel( - request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, {}|undefined - ]>; - pauseModel( - request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): void; - pauseModel( - request: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): void; - pauseModel( - request?: protos.google.cloud.retail.v2alpha.IPauseModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('pauseModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pauseModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.pauseModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IPauseModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('pauseModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Resumes the training of an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the model to resume. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.resume_model.js - * region_tag:retail_v2alpha_generated_ModelService_ResumeModel_async - */ - resumeModel( - request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, {}|undefined - ]>; - resumeModel( - request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): void; - resumeModel( - request: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): void; - resumeModel( - request?: protos.google.cloud.retail.v2alpha.IResumeModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('resumeModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resumeModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.resumeModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IResumeModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('resumeModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the - * {@link protos.google.cloud.retail.v2alpha.Model|Model} to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.delete_model.js - * region_tag:retail_v2alpha_generated_ModelService_DeleteModel_async - */ - deleteModel( - request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, {}|undefined - ]>; - deleteModel( - request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): void; - deleteModel( - request?: protos.google.cloud.retail.v2alpha.IDeleteModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteModel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update of model metadata. Only fields that - * currently can be updated are: `filtering_option` and - * `periodic_tuning_state`. - * If other values are provided, this API method ignores them. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Model} request.model - * Required. The body of the updated - * {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Indicates which fields in the provided 'model' to - * update. If not set, by default updates all 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 {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.update_model.js - * region_tag:retail_v2alpha_generated_ModelService_UpdateModel_async - */ - updateModel( - request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, {}|undefined - ]>; - updateModel( - request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): void; - updateModel( - request: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): void; - updateModel( - request?: protos.google.cloud.retail.v2alpha.IUpdateModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'model.name': request.model!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateModel request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateModel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateModel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IModel, - protos.google.cloud.retail.v2alpha.IUpdateModelRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateModel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Creates a new model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource under which to create the model. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.Model} request.model - * Required. The payload of the {@link protos.google.cloud.retail.v2alpha.Model|Model} to - * create. - * @param {boolean} [request.dryRun] - * Optional. Whether to run a dry run to validate the request (without - * actually creating the model). - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.create_model.js - * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async - */ - createModel( - request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createModel( - request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createModel( - request: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createModel( - request?: protos.google.cloud.retail.v2alpha.ICreateModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createModel response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('createModel request %j', request); - return this.innerApiCalls.createModel(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createModel response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.create_model.js - * region_tag:retail_v2alpha_generated_ModelService_CreateModel_async - */ - async checkCreateModelProgress(name: string): Promise>{ - this._log.info('createModel long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Tunes an existing model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the model to tune. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.tune_model.js - * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async - */ - tuneModel( - request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - tuneModel( - request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - tuneModel( - request: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - tuneModel( - request?: protos.google.cloud.retail.v2alpha.ITuneModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('tuneModel response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('tuneModel request %j', request); - return this.innerApiCalls.tuneModel(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('tuneModel response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `tuneModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/model_service.tune_model.js - * region_tag:retail_v2alpha_generated_ModelService_TuneModel_async - */ - async checkTuneModelProgress(name: string): Promise>{ - this._log.info('tuneModel long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.tuneModel, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all the models linked to this event store. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Model|Model}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listModelsAsync()` - * 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. - */ - listModels( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]>; - listModels( - request: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): void; - listModels( - request: protos.google.cloud.retail.v2alpha.IListModelsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): void; - listModels( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>): - Promise<[ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListModelsRequest, - protos.google.cloud.retail.v2alpha.IListModelsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IModel>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listModels values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listModels request %j', request); - return this.innerApiCalls - .listModels(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IModel[], - protos.google.cloud.retail.v2alpha.IListModelsRequest|null, - protos.google.cloud.retail.v2alpha.IListModelsResponse - ]) => { - this._log.info('listModels values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listModels`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.Model|Model} 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 `listModelsAsync()` - * 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. - */ - listModelsStream( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels stream %j', request); - return this.descriptors.page.listModels.createStream( - this.innerApiCalls.listModels as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listModels`, 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. The parent for which to list models. - * Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 50. Max allowed value is 1000. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListModels` - * call. Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.Model|Model}. 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 include:samples/generated/v2alpha/model_service.list_models.js - * region_tag:retail_v2alpha_generated_ModelService_ListModels_async - */ - listModelsAsync( - request?: protos.google.cloud.retail.v2alpha.IListModelsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listModels']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listModels iterate %j', request); - return this.descriptors.page.listModels.asyncIterate( - this.innerApiCalls['listModels'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.modelServiceStub && !this._terminated) { - return this.modelServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client_config.json.baseline deleted file mode 100644 index 7734305bc78c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ModelService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "GetModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "PauseModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ResumeModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "DeleteModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "ListModels": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "UpdateModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "TuneModel": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/model_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client.ts.baseline deleted file mode 100644 index 0d314b78eb15..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client.ts.baseline +++ /dev/null @@ -1,1202 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/prediction_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './prediction_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for making recommendation prediction. - * @class - * @memberof v2alpha - */ -export class PredictionServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - predictionServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of PredictionServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 PredictionServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof PredictionServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.PredictionService', gapicConfig as gax.ClientConfig, - 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.predictionServiceStub) { - return this.predictionServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.PredictionService. - this.predictionServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.PredictionService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.PredictionService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const predictionServiceStubMethods = - ['predict']; - for (const methodName of predictionServiceStubMethods) { - const callPromise = this.predictionServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.predictionServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Makes a recommendation prediction. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. Full resource name of the format: - * `{placement=projects/* /locations/global/catalogs/default_catalog/servingConfigs/*}` - * or - * `{placement=projects/* /locations/global/catalogs/default_catalog/placements/*}`. - * We recommend using the `servingConfigs` resource. `placements` is a legacy - * resource. - * The ID of the Recommendations AI serving config or placement. - * Before you can request predictions from your model, you must create at - * least one serving config or placement for it. For more information, see - * [Manage serving configs] - * (https://cloud.google.com/retail/docs/manage-configs). - * - * The full list of available serving configs can be seen at - * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs - * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent - * Required. Context about the user, what they are looking at and what action - * they took to trigger the predict request. Note that this user event detail - * won't be ingested to userEvent logs. Thus, a separate userEvent write - * request is required for event logging. - * - * Don't set - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} or - * {@link protos.google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} to the - * same fixed ID for different users. If you are trying to receive - * non-personalized recommendations (not recommended; this can negatively - * impact model performance), instead set - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id} to - * a random unique ID and leave - * {@link protos.google.cloud.retail.v2alpha.UserInfo.user_id|UserInfo.user_id} unset. - * @param {number} request.pageSize - * Maximum number of results to return. Set this property to the number of - * prediction results needed. If zero, the service will choose a reasonable - * default. The maximum allowed value is 100. Values above 100 will be coerced - * to 100. - * @param {string} request.pageToken - * This field is not used; leave it unset. - * @param {string} request.filter - * Filter for restricting prediction results with a length limit of 5,000 - * characters. Accepts values for tags and the `filterOutOfStockItems` flag. - * - * * Tag expressions. Restricts predictions to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses, and must be separated from the - * tag values by a space. `-"tagA"` is also supported and is equivalent to - * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings - * with a size limit of 1,000 characters. - * - * Note: "Recently viewed" models don't support tag filtering at the - * moment. - * - * * filterOutOfStockItems. Restricts predictions to products that do not - * have a - * stockState value of OUT_OF_STOCK. - * - * Examples: - * - * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") - * * filterOutOfStockItems tag=(-"promotional") - * * filterOutOfStockItems - * - * If your filter blocks all prediction results, the API will return *no* - * results. If instead you want empty result sets to return generic - * (unfiltered) popular products, set `strictFiltering` to False in - * `PredictRequest.params`. Note that the API will never return items with - * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. - * - * If `filterSyntaxV2` is set to true under the `params` field, then - * attribute-based expressions are expected instead of the above described - * tag-based syntax. Examples: - * - * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) - * * (availability: ANY("IN_STOCK")) AND - * (colors: ANY("Red") OR categories: ANY("Phones")) - * - * For more information, see - * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). - * @param {boolean} request.validateOnly - * Use validate only mode for this prediction query. If set to true, a - * dummy model will be used that returns arbitrary products. - * Note that the validate only mode should only be used for testing the API, - * or if the model is not ready. - * @param {number[]} request.params - * Additional domain specific parameters for the predictions. - * - * Allowed values: - * - * * `returnProduct`: Boolean. If set to true, the associated product - * object will be returned in the `results.metadata` field in the - * prediction response. - * * `returnScore`: Boolean. If set to true, the prediction 'score' - * corresponding to each returned product will be set in the - * `results.metadata` field in the prediction response. The given - * 'score' indicates the probability of a product being clicked/purchased - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular products instead of empty if - * your filter blocks all prediction results. - * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-price-reranking', 'low-price-reranking', - * 'medium-price-reranking', 'high-price-reranking'}. This gives - * request-level control and adjusts prediction results based on product - * price. - * * `diversityLevel`: String. Default empty. If set to be non-empty, then - * it needs to be one of {'no-diversity', 'low-diversity', - * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives - * request-level control and adjusts prediction results based on product - * category. - * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` - * field is interpreteted according to the new, attribute-based syntax. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * See [Google Cloud - * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * for more details. - * @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 {@link protos.google.cloud.retail.v2alpha.PredictResponse|PredictResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/prediction_service.predict.js - * region_tag:retail_v2alpha_generated_PredictionService_Predict_async - */ - predict( - request?: protos.google.cloud.retail.v2alpha.IPredictRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, {}|undefined - ]>; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): void; - predict( - request: protos.google.cloud.retail.v2alpha.IPredictRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): void; - predict( - request?: protos.google.cloud.retail.v2alpha.IPredictRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('predict request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('predict response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.predict(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IPredictResponse, - protos.google.cloud.retail.v2alpha.IPredictRequest|undefined, - {}|undefined - ]) => { - this._log.info('predict response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.predictionServiceStub && !this._terminated) { - return this.predictionServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client_config.json.baseline deleted file mode 100644 index ed48fe501013..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_client_config.json.baseline +++ /dev/null @@ -1,40 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.PredictionService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Predict": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/prediction_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client.ts.baseline deleted file mode 100644 index f18f971f405e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client.ts.baseline +++ /dev/null @@ -1,3371 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/product_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './product_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for ingesting {@link protos.google.cloud.retail.v2alpha.Product|Product} - * information of the customer's website. - * @class - * @memberof v2alpha - */ -export class ProductServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - productServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProductServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ProductServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProductServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listProducts: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'products') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const purgeProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeProductsResponse') as gax.protobuf.Type; - const purgeProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeProductsMetadata') as gax.protobuf.Type; - const importProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportProductsResponse') as gax.protobuf.Type; - const importProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - const exportProductsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportProductsResponse') as gax.protobuf.Type; - const exportProductsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - const setInventoryResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.SetInventoryResponse') as gax.protobuf.Type; - const setInventoryMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.SetInventoryMetadata') as gax.protobuf.Type; - const addFulfillmentPlacesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddFulfillmentPlacesResponse') as gax.protobuf.Type; - const addFulfillmentPlacesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddFulfillmentPlacesMetadata') as gax.protobuf.Type; - const removeFulfillmentPlacesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesResponse') as gax.protobuf.Type; - const removeFulfillmentPlacesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesMetadata') as gax.protobuf.Type; - const addLocalInventoriesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddLocalInventoriesResponse') as gax.protobuf.Type; - const addLocalInventoriesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.AddLocalInventoriesMetadata') as gax.protobuf.Type; - const removeLocalInventoriesResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveLocalInventoriesResponse') as gax.protobuf.Type; - const removeLocalInventoriesMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RemoveLocalInventoriesMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - purgeProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeProductsResponse.decode.bind(purgeProductsResponse), - purgeProductsMetadata.decode.bind(purgeProductsMetadata)), - importProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importProductsResponse.decode.bind(importProductsResponse), - importProductsMetadata.decode.bind(importProductsMetadata)), - exportProducts: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportProductsResponse.decode.bind(exportProductsResponse), - exportProductsMetadata.decode.bind(exportProductsMetadata)), - setInventory: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - setInventoryResponse.decode.bind(setInventoryResponse), - setInventoryMetadata.decode.bind(setInventoryMetadata)), - addFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - addFulfillmentPlacesResponse.decode.bind(addFulfillmentPlacesResponse), - addFulfillmentPlacesMetadata.decode.bind(addFulfillmentPlacesMetadata)), - removeFulfillmentPlaces: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - removeFulfillmentPlacesResponse.decode.bind(removeFulfillmentPlacesResponse), - removeFulfillmentPlacesMetadata.decode.bind(removeFulfillmentPlacesMetadata)), - addLocalInventories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - addLocalInventoriesResponse.decode.bind(addLocalInventoriesResponse), - addLocalInventoriesMetadata.decode.bind(addLocalInventoriesMetadata)), - removeLocalInventories: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - removeLocalInventoriesResponse.decode.bind(removeLocalInventoriesResponse), - removeLocalInventoriesMetadata.decode.bind(removeLocalInventoriesMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ProductService', gapicConfig as gax.ClientConfig, - 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.productServiceStub) { - return this.productServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ProductService. - this.productServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ProductService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ProductService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const productServiceStubMethods = - ['createProduct', 'getProduct', 'listProducts', 'updateProduct', 'deleteProduct', 'purgeProducts', 'importProducts', 'exportProducts', 'setInventory', 'addFulfillmentPlaces', 'removeFulfillmentPlaces', 'addLocalInventories', 'removeLocalInventories']; - for (const methodName of productServiceStubMethods) { - const callPromise = this.productServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.productServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch`. - * @param {google.cloud.retail.v2alpha.Product} request.product - * Required. The {@link protos.google.cloud.retail.v2alpha.Product|Product} to create. - * @param {string} request.productId - * Required. The ID to use for the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, which will become the final - * component of the {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name}. - * - * If the caller does not have permission to create the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * This field must be unique among all - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s with the same - * {@link protos.google.cloud.retail.v2alpha.CreateProductRequest.parent|parent}. - * Otherwise, an ALREADY_EXISTS error is returned. - * - * This field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error 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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.create_product.js - * region_tag:retail_v2alpha_generated_ProductService_CreateProduct_async - */ - createProduct( - request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, {}|undefined - ]>; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): void; - createProduct( - request: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): void; - createProduct( - request?: protos.google.cloud.retail.v2alpha.ICreateProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createProduct response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.ICreateProductRequest|undefined, - {}|undefined - ]) => { - this._log.info('createProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the requested {@link protos.google.cloud.retail.v2alpha.Product|Product} does not - * exist, a NOT_FOUND error 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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.get_product.js - * region_tag:retail_v2alpha_generated_ProductService_GetProduct_async - */ - getProduct( - request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, {}|undefined - ]>; - getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): void; - getProduct( - request: protos.google.cloud.retail.v2alpha.IGetProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): void; - getProduct( - request?: protos.google.cloud.retail.v2alpha.IGetProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProduct response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IGetProductRequest|undefined, - {}|undefined - ]) => { - this._log.info('getProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Product} request.product - * Required. The product to update/create. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update does not - * exist and - * {@link protos.google.cloud.retail.v2alpha.UpdateProductRequest.allow_missing|allow_missing} - * is not set, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to update. The immutable and - * output only fields are NOT supported. If not set, all supported fields (the - * fields that are neither immutable nor output only) are updated. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * - * The attribute key can be updated by setting the mask path as - * "attributes.${key_name}". If a key name is present in the mask but not in - * the patching product from the request, this key will be deleted after the - * update. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, a new {@link protos.google.cloud.retail.v2alpha.Product|Product} will be - * created. In this situation, `update_mask` is ignored. - * @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 {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.update_product.js - * region_tag:retail_v2alpha_generated_ProductService_UpdateProduct_async - */ - updateProduct( - request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, {}|undefined - ]>; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): void; - updateProduct( - request: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): void; - updateProduct( - request?: protos.google.cloud.retail.v2alpha.IUpdateProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product.name': request.product!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateProduct request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateProduct response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProduct, - protos.google.cloud.retail.v2alpha.IUpdateProductRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to delete the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to delete does not - * exist, a NOT_FOUND error is returned. - * - * The {@link protos.google.cloud.retail.v2alpha.Product|Product} to delete can neither be - * a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} member nor a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} with more than one - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variants}. Otherwise, an - * INVALID_ARGUMENT error is returned. - * - * All inventory information for the named - * {@link protos.google.cloud.retail.v2alpha.Product|Product} will be deleted. - * @param {boolean} request.force - * This value only applies to the case when the target product is of type - * PRIMARY. - * When deleting a product of VARIANT/COLLECTION type, this value - * will be ignored. - * When set to true, the subsequent variant products will be - * deleted. - * When set to false, if the primary product has active variant products, an - * error will be 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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.delete_product.js - * region_tag:retail_v2alpha_generated_ProductService_DeleteProduct_async - */ - deleteProduct( - request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, {}|undefined - ]>; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): void; - deleteProduct( - request: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): void; - deleteProduct( - request?: protos.google.cloud.retail.v2alpha.IDeleteProductRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteProduct request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteProduct response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteProduct(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteProductRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteProduct response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Permanently deletes all selected - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under a branch. - * - * This process is asynchronous. If the request is valid, the removal will be - * enqueued and processed offline. Depending on the number of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s, this operation could take - * hours to complete. Before the operation completes, some - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s may still be returned by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Depending on the number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s, - * this operation could take hours to complete. To get a sample of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s that would be deleted, set - * {@link protos.google.cloud.retail.v2alpha.PurgeProductsRequest.force|PurgeProductsRequest.force} - * to false. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the branch under which the products are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}` - * @param {string} request.filter - * Required. The filter string to specify the products to be deleted with a - * length limit of 5,000 characters. - * - * Empty string filter is not allowed. "*" implies delete all items in a - * branch. - * - * The eligible fields for filtering are: - * - * * `availability`: Double quoted - * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * string. - * * `create_time` : in ISO 8601 "zulu" format. - * - * Supported syntax: - * - * * Comparators (">", "<", ">=", "<=", "="). - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" - * * availability = "IN_STOCK" - * - * * Conjunctions ("AND") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER" - * - * * Disjunctions ("OR") - * Examples: - * * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK" - * - * * Can support nested queries. - * Examples: - * * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER") - * OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK") - * - * * Filter Limits: - * * Filter should not contain more than 6 conditions. - * * Max nesting depth should not exceed 2 levels. - * - * Examples queries: - * * Delete back order products created before a timestamp. - * create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER" - * @param {boolean} request.force - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any products. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.purge_products.js - * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async - */ - purgeProducts( - request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - purgeProducts( - request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeProducts( - request: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeProducts( - request?: protos.google.cloud.retail.v2alpha.IPurgeProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('purgeProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('purgeProducts request %j', request); - return this.innerApiCalls.purgeProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('purgeProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `purgeProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.purge_products.js - * region_tag:retail_v2alpha_generated_ProductService_PurgeProducts_async - */ - async checkPurgeProductsProgress(name: string): Promise>{ - this._log.info('purgeProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.purgeProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Bulk import of multiple {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * Request processing may be synchronous. - * Non-existing items are created. - * - * Note that it is possible for a subset of the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s to be successfully updated. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * - * If no updateMask is specified, requires products.create permission. - * If updateMask is specified, requires products.update permission. - * @param {string} request.requestId - * Deprecated. This field has no effect. - * @param {google.cloud.retail.v2alpha.ProductInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided imported `products` to update. If - * not set, all fields are updated. If provided, only the existing product - * fields are updated. Missing products will not be created. - * @param {google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode} request.reconciliationMode - * The mode of reconciliation between existing products and the products to be - * imported. Defaults to - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL|ReconciliationMode.INCREMENTAL}. - * @param {string} request.notificationPubsubTopic - * Full Pub/Sub topic name for receiving notification. If this field is set, - * when the import is finished, a notification is sent to - * specified Pub/Sub topic. The message data is JSON string of a - * {@link protos.google.longrunning.Operation|Operation}. - * - * Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has - * to be within the same project as - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.parent|ImportProductsRequest.parent}. - * Make sure that both - * `cloud-retail-customer-data-access@system.gserviceaccount.com` and - * `service-@gcp-sa-retail.iam.gserviceaccount.com` - * have the `pubsub.topics.publish` IAM permission on the topic. - * - * Only supported when - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. - * @param {boolean} request.skipDefaultBranchProtection - * If true, this performs the FULL import even if it would delete a large - * proportion of the products in the default branch, which could potentially - * cause outages if you have live predict/search traffic. - * - * Only supported when - * {@link protos.google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode|ImportProductsRequest.reconciliation_mode} - * is set to `FULL`. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.import_products.js - * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async - */ - importProducts( - request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importProducts( - request: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importProducts( - request?: protos.google.cloud.retail.v2alpha.IImportProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('importProducts request %j', request); - return this.innerApiCalls.importProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.import_products.js - * region_tag:retail_v2alpha_generated_ProductService_ImportProducts_async - */ - async checkImportProductsProgress(name: string): Promise>{ - this._log.info('importProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports multiple {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of a {@link protos.google.cloud.retail.v2alpha.Branch|Branch}, - * and `default_branch` for branch_id component is supported. For example - * `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned products. Use this expression to restrict results to a - * specific time range, tag, or stock state or to filter products by product - * type. - * For example, `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime<"2012-04-23T18:25:43.511Z" productType=primary` - * - * We expect only four types of fields: - * - * * `lastModifiedTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `lastModifiedTime` restriction should result in one, contiguous, - * valid, last-modified, time range. - * - * * `productType`: Supported values are `primary` and `variant`. The - * Boolean operators `OR` and `NOT` are supported if the expression is - * enclosed in parentheses and must be separated from the - * `productType` values by a space. - * - * * `availability`: Supported values are `IN_STOCK`, `OUT_OF_STOCK`, - * `PREORDER`, and `BACKORDER`. Boolean operators `OR` and `NOT` are - * supported if the expression is enclosed in parentheses and must be - * separated from the `availability` values by a space. - * - * * `Tag expressions`: Restricts output to products that match all of the - * specified tags. Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. Also supported is '`-"tagA"`', which - * is equivalent to '`NOT "tagA"`'. Tag values must be double-quoted, - * UTF-8 encoded strings and have a size limit of 1,000 characters. - * - * Some examples of valid filters expressions: - * - * * Example 1: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * lastModifiedTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `lastModifiedTime > "2012-04-23T18:25:43.511Z" - * productType = "variant"` - * * Example 3: `tag=("Red" OR "Blue") tag="New-Arrival" - * tag=(NOT "promotional") - * productType = "primary" lastModifiedTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `lastModifiedTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `availability = (IN_STOCK OR BACKORDER)` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.export_products.js - * region_tag:retail_v2alpha_generated_ProductService_ExportProducts_async - */ - exportProducts( - request?: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportProducts( - request: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportProducts( - request: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportProducts( - request?: protos.google.cloud.retail.v2alpha.IExportProductsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportProducts response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('exportProducts request %j', request); - return this.innerApiCalls.exportProducts(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportProducts response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportProducts()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.export_products.js - * region_tag:retail_v2alpha_generated_ProductService_ExportProducts_async - */ - async checkExportProductsProgress(name: string): Promise>{ - this._log.info('exportProducts long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportProducts, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} while respecting the last - * update timestamps of each inventory field. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update is enqueued - * and processed downstream. As a consequence, when a response is returned, - * updates are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * When inventory is updated with - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct}, - * the specified inventory field value(s) overwrite any existing value(s) - * while ignoring the last update time for this field. Furthermore, the last - * update times for the specified inventory fields are overwritten by the - * times of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * request. - * - * If no inventory fields are set in - * {@link protos.google.cloud.retail.v2alpha.CreateProductRequest.product|CreateProductRequest.product}, - * then any pre-existing inventory information for this product is used. - * - * If no inventory fields are set in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}, - * then any existing inventory information is preserved. - * - * Pre-existing inventory information can only be updated with - * {@link protos.google.cloud.retail.v2alpha.ProductService.SetInventory|ProductService.SetInventory}, - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces}, - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s is obsolete after - * one day, and the {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API returns `NOT_FOUND` afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates are not marked as {@link protos.google.longrunning.Operation.done|done} until - * they are obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.Product} request.inventory - * Required. The inventory information to update. The allowable fields to - * update are: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * * {@link protos.google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} - * * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} - * The updated inventory fields must be specified in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask}. - * - * If - * {@link protos.google.cloud.retail.v2alpha.Product.name|SetInventoryRequest.inventory.name} - * is empty or invalid, an INVALID_ARGUMENT error is returned. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} named in - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name}, regardless of - * whether or not it exists, a PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update does not - * have existing inventory information, the provided inventory information - * will be inserted. - * - * If the {@link protos.google.cloud.retail.v2alpha.Product|Product} to update has - * existing inventory information, the provided inventory information will be - * merged while respecting the last update time for each inventory field, - * using the provided or default value for - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_time|SetInventoryRequest.set_time}. - * - * The caller can replace place IDs for a subset of fulfillment types in the - * following ways: - * - * * Adds "fulfillment_info" in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} - * * Specifies only the desired fulfillment types and corresponding place IDs - * to update in - * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} - * - * The caller can clear all place IDs from a subset of fulfillment types in - * the following ways: - * - * * Adds "fulfillment_info" in - * {@link protos.google.cloud.retail.v2alpha.SetInventoryRequest.set_mask|SetInventoryRequest.set_mask} - * * Specifies only the desired fulfillment types to clear in - * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|SetInventoryRequest.inventory.fulfillment_info} - * * Checks that only the desired fulfillment info types have empty - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|SetInventoryRequest.inventory.fulfillment_info.place_ids} - * - * The last update time is recorded for the following inventory fields: - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.availability|Product.availability} - * * {@link protos.google.cloud.retail.v2alpha.Product.available_quantity|Product.available_quantity} - * * {@link protos.google.cloud.retail.v2alpha.Product.fulfillment_info|Product.fulfillment_info} - * - * If a full overwrite of inventory information while ignoring timestamps is - * needed, - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * should be invoked instead. - * @param {google.protobuf.FieldMask} request.setMask - * Indicates which inventory fields in the provided - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to update. - * - * At least one field must be provided. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - * @param {google.protobuf.Timestamp} request.setTime - * The time when the request is issued, used to prevent - * out-of-order updates on inventory fields with the last update time - * recorded. If not provided, the internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} with - * name {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is not found, - * the inventory update will still be processed and retained for at most 1 day - * until the {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set - * to false, a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.set_inventory.js - * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async - */ - setInventory( - request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setInventory( - request: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - setInventory( - request?: protos.google.cloud.retail.v2alpha.ISetInventoryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'inventory.name': request.inventory!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('setInventory response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('setInventory request %j', request); - return this.innerApiCalls.setInventory(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('setInventory response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `setInventory()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.set_inventory.js - * region_tag:retail_v2alpha_generated_ProductService_SetInventory_async - */ - async checkSetInventoryProgress(name: string): Promise>{ - this._log.info('setInventory long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.setInventory, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * We recommend that you use the - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddLocalInventories|ProductService.AddLocalInventories} - * method instead of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddFulfillmentPlaces|ProductService.AddFulfillmentPlaces} - * method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.AddLocalInventories|ProductService.AddLocalInventories} - * achieves the same results but provides more fine-grained control over - * ingesting local inventory data. - * - * Incrementally adds place IDs to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, the added place IDs are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string} request.type - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * - * Supported values: - * - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * - * This field directly corresponds to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. - * @param {string[]} request.placeIds - * Required. The IDs for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}, such - * as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery" to be added for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type}. - * Duplicate IDs will be automatically ignored. - * - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * - * If the total number of place IDs exceeds 2000 for this - * {@link protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest.type|type} after - * adding, then the update will be rejected. - * @param {google.protobuf.Timestamp} request.addTime - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async - */ - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IAddFulfillmentPlacesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('addFulfillmentPlaces response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('addFulfillmentPlaces request %j', request); - return this.innerApiCalls.addFulfillmentPlaces(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addFulfillmentPlaces response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `addFulfillmentPlaces()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_AddFulfillmentPlaces_async - */ - async checkAddFulfillmentPlacesProgress(name: string): Promise>{ - this._log.info('addFulfillmentPlaces long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * We recommend that you use the - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} - * method instead of the - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveFulfillmentPlaces|ProductService.RemoveFulfillmentPlaces} - * method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.RemoveLocalInventories|ProductService.RemoveLocalInventories} - * achieves the same results but provides more fine-grained control over - * ingesting local inventory data. - * - * Incrementally removes place IDs from a - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|Product.fulfillment_info.place_ids}. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * fulfillment information. If the request is valid, the update will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, the removed place IDs are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string} request.type - * Required. The fulfillment type, including commonly used types (such as - * pickup in store and same day delivery), and custom types. - * - * Supported values: - * - * * "pickup-in-store" - * * "ship-to-store" - * * "same-day-delivery" - * * "next-day-delivery" - * * "custom-type-1" - * * "custom-type-2" - * * "custom-type-3" - * * "custom-type-4" - * * "custom-type-5" - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * - * This field directly corresponds to - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|Product.fulfillment_info.type}. - * @param {string[]} request.placeIds - * Required. The IDs for this - * {@link protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}, - * such as the store IDs for "pickup-in-store" or the region IDs for - * "same-day-delivery", to be removed for this - * {@link protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest.type|type}. - * - * At least 1 value is required, and a maximum of 2000 values are allowed. - * Each value must be a string with a length limit of 10 characters, matching - * the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {google.protobuf.Timestamp} request.removeTime - * The time when the fulfillment updates are issued, used to prevent - * out-of-order updates on fulfillment information. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the fulfillment information will still be processed and retained - * for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async - */ - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeFulfillmentPlaces( - request: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeFulfillmentPlaces( - request?: protos.google.cloud.retail.v2alpha.IRemoveFulfillmentPlacesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('removeFulfillmentPlaces response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('removeFulfillmentPlaces request %j', request); - return this.innerApiCalls.removeFulfillmentPlaces(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeFulfillmentPlaces response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `removeFulfillmentPlaces()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_fulfillment_places.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveFulfillmentPlaces_async - */ - async checkRemoveFulfillmentPlacesProgress(name: string): Promise>{ - this._log.info('removeFulfillmentPlaces long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeFulfillmentPlaces, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates local inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} at a list of places, while - * respecting the last update timestamps of each inventory field. - * - * This process is asynchronous and does not require the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} to exist before updating - * inventory information. If the request is valid, the update will be enqueued - * and processed downstream. As a consequence, when a response is returned, - * updates are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Local inventory information can only be modified using this method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * has no effect on local inventories. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {number[]} request.localInventories - * Required. A list of inventory information at difference places. Each place - * is identified by its place ID. At most 3000 inventories are allowed per - * request. - * @param {google.protobuf.FieldMask} request.addMask - * Indicates which inventory fields in the provided list of - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory} to update. The - * field is updated to the provided value. - * - * If a field is set while the place does not have a previous local inventory, - * the local inventory at that store is created. - * - * If a field is set while the value of that field is not provided, the - * original field value, if it exists, is deleted. - * - * If the mask is not set or set with empty paths, all inventory fields will - * be updated. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned and the entire update will be ignored. - * @param {google.protobuf.Timestamp} request.addTime - * The time when the inventory updates are issued. Used to prevent - * out-of-order updates on local inventory fields. If not provided, the - * internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the local inventory will still be processed and retained for at - * most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async - */ - addLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addLocalInventories( - request: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - addLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IAddLocalInventoriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('addLocalInventories response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('addLocalInventories request %j', request); - return this.innerApiCalls.addLocalInventories(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('addLocalInventories response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `addLocalInventories()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.add_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_AddLocalInventories_async - */ - async checkAddLocalInventoriesProgress(name: string): Promise>{ - this._log.info('addLocalInventories long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.addLocalInventories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Remove local inventory information for a - * {@link protos.google.cloud.retail.v2alpha.Product|Product} at a list of places at a - * removal timestamp. - * - * This process is asynchronous. If the request is valid, the removal will be - * enqueued and processed downstream. As a consequence, when a response is - * returned, removals are not immediately manifested in the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} queried by - * {@link protos.google.cloud.retail.v2alpha.ProductService.GetProduct|ProductService.GetProduct} - * or - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts}. - * - * Local inventory information can only be removed using this method. - * {@link protos.google.cloud.retail.v2alpha.ProductService.CreateProduct|ProductService.CreateProduct} - * and - * {@link protos.google.cloud.retail.v2alpha.ProductService.UpdateProduct|ProductService.UpdateProduct} - * has no effect on local inventories. - * - * The returned {@link protos.google.longrunning.Operation|Operation}s will be obsolete - * after 1 day, and {@link protos.google.longrunning.Operations.GetOperation|GetOperation} - * API will return NOT_FOUND afterwards. - * - * If conflicting updates are issued, the - * {@link protos.google.longrunning.Operation|Operation}s associated with the stale - * updates will not be marked as {@link protos.google.longrunning.Operation.done|done} - * until being obsolete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.product - * Required. Full resource name of - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`. - * - * If the caller does not have permission to access the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}, regardless of whether or - * not it exists, a PERMISSION_DENIED error is returned. - * @param {string[]} request.placeIds - * Required. A list of place IDs to have their inventory deleted. - * At most 3000 place IDs are allowed per request. - * @param {google.protobuf.Timestamp} request.removeTime - * The time when the inventory deletions are issued. Used to prevent - * out-of-order updates and deletions on local inventory fields. If not - * provided, the internal system time will be used. - * @param {boolean} request.allowMissing - * If set to true, and the {@link protos.google.cloud.retail.v2alpha.Product|Product} is - * not found, the local inventory removal request will still be processed and - * retained for at most 1 day and processed once the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is created. If set to false, - * a NOT_FOUND error is returned if the - * {@link protos.google.cloud.retail.v2alpha.Product|Product} is not found. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async - */ - removeLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeLocalInventories( - request: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - removeLocalInventories( - request?: protos.google.cloud.retail.v2alpha.IRemoveLocalInventoriesRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'product': request.product ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('removeLocalInventories response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('removeLocalInventories request %j', request); - return this.innerApiCalls.removeLocalInventories(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('removeLocalInventories response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `removeLocalInventories()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/product_service.remove_local_inventories.js - * region_tag:retail_v2alpha_generated_ProductService_RemoveLocalInventories_async - */ - async checkRemoveLocalInventoriesProgress(name: string): Promise>{ - this._log.info('removeLocalInventories long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.removeLocalInventories, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Gets a list of {@link protos.google.cloud.retail.v2alpha.Product|Product}s. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listProductsAsync()` - * 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. - */ - listProducts( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]>; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): void; - listProducts( - request: protos.google.cloud.retail.v2alpha.IListProductsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): void; - listProducts( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListProductsRequest, - protos.google.cloud.retail.v2alpha.IListProductsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IProduct>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listProducts values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listProducts request %j', request); - return this.innerApiCalls - .listProducts(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IProduct[], - protos.google.cloud.retail.v2alpha.IListProductsRequest|null, - protos.google.cloud.retail.v2alpha.IListProductsResponse - ]) => { - this._log.info('listProducts values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listProducts`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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.cloud.retail.v2alpha.Product|Product} 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 `listProductsAsync()` - * 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. - */ - listProductsStream( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listProducts stream %j', request); - return this.descriptors.page.listProducts.createStream( - this.innerApiCalls.listProducts as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listProducts`, 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. The parent branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. Use - * `default_branch` as the branch ID, to list products under the default - * branch. - * - * If the caller does not have permission to list - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s under this branch, - * regardless of whether or not this branch exists, a PERMISSION_DENIED error - * is returned. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. - * - * If this field is negative, an INVALID_ARGUMENT error is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.next_page_token|ListProductsResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.ProductService.ListProducts|ProductService.ListProducts} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {string} request.filter - * A filter to apply on the list results. Supported features: - * - * * List all the products under the parent branch if - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.filter|filter} is unset. - * * List - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|Product.Type.VARIANT} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s sharing the same - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. For example: - * `primary_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s bundled in a - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}. - * For example: - * `collection_product_id = "some_product_id"` - * * List {@link protos.google.cloud.retail.v2alpha.Product|Product}s with a partibular - * type. For example: - * `type = "PRIMARY"` - * `type = "VARIANT"` - * `type = "COLLECTION"` - * - * If the field is unrecognizable, an INVALID_ARGUMENT error is returned. - * - * If the specified - * {@link protos.google.cloud.retail.v2alpha.Product.Type.PRIMARY|Product.Type.PRIMARY} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} or - * {@link protos.google.cloud.retail.v2alpha.Product.Type.COLLECTION|Product.Type.COLLECTION} - * {@link protos.google.cloud.retail.v2alpha.Product|Product} does not exist, a NOT_FOUND - * error is returned. - * @param {google.protobuf.FieldMask} request.readMask - * The fields of {@link protos.google.cloud.retail.v2alpha.Product|Product} to return in - * the responses. If not set or empty, the following fields are returned: - * - * * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} - * * {@link protos.google.cloud.retail.v2alpha.Product.id|Product.id} - * * {@link protos.google.cloud.retail.v2alpha.Product.title|Product.title} - * * {@link protos.google.cloud.retail.v2alpha.Product.uri|Product.uri} - * * {@link protos.google.cloud.retail.v2alpha.Product.images|Product.images} - * * {@link protos.google.cloud.retail.v2alpha.Product.price_info|Product.price_info} - * * {@link protos.google.cloud.retail.v2alpha.Product.brands|Product.brands} - * - * If "*" is provided, all fields are returned. - * {@link protos.google.cloud.retail.v2alpha.Product.name|Product.name} is always returned - * no matter what mask is set. - * - * If an unsupported or unknown field is provided, an INVALID_ARGUMENT error - * is returned. - * @param {boolean} request.requireTotalSize - * If true and - * {@link protos.google.cloud.retail.v2alpha.ListProductsRequest.page_token|page_token} is - * empty, - * {@link protos.google.cloud.retail.v2alpha.ListProductsResponse.total_size|ListProductsResponse.total_size} - * is set to the total count of matched items irrespective of pagination. - * - * Notice that setting this field to true affects the performance. - * @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.cloud.retail.v2alpha.Product|Product}. 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 include:samples/generated/v2alpha/product_service.list_products.js - * region_tag:retail_v2alpha_generated_ProductService_ListProducts_async - */ - listProductsAsync( - request?: protos.google.cloud.retail.v2alpha.IListProductsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listProducts']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listProducts iterate %j', request); - return this.descriptors.page.listProducts.asyncIterate( - this.innerApiCalls['listProducts'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.productServiceStub && !this._terminated) { - return this.productServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client_config.json.baseline deleted file mode 100644 index a50b8b0ae321..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_client_config.json.baseline +++ /dev/null @@ -1,109 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ProductService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "49abb7cadc111ff8dd551b61fcad123362c8d090": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 300000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ListProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "DeleteProduct": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "PurgeProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ImportProducts": { - "timeout_millis": 300000, - "retry_codes_name": "idempotent", - "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" - }, - "ExportProducts": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "SetInventory": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AddFulfillmentPlaces": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "RemoveFulfillmentPlaces": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AddLocalInventories": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "RemoveLocalInventories": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/product_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client.ts.baseline deleted file mode 100644 index f79335bc3e1b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client.ts.baseline +++ /dev/null @@ -1,1856 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/project_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './project_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for settings at Project level. - * @class - * @memberof v2alpha - */ -export class ProjectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - projectServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ProjectServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ProjectServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ProjectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const enrollSolutionResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.EnrollSolutionResponse') as gax.protobuf.Type; - const enrollSolutionMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.EnrollSolutionMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - enrollSolution: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - enrollSolutionResponse.decode.bind(enrollSolutionResponse), - enrollSolutionMetadata.decode.bind(enrollSolutionMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ProjectService', gapicConfig as gax.ClientConfig, - 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.projectServiceStub) { - return this.projectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ProjectService. - this.projectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ProjectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ProjectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const projectServiceStubMethods = - ['getProject', 'acceptTerms', 'enrollSolution', 'listEnrolledSolutions', 'getLoggingConfig', 'updateLoggingConfig', 'getAlertConfig', 'updateAlertConfig']; - for (const methodName of projectServiceStubMethods) { - const callPromise = this.projectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.projectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets the project. - * - * Throws `NOT_FOUND` if the project wasn't initialized for the Retail API - * service. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - * @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 {@link protos.google.cloud.retail.v2alpha.Project|Project}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_project.js - * region_tag:retail_v2alpha_generated_ProjectService_GetProject_async - */ - getProject( - request?: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, {}|undefined - ]>; - getProject( - request: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): void; - getProject( - request: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): void; - getProject( - request?: protos.google.cloud.retail.v2alpha.IGetProjectRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getProject request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getProject response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getProject(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IGetProjectRequest|undefined, - {}|undefined - ]) => { - this._log.info('getProject response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Accepts service terms for this project. - * By making requests to this API, you agree to the terms of service linked - * below. - * https://cloud.google.com/retail/data-use-terms - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. Full resource name of the project. Format: - * `projects/{project_number_or_id}/retailProject` - * @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 {@link protos.google.cloud.retail.v2alpha.Project|Project}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.accept_terms.js - * region_tag:retail_v2alpha_generated_ProjectService_AcceptTerms_async - */ - acceptTerms( - request?: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, {}|undefined - ]>; - acceptTerms( - request: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): void; - acceptTerms( - request: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): void; - acceptTerms( - request?: protos.google.cloud.retail.v2alpha.IAcceptTermsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('acceptTerms request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('acceptTerms response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.acceptTerms(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IProject, - protos.google.cloud.retail.v2alpha.IAcceptTermsRequest|undefined, - {}|undefined - ]) => { - this._log.info('acceptTerms response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Lists all the retail API solutions the project has enrolled. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_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 {@link protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse|ListEnrolledSolutionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.list_enrolled_solutions.js - * region_tag:retail_v2alpha_generated_ProjectService_ListEnrolledSolutions_async - */ - listEnrolledSolutions( - request?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, {}|undefined - ]>; - listEnrolledSolutions( - request: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): void; - listEnrolledSolutions( - request: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): void; - listEnrolledSolutions( - request?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('listEnrolledSolutions request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listEnrolledSolutions response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listEnrolledSolutions(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse, - protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsRequest|undefined, - {}|undefined - ]) => { - this._log.info('listEnrolledSolutions response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} of the - * requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full LoggingConfig resource name. Format: - * projects/{project_number}/loggingConfig - * @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 {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_logging_config.js - * region_tag:retail_v2alpha_generated_ProjectService_GetLoggingConfig_async - */ - getLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, {}|undefined - ]>; - getLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - getLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - getLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getLoggingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLoggingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getLoggingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IGetLoggingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getLoggingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} of - * the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.LoggingConfig} request.loggingConfig - * Required. The {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to - * update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to update - * does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig} to update. The - * following are the only supported fields: - * - * * {@link protos.google.cloud.retail.v2alpha.LoggingConfig.default_log_generation_rule|LoggingConfig.default_log_generation_rule} - * * {@link protos.google.cloud.retail.v2alpha.LoggingConfig.service_log_generation_rules|LoggingConfig.service_log_generation_rules} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.LoggingConfig|LoggingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.update_logging_config.js - * region_tag:retail_v2alpha_generated_ProjectService_UpdateLoggingConfig_async - */ - updateLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, {}|undefined - ]>; - updateLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateLoggingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateLoggingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'logging_config.name': request.loggingConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateLoggingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateLoggingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateLoggingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.ILoggingConfig, - protos.google.cloud.retail.v2alpha.IUpdateLoggingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateLoggingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Get the {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} of the - * requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Full AlertConfig resource name. Format: - * projects/{project_number}/alertConfig - * @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 {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.get_alert_config.js - * region_tag:retail_v2alpha_generated_ProjectService_GetAlertConfig_async - */ - getAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, {}|undefined - ]>; - getAlertConfig( - request: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - getAlertConfig( - request: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - getAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getAlertConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getAlertConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getAlertConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IGetAlertConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getAlertConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Update the alert config of the requested project. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.AlertConfig} request.alertConfig - * Required. The {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to - * update. - * - * If the caller does not have permission to update the - * {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}, then a - * PERMISSION_DENIED error is returned. - * - * If the {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to update - * does not exist, a NOT_FOUND error is returned. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig} to update. If not - * set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.AlertConfig|AlertConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.update_alert_config.js - * region_tag:retail_v2alpha_generated_ProjectService_UpdateAlertConfig_async - */ - updateAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, {}|undefined - ]>; - updateAlertConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAlertConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): void; - updateAlertConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'alert_config.name': request.alertConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateAlertConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateAlertConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateAlertConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IAlertConfig, - protos.google.cloud.retail.v2alpha.IUpdateAlertConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateAlertConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * The method enrolls a solution of type [Retail - * Search][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_SEARCH] - * into a project. - * - * The [Recommendations AI solution - * type][google.cloud.retail.v2alpha.SolutionType.SOLUTION_TYPE_RECOMMENDATION] - * is enrolled by default when your project enables Retail API, so you don't - * need to call the enrollSolution method for recommendations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Required. Full resource name of parent. Format: - * `projects/{project_number_or_id}` - * @param {google.cloud.retail.v2alpha.SolutionType} request.solution - * Required. Solution to enroll. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.enroll_solution.js - * region_tag:retail_v2alpha_generated_ProjectService_EnrollSolution_async - */ - enrollSolution( - request?: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - enrollSolution( - request: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enrollSolution( - request: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - enrollSolution( - request?: protos.google.cloud.retail.v2alpha.IEnrollSolutionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('enrollSolution response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('enrollSolution request %j', request); - return this.innerApiCalls.enrollSolution(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('enrollSolution response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `enrollSolution()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/project_service.enroll_solution.js - * region_tag:retail_v2alpha_generated_ProjectService_EnrollSolution_async - */ - async checkEnrollSolutionProgress(name: string): Promise>{ - this._log.info('enrollSolution long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.enrollSolution, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.projectServiceStub && !this._terminated) { - return this.projectServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client_config.json.baseline deleted file mode 100644 index 9360e98eed01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_client_config.json.baseline +++ /dev/null @@ -1,75 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ProjectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetProject": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "AcceptTerms": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "EnrollSolution": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ListEnrolledSolutions": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetLoggingConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateLoggingConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "GetAlertConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "UpdateAlertConfig": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/project_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client.ts.baseline deleted file mode 100644 index ac948b7514ba..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client.ts.baseline +++ /dev/null @@ -1,2135 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/search_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './search_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for search. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * @class - * @memberof v2alpha - */ -export class SearchServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - searchServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SearchServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 SearchServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SearchServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - experimentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/experiments/{experiment}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - search: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.SearchService', gapicConfig as gax.ClientConfig, - 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.searchServiceStub) { - return this.searchServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.SearchService. - this.searchServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.SearchService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.SearchService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const searchServiceStubMethods = - ['search']; - for (const methodName of searchServiceStubMethods) { - const callPromise = this.searchServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.searchServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Performs a search. - * - * This feature is only available for users who have Retail Search enabled. - * Enable Retail Search on Cloud Console before using this feature. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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 Array of {@link protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `searchAsync()` - * 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. - */ - search( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]>; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): void; - search( - request: protos.google.cloud.retail.v2alpha.ISearchRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): void; - search( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>): - Promise<[ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'placement': request.placement ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.ISearchRequest, - protos.google.cloud.retail.v2alpha.ISearchResponse|null|undefined, - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('search values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('search request %j', request); - return this.innerApiCalls - .search(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[], - protos.google.cloud.retail.v2alpha.ISearchRequest|null, - protos.google.cloud.retail.v2alpha.ISearchResponse - ]) => { - this._log.info('search values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `search`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult} 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 `searchAsync()` - * 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. - */ - searchStream( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - Transform{ - 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({ - 'placement': request.placement ?? '', - }); - const defaultCallSettings = this._defaults['search']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('search stream %j', request); - return this.descriptors.page.search.createStream( - this.innerApiCalls.search as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `search`, 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.placement - * Required. The resource name of the Retail Search serving config, such as - * `projects/* /locations/global/catalogs/default_catalog/servingConfigs/default_serving_config` - * or the name of the legacy placement resource, such as - * `projects/* /locations/global/catalogs/default_catalog/placements/default_search`. - * This field is used to identify the serving config name and the set - * of models that are used to make the search. - * @param {string} request.branch - * The branch resource name, such as - * `projects/* /locations/global/catalogs/default_catalog/branches/0`. - * - * Use "default_branch" as the branch ID or leave this field empty, to search - * products under the default branch. - * @param {string} request.query - * Raw search query. - * - * If this field is empty, the request is considered a category browsing - * request and returned results are based on - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|filter} and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_categories|page_categories}. - * @param {string} request.visitorId - * Required. A unique identifier for tracking visitors. For example, this - * could be implemented with an HTTP cookie, which should be able to uniquely - * identify a visitor on a single device. This unique identifier should not - * change if the visitor logs in or out of the website. - * - * This should be the same identifier as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.visitor_id|UserEvent.visitor_id}. - * - * The field must be a UTF-8 encoded string with a length limit of 128 - * characters. Otherwise, an INVALID_ARGUMENT error is returned. - * @param {google.cloud.retail.v2alpha.UserInfo} request.userInfo - * User information. - * @param {number} request.pageSize - * Maximum number of {@link protos.google.cloud.retail.v2alpha.Product|Product}s to - * return. If unspecified, defaults to a reasonable value. The maximum allowed - * value is 120. Values above 120 will be coerced to 120. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.pageToken - * A page token - * {@link protos.google.cloud.retail.v2alpha.SearchResponse.next_page_token|SearchResponse.next_page_token}, - * received from a previous - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * call. Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * {@link protos.google.cloud.retail.v2alpha.SearchService.Search|SearchService.Search} - * must match the call that provided the page token. Otherwise, an - * INVALID_ARGUMENT error is returned. - * @param {number} request.offset - * A 0-indexed integer that specifies the current offset (that is, starting - * result location, amongst the - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s deemed by the API as - * relevant) in search results. This field is only considered if - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.page_token|page_token} is - * unset. - * - * If this field is negative, an INVALID_ARGUMENT is returned. - * @param {string} request.filter - * The filter syntax consists of an expression language for constructing a - * predicate from one or more fields of the products being filtered. Filter - * expression is case-sensitive. For more information, see - * [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {string} request.canonicalFilter - * The default filter that is applied when a user performs a search without - * checking any filters on the search page. - * - * The filter applied to every search request when quality improvement such as - * query expansion is needed. In the case a query does not have a sufficient - * amount of results this filter will be used to determine whether or not to - * enable the query expansion flow. The original filter will still be used for - * the query expanded search. - * This field is strongly recommended to achieve high search quality. - * - * For more information about filter syntax, see - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.filter|SearchRequest.filter}. - * @param {string} request.orderBy - * The order in which products are returned. Products can be ordered by - * a field in an {@link protos.google.cloud.retail.v2alpha.Product|Product} object. Leave - * it unset if ordered by relevance. OrderBy expression is case-sensitive. For - * more information, see - * [Order](https://cloud.google.com/retail/docs/filter-and-order#order). - * - * If this field is unrecognizable, an INVALID_ARGUMENT is returned. - * @param {number[]} request.facetSpecs - * Facet specifications for faceted search. If empty, no facets are returned. - * - * A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error - * is returned. - * @param {google.cloud.retail.v2alpha.SearchRequest.DynamicFacetSpec} request.dynamicFacetSpec - * Deprecated. Refer to https://cloud.google.com/retail/docs/configs#dynamic - * to enable dynamic facets. Do not set this field. - * - * The specification for dynamically generated facets. Notice that only - * textual facets can be dynamically generated. - * @param {google.cloud.retail.v2alpha.SearchRequest.BoostSpec} request.boostSpec - * Boost specification to boost certain products. For more information, see - * [Boost results](https://cloud.google.com/retail/docs/boosting). - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.boost_control_ids|ServingConfig.boost_control_ids} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.boost_spec|SearchRequest.boost_spec} - * are set, the boost conditions from both places are evaluated. If a search - * request matches multiple boost conditions, the final boost score is equal - * to the sum of the boost scores from all matched boost conditions. - * @param {google.cloud.retail.v2alpha.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec - * The query expansion specification that specifies the conditions under which - * query expansion occurs. For more information, see [Query - * expansion](https://cloud.google.com/retail/docs/result-size#query_expansion). - * @param {google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold} request.relevanceThreshold - * The relevance threshold of the search results. - * - * Defaults to - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.RelevanceThreshold.HIGH|RelevanceThreshold.HIGH}, - * which means only the most relevant results are shown, and the least number - * of results are returned. For more information, see [Adjust result - * size](https://cloud.google.com/retail/docs/result-size#relevance_thresholding). - * @param {string[]} request.variantRollupKeys - * The keys to fetch and rollup the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s attributes, - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo} or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s attributes. - * The attributes from all the matching - * {@link protos.google.cloud.retail.v2alpha.Product.Type.VARIANT|variant} - * {@link protos.google.cloud.retail.v2alpha.Product|Product}s or - * {@link protos.google.cloud.retail.v2alpha.LocalInventory|LocalInventory}s are merged - * and de-duplicated. Notice that rollup attributes will lead to extra query - * latency. Maximum number of keys is 30. - * - * For {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo|FulfillmentInfo}, a - * fulfillment type and a fulfillment ID must be provided in the format of - * "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123", - * "pickupInStore" is fulfillment type and "store123" is the store ID. - * - * Supported keys are: - * - * * colorFamilies - * * price - * * originalPrice - * * discount - * * variantId - * * inventory(place_id,price) - * * inventory(place_id,original_price) - * * inventory(place_id,attributes.key), where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.attributes|Product.local_inventories.attributes} - * map. - * * attributes.key, where key is any key in the - * {@link protos.google.cloud.retail.v2alpha.Product.attributes|Product.attributes} map. - * * pickupInStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "pickup-in-store". - * * shipToStore.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "ship-to-store". - * * sameDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "same-day-delivery". - * * nextDayDelivery.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "next-day-delivery". - * * customFulfillment1.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-1". - * * customFulfillment2.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-2". - * * customFulfillment3.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-3". - * * customFulfillment4.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-4". - * * customFulfillment5.id, where id is any - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.place_ids|FulfillmentInfo.place_ids} - * for - * {@link protos.google.cloud.retail.v2alpha.FulfillmentInfo.type|FulfillmentInfo.type} - * "custom-type-5". - * - * If this field is set to an invalid value other than these, an - * INVALID_ARGUMENT error is returned. - * @param {string[]} request.pageCategories - * The categories associated with a category page. Must be set for category - * navigation queries to achieve good search quality. The format should be - * the same as - * {@link protos.google.cloud.retail.v2alpha.UserEvent.page_categories|UserEvent.page_categories}; - * - * To represent full path of category, use '>' sign to separate different - * hierarchies. If '>' is part of the category name, replace it with - * other character(s). - * - * Category pages include special pages such as sales or promotions. For - * instance, a special sale page may have the category hierarchy: - * "pageCategories" : ["Sales > 2017 Black Friday Deals"]. - * @param {google.cloud.retail.v2alpha.SearchRequest.SearchMode} request.searchMode - * The search mode of the search request. If not specified, a single search - * request triggers both product search and faceted search. - * @param {google.cloud.retail.v2alpha.SearchRequest.PersonalizationSpec} request.personalizationSpec - * The specification for personalization. - * - * Notice that if both - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec} - * and - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * are set. - * {@link protos.google.cloud.retail.v2alpha.SearchRequest.personalization_spec|SearchRequest.personalization_spec} - * will override - * {@link protos.google.cloud.retail.v2alpha.ServingConfig.personalization_spec|ServingConfig.personalization_spec}. - * @param {number[]} request.labels - * The labels applied to a resource must meet the following requirements: - * - * * Each resource can have multiple labels, up to a maximum of 64. - * * Each label must be a key-value pair. - * * Keys have a minimum length of 1 character and a maximum length of 63 - * characters and cannot be empty. Values can be empty and have a maximum - * length of 63 characters. - * * Keys and values can contain only lowercase letters, numeric characters, - * underscores, and dashes. All characters must use UTF-8 encoding, and - * international characters are allowed. - * * The key portion of a label must be unique. However, you can use the same - * key with multiple resources. - * * Keys must start with a lowercase letter or international character. - * - * For more information, see [Requirements for - * labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) - * in the Resource Manager documentation. - * @param {google.cloud.retail.v2alpha.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec - * The spell correction specification that specifies the mode under - * which spell correction will take effect. - * @param {string} request.entity - * The entity for customers that may run multiple different entities, domains, - * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, - * `google.com`, `youtube.com`, etc. - * If this is set, it should be exactly matched with - * {@link protos.google.cloud.retail.v2alpha.UserEvent.entity|UserEvent.entity} to get - * search results boosted by entity. - * @param {google.cloud.retail.v2alpha.SearchRequest.ConversationalSearchSpec} [request.conversationalSearchSpec] - * Optional. This field specifies all conversational related parameters - * addition to traditional retail search. - * @param {google.cloud.retail.v2alpha.SearchRequest.TileNavigationSpec} [request.tileNavigationSpec] - * Optional. This field specifies tile navigation related parameters. - * @param {string} [request.languageCode] - * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn" - * [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more - * information, see [Standardized codes](https://google.aip.dev/143). This - * field helps to better interpret the query. If a value isn't specified, the - * query language code is automatically detected, which may not be accurate. - * @param {string} [request.regionCode] - * Optional. The Unicode country/region code (CLDR) of a location, such as - * "US" and "419" - * [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html). - * For more information, see [Standardized codes](https://google.aip.dev/143). - * If set, then results will be boosted based on the region_code provided. - * @param {string} [request.placeId] - * Optional. An id corresponding to a place, such as a store id or region id. - * When specified, we use the price from the local inventory with the matching - * product's - * {@link protos.google.cloud.retail.v2alpha.LocalInventory.place_id|LocalInventory.place_id} - * for revenue optimization. - * @param {number[]} [request.userAttributes] - * Optional. The user attributes that could be used for personalization of - * search results. - * * Populate at most 100 key-value pairs per query. - * * Only supports string keys and repeated string values. - * * Duplcate keys are not allowed within a single query. - * - * Example: - * user_attributes: [ - * { key: "pets" - * value { - * values: "dog" - * values: "cat" - * } - * }, - * { key: "state" - * value { - * values: "CA" - * } - * } - * ] - * @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.cloud.retail.v2alpha.SearchResponse.SearchResult|SearchResult}. 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 include:samples/generated/v2alpha/search_service.search.js - * region_tag:retail_v2alpha_generated_SearchService_Search_async - */ - searchAsync( - request?: protos.google.cloud.retail.v2alpha.ISearchRequest, - options?: CallOptions): - AsyncIterable{ - 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({ - 'placement': request.placement ?? '', - }); - const defaultCallSettings = this._defaults['search']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('search iterate %j', request); - return this.descriptors.page.search.asyncIterate( - this.innerApiCalls['search'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified experiment resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} experiment - * @returns {string} Resource name string. - */ - experimentPath(project:string,location:string,catalog:string,experiment:string) { - return this.pathTemplates.experimentPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - experiment: experiment, - }); - } - - /** - * Parse the project from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).project; - } - - /** - * Parse the location from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the location. - */ - matchLocationFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).location; - } - - /** - * Parse the catalog from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).catalog; - } - - /** - * Parse the experiment from Experiment resource. - * - * @param {string} experimentName - * A fully-qualified path representing Experiment resource. - * @returns {string} A string representing the experiment. - */ - matchExperimentFromExperimentName(experimentName: string) { - return this.pathTemplates.experimentPathTemplate.match(experimentName).experiment; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.searchServiceStub && !this._terminated) { - return this.searchServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client_config.json.baseline deleted file mode 100644 index 71a5a478c8cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_client_config.json.baseline +++ /dev/null @@ -1,40 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.SearchService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Search": { - "timeout_millis": 5000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/search_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client.ts.baseline deleted file mode 100644 index e14660714811..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client.ts.baseline +++ /dev/null @@ -1,1803 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/serving_config_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './serving_config_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for modifying ServingConfig. - * @class - * @memberof v2alpha - */ -export class ServingConfigServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - servingConfigServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ServingConfigServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 ServingConfigServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ServingConfigServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - // 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 = { - listServingConfigs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'servingConfigs') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.ServingConfigService', gapicConfig as gax.ClientConfig, - 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.servingConfigServiceStub) { - return this.servingConfigServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.ServingConfigService. - this.servingConfigServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.ServingConfigService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.ServingConfigService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const servingConfigServiceStubMethods = - ['createServingConfig', 'deleteServingConfig', 'updateServingConfig', 'getServingConfig', 'listServingConfigs', 'addControl', 'removeControl']; - for (const methodName of servingConfigServiceStubMethods) { - const callPromise = this.servingConfigServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.servingConfigServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a ServingConfig. - * - * A maximum of 100 - * {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}s are allowed in - * a {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}, otherwise a - * FAILED_PRECONDITION error is returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Full resource name of parent. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig - * Required. The ServingConfig to create. - * @param {string} request.servingConfigId - * Required. The ID to use for the ServingConfig, which will become the final - * component of the ServingConfig's resource name. - * - * This value should be 4-63 characters, and valid characters - * are /{@link protos.0-9|a-z}-_/. - * @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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.create_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_CreateServingConfig_async - */ - createServingConfig( - request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, {}|undefined - ]>; - createServingConfig( - request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - createServingConfig( - request: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - createServingConfig( - request?: protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createServingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.ICreateServingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('createServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a ServingConfig. - * - * Returns a NotFound error if the ServingConfig does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ServingConfig to delete. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.delete_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_DeleteServingConfig_async - */ - deleteServingConfig( - request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, {}|undefined - ]>; - deleteServingConfig( - request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteServingConfig( - request: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): void; - deleteServingConfig( - request?: protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteServingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.retail.v2alpha.IDeleteServingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a ServingConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.retail.v2alpha.ServingConfig} request.servingConfig - * Required. The ServingConfig to update. - * @param {google.protobuf.FieldMask} request.updateMask - * Indicates which fields in the provided - * {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig} to update. The - * following are NOT supported: - * - * * {@link protos.google.cloud.retail.v2alpha.ServingConfig.name|ServingConfig.name} - * - * If not set, all supported fields are 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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.update_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_UpdateServingConfig_async - */ - updateServingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, {}|undefined - ]>; - updateServingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateServingConfig( - request: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): void; - updateServingConfig( - request?: protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config.name': request.servingConfig!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateServingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IUpdateServingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a ServingConfig. - * - * Returns a NotFound error if the ServingConfig does not exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the ServingConfig to get. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.get_serving_config.js - * region_tag:retail_v2alpha_generated_ServingConfigService_GetServingConfig_async - */ - getServingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, {}|undefined - ]>; - getServingConfig( - request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): void; - getServingConfig( - request: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): void; - getServingConfig( - request?: protos.google.cloud.retail.v2alpha.IGetServingConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getServingConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getServingConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getServingConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IGetServingConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getServingConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Enables a Control on the specified ServingConfig. - * The control is added in the last position of the list of controls - * it belongs to (e.g. if it's a facet spec control it will be applied - * in the last position of servingConfig.facetSpecIds) - * Returns a ALREADY_EXISTS error if the control has already been applied. - * Returns a FAILED_PRECONDITION error if the addition could exceed maximum - * number of control allowed for that type of control. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.servingConfig - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - * @param {string} request.controlId - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config - if id is not found a NOT_FOUND error 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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.add_control.js - * region_tag:retail_v2alpha_generated_ServingConfigService_AddControl_async - */ - addControl( - request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, {}|undefined - ]>; - addControl( - request: protos.google.cloud.retail.v2alpha.IAddControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): void; - addControl( - request: protos.google.cloud.retail.v2alpha.IAddControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): void; - addControl( - request?: protos.google.cloud.retail.v2alpha.IAddControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config': request.servingConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('addControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.addControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IAddControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('addControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Disables a Control on the specified ServingConfig. - * The control is removed from the ServingConfig. - * Returns a NOT_FOUND error if the Control is not enabled for the - * ServingConfig. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.servingConfig - * Required. The source ServingConfig resource name . Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` - * @param {string} request.controlId - * Required. The id of the control to apply. Assumed to be in the same catalog - * as the serving config. - * @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 {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/serving_config_service.remove_control.js - * region_tag:retail_v2alpha_generated_ServingConfigService_RemoveControl_async - */ - removeControl( - request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, {}|undefined - ]>; - removeControl( - request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): void; - removeControl( - request: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): void; - removeControl( - request?: protos.google.cloud.retail.v2alpha.IRemoveControlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'serving_config': request.servingConfig ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('removeControl request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('removeControl response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.removeControl(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IServingConfig, - protos.google.cloud.retail.v2alpha.IRemoveControlRequest|undefined, - {}|undefined - ]) => { - this._log.info('removeControl response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all ServingConfigs linked to this catalog. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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 Array of {@link protos.google.cloud.retail.v2alpha.ServingConfig|ServingConfig}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listServingConfigsAsync()` - * 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. - */ - listServingConfigs( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]>; - listServingConfigs( - request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): void; - listServingConfigs( - request: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - callback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): void; - listServingConfigs( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>, - callback?: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>): - Promise<[ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse|null|undefined, - protos.google.cloud.retail.v2alpha.IServingConfig>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listServingConfigs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listServingConfigs request %j', request); - return this.innerApiCalls - .listServingConfigs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.retail.v2alpha.IServingConfig[], - protos.google.cloud.retail.v2alpha.IListServingConfigsRequest|null, - protos.google.cloud.retail.v2alpha.IListServingConfigsResponse - ]) => { - this._log.info('listServingConfigs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listServingConfigs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.ServingConfig|ServingConfig} 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 `listServingConfigsAsync()` - * 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. - */ - listServingConfigsStream( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServingConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServingConfigs stream %j', request); - return this.descriptors.page.listServingConfigs.createStream( - this.innerApiCalls.listServingConfigs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listServingConfigs`, 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. The catalog resource name. Format: - * `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` - * @param {number} [request.pageSize] - * Optional. Maximum number of results to return. If unspecified, defaults - * to 100. If a value greater than 100 is provided, at most 100 results are - * returned. - * @param {string} [request.pageToken] - * Optional. A page token, received from a previous `ListServingConfigs` call. - * Provide this to retrieve the subsequent page. - * @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.cloud.retail.v2alpha.ServingConfig|ServingConfig}. 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 include:samples/generated/v2alpha/serving_config_service.list_serving_configs.js - * region_tag:retail_v2alpha_generated_ServingConfigService_ListServingConfigs_async - */ - listServingConfigsAsync( - request?: protos.google.cloud.retail.v2alpha.IListServingConfigsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listServingConfigs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listServingConfigs iterate %j', request); - return this.descriptors.page.listServingConfigs.asyncIterate( - this.innerApiCalls['listServingConfigs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.servingConfigServiceStub && !this._terminated) { - return this.servingConfigServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client_config.json.baseline deleted file mode 100644 index 6489c5db6ef6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_client_config.json.baseline +++ /dev/null @@ -1,54 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.ServingConfigService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetServingConfig": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServingConfigs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RemoveControl": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/serving_config_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client.ts.baseline deleted file mode 100644 index c1af7bda9466..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client.ts.baseline +++ /dev/null @@ -1,1789 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2alpha/user_event_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './user_event_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for ingesting end user actions on the customer website. - * @class - * @memberof v2alpha - */ -export class UserEventServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('retail'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - userEventServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of UserEventServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 UserEventServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof UserEventServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'retail.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - alertConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/alertConfig' - ), - attributesConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/attributesConfig' - ), - branchPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}' - ), - catalogPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}' - ), - completionConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/completionConfig' - ), - controlPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/controls/{control}' - ), - loggingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/loggingConfig' - ), - merchantCenterAccountLinkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/merchantCenterAccountLinks/{merchant_center_account_link}' - ), - modelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/models/{model}' - ), - productPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/branches/{branch}/products/{product}' - ), - retailProjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/retailProject' - ), - servingConfigPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/catalogs/{catalog}/servingConfigs/{serving_config}' - ), - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.longrunning.Operations.GetOperation',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/operations/*}',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/branches/*/places/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/catalogs/*/operations/*}',},{get: '/v2alpha/{name=projects/*/locations/*/operations/*}',},{get: '/v2alpha/{name=projects/*/operations/*}',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v2alpha/{name=projects/*/locations/*/catalogs/*}/operations',additional_bindings: [{get: '/v2alpha/{name=projects/*/locations/*}/operations',},{get: '/v2alpha/{name=projects/*}/operations',}], - }]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const purgeUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeUserEventsResponse') as gax.protobuf.Type; - const purgeUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.PurgeMetadata') as gax.protobuf.Type; - const importUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportUserEventsResponse') as gax.protobuf.Type; - const importUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ImportMetadata') as gax.protobuf.Type; - const exportUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportUserEventsResponse') as gax.protobuf.Type; - const exportUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.ExportMetadata') as gax.protobuf.Type; - const rejoinUserEventsResponse = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RejoinUserEventsResponse') as gax.protobuf.Type; - const rejoinUserEventsMetadata = protoFilesRoot.lookup( - '.google.cloud.retail.v2alpha.RejoinUserEventsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - purgeUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - purgeUserEventsResponse.decode.bind(purgeUserEventsResponse), - purgeUserEventsMetadata.decode.bind(purgeUserEventsMetadata)), - importUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - importUserEventsResponse.decode.bind(importUserEventsResponse), - importUserEventsMetadata.decode.bind(importUserEventsMetadata)), - exportUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportUserEventsResponse.decode.bind(exportUserEventsResponse), - exportUserEventsMetadata.decode.bind(exportUserEventsMetadata)), - rejoinUserEvents: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - rejoinUserEventsResponse.decode.bind(rejoinUserEventsResponse), - rejoinUserEventsMetadata.decode.bind(rejoinUserEventsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.retail.v2alpha.UserEventService', gapicConfig as gax.ClientConfig, - 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.userEventServiceStub) { - return this.userEventServiceStub; - } - - // Put together the "service stub" for - // google.cloud.retail.v2alpha.UserEventService. - this.userEventServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.retail.v2alpha.UserEventService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.retail.v2alpha.UserEventService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const userEventServiceStubMethods = - ['writeUserEvent', 'collectUserEvent', 'purgeUserEvents', 'importUserEvents', 'exportUserEvents', 'rejoinUserEvents']; - for (const methodName of userEventServiceStubMethods) { - const callPromise = this.userEventServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.userEventServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'retail.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Writes a single user event. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.UserEvent} request.userEvent - * Required. User event to write. - * @param {boolean} request.writeAsync - * If set to true, the user event will be written asynchronously after - * validation, and the API will respond without waiting for the write. - * Therefore, silent failures can occur even if the API returns success. In - * case of silent failures, error messages can be found in Stackdriver logs. - * @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 {@link protos.google.cloud.retail.v2alpha.UserEvent|UserEvent}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.write_user_event.js - * region_tag:retail_v2alpha_generated_UserEventService_WriteUserEvent_async - */ - writeUserEvent( - request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, {}|undefined - ]>; - writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): void; - writeUserEvent( - request: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - callback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): void; - writeUserEvent( - request?: protos.google.cloud.retail.v2alpha.IWriteUserEventRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('writeUserEvent request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('writeUserEvent response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.writeUserEvent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.retail.v2alpha.IUserEvent, - protos.google.cloud.retail.v2alpha.IWriteUserEventRequest|undefined, - {}|undefined - ]) => { - this._log.info('writeUserEvent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Writes a single user event from the browser. - * - * For larger user event payload over 16 KB, the POST method should be used - * instead, otherwise a 400 Bad Request error is returned. - * - * This method is used only by the Retail API JavaScript pixel and Google Tag - * Manager. Users should not call this method directly. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.prebuiltRule - * The prebuilt rule name that can convert a specific type of raw_json. - * For example: "ga4_bq" rule for the GA4 user event schema. - * @param {string} request.parent - * Required. The parent catalog name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {string} request.userEvent - * Required. URL encoded UserEvent proto with a length limit of 2,000,000 - * characters. - * @param {string} request.uri - * The URL including cgi-parameters but excluding the hash fragment with a - * length limit of 5,000 characters. This is often more useful than the - * referer URL, because many browsers only send the domain for 3rd party - * requests. - * @param {number} request.ets - * The event timestamp in milliseconds. This prevents browser caching of - * otherwise identical get requests. The name is abbreviated to reduce the - * payload bytes. - * @param {string} request.rawJson - * An arbitrary serialized JSON string that contains necessary information - * that can comprise a user event. When this field is specified, the - * user_event field will be ignored. Note: line-delimited JSON is not - * supported, a single JSON only. - * @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 {@link protos.google.api.HttpBody|HttpBody}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.collect_user_event.js - * region_tag:retail_v2alpha_generated_UserEventService_CollectUserEvent_async - */ - collectUserEvent( - request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options?: CallOptions): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, {}|undefined - ]>; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - options: CallOptions, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): void; - collectUserEvent( - request: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - callback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): void; - collectUserEvent( - request?: protos.google.cloud.retail.v2alpha.ICollectUserEventRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('collectUserEvent request %j', request); - const wrappedCallback: Callback< - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('collectUserEvent response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.collectUserEvent(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.api.IHttpBody, - protos.google.cloud.retail.v2alpha.ICollectUserEventRequest|undefined, - {}|undefined - ]) => { - this._log.info('collectUserEvent response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Deletes permanently all user events specified by the filter provided. - * Depending on the number of events specified by the filter, this operation - * could take hours or days to complete. To test a filter, use the list - * command first. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the catalog under which the events are - * created. The format is - * `projects/${projectId}/locations/global/catalogs/${catalogId}` - * @param {string} request.filter - * Required. The filter string to specify the events to be deleted with a - * length limit of 5,000 characters. Empty string filter is not allowed. The - * eligible fields for filtering are: - * - * * `eventType`: Double quoted - * {@link protos.google.cloud.retail.v2alpha.UserEvent.event_type|UserEvent.event_type} - * string. - * * `eventTime`: in ISO 8601 "zulu" format. - * * `visitorId`: Double quoted string. Specifying this will delete all - * events associated with a visitor. - * * `userId`: Double quoted string. Specifying this will delete all events - * associated with a user. - * - * Examples: - * - * * Deleting all events in a time range: - * `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Deleting specific eventType in time range: - * `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"` - * * Deleting all events for a specific visitor: - * `visitorId = "visitor1024"` - * - * The filtering fields are assumed to have an implicit AND. - * @param {boolean} request.force - * Actually perform the purge. - * If `force` is set to false, the method will return the expected purge count - * without deleting any user events. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async - */ - purgeUserEvents( - request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeUserEvents( - request: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - purgeUserEvents( - request?: protos.google.cloud.retail.v2alpha.IPurgeUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('purgeUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('purgeUserEvents request %j', request); - return this.innerApiCalls.purgeUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('purgeUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `purgeUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.purge_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_PurgeUserEvents_async - */ - async checkPurgeUserEventsProgress(name: string): Promise>{ - this._log.info('purgeUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.purgeUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Bulk import of User events. Request processing might be - * synchronous. Events that already exist are skipped. - * Use this method for backfilling historical user events. - * - * `Operation.response` is of type `ImportResponse`. Note that it is - * possible for a subset of the items to be successfully inserted. - * `Operation.metadata` is of type `ImportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2alpha.UserEventInputConfig} request.inputConfig - * Required. The desired input location of the data. - * @param {google.cloud.retail.v2alpha.ImportErrorsConfig} request.errorsConfig - * The desired location of errors incurred during the Import. Cannot be set - * for inline user event imports. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async - */ - importUserEvents( - request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importUserEvents( - request: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - importUserEvents( - request?: protos.google.cloud.retail.v2alpha.IImportUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('importUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('importUserEvents request %j', request); - return this.innerApiCalls.importUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('importUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `importUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.import_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ImportUserEvents_async - */ - async checkImportUserEventsProgress(name: string): Promise>{ - this._log.info('importUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Exports user events. - * - * `Operation.response` is of type `ExportResponse`. - * `Operation.metadata` is of type `ExportMetadata`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Resource name of a - * {@link protos.google.cloud.retail.v2alpha.Catalog|Catalog}. For example - * `projects/1234/locations/global/catalogs/default_catalog` - * @param {google.cloud.retail.v2alpha.OutputConfig} request.outputConfig - * Required. The output location of the data. - * @param {string} request.filter - * A filtering expression to specify restrictions on returned events. - * The expression is a sequence of terms. Each term applies a restriction to - * the returned user events. Use this expression to restrict results to a - * specific time range or to filter events by eventType. - * For example, `eventTime > "2012-04-23T18:25:43.511Z" - * eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z" - * eventType=search` - * - * We expect only three types of fields: - * - * * `eventTime`: This can be specified twice, once with a - * less than operator and once with a greater than operator. The - * `eventTime` restriction should result in one, contiguous, valid, - * `eventTime` range. - * - * * `eventType`: Boolean operators `OR` and `NOT` are supported if the - * expression is enclosed in parentheses and the operators are separated - * from the tag values by a space. - * - * * `eventsMissingCatalogItems`: This restricts results - * to events for which catalog items were not found in the catalog. The - * default behavior is to return only those events for which catalog - * items were found. - * - * Some examples of valid filters expressions: - * - * * Example 1: `eventTime > "2012-04-23T18:25:43.511Z" - * eventTime < "2012-04-23T18:30:43.511Z"` - * * Example 2: `eventTime > "2012-04-23T18:25:43.511Z" - * eventType = detail-page-view` - * * Example 3: `eventsMissingCatalogItems - * eventType = (NOT search) eventTime < - * "2018-04-23T18:30:43.511Z"` - * * Example 4: `eventTime > "2012-04-23T18:25:43.511Z"` - * * Example 5: `eventType = (detail-page-view OR search)` - * * Example 6: `eventsMissingCatalogItems` - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.export_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ExportUserEvents_async - */ - exportUserEvents( - request?: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportUserEvents( - request: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportUserEvents( - request: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportUserEvents( - request?: protos.google.cloud.retail.v2alpha.IExportUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('exportUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('exportUserEvents request %j', request); - return this.innerApiCalls.exportUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('exportUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `exportUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.export_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_ExportUserEvents_async - */ - async checkExportUserEventsProgress(name: string): Promise>{ - this._log.info('exportUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.exportUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Starts a user-event rejoin operation with latest product catalog. Events - * are not annotated with detailed product information for products that are - * missing from the catalog when the user event is ingested. These - * events are stored as unjoined events with limited usage on training and - * serving. You can use this method to start a join operation on specified - * events with the latest version of product catalog. You can also use this - * method to correct events joined with the wrong product catalog. A rejoin - * operation can take hours or days to complete. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent catalog resource name, such as - * `projects/1234/locations/global/catalogs/default_catalog`. - * @param {google.cloud.retail.v2alpha.RejoinUserEventsRequest.UserEventRejoinScope} request.userEventRejoinScope - * The type of the user event rejoin to define the scope and range of the user - * events to be rejoined with the latest product catalog. Defaults to - * `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to - * an invalid integer value. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async - */ - rejoinUserEvents( - request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rejoinUserEvents( - request: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - rejoinUserEvents( - request?: protos.google.cloud.retail.v2alpha.IRejoinUserEventsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('rejoinUserEvents response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('rejoinUserEvents request %j', request); - return this.innerApiCalls.rejoinUserEvents(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('rejoinUserEvents response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `rejoinUserEvents()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v2alpha/user_event_service.rejoin_user_events.js - * region_tag:retail_v2alpha_generated_UserEventService_RejoinUserEvents_async - */ - async checkRejoinUserEventsProgress(name: string): Promise>{ - this._log.info('rejoinUserEvents long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.rejoinUserEvents, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified alertConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - alertConfigPath(project:string) { - return this.pathTemplates.alertConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from AlertConfig resource. - * - * @param {string} alertConfigName - * A fully-qualified path representing AlertConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAlertConfigName(alertConfigName: string) { - return this.pathTemplates.alertConfigPathTemplate.match(alertConfigName).project; - } - - /** - * Return a fully-qualified attributesConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - attributesConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.attributesConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).project; - } - - /** - * Parse the location from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).location; - } - - /** - * Parse the catalog from AttributesConfig resource. - * - * @param {string} attributesConfigName - * A fully-qualified path representing AttributesConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromAttributesConfigName(attributesConfigName: string) { - return this.pathTemplates.attributesConfigPathTemplate.match(attributesConfigName).catalog; - } - - /** - * Return a fully-qualified branch resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @returns {string} Resource name string. - */ - branchPath(project:string,location:string,catalog:string,branch:string) { - return this.pathTemplates.branchPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - }); - } - - /** - * Parse the project from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).project; - } - - /** - * Parse the location from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).location; - } - - /** - * Parse the catalog from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).catalog; - } - - /** - * Parse the branch from Branch resource. - * - * @param {string} branchName - * A fully-qualified path representing Branch resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromBranchName(branchName: string) { - return this.pathTemplates.branchPathTemplate.match(branchName).branch; - } - - /** - * Return a fully-qualified catalog resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - catalogPath(project:string,location:string,catalog:string) { - return this.pathTemplates.catalogPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).project; - } - - /** - * Parse the location from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).location; - } - - /** - * Parse the catalog from Catalog resource. - * - * @param {string} catalogName - * A fully-qualified path representing Catalog resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCatalogName(catalogName: string) { - return this.pathTemplates.catalogPathTemplate.match(catalogName).catalog; - } - - /** - * Return a fully-qualified completionConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @returns {string} Resource name string. - */ - completionConfigPath(project:string,location:string,catalog:string) { - return this.pathTemplates.completionConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - }); - } - - /** - * Parse the project from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).project; - } - - /** - * Parse the location from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).location; - } - - /** - * Parse the catalog from CompletionConfig resource. - * - * @param {string} completionConfigName - * A fully-qualified path representing CompletionConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromCompletionConfigName(completionConfigName: string) { - return this.pathTemplates.completionConfigPathTemplate.match(completionConfigName).catalog; - } - - /** - * Return a fully-qualified control resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} control - * @returns {string} Resource name string. - */ - controlPath(project:string,location:string,catalog:string,control:string) { - return this.pathTemplates.controlPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - control: control, - }); - } - - /** - * Parse the project from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the project. - */ - matchProjectFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).project; - } - - /** - * Parse the location from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the location. - */ - matchLocationFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).location; - } - - /** - * Parse the catalog from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).catalog; - } - - /** - * Parse the control from Control resource. - * - * @param {string} controlName - * A fully-qualified path representing Control resource. - * @returns {string} A string representing the control. - */ - matchControlFromControlName(controlName: string) { - return this.pathTemplates.controlPathTemplate.match(controlName).control; - } - - /** - * Return a fully-qualified loggingConfig resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - loggingConfigPath(project:string) { - return this.pathTemplates.loggingConfigPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from LoggingConfig resource. - * - * @param {string} loggingConfigName - * A fully-qualified path representing LoggingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLoggingConfigName(loggingConfigName: string) { - return this.pathTemplates.loggingConfigPathTemplate.match(loggingConfigName).project; - } - - /** - * Return a fully-qualified merchantCenterAccountLink resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} merchant_center_account_link - * @returns {string} Resource name string. - */ - merchantCenterAccountLinkPath(project:string,location:string,catalog:string,merchantCenterAccountLink:string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - merchant_center_account_link: merchantCenterAccountLink, - }); - } - - /** - * Parse the project from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the project. - */ - matchProjectFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).project; - } - - /** - * Parse the location from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the location. - */ - matchLocationFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).location; - } - - /** - * Parse the catalog from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).catalog; - } - - /** - * Parse the merchant_center_account_link from MerchantCenterAccountLink resource. - * - * @param {string} merchantCenterAccountLinkName - * A fully-qualified path representing MerchantCenterAccountLink resource. - * @returns {string} A string representing the merchant_center_account_link. - */ - matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(merchantCenterAccountLinkName: string) { - return this.pathTemplates.merchantCenterAccountLinkPathTemplate.match(merchantCenterAccountLinkName).merchant_center_account_link; - } - - /** - * Return a fully-qualified model resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} model - * @returns {string} Resource name string. - */ - modelPath(project:string,location:string,catalog:string,model:string) { - return this.pathTemplates.modelPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - model: model, - }); - } - - /** - * Parse the project from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the project. - */ - matchProjectFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).project; - } - - /** - * Parse the location from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the location. - */ - matchLocationFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).location; - } - - /** - * Parse the catalog from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).catalog; - } - - /** - * Parse the model from Model resource. - * - * @param {string} modelName - * A fully-qualified path representing Model resource. - * @returns {string} A string representing the model. - */ - matchModelFromModelName(modelName: string) { - return this.pathTemplates.modelPathTemplate.match(modelName).model; - } - - /** - * Return a fully-qualified product resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} branch - * @param {string} product - * @returns {string} Resource name string. - */ - productPath(project:string,location:string,catalog:string,branch:string,product:string) { - return this.pathTemplates.productPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - branch: branch, - product: product, - }); - } - - /** - * Parse the project from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).project; - } - - /** - * Parse the location from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the location. - */ - matchLocationFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).location; - } - - /** - * Parse the catalog from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).catalog; - } - - /** - * Parse the branch from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the branch. - */ - matchBranchFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).branch; - } - - /** - * Parse the product from Product resource. - * - * @param {string} productName - * A fully-qualified path representing Product resource. - * @returns {string} A string representing the product. - */ - matchProductFromProductName(productName: string) { - return this.pathTemplates.productPathTemplate.match(productName).product; - } - - /** - * Return a fully-qualified retailProject resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - retailProjectPath(project:string) { - return this.pathTemplates.retailProjectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from RetailProject resource. - * - * @param {string} retailProjectName - * A fully-qualified path representing RetailProject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRetailProjectName(retailProjectName: string) { - return this.pathTemplates.retailProjectPathTemplate.match(retailProjectName).project; - } - - /** - * Return a fully-qualified servingConfig resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} catalog - * @param {string} serving_config - * @returns {string} Resource name string. - */ - servingConfigPath(project:string,location:string,catalog:string,servingConfig:string) { - return this.pathTemplates.servingConfigPathTemplate.render({ - project: project, - location: location, - catalog: catalog, - serving_config: servingConfig, - }); - } - - /** - * Parse the project from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the project. - */ - matchProjectFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).project; - } - - /** - * Parse the location from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the location. - */ - matchLocationFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).location; - } - - /** - * Parse the catalog from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the catalog. - */ - matchCatalogFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).catalog; - } - - /** - * Parse the serving_config from ServingConfig resource. - * - * @param {string} servingConfigName - * A fully-qualified path representing ServingConfig resource. - * @returns {string} A string representing the serving_config. - */ - matchServingConfigFromServingConfigName(servingConfigName: string) { - return this.pathTemplates.servingConfigPathTemplate.match(servingConfigName).serving_config; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.userEventServiceStub && !this._terminated) { - return this.userEventServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client_config.json.baseline deleted file mode 100644 index 65e9ec7d6f6e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_client_config.json.baseline +++ /dev/null @@ -1,83 +0,0 @@ -{ - "interfaces": { - "google.cloud.retail.v2alpha.UserEventService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "319f27672a8be83550d842a373549dd84649a57e": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 5000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "71ca22c74d2828b200f9ff1cc285a8beb96cc2af": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 30000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "49abb7cadc111ff8dd551b61fcad123362c8d090": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 300000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "WriteUserEvent": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "CollectUserEvent": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "PurgeUserEvents": { - "timeout_millis": 30000, - "retry_codes_name": "idempotent", - "retry_params_name": "71ca22c74d2828b200f9ff1cc285a8beb96cc2af" - }, - "ImportUserEvents": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "49abb7cadc111ff8dd551b61fcad123362c8d090" - }, - "ExportUserEvents": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - }, - "RejoinUserEvents": { - "timeout_millis": 10000, - "retry_codes_name": "idempotent", - "retry_params_name": "319f27672a8be83550d842a373549dd84649a57e" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_proto_list.json.baseline deleted file mode 100644 index c6592a30e0bb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/src/v2alpha/user_event_service_proto_list.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -[ - "../../protos/google/cloud/retail/v2alpha/analytics_service.proto", - "../../protos/google/cloud/retail/v2alpha/branch.proto", - "../../protos/google/cloud/retail/v2alpha/branch_service.proto", - "../../protos/google/cloud/retail/v2alpha/catalog.proto", - "../../protos/google/cloud/retail/v2alpha/catalog_service.proto", - "../../protos/google/cloud/retail/v2alpha/common.proto", - "../../protos/google/cloud/retail/v2alpha/completion_service.proto", - "../../protos/google/cloud/retail/v2alpha/control.proto", - "../../protos/google/cloud/retail/v2alpha/control_service.proto", - "../../protos/google/cloud/retail/v2alpha/conversational_search_service.proto", - "../../protos/google/cloud/retail/v2alpha/export_config.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question.proto", - "../../protos/google/cloud/retail/v2alpha/generative_question_service.proto", - "../../protos/google/cloud/retail/v2alpha/import_config.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link.proto", - "../../protos/google/cloud/retail/v2alpha/merchant_center_account_link_service.proto", - "../../protos/google/cloud/retail/v2alpha/model.proto", - "../../protos/google/cloud/retail/v2alpha/model_service.proto", - "../../protos/google/cloud/retail/v2alpha/prediction_service.proto", - "../../protos/google/cloud/retail/v2alpha/product.proto", - "../../protos/google/cloud/retail/v2alpha/product_service.proto", - "../../protos/google/cloud/retail/v2alpha/project.proto", - "../../protos/google/cloud/retail/v2alpha/project_service.proto", - "../../protos/google/cloud/retail/v2alpha/promotion.proto", - "../../protos/google/cloud/retail/v2alpha/purge_config.proto", - "../../protos/google/cloud/retail/v2alpha/search_service.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config.proto", - "../../protos/google/cloud/retail/v2alpha/serving_config_service.proto", - "../../protos/google/cloud/retail/v2alpha/user_event.proto", - "../../protos/google/cloud/retail/v2alpha/user_event_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index ddd81b9f0d86..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const retail = require('retail'); - -function main() { - const analyticsServiceClient = new retail.AnalyticsServiceClient(); - const branchServiceClient = new retail.BranchServiceClient(); - const catalogServiceClient = new retail.CatalogServiceClient(); - const completionServiceClient = new retail.CompletionServiceClient(); - const controlServiceClient = new retail.ControlServiceClient(); - const conversationalSearchServiceClient = new retail.ConversationalSearchServiceClient(); - const generativeQuestionServiceClient = new retail.GenerativeQuestionServiceClient(); - const merchantCenterAccountLinkServiceClient = new retail.MerchantCenterAccountLinkServiceClient(); - const modelServiceClient = new retail.ModelServiceClient(); - const predictionServiceClient = new retail.PredictionServiceClient(); - const productServiceClient = new retail.ProductServiceClient(); - const projectServiceClient = new retail.ProjectServiceClient(); - const searchServiceClient = new retail.SearchServiceClient(); - const servingConfigServiceClient = new retail.ServingConfigServiceClient(); - const userEventServiceClient = new retail.UserEventServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 060b8503bc11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2026 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. ** - -import {AnalyticsServiceClient, BranchServiceClient, CatalogServiceClient, CompletionServiceClient, ControlServiceClient, ConversationalSearchServiceClient, GenerativeQuestionServiceClient, MerchantCenterAccountLinkServiceClient, ModelServiceClient, PredictionServiceClient, ProductServiceClient, ProjectServiceClient, SearchServiceClient, ServingConfigServiceClient, UserEventServiceClient} from 'retail'; - -// check that the client class type name can be used -function doStuffWithAnalyticsServiceClient(client: AnalyticsServiceClient) { - client.close(); -} -function doStuffWithBranchServiceClient(client: BranchServiceClient) { - client.close(); -} -function doStuffWithCatalogServiceClient(client: CatalogServiceClient) { - client.close(); -} -function doStuffWithCompletionServiceClient(client: CompletionServiceClient) { - client.close(); -} -function doStuffWithControlServiceClient(client: ControlServiceClient) { - client.close(); -} -function doStuffWithConversationalSearchServiceClient(client: ConversationalSearchServiceClient) { - client.close(); -} -function doStuffWithGenerativeQuestionServiceClient(client: GenerativeQuestionServiceClient) { - client.close(); -} -function doStuffWithMerchantCenterAccountLinkServiceClient(client: MerchantCenterAccountLinkServiceClient) { - client.close(); -} -function doStuffWithModelServiceClient(client: ModelServiceClient) { - client.close(); -} -function doStuffWithPredictionServiceClient(client: PredictionServiceClient) { - client.close(); -} -function doStuffWithProductServiceClient(client: ProductServiceClient) { - client.close(); -} -function doStuffWithProjectServiceClient(client: ProjectServiceClient) { - client.close(); -} -function doStuffWithSearchServiceClient(client: SearchServiceClient) { - client.close(); -} -function doStuffWithServingConfigServiceClient(client: ServingConfigServiceClient) { - client.close(); -} -function doStuffWithUserEventServiceClient(client: UserEventServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const analyticsServiceClient = new AnalyticsServiceClient(); - doStuffWithAnalyticsServiceClient(analyticsServiceClient); - // check that the client instance can be created - const branchServiceClient = new BranchServiceClient(); - doStuffWithBranchServiceClient(branchServiceClient); - // check that the client instance can be created - const catalogServiceClient = new CatalogServiceClient(); - doStuffWithCatalogServiceClient(catalogServiceClient); - // check that the client instance can be created - const completionServiceClient = new CompletionServiceClient(); - doStuffWithCompletionServiceClient(completionServiceClient); - // check that the client instance can be created - const controlServiceClient = new ControlServiceClient(); - doStuffWithControlServiceClient(controlServiceClient); - // check that the client instance can be created - const conversationalSearchServiceClient = new ConversationalSearchServiceClient(); - doStuffWithConversationalSearchServiceClient(conversationalSearchServiceClient); - // check that the client instance can be created - const generativeQuestionServiceClient = new GenerativeQuestionServiceClient(); - doStuffWithGenerativeQuestionServiceClient(generativeQuestionServiceClient); - // check that the client instance can be created - const merchantCenterAccountLinkServiceClient = new MerchantCenterAccountLinkServiceClient(); - doStuffWithMerchantCenterAccountLinkServiceClient(merchantCenterAccountLinkServiceClient); - // check that the client instance can be created - const modelServiceClient = new ModelServiceClient(); - doStuffWithModelServiceClient(modelServiceClient); - // check that the client instance can be created - const predictionServiceClient = new PredictionServiceClient(); - doStuffWithPredictionServiceClient(predictionServiceClient); - // check that the client instance can be created - const productServiceClient = new ProductServiceClient(); - doStuffWithProductServiceClient(productServiceClient); - // check that the client instance can be created - const projectServiceClient = new ProjectServiceClient(); - doStuffWithProjectServiceClient(projectServiceClient); - // check that the client instance can be created - const searchServiceClient = new SearchServiceClient(); - doStuffWithSearchServiceClient(searchServiceClient); - // check that the client instance can be created - const servingConfigServiceClient = new ServingConfigServiceClient(); - doStuffWithServingConfigServiceClient(servingConfigServiceClient); - // check that the client instance can be created - const userEventServiceClient = new UserEventServiceClient(); - doStuffWithUserEventServiceClient(userEventServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_analytics_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_analytics_service_v2alpha.ts.baseline deleted file mode 100644 index 4e4320fcc73d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_analytics_service_v2alpha.ts.baseline +++ /dev/null @@ -1,943 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as analyticsserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.AnalyticsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = analyticsserviceModule.v2alpha.AnalyticsServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = analyticsserviceModule.v2alpha.AnalyticsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new analyticsserviceModule.v2alpha.AnalyticsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = analyticsserviceModule.v2alpha.AnalyticsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.analyticsServiceStub, undefined); - await client.initialize(); - assert(client.analyticsServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.analyticsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.analyticsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('exportAnalyticsMetrics', () => { - it('invokes exportAnalyticsMetrics without error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportAnalyticsMetrics(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics without error using callback', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportAnalyticsMetrics( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics with call error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportAnalyticsMetrics(request), expectedError); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportAnalyticsMetrics with LRO error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportAnalyticsMetricsRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportAnalyticsMetrics = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportAnalyticsMetrics(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportAnalyticsMetrics as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportAnalyticsMetricsProgress without error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportAnalyticsMetricsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportAnalyticsMetricsProgress with error', async () => { - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportAnalyticsMetricsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new analyticsserviceModule.v2alpha.AnalyticsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_branch_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_branch_service_v2alpha.ts.baseline deleted file mode 100644 index b2bbf1dd160a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_branch_service_v2alpha.ts.baseline +++ /dev/null @@ -1,993 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as branchserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.BranchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = branchserviceModule.v2alpha.BranchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = branchserviceModule.v2alpha.BranchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new branchserviceModule.v2alpha.BranchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = branchserviceModule.v2alpha.BranchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.branchServiceStub, undefined); - await client.initialize(); - assert(client.branchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.branchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.branchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listBranches', () => { - it('invokes listBranches without error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesResponse() - ); - client.innerApiCalls.listBranches = stubSimpleCall(expectedResponse); - const [response] = await client.listBranches(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches without error using callback', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesResponse() - ); - client.innerApiCalls.listBranches = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBranches( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListBranchesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches with error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBranches = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBranches(request), expectedError); - const actualRequest = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBranches as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBranches with closed client', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListBranchesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListBranchesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listBranches(request), expectedError); - }); - }); - - describe('getBranch', () => { - it('invokes getBranch without error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Branch() - ); - client.innerApiCalls.getBranch = stubSimpleCall(expectedResponse); - const [response] = await client.getBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch without error using callback', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Branch() - ); - client.innerApiCalls.getBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBranch( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBranch|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch with error', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBranch with closed client', async () => { - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetBranchRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBranch(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new branchserviceModule.v2alpha.BranchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_catalog_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_catalog_service_v2alpha.ts.baseline deleted file mode 100644 index c042b00f66e1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_catalog_service_v2alpha.ts.baseline +++ /dev/null @@ -1,2307 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as catalogserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.CatalogServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = catalogserviceModule.v2alpha.CatalogServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = catalogserviceModule.v2alpha.CatalogServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new catalogserviceModule.v2alpha.CatalogServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = catalogserviceModule.v2alpha.CatalogServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.catalogServiceStub, undefined); - await client.initialize(); - assert(client.catalogServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.catalogServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.catalogServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('updateCatalog', () => { - it('invokes updateCatalog without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Catalog() - ); - client.innerApiCalls.updateCatalog = stubSimpleCall(expectedResponse); - const [response] = await client.updateCatalog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Catalog() - ); - client.innerApiCalls.updateCatalog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCatalog( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICatalog|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedHeaderRequestParams = `catalog.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCatalog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCatalog(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCatalog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCatalog with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCatalogRequest() - ); - request.catalog ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCatalogRequest', ['catalog', 'name']); - request.catalog.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCatalog(request), expectedError); - }); - }); - - describe('setDefaultBranch', () => { - it('invokes setDefaultBranch without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.setDefaultBranch = stubSimpleCall(expectedResponse); - const [response] = await client.setDefaultBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.setDefaultBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setDefaultBranch( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setDefaultBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setDefaultBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setDefaultBranch with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.setDefaultBranch(request), expectedError); - }); - }); - - describe('getDefaultBranch', () => { - it('invokes getDefaultBranch without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() - ); - client.innerApiCalls.getDefaultBranch = stubSimpleCall(expectedResponse); - const [response] = await client.getDefaultBranch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchResponse() - ); - client.innerApiCalls.getDefaultBranch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDefaultBranch( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGetDefaultBranchResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDefaultBranch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDefaultBranch(request), expectedError); - const actualRequest = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDefaultBranch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDefaultBranch with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetDefaultBranchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetDefaultBranchRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDefaultBranch(request), expectedError); - }); - }); - - describe('getCompletionConfig', () => { - it('invokes getCompletionConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.getCompletionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getCompletionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.getCompletionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getCompletionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompletionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getCompletionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getCompletionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getCompletionConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetCompletionConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetCompletionConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getCompletionConfig(request), expectedError); - }); - }); - - describe('updateCompletionConfig', () => { - it('invokes updateCompletionConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.updateCompletionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateCompletionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompletionConfig() - ); - client.innerApiCalls.updateCompletionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateCompletionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompletionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedHeaderRequestParams = `completion_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateCompletionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateCompletionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateCompletionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateCompletionConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest() - ); - request.completionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateCompletionConfigRequest', ['completionConfig', 'name']); - request.completionConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateCompletionConfig(request), expectedError); - }); - }); - - describe('getAttributesConfig', () => { - it('invokes getAttributesConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.getAttributesConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAttributesConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.getAttributesConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAttributesConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAttributesConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAttributesConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAttributesConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAttributesConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAttributesConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAttributesConfig(request), expectedError); - }); - }); - - describe('updateAttributesConfig', () => { - it('invokes updateAttributesConfig without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.updateAttributesConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateAttributesConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.updateAttributesConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAttributesConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedHeaderRequestParams = `attributes_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAttributesConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAttributesConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAttributesConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAttributesConfig with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest() - ); - request.attributesConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAttributesConfigRequest', ['attributesConfig', 'name']); - request.attributesConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAttributesConfig(request), expectedError); - }); - }); - - describe('addCatalogAttribute', () => { - it('invokes addCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.addCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.addCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.addCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addCatalogAttribute(request), expectedError); - }); - }); - - describe('removeCatalogAttribute', () => { - it('invokes removeCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.removeCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.removeCatalogAttribute(request), expectedError); - }); - }); - - describe('batchRemoveCatalogAttributes', () => { - it('invokes batchRemoveCatalogAttributes without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse() - ); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall(expectedResponse); - const [response] = await client.batchRemoveCatalogAttributes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesResponse() - ); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchRemoveCatalogAttributes( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBatchRemoveCatalogAttributesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchRemoveCatalogAttributes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchRemoveCatalogAttributes(request), expectedError); - const actualRequest = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchRemoveCatalogAttributes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchRemoveCatalogAttributes with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchRemoveCatalogAttributesRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchRemoveCatalogAttributes(request), expectedError); - }); - }); - - describe('replaceCatalogAttribute', () => { - it('invokes replaceCatalogAttribute without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall(expectedResponse); - const [response] = await client.replaceCatalogAttribute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AttributesConfig() - ); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.replaceCatalogAttribute( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAttributesConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedHeaderRequestParams = `attributes_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.replaceCatalogAttribute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.replaceCatalogAttribute(request), expectedError); - const actualRequest = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.replaceCatalogAttribute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes replaceCatalogAttribute with closed client', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ReplaceCatalogAttributeRequest', ['attributesConfig']); - request.attributesConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.replaceCatalogAttribute(request), expectedError); - }); - }); - - describe('listCatalogs', () => { - it('invokes listCatalogs without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.innerApiCalls.listCatalogs = stubSimpleCall(expectedResponse); - const [response] = await client.listCatalogs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogs without error using callback', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.innerApiCalls.listCatalogs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listCatalogs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICatalog[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogs with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listCatalogs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listCatalogs(request), expectedError); - const actualRequest = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listCatalogs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listCatalogsStream without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listCatalogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Catalog) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCatalogs, request)); - assert( - (client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listCatalogsStream with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listCatalogsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Catalog[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Catalog) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listCatalogs, request)); - assert( - (client.descriptors.page.listCatalogs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCatalogs without error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Catalog()), - ]; - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; - const iterable = client.listCatalogsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listCatalogs with error', async () => { - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListCatalogsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListCatalogsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listCatalogs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listCatalogsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.ICatalog[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listCatalogs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new catalogserviceModule.v2alpha.CatalogServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_completion_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_completion_service_v2alpha.ts.baseline deleted file mode 100644 index edb151f19161..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_completion_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1055 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as completionserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.CompletionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = completionserviceModule.v2alpha.CompletionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = completionserviceModule.v2alpha.CompletionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new completionserviceModule.v2alpha.CompletionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = completionserviceModule.v2alpha.CompletionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.completionServiceStub, undefined); - await client.initialize(); - assert(client.completionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.completionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.completionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('completeQuery', () => { - it('invokes completeQuery without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() - ); - client.innerApiCalls.completeQuery = stubSimpleCall(expectedResponse); - const [response] = await client.completeQuery(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery without error using callback', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryResponse() - ); - client.innerApiCalls.completeQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.completeQuery( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ICompleteQueryResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery with error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.completeQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.completeQuery(request), expectedError); - const actualRequest = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.completeQuery as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes completeQuery with closed client', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CompleteQueryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CompleteQueryRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.completeQuery(request), expectedError); - }); - }); - - describe('importCompletionData', () => { - it('invokes importCompletionData without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importCompletionData = stubLongRunningCall(expectedResponse); - const [operation] = await client.importCompletionData(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData without error using callback', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importCompletionData = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importCompletionData( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData with call error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCompletionData = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importCompletionData(request), expectedError); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importCompletionData with LRO error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportCompletionDataRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportCompletionDataRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importCompletionData = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importCompletionData(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importCompletionData as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportCompletionDataProgress without error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportCompletionDataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportCompletionDataProgress with error', async () => { - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportCompletionDataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new completionserviceModule.v2alpha.CompletionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_control_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_control_service_v2alpha.ts.baseline deleted file mode 100644 index 6a4bf6b4b0ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_control_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1505 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as controlserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ControlServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = controlserviceModule.v2alpha.ControlServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = controlserviceModule.v2alpha.ControlServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new controlserviceModule.v2alpha.ControlServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = controlserviceModule.v2alpha.ControlServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.controlServiceStub, undefined); - await client.initialize(); - assert(client.controlServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.controlServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.controlServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createControl', () => { - it('invokes createControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.createControl = stubSimpleCall(expectedResponse); - const [response] = await client.createControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.createControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createControl(request), expectedError); - const actualRequest = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateControlRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createControl(request), expectedError); - }); - }); - - describe('deleteControl', () => { - it('invokes deleteControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteControl = stubSimpleCall(expectedResponse); - const [response] = await client.deleteControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteControl( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteControl(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteControlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteControl(request), expectedError); - }); - }); - - describe('updateControl', () => { - it('invokes updateControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.updateControl = stubSimpleCall(expectedResponse); - const [response] = await client.updateControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.updateControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedHeaderRequestParams = `control.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateControl(request), expectedError); - const actualRequest = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateControlRequest() - ); - request.control ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateControlRequest', ['control', 'name']); - request.control.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateControl(request), expectedError); - }); - }); - - describe('getControl', () => { - it('invokes getControl without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.getControl = stubSimpleCall(expectedResponse); - const [response] = await client.getControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Control() - ); - client.innerApiCalls.getControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getControl(request), expectedError); - const actualRequest = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getControl with closed client', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetControlRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getControl(request), expectedError); - }); - }); - - describe('listControls', () => { - it('invokes listControls without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.innerApiCalls.listControls = stubSimpleCall(expectedResponse); - const [response] = await client.listControls(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControls without error using callback', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.innerApiCalls.listControls = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listControls( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IControl[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControls with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listControls = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listControls(request), expectedError); - const actualRequest = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listControls as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listControlsStream without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.descriptors.page.listControls.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listControlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Control[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Control) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listControls, request)); - assert( - (client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listControlsStream with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listControls.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listControlsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Control[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Control) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listControls, request)); - assert( - (client.descriptors.page.listControls.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listControls without error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Control()), - ]; - client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; - const iterable = client.listControlsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listControls with error', async () => { - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListControlsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListControlsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listControls.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listControlsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IControl[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listControls.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new controlserviceModule.v2alpha.ControlServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_conversational_search_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_conversational_search_service_v2alpha.ts.baseline deleted file mode 100644 index 3723e2c2fbb0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_conversational_search_service_v2alpha.ts.baseline +++ /dev/null @@ -1,923 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as conversationalsearchserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -describe('v2alpha.ConversationalSearchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationalSearchServiceStub, undefined); - await client.initialize(); - assert(client.conversationalSearchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.conversationalSearchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.conversationalSearchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('conversationalSearch', () => { - it('invokes conversationalSearch without error', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchResponse() - ); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(expectedResponse); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch without error and gaxServerStreamingRetries enabled', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchResponse() - ); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(expectedResponse); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch with error', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.conversationalSearch = stubServerStreamingCall(undefined, expectedError); - const stream = client.conversationalSearch(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.conversationalSearch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes conversationalSearch with closed client', async () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ConversationalSearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ConversationalSearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.conversationalSearch(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ConversationalSearchResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new conversationalsearchserviceModule.v2alpha.ConversationalSearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_generative_question_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_generative_question_service_v2alpha.ts.baseline deleted file mode 100644 index c3531333f6d6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_generative_question_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1325 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as generativequestionserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.GenerativeQuestionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.generativeQuestionServiceStub, undefined); - await client.initialize(); - assert(client.generativeQuestionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.generativeQuestionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.generativeQuestionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('updateGenerativeQuestionsFeatureConfig', () => { - it('invokes updateGenerativeQuestionsFeatureConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateGenerativeQuestionsFeatureConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGenerativeQuestionsFeatureConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_questions_feature_config.catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGenerativeQuestionsFeatureConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGenerativeQuestionsFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionsFeatureConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest() - ); - request.generativeQuestionsFeatureConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionsFeatureConfigRequest', ['generativeQuestionsFeatureConfig', 'catalog']); - request.generativeQuestionsFeatureConfig.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGenerativeQuestionsFeatureConfig(request), expectedError); - }); - }); - - describe('getGenerativeQuestionsFeatureConfig', () => { - it('invokes getGenerativeQuestionsFeatureConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getGenerativeQuestionsFeatureConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionsFeatureConfig() - ); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGenerativeQuestionsFeatureConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionsFeatureConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedHeaderRequestParams = `catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGenerativeQuestionsFeatureConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGenerativeQuestionsFeatureConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGenerativeQuestionsFeatureConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGenerativeQuestionsFeatureConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetGenerativeQuestionsFeatureConfigRequest', ['catalog']); - request.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGenerativeQuestionsFeatureConfig(request), expectedError); - }); - }); - - describe('listGenerativeQuestionConfigs', () => { - it('invokes listGenerativeQuestionConfigs without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listGenerativeQuestionConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGenerativeQuestionConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListGenerativeQuestionConfigsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGenerativeQuestionConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGenerativeQuestionConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGenerativeQuestionConfigs with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listGenerativeQuestionConfigs(request), expectedError); - }); - }); - - describe('updateGenerativeQuestionConfig', () => { - it('invokes updateGenerativeQuestionConfig without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig() - ); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateGenerativeQuestionConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GenerativeQuestionConfig() - ); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateGenerativeQuestionConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IGenerativeQuestionConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedHeaderRequestParams = `generative_question_config.catalog=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateGenerativeQuestionConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateGenerativeQuestionConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateGenerativeQuestionConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateGenerativeQuestionConfig with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest() - ); - request.generativeQuestionConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateGenerativeQuestionConfigRequest', ['generativeQuestionConfig', 'catalog']); - request.generativeQuestionConfig.catalog = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateGenerativeQuestionConfig(request), expectedError); - }); - }); - - describe('batchUpdateGenerativeQuestionConfigs', () => { - it('invokes batchUpdateGenerativeQuestionConfigs without error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.batchUpdateGenerativeQuestionConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs without error using callback', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsResponse() - ); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchUpdateGenerativeQuestionConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IBatchUpdateGenerativeQuestionConfigsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs with error', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchUpdateGenerativeQuestionConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.batchUpdateGenerativeQuestionConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchUpdateGenerativeQuestionConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchUpdateGenerativeQuestionConfigs with closed client', async () => { - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.BatchUpdateGenerativeQuestionConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.batchUpdateGenerativeQuestionConfigs(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new generativequestionserviceModule.v2alpha.GenerativeQuestionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline deleted file mode 100644 index b8166ae516d3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_merchant_center_account_link_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1163 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as merchantcenteraccountlinkserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.MerchantCenterAccountLinkServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.merchantCenterAccountLinkServiceStub, undefined); - await client.initialize(); - assert(client.merchantCenterAccountLinkServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.merchantCenterAccountLinkServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.merchantCenterAccountLinkServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listMerchantCenterAccountLinks', () => { - it('invokes listMerchantCenterAccountLinks without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse() - ); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCall(expectedResponse); - const [response] = await client.listMerchantCenterAccountLinks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksResponse() - ); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listMerchantCenterAccountLinks( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListMerchantCenterAccountLinksResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listMerchantCenterAccountLinks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listMerchantCenterAccountLinks(request), expectedError); - const actualRequest = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listMerchantCenterAccountLinks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listMerchantCenterAccountLinks with closed client', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListMerchantCenterAccountLinksRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listMerchantCenterAccountLinks(request), expectedError); - }); - }); - - describe('deleteMerchantCenterAccountLink', () => { - it('invokes deleteMerchantCenterAccountLink without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCall(expectedResponse); - const [response] = await client.deleteMerchantCenterAccountLink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteMerchantCenterAccountLink( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteMerchantCenterAccountLink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteMerchantCenterAccountLink(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteMerchantCenterAccountLink with closed client', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteMerchantCenterAccountLinkRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteMerchantCenterAccountLink(request), expectedError); - }); - }); - - describe('createMerchantCenterAccountLink', () => { - it('invokes createMerchantCenterAccountLink without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(expectedResponse); - const [operation] = await client.createMerchantCenterAccountLink(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink without error using callback', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createMerchantCenterAccountLink( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink with call error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createMerchantCenterAccountLink(request), expectedError); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createMerchantCenterAccountLink with LRO error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateMerchantCenterAccountLinkRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createMerchantCenterAccountLink = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createMerchantCenterAccountLink(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createMerchantCenterAccountLink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateMerchantCenterAccountLinkProgress without error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateMerchantCenterAccountLinkProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateMerchantCenterAccountLinkProgress with error', async () => { - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateMerchantCenterAccountLinkProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new merchantcenteraccountlinkserviceModule.v2alpha.MerchantCenterAccountLinkServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_model_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_model_service_v2alpha.ts.baseline deleted file mode 100644 index 36022a799068..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_model_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1937 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as modelserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ModelServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = modelserviceModule.v2alpha.ModelServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = modelserviceModule.v2alpha.ModelServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new modelserviceModule.v2alpha.ModelServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = modelserviceModule.v2alpha.ModelServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - await client.initialize(); - assert(client.modelServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.modelServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.modelServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getModel', () => { - it('invokes getModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.getModel = stubSimpleCall(expectedResponse); - const [response] = await client.getModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.getModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getModel(request), expectedError); - const actualRequest = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getModel(request), expectedError); - }); - }); - - describe('pauseModel', () => { - it('invokes pauseModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.pauseModel = stubSimpleCall(expectedResponse); - const [response] = await client.pauseModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.pauseModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseModel(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PauseModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PauseModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pauseModel(request), expectedError); - }); - }); - - describe('resumeModel', () => { - it('invokes resumeModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.resumeModel = stubSimpleCall(expectedResponse); - const [response] = await client.resumeModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.resumeModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeModel(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ResumeModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ResumeModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resumeModel(request), expectedError); - }); - }); - - describe('deleteModel', () => { - it('invokes deleteModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCall(expectedResponse); - const [response] = await client.deleteModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteModel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteModel(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteModelRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteModel(request), expectedError); - }); - }); - - describe('updateModel', () => { - it('invokes updateModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.updateModel = stubSimpleCall(expectedResponse); - const [response] = await client.updateModel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Model() - ); - client.innerApiCalls.updateModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateModel( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedHeaderRequestParams = `model.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateModel(request), expectedError); - const actualRequest = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateModel with closed client', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateModelRequest() - ); - request.model ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateModelRequest', ['model', 'name']); - request.model.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateModel(request), expectedError); - }); - }); - - describe('createModel', () => { - it('invokes createModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel with call error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createModel(request), expectedError); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createModel with LRO error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateModelRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateModelProgress without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateModelProgress with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('tuneModel', () => { - it('invokes tuneModel without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.tuneModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.tuneModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.tuneModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.tuneModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel with call error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.tuneModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.tuneModel(request), expectedError); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes tuneModel with LRO error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.TuneModelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.TuneModelRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.tuneModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.tuneModel(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.tuneModel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkTuneModelProgress without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkTuneModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkTuneModelProgress with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkTuneModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listModels', () => { - it('invokes listModels without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCall(expectedResponse); - const [response] = await client.listModels(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels without error using callback', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.innerApiCalls.listModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listModels( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IModel[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModels with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listModels(request), expectedError); - const actualRequest = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listModels as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listModelsStream without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.descriptors.page.listModels.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Model[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listModelsStream with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listModelsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Model[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Model) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listModels, request)); - assert( - (client.descriptors.page.listModels.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels without error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Model()), - ]; - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; - const iterable = client.listModelsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listModels with error', async () => { - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListModelsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListModelsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listModels.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listModelsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IModel[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listModels.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new modelserviceModule.v2alpha.ModelServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_prediction_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_prediction_service_v2alpha.ts.baseline deleted file mode 100644 index 35230e3a276a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_prediction_service_v2alpha.ts.baseline +++ /dev/null @@ -1,885 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as predictionserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v2alpha.PredictionServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = predictionserviceModule.v2alpha.PredictionServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = predictionserviceModule.v2alpha.PredictionServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new predictionserviceModule.v2alpha.PredictionServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = predictionserviceModule.v2alpha.PredictionServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.predictionServiceStub, undefined); - await client.initialize(); - assert(client.predictionServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.predictionServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.predictionServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('predict', () => { - it('invokes predict without error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictResponse() - ); - client.innerApiCalls.predict = stubSimpleCall(expectedResponse); - const [response] = await client.predict(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict without error using callback', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictResponse() - ); - client.innerApiCalls.predict = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.predict( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IPredictResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict with error', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.predict = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.predict(request), expectedError); - const actualRequest = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.predict as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes predict with closed client', async () => { - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PredictRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PredictRequest', ['placement']); - request.placement = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.predict(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new predictionserviceModule.v2alpha.PredictionServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_product_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_product_service_v2alpha.ts.baseline deleted file mode 100644 index d806c5a092c6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_product_service_v2alpha.ts.baseline +++ /dev/null @@ -1,2757 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as productserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ProductServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = productserviceModule.v2alpha.ProductServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = productserviceModule.v2alpha.ProductServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new productserviceModule.v2alpha.ProductServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new productserviceModule.v2alpha.ProductServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new productserviceModule.v2alpha.ProductServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = productserviceModule.v2alpha.ProductServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productServiceStub, undefined); - await client.initialize(); - assert(client.productServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.productServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.productServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createProduct', () => { - it('invokes createProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCall(expectedResponse); - const [response] = await client.createProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.createProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateProductRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createProduct(request), expectedError); - }); - }); - - describe('getProduct', () => { - it('invokes getProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCall(expectedResponse); - const [response] = await client.getProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.getProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProductRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProduct(request), expectedError); - }); - }); - - describe('updateProduct', () => { - it('invokes updateProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCall(expectedResponse); - const [response] = await client.updateProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Product() - ); - client.innerApiCalls.updateProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProduct( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedHeaderRequestParams = `product.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateProductRequest() - ); - request.product ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateProductRequest', ['product', 'name']); - request.product.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateProduct(request), expectedError); - }); - }); - - describe('deleteProduct', () => { - it('invokes deleteProduct without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCall(expectedResponse); - const [response] = await client.deleteProduct(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteProduct = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteProduct( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteProduct = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteProduct(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteProduct as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteProduct with closed client', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteProductRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteProductRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteProduct(request), expectedError); - }); - }); - - describe('purgeProducts', () => { - it('invokes purgeProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.purgeProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.purgeProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkPurgeProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importProducts', () => { - it('invokes importProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.importProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportProducts', () => { - it('invokes exportProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportProducts = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportProducts(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportProducts = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportProducts( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportProducts = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportProducts with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportProducts = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportProducts(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportProductsProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportProductsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportProductsProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportProductsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('setInventory', () => { - it('invokes setInventory without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setInventory = stubLongRunningCall(expectedResponse); - const [operation] = await client.setInventory(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.setInventory = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setInventory( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setInventory = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.setInventory(request), expectedError); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setInventory with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SetInventoryRequest() - ); - request.inventory ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SetInventoryRequest', ['inventory', 'name']); - request.inventory.name = defaultValue1; - const expectedHeaderRequestParams = `inventory.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setInventory = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.setInventory(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setInventory as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSetInventoryProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSetInventoryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSetInventoryProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSetInventoryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('addFulfillmentPlaces', () => { - it('invokes addFulfillmentPlaces without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(expectedResponse); - const [operation] = await client.addFulfillmentPlaces(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addFulfillmentPlaces( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addFulfillmentPlaces(request), expectedError); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addFulfillmentPlaces with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addFulfillmentPlaces = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addFulfillmentPlaces(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAddFulfillmentPlacesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddFulfillmentPlacesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAddFulfillmentPlacesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddFulfillmentPlacesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('removeFulfillmentPlaces', () => { - it('invokes removeFulfillmentPlaces without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeFulfillmentPlaces(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeFulfillmentPlaces( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeFulfillmentPlaces(request), expectedError); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeFulfillmentPlaces with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveFulfillmentPlacesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeFulfillmentPlaces = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeFulfillmentPlaces(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeFulfillmentPlaces as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRemoveFulfillmentPlacesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveFulfillmentPlacesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRemoveFulfillmentPlacesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveFulfillmentPlacesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('addLocalInventories', () => { - it('invokes addLocalInventories without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(expectedResponse); - const [operation] = await client.addLocalInventories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.addLocalInventories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addLocalInventories( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.addLocalInventories(request), expectedError); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addLocalInventories with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addLocalInventories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.addLocalInventories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkAddLocalInventoriesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAddLocalInventoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAddLocalInventoriesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAddLocalInventoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('removeLocalInventories', () => { - it('invokes removeLocalInventories without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(expectedResponse); - const [operation] = await client.removeLocalInventories(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.removeLocalInventories = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeLocalInventories( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories with call error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.removeLocalInventories(request), expectedError); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeLocalInventories with LRO error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveLocalInventoriesRequest', ['product']); - request.product = defaultValue1; - const expectedHeaderRequestParams = `product=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeLocalInventories = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.removeLocalInventories(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeLocalInventories as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRemoveLocalInventoriesProgress without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRemoveLocalInventoriesProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRemoveLocalInventoriesProgress with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRemoveLocalInventoriesProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listProducts', () => { - it('invokes listProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.innerApiCalls.listProducts = stubSimpleCall(expectedResponse); - const [response] = await client.listProducts(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts without error using callback', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.innerApiCalls.listProducts = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listProducts( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProduct[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProducts with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listProducts = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listProducts(request), expectedError); - const actualRequest = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listProducts as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listProductsStream without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.descriptors.page.listProducts.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Product[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProducts, request)); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listProductsStream with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listProductsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.Product[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.Product) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listProducts, request)); - assert( - (client.descriptors.page.listProducts.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts without error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.Product()), - ]; - client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; - const iterable = client.listProductsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listProducts with error', async () => { - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListProductsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListProductsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listProducts.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listProductsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IProduct[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listProducts.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new productserviceModule.v2alpha.ProductServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_project_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_project_service_v2alpha.ts.baseline deleted file mode 100644 index a0d3cc3643ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_project_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1741 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as projectserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.ProjectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = projectserviceModule.v2alpha.ProjectServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = projectserviceModule.v2alpha.ProjectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new projectserviceModule.v2alpha.ProjectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = projectserviceModule.v2alpha.ProjectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - await client.initialize(); - assert(client.projectServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.projectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.projectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getProject', () => { - it('invokes getProject without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.getProject = stubSimpleCall(expectedResponse); - const [response] = await client.getProject(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.getProject = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProject( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProject = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProject(request), expectedError); - const actualRequest = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProject with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetProjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetProjectRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProject(request), expectedError); - }); - }); - - describe('acceptTerms', () => { - it('invokes acceptTerms without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.acceptTerms = stubSimpleCall(expectedResponse); - const [response] = await client.acceptTerms(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.Project() - ); - client.innerApiCalls.acceptTerms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acceptTerms( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IProject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.acceptTerms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.acceptTerms(request), expectedError); - const actualRequest = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acceptTerms as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acceptTerms with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AcceptTermsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AcceptTermsRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.acceptTerms(request), expectedError); - }); - }); - - describe('listEnrolledSolutions', () => { - it('invokes listEnrolledSolutions without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse() - ); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCall(expectedResponse); - const [response] = await client.listEnrolledSolutions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsResponse() - ); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEnrolledSolutions( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IListEnrolledSolutionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEnrolledSolutions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEnrolledSolutions(request), expectedError); - const actualRequest = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEnrolledSolutions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEnrolledSolutions with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListEnrolledSolutionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listEnrolledSolutions(request), expectedError); - }); - }); - - describe('getLoggingConfig', () => { - it('invokes getLoggingConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.getLoggingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getLoggingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.getLoggingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLoggingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ILoggingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLoggingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLoggingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLoggingConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetLoggingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetLoggingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLoggingConfig(request), expectedError); - }); - }); - - describe('updateLoggingConfig', () => { - it('invokes updateLoggingConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.updateLoggingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateLoggingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.LoggingConfig() - ); - client.innerApiCalls.updateLoggingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateLoggingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.ILoggingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `logging_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateLoggingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateLoggingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateLoggingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateLoggingConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest() - ); - request.loggingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateLoggingConfigRequest', ['loggingConfig', 'name']); - request.loggingConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateLoggingConfig(request), expectedError); - }); - }); - - describe('getAlertConfig', () => { - it('invokes getAlertConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.getAlertConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getAlertConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.getAlertConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAlertConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAlertConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getAlertConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAlertConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getAlertConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetAlertConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetAlertConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getAlertConfig(request), expectedError); - }); - }); - - describe('updateAlertConfig', () => { - it('invokes updateAlertConfig without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.updateAlertConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateAlertConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AlertConfig() - ); - client.innerApiCalls.updateAlertConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateAlertConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IAlertConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedHeaderRequestParams = `alert_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateAlertConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateAlertConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateAlertConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateAlertConfig with closed client', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateAlertConfigRequest() - ); - request.alertConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateAlertConfigRequest', ['alertConfig', 'name']); - request.alertConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateAlertConfig(request), expectedError); - }); - }); - - describe('enrollSolution', () => { - it('invokes enrollSolution without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.enrollSolution = stubLongRunningCall(expectedResponse); - const [operation] = await client.enrollSolution(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution without error using callback', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.enrollSolution = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.enrollSolution( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution with call error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.enrollSolution = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.enrollSolution(request), expectedError); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes enrollSolution with LRO error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.EnrollSolutionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.EnrollSolutionRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.enrollSolution = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.enrollSolution(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.enrollSolution as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkEnrollSolutionProgress without error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkEnrollSolutionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkEnrollSolutionProgress with error', async () => { - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkEnrollSolutionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new projectserviceModule.v2alpha.ProjectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_search_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_search_service_v2alpha.ts.baseline deleted file mode 100644 index 66e39d3fa6ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_search_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1123 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as searchserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.SearchServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = searchserviceModule.v2alpha.SearchServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = searchserviceModule.v2alpha.SearchServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new searchserviceModule.v2alpha.SearchServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = searchserviceModule.v2alpha.SearchServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.searchServiceStub, undefined); - await client.initialize(); - assert(client.searchServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.searchServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.searchServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('search', () => { - it('invokes search without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.innerApiCalls.search = stubSimpleCall(expectedResponse); - const [response] = await client.search(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes search without error using callback', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.innerApiCalls.search = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.search( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes search with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.search = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.search(request), expectedError); - const actualRequest = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.search as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchStream without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.descriptors.page.search.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.searchStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.search.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.search, request)); - assert( - (client.descriptors.page.search.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes searchStream with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.search.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.searchStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.search.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.search, request)); - assert( - (client.descriptors.page.search.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with search without error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.SearchResponse.SearchResult()), - ]; - client.descriptors.page.search.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = []; - const iterable = client.searchAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with search with error', async () => { - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.SearchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.SearchRequest', ['placement']); - request.placement = defaultValue1; - const expectedHeaderRequestParams = `placement=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.search.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.searchAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.SearchResponse.ISearchResult[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.search.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('experiment', async () => { - const fakePath = "/rendered/path/experiment"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - experiment: "experimentValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.experimentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.experimentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('experimentPath', () => { - const result = client.experimentPath("projectValue", "locationValue", "catalogValue", "experimentValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.experimentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromExperimentName', () => { - const result = client.matchProjectFromExperimentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromExperimentName', () => { - const result = client.matchLocationFromExperimentName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromExperimentName', () => { - const result = client.matchCatalogFromExperimentName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchExperimentFromExperimentName', () => { - const result = client.matchExperimentFromExperimentName(fakePath); - assert.strictEqual(result, "experimentValue"); - assert((client.pathTemplates.experimentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new searchserviceModule.v2alpha.SearchServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_serving_config_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_serving_config_service_v2alpha.ts.baseline deleted file mode 100644 index 1638a554681a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_serving_config_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1721 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as servingconfigserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2alpha.ServingConfigServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = servingconfigserviceModule.v2alpha.ServingConfigServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - await client.initialize(); - assert(client.servingConfigServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.servingConfigServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.servingConfigServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createServingConfig', () => { - it('invokes createServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.createServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.createServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.createServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CreateServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CreateServingConfigRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createServingConfig(request), expectedError); - }); - }); - - describe('deleteServingConfig', () => { - it('invokes deleteServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.deleteServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteServingConfig( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.DeleteServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.DeleteServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteServingConfig(request), expectedError); - }); - }); - - describe('updateServingConfig', () => { - it('invokes updateServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.updateServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.updateServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.updateServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedHeaderRequestParams = `serving_config.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UpdateServingConfigRequest() - ); - request.servingConfig ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.UpdateServingConfigRequest', ['servingConfig', 'name']); - request.servingConfig.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateServingConfig(request), expectedError); - }); - }); - - describe('getServingConfig', () => { - it('invokes getServingConfig without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.getServingConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getServingConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.getServingConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getServingConfig( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getServingConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getServingConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getServingConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getServingConfig with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.GetServingConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.GetServingConfigRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getServingConfig(request), expectedError); - }); - }); - - describe('addControl', () => { - it('invokes addControl without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.addControl = stubSimpleCall(expectedResponse); - const [response] = await client.addControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.addControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addControl(request), expectedError); - const actualRequest = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addControl with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.AddControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.AddControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addControl(request), expectedError); - }); - }); - - describe('removeControl', () => { - it('invokes removeControl without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.removeControl = stubSimpleCall(expectedResponse); - const [response] = await client.removeControl(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ServingConfig() - ); - client.innerApiCalls.removeControl = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.removeControl( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedHeaderRequestParams = `serving_config=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.removeControl = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.removeControl(request), expectedError); - const actualRequest = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.removeControl as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes removeControl with closed client', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RemoveControlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RemoveControlRequest', ['servingConfig']); - request.servingConfig = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.removeControl(request), expectedError); - }); - }); - - describe('listServingConfigs', () => { - it('invokes listServingConfigs without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.innerApiCalls.listServingConfigs = stubSimpleCall(expectedResponse); - const [response] = await client.listServingConfigs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigs without error using callback', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.innerApiCalls.listServingConfigs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServingConfigs( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IServingConfig[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigs with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServingConfigs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServingConfigs(request), expectedError); - const actualRequest = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServingConfigs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServingConfigsStream without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listServingConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServingConfigs, request)); - assert( - (client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listServingConfigsStream with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServingConfigs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listServingConfigsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.retail.v2alpha.ServingConfig[] = []; - stream.on('data', (response: protos.google.cloud.retail.v2alpha.ServingConfig) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listServingConfigs, request)); - assert( - (client.descriptors.page.listServingConfigs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServingConfigs without error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - generateSampleMessage(new protos.google.cloud.retail.v2alpha.ServingConfig()), - ]; - client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = []; - const iterable = client.listServingConfigsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listServingConfigs with error', async () => { - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ListServingConfigsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ListServingConfigsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listServingConfigs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listServingConfigsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.retail.v2alpha.IServingConfig[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listServingConfigs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new servingconfigserviceModule.v2alpha.ServingConfigServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_user_event_service_v2alpha.ts.baseline b/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_user_event_service_v2alpha.ts.baseline deleted file mode 100644 index 3ea4a094fcd0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/test/gapic_user_event_service_v2alpha.ts.baseline +++ /dev/null @@ -1,1625 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as usereventserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v2alpha.UserEventServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = usereventserviceModule.v2alpha.UserEventServiceClient.servicePath; - assert.strictEqual(servicePath, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = usereventserviceModule.v2alpha.UserEventServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'retail.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'retail.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new usereventserviceModule.v2alpha.UserEventServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = usereventserviceModule.v2alpha.UserEventServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.userEventServiceStub, undefined); - await client.initialize(); - assert(client.userEventServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.userEventServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.userEventServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('writeUserEvent', () => { - it('invokes writeUserEvent without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UserEvent() - ); - client.innerApiCalls.writeUserEvent = stubSimpleCall(expectedResponse); - const [response] = await client.writeUserEvent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.UserEvent() - ); - client.innerApiCalls.writeUserEvent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.writeUserEvent( - request, - (err?: Error|null, result?: protos.google.cloud.retail.v2alpha.IUserEvent|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.writeUserEvent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.writeUserEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.writeUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes writeUserEvent with closed client', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.WriteUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.WriteUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.writeUserEvent(request), expectedError); - }); - }); - - describe('collectUserEvent', () => { - it('invokes collectUserEvent without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.collectUserEvent = stubSimpleCall(expectedResponse); - const [response] = await client.collectUserEvent(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.api.HttpBody() - ); - client.innerApiCalls.collectUserEvent = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.collectUserEvent( - request, - (err?: Error|null, result?: protos.google.api.IHttpBody|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.collectUserEvent = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.collectUserEvent(request), expectedError); - const actualRequest = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.collectUserEvent as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes collectUserEvent with closed client', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.CollectUserEventRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.CollectUserEventRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.collectUserEvent(request), expectedError); - }); - }); - - describe('purgeUserEvents', () => { - it('invokes purgeUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.purgeUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.purgeUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.purgeUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.PurgeUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.PurgeUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.purgeUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkPurgeUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkPurgeUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkPurgeUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkPurgeUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('importUserEvents', () => { - it('invokes importUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.importUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.importUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.importUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.importUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes importUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ImportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ImportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.importUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.importUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.importUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkImportUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkImportUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkImportUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkImportUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportUserEvents', () => { - it('invokes exportUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.exportUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes exportUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.ExportUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.ExportUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkExportUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkExportUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkExportUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('rejoinUserEvents', () => { - it('invokes rejoinUserEvents without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(expectedResponse); - const [operation] = await client.rejoinUserEvents(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents without error using callback', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rejoinUserEvents( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents with call error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.rejoinUserEvents(request), expectedError); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rejoinUserEvents with LRO error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.retail.v2alpha.RejoinUserEventsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.retail.v2alpha.RejoinUserEventsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rejoinUserEvents = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.rejoinUserEvents(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rejoinUserEvents as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkRejoinUserEventsProgress without error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkRejoinUserEventsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkRejoinUserEventsProgress with error', async () => { - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkRejoinUserEventsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('Path templates', () => { - - describe('alertConfig', async () => { - const fakePath = "/rendered/path/alertConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.alertConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.alertConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('alertConfigPath', () => { - const result = client.alertConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.alertConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAlertConfigName', () => { - const result = client.matchProjectFromAlertConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.alertConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('attributesConfig', async () => { - const fakePath = "/rendered/path/attributesConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.attributesConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.attributesConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('attributesConfigPath', () => { - const result = client.attributesConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.attributesConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAttributesConfigName', () => { - const result = client.matchProjectFromAttributesConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAttributesConfigName', () => { - const result = client.matchLocationFromAttributesConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromAttributesConfigName', () => { - const result = client.matchCatalogFromAttributesConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.attributesConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('branch', async () => { - const fakePath = "/rendered/path/branch"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.branchPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.branchPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('branchPath', () => { - const result = client.branchPath("projectValue", "locationValue", "catalogValue", "branchValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.branchPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBranchName', () => { - const result = client.matchProjectFromBranchName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBranchName', () => { - const result = client.matchLocationFromBranchName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromBranchName', () => { - const result = client.matchCatalogFromBranchName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromBranchName', () => { - const result = client.matchBranchFromBranchName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.branchPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('catalog', async () => { - const fakePath = "/rendered/path/catalog"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.catalogPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.catalogPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('catalogPath', () => { - const result = client.catalogPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.catalogPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCatalogName', () => { - const result = client.matchProjectFromCatalogName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCatalogName', () => { - const result = client.matchLocationFromCatalogName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCatalogName', () => { - const result = client.matchCatalogFromCatalogName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.catalogPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('completionConfig', async () => { - const fakePath = "/rendered/path/completionConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.completionConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.completionConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('completionConfigPath', () => { - const result = client.completionConfigPath("projectValue", "locationValue", "catalogValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.completionConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromCompletionConfigName', () => { - const result = client.matchProjectFromCompletionConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromCompletionConfigName', () => { - const result = client.matchLocationFromCompletionConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromCompletionConfigName', () => { - const result = client.matchCatalogFromCompletionConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.completionConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('control', async () => { - const fakePath = "/rendered/path/control"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - control: "controlValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.controlPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.controlPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('controlPath', () => { - const result = client.controlPath("projectValue", "locationValue", "catalogValue", "controlValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.controlPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromControlName', () => { - const result = client.matchProjectFromControlName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromControlName', () => { - const result = client.matchLocationFromControlName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromControlName', () => { - const result = client.matchCatalogFromControlName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchControlFromControlName', () => { - const result = client.matchControlFromControlName(fakePath); - assert.strictEqual(result, "controlValue"); - assert((client.pathTemplates.controlPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('loggingConfig', async () => { - const fakePath = "/rendered/path/loggingConfig"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.loggingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.loggingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('loggingConfigPath', () => { - const result = client.loggingConfigPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.loggingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLoggingConfigName', () => { - const result = client.matchProjectFromLoggingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.loggingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('merchantCenterAccountLink', async () => { - const fakePath = "/rendered/path/merchantCenterAccountLink"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - merchant_center_account_link: "merchantCenterAccountLinkValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.merchantCenterAccountLinkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('merchantCenterAccountLinkPath', () => { - const result = client.merchantCenterAccountLinkPath("projectValue", "locationValue", "catalogValue", "merchantCenterAccountLinkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromMerchantCenterAccountLinkName', () => { - const result = client.matchProjectFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromMerchantCenterAccountLinkName', () => { - const result = client.matchLocationFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromMerchantCenterAccountLinkName', () => { - const result = client.matchCatalogFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName', () => { - const result = client.matchMerchantCenterAccountLinkFromMerchantCenterAccountLinkName(fakePath); - assert.strictEqual(result, "merchantCenterAccountLinkValue"); - assert((client.pathTemplates.merchantCenterAccountLinkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('model', async () => { - const fakePath = "/rendered/path/model"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - model: "modelValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.modelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.modelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('modelPath', () => { - const result = client.modelPath("projectValue", "locationValue", "catalogValue", "modelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.modelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromModelName', () => { - const result = client.matchProjectFromModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromModelName', () => { - const result = client.matchLocationFromModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromModelName', () => { - const result = client.matchCatalogFromModelName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchModelFromModelName', () => { - const result = client.matchModelFromModelName(fakePath); - assert.strictEqual(result, "modelValue"); - assert((client.pathTemplates.modelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('product', async () => { - const fakePath = "/rendered/path/product"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - branch: "branchValue", - product: "productValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.productPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.productPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('productPath', () => { - const result = client.productPath("projectValue", "locationValue", "catalogValue", "branchValue", "productValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.productPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProductName', () => { - const result = client.matchProjectFromProductName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromProductName', () => { - const result = client.matchLocationFromProductName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromProductName', () => { - const result = client.matchCatalogFromProductName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBranchFromProductName', () => { - const result = client.matchBranchFromProductName(fakePath); - assert.strictEqual(result, "branchValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchProductFromProductName', () => { - const result = client.matchProductFromProductName(fakePath); - assert.strictEqual(result, "productValue"); - assert((client.pathTemplates.productPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('retailProject', async () => { - const fakePath = "/rendered/path/retailProject"; - const expectedParameters = { - project: "projectValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.retailProjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.retailProjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('retailProjectPath', () => { - const result = client.retailProjectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.retailProjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRetailProjectName', () => { - const result = client.matchProjectFromRetailProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.retailProjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('servingConfig', async () => { - const fakePath = "/rendered/path/servingConfig"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - catalog: "catalogValue", - serving_config: "servingConfigValue", - }; - const client = new usereventserviceModule.v2alpha.UserEventServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.servingConfigPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.servingConfigPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('servingConfigPath', () => { - const result = client.servingConfigPath("projectValue", "locationValue", "catalogValue", "servingConfigValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.servingConfigPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromServingConfigName', () => { - const result = client.matchProjectFromServingConfigName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromServingConfigName', () => { - const result = client.matchLocationFromServingConfigName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchCatalogFromServingConfigName', () => { - const result = client.matchCatalogFromServingConfigName(fakePath); - assert.strictEqual(result, "catalogValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchServingConfigFromServingConfigName', () => { - const result = client.matchServingConfigFromServingConfigName(fakePath); - assert.strictEqual(result, "servingConfigValue"); - assert((client.pathTemplates.servingConfigPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/retail/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/retail/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/retail/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/retail/webpack.config.js.baseline deleted file mode 100644 index 4de3e25e3d10..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/retail/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'retail', - filename: './retail.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 90e875d0e420..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/routingtest/google-routingtest-nodejs - dest: /owl-bot-staging/google-routingtest - -api-name: routingtest \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 7fb2133f573d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'routingtest', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/README.md.baseline deleted file mode 100644 index 7a1ca9041a98..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Routingtest: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/routingtest.svg)](https://www.npmjs.org/package/routingtest) - -Routingtest client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Routingtest Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/routingtest/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Routingtest API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install routingtest -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install routingtest@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/index.ts.baseline deleted file mode 100644 index e0b9fe7c0ad7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const TestServiceClient = v1.TestServiceClient; -type TestServiceClient = v1.TestServiceClient; -export {v1, TestServiceClient}; -export default {v1, TestServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index d023b4366ab3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TestServiceClient} from './test_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client.ts.baseline deleted file mode 100644 index ba7217a0b2cf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client.ts.baseline +++ /dev/null @@ -1,716 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as test_service_client_config from './test_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/test_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'test_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This is a service description. - * It takes up multiple lines, like so. - * @class - * @memberof v1 - */ -export class TestServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('routingtest'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - testServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TestServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.routingtest.v1.TestService', gapicConfig as gax.ClientConfig, - 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.testServiceStub) { - return this.testServiceStub; - } - - // Put together the "service stub" for - // google.routingtest.v1.TestService. - this.testServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.routingtest.v1.TestService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.routingtest.v1.TestService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testServiceStubMethods = - ['fastFibonacci', 'randomFibonacci', 'slowFibonacci']; - for (const methodName of testServiceStubMethods) { - const callPromise = this.testServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.testServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Calculates Fibonacci on the provided value, quickly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.fast_fibonacci.js - * region_tag:localhost_v1_generated_TestService_FastFibonacci_async - */ - fastFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - fastFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/databases/[^/]+)/documents')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('fastFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('fastFibonacci response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.fastFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]) => { - this._log.info('fastFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, randomly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.random_fibonacci.js - * region_tag:localhost_v1_generated_TestService_RandomFibonacci_async - */ - randomFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - randomFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - randomFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - randomFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?.*)')); - if (match) { - const parameterValue = match.groups?.['name'] ?? fieldValue; - Object.assign(routingParameter, { name: parameterValue }); - } - } - } - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('randomFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('randomFibonacci response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.randomFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]) => { - this._log.info('randomFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, slowly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.slow_fibonacci.js - * region_tag:localhost_v1_generated_TestService_SlowFibonacci_async - */ - slowFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - slowFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parentId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - { - const fieldValue = request.nest1?.nest2?.nameId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/databases/[^/]+)/documents')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - { - const fieldValue = request.anotherParentId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)/databases/[^/]+/documents')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('slowFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('slowFibonacci response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.slowFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]) => { - this._log.info('slowFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testServiceStub && !this._terminated) { - return this.testServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client_config.json.baseline deleted file mode 100644 index 63de77a7c3a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.routingtest.v1.TestService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "FastFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RandomFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SlowFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_proto_list.json.baseline deleted file mode 100644 index e6c98404d946..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/src/v1/test_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/routingtest/v1/routingtest_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 3b32afa03b61..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const routingtest = require('routingtest'); - -function main() { - const testServiceClient = new routingtest.TestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index d2d9aee6deb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as routingtest from 'routingtest'; - -function main() { - const testServiceClient = new routingtest.TestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index a07bf100be47..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {TestServiceClient} from 'routingtest'; - -// check that the client class type name can be used -function doStuffWithTestServiceClient(client: TestServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const testServiceClient = new TestServiceClient(); - doStuffWithTestServiceClient(testServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/test/gapic_test_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/test/gapic_test_service_v1.ts.baseline deleted file mode 100644 index 274ac5a2f027..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/esm/test/gapic_test_service_v1.ts.baseline +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.TestServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testserviceModule.v1.TestServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testserviceModule.v1.TestServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testserviceModule.v1.TestServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testserviceModule.v1.TestServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testserviceModule.v1.TestServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testserviceModule.v1.TestServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testserviceModule.v1.TestServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testserviceModule.v1.TestServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testServiceStub, undefined); - await client.initialize(); - assert(client.testServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('fastFibonacci', () => { - it('invokes fastFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.fastFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.fastFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.fastFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fastFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.fastFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fastFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.fastFibonacci(request), expectedError); - }); - }); - - describe('randomFibonacci', () => { - it('invokes randomFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.randomFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.randomFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.randomFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.randomFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.randomFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.randomFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.randomFibonacci(request), expectedError); - }); - }); - - describe('slowFibonacci', () => { - it('invokes slowFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.slowFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.slowFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.slowFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.slowFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.slowFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.slowFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.slowFibonacci(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json deleted file mode 100644 index d4c5a67c414e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "routingtest", - "version": "0.1.0", - "description": "Routingtest client for Node.js", - "repository": "googleapis/nodejs-routingtest", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google routingtest", - "routingtest", - "test service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/routingtest/v1/routingtest_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/routingtest/v1/routingtest_service.proto.baseline deleted file mode 100644 index 6956405349ff..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/protos/google/routingtest/v1/routingtest_service.proto.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/routing.proto"; -import "google/protobuf/empty.proto"; - -package google.routingtest.v1; - -option java_package = "com.google.routingtest.v1"; -option java_multiple_files = true; - -// This is a service description. -// It takes up multiple lines, like so. -service TestService { - option (google.api.default_host) = "localhost:7469"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Calculates Fibonacci on the provided value, quickly. - rpc FastFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - // This routing annotation is only for baseline testing purposes. - option (google.api.http) = { - get: "/v1/{name=projects/*/databases/*/documents/*/**}" - }; - option (google.api.routing) = { - routing_parameters { - field: "name", - path_template: "{database=projects/*/databases/*}/documents" - } - }; - }; - - // Calculates Fibonacci on the provided value, randomly. - rpc RandomFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - // This routing annotation is only for baseline testing purposes. - option (google.api.routing) = { - routing_parameters { - field: "name" - } - routing_parameters { - field: "name" - path_template: "{routing_id=**}" - } - }; - }; - - - // Calculates Fibonacci on the provided value, slowly. - rpc SlowFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" - }; - // This routing annotation is only for baseline testing purposes. - option (google.api.routing) = { - routing_parameters { - field: "parent_id", - path_template: "{database=projects/*}" - } - routing_parameters { - field: "nest1.nest2.name_id", - path_template: "{database=projects/*/databases/*}/documents" - } - routing_parameters { - field: "another_parent_id", - path_template: "{routing_id=projects/*}/databases/*/documents" - } - }; - }; -} - -// This is a message description. -// Lorum ipsum dolor sit amet consectetur adipiscing elit. -message FibonacciRequest { - message Inner1{ - message Inner2{ - string name_id = 1; - } - Inner2 nest2 = 1; - } - Inner1 nest1 = 1; - // The nth term to retrieve in the Fibonacci sequence. - int32 value = 2; - // This is for testing the routing annotation. - string name = 3; - // This is for testing the routing annotation. - string parent_id = 4; - string another_parent_id = 5; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline deleted file mode 100644 index 0c4def31f7f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline +++ /dev/null @@ -1,183 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-routingtest", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.routingtest.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1_generated_TestService_FastFibonacci_async", - "title": "TestService fastFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, quickly.", - "canonical": true, - "file": "test_service.fast_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FastFibonacci", - "fullName": "google.routingtest.v1.TestService.FastFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "FastFibonacci", - "fullName": "google.routingtest.v1.TestService.FastFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_TestService_RandomFibonacci_async", - "title": "TestService randomFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, randomly.", - "canonical": true, - "file": "test_service.random_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RandomFibonacci", - "fullName": "google.routingtest.v1.TestService.RandomFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "RandomFibonacci", - "fullName": "google.routingtest.v1.TestService.RandomFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_TestService_SlowFibonacci_async", - "title": "TestService slowFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, slowly.", - "canonical": true, - "file": "test_service.slow_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SlowFibonacci", - "fullName": "google.routingtest.v1.TestService.SlowFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "SlowFibonacci", - "fullName": "google.routingtest.v1.TestService.SlowFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.fast_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.fast_fibonacci.js.baseline deleted file mode 100644 index e99c88c46447..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.fast_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_FastFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callFastFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.fastFibonacci(request); - console.log(response); - } - - callFastFibonacci(); - // [END localhost_v1_generated_TestService_FastFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.random_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.random_fibonacci.js.baseline deleted file mode 100644 index c23e5a4fc269..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.random_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_RandomFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callRandomFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.randomFibonacci(request); - console.log(response); - } - - callRandomFibonacci(); - // [END localhost_v1_generated_TestService_RandomFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.slow_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.slow_fibonacci.js.baseline deleted file mode 100644 index a0ae88bd7742..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/samples/generated/v1/test_service.slow_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_SlowFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callSlowFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.slowFibonacci(request); - console.log(response); - } - - callSlowFibonacci(); - // [END localhost_v1_generated_TestService_SlowFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest-esm/webpack.config.cjs.baseline deleted file mode 100644 index 2ae70cdfddb4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TestService', - filename: './test-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.OwlBot.yaml.baseline deleted file mode 100644 index 90e875d0e420..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/routingtest/google-routingtest-nodejs - dest: /owl-bot-staging/google-routingtest - -api-name: routingtest \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.jsdoc.js.baseline deleted file mode 100644 index 00dab9025cf9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'routingtest', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/README.md.baseline deleted file mode 100644 index 7a1ca9041a98..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Routingtest: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/routingtest.svg)](https://www.npmjs.org/package/routingtest) - -Routingtest client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Routingtest Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/routingtest/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Routingtest API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install routingtest -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install routingtest@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-routingtest diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/package.json b/core/generator/gapic-generator-typescript/baselines/routingtest/package.json deleted file mode 100644 index 0ab0042ce5f7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "routingtest", - "version": "0.1.0", - "description": "Routingtest client for Node.js", - "repository": "googleapis/nodejs-routingtest", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google routingtest", - "routingtest", - "test service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/routingtest/v1/routingtest_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/routingtest/v1/routingtest_service.proto.baseline deleted file mode 100644 index 6956405349ff..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/protos/google/routingtest/v1/routingtest_service.proto.baseline +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/routing.proto"; -import "google/protobuf/empty.proto"; - -package google.routingtest.v1; - -option java_package = "com.google.routingtest.v1"; -option java_multiple_files = true; - -// This is a service description. -// It takes up multiple lines, like so. -service TestService { - option (google.api.default_host) = "localhost:7469"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Calculates Fibonacci on the provided value, quickly. - rpc FastFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - // This routing annotation is only for baseline testing purposes. - option (google.api.http) = { - get: "/v1/{name=projects/*/databases/*/documents/*/**}" - }; - option (google.api.routing) = { - routing_parameters { - field: "name", - path_template: "{database=projects/*/databases/*}/documents" - } - }; - }; - - // Calculates Fibonacci on the provided value, randomly. - rpc RandomFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - // This routing annotation is only for baseline testing purposes. - option (google.api.routing) = { - routing_parameters { - field: "name" - } - routing_parameters { - field: "name" - path_template: "{routing_id=**}" - } - }; - }; - - - // Calculates Fibonacci on the provided value, slowly. - rpc SlowFibonacci(FibonacciRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/databases/*/documents/*/**}/{collection_id}" - }; - // This routing annotation is only for baseline testing purposes. - option (google.api.routing) = { - routing_parameters { - field: "parent_id", - path_template: "{database=projects/*}" - } - routing_parameters { - field: "nest1.nest2.name_id", - path_template: "{database=projects/*/databases/*}/documents" - } - routing_parameters { - field: "another_parent_id", - path_template: "{routing_id=projects/*}/databases/*/documents" - } - }; - }; -} - -// This is a message description. -// Lorum ipsum dolor sit amet consectetur adipiscing elit. -message FibonacciRequest { - message Inner1{ - message Inner2{ - string name_id = 1; - } - Inner2 nest2 = 1; - } - Inner1 nest1 = 1; - // The nth term to retrieve in the Fibonacci sequence. - int32 value = 2; - // This is for testing the routing annotation. - string name = 3; - // This is for testing the routing annotation. - string parent_id = 4; - string another_parent_id = 5; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline deleted file mode 100644 index 0c4def31f7f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/snippet_metadata_google.routingtest.v1.json.baseline +++ /dev/null @@ -1,183 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-routingtest", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.routingtest.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1_generated_TestService_FastFibonacci_async", - "title": "TestService fastFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, quickly.", - "canonical": true, - "file": "test_service.fast_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FastFibonacci", - "fullName": "google.routingtest.v1.TestService.FastFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "FastFibonacci", - "fullName": "google.routingtest.v1.TestService.FastFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_TestService_RandomFibonacci_async", - "title": "TestService randomFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, randomly.", - "canonical": true, - "file": "test_service.random_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RandomFibonacci", - "fullName": "google.routingtest.v1.TestService.RandomFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "RandomFibonacci", - "fullName": "google.routingtest.v1.TestService.RandomFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - }, - { - "regionTag": "localhost_v1_generated_TestService_SlowFibonacci_async", - "title": "TestService slowFibonacci Sample", - "origin": "API_DEFINITION", - "description": " Calculates Fibonacci on the provided value, slowly.", - "canonical": true, - "file": "test_service.slow_fibonacci.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SlowFibonacci", - "fullName": "google.routingtest.v1.TestService.SlowFibonacci", - "async": true, - "parameters": [ - { - "name": "nest1", - "type": ".google.routingtest.v1.FibonacciRequest.Inner1" - }, - { - "name": "value", - "type": "TYPE_INT32" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "parent_id", - "type": "TYPE_STRING" - }, - { - "name": "another_parent_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "TestServiceClient", - "fullName": "google.routingtest.v1.TestServiceClient" - }, - "method": { - "shortName": "SlowFibonacci", - "fullName": "google.routingtest.v1.TestService.SlowFibonacci", - "service": { - "shortName": "TestService", - "fullName": "google.routingtest.v1.TestService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.fast_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.fast_fibonacci.js.baseline deleted file mode 100644 index e99c88c46447..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.fast_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_FastFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callFastFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.fastFibonacci(request); - console.log(response); - } - - callFastFibonacci(); - // [END localhost_v1_generated_TestService_FastFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.random_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.random_fibonacci.js.baseline deleted file mode 100644 index c23e5a4fc269..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.random_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_RandomFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callRandomFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.randomFibonacci(request); - console.log(response); - } - - callRandomFibonacci(); - // [END localhost_v1_generated_TestService_RandomFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.slow_fibonacci.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.slow_fibonacci.js.baseline deleted file mode 100644 index a0ae88bd7742..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/samples/generated/v1/test_service.slow_fibonacci.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1_generated_TestService_SlowFibonacci_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - */ - // const nest1 = {} - /** - * The nth term to retrieve in the Fibonacci sequence. - */ - // const value = 1234 - /** - * This is for testing the routing annotation. - */ - // const name = 'abc123' - /** - * This is for testing the routing annotation. - */ - // const parentId = 'abc123' - /** - */ - // const anotherParentId = 'abc123' - - // Imports the Routingtest library - const {TestServiceClient} = require('routingtest').v1; - - // Instantiates a client - const routingtestClient = new TestServiceClient(); - - async function callSlowFibonacci() { - // Construct request - const request = { - }; - - // Run request - const response = await routingtestClient.slowFibonacci(request); - console.log(response); - } - - callSlowFibonacci(); - // [END localhost_v1_generated_TestService_SlowFibonacci_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/src/index.ts.baseline deleted file mode 100644 index 3ab98078f086..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const TestServiceClient = v1.TestServiceClient; -type TestServiceClient = v1.TestServiceClient; -export {v1, TestServiceClient}; -export default {v1, TestServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/index.ts.baseline deleted file mode 100644 index ae9662f6819c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TestServiceClient} from './test_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client.ts.baseline deleted file mode 100644 index 1d459e685a19..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client.ts.baseline +++ /dev/null @@ -1,699 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/test_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './test_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This is a service description. - * It takes up multiple lines, like so. - * @class - * @memberof v1 - */ -export class TestServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('routingtest'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - testServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 TestServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.routingtest.v1.TestService', gapicConfig as gax.ClientConfig, - 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.testServiceStub) { - return this.testServiceStub; - } - - // Put together the "service stub" for - // google.routingtest.v1.TestService. - this.testServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.routingtest.v1.TestService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.routingtest.v1.TestService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testServiceStubMethods = - ['fastFibonacci', 'randomFibonacci', 'slowFibonacci']; - for (const methodName of testServiceStubMethods) { - const callPromise = this.testServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.testServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Calculates Fibonacci on the provided value, quickly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.fast_fibonacci.js - * region_tag:localhost_v1_generated_TestService_FastFibonacci_async - */ - fastFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - fastFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - fastFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/databases/[^/]+)/documents')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('fastFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('fastFibonacci response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.fastFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, - {}|undefined - ]) => { - this._log.info('fastFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, randomly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.random_fibonacci.js - * region_tag:localhost_v1_generated_TestService_RandomFibonacci_async - */ - randomFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - randomFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - randomFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - randomFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?.*)')); - if (match) { - const parameterValue = match.groups?.['name'] ?? fieldValue; - Object.assign(routingParameter, { name: parameterValue }); - } - } - } - { - const fieldValue = request.name; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('randomFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('randomFibonacci response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.randomFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, - {}|undefined - ]) => { - this._log.info('randomFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Calculates Fibonacci on the provided value, slowly. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.routingtest.v1.FibonacciRequest.Inner1} request.nest1 - * @param {number} request.value - * The nth term to retrieve in the Fibonacci sequence. - * @param {string} request.name - * This is for testing the routing annotation. - * @param {string} request.parentId - * This is for testing the routing annotation. - * @param {string} request.anotherParentId - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/test_service.slow_fibonacci.js - * region_tag:localhost_v1_generated_TestService_SlowFibonacci_async - */ - slowFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>; - slowFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request: protos.google.routingtest.v1.IFibonacciRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): void; - slowFibonacci( - request?: protos.google.routingtest.v1.IFibonacciRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.parentId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - { - const fieldValue = request.nest1?.nest2?.nameId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/databases/[^/]+)/documents')); - if (match) { - const parameterValue = match.groups?.['database'] ?? fieldValue; - Object.assign(routingParameter, { database: parameterValue }); - } - } - } - { - const fieldValue = request.anotherParentId; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)/databases/[^/]+/documents')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('slowFibonacci request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('slowFibonacci response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.slowFibonacci(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.routingtest.v1.IFibonacciRequest|undefined, - {}|undefined - ]) => { - this._log.info('slowFibonacci response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testServiceStub && !this._terminated) { - return this.testServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client_config.json.baseline deleted file mode 100644 index 63de77a7c3a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.routingtest.v1.TestService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "FastFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RandomFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SlowFibonacci": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_proto_list.json.baseline deleted file mode 100644 index e6c98404d946..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/src/v1/test_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/routingtest/v1/routingtest_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 11226a0d230d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const routingtest = require('routingtest'); - -function main() { - const testServiceClient = new routingtest.TestServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 2064c65d4c0c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {TestServiceClient} from 'routingtest'; - -// check that the client class type name can be used -function doStuffWithTestServiceClient(client: TestServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const testServiceClient = new TestServiceClient(); - doStuffWithTestServiceClient(testServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/test/gapic_test_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/test/gapic_test_service_v1.ts.baseline deleted file mode 100644 index 8a360496e13f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/test/gapic_test_service_v1.ts.baseline +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.TestServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testserviceModule.v1.TestServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testserviceModule.v1.TestServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testserviceModule.v1.TestServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testserviceModule.v1.TestServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testserviceModule.v1.TestServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testserviceModule.v1.TestServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testserviceModule.v1.TestServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testserviceModule.v1.TestServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testServiceStub, undefined); - await client.initialize(); - assert(client.testServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('fastFibonacci', () => { - it('invokes fastFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.fastFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.fastFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.fastFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fastFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'database=projects%2Fvalue%2Fdatabases%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.fastFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fastFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fastFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fastFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {database=projects/*/databases/*}/documents - request.name = 'projects/value/databases/value/documents'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.fastFibonacci(request), expectedError); - }); - }); - - describe('randomFibonacci', () => { - it('invokes randomFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.randomFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.randomFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.randomFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.randomFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedHeaderRequestParams = 'routing_id=value'; - const expectedError = new Error('expected'); - client.innerApiCalls.randomFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.randomFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.randomFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes randomFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=**} - request.name = 'value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.randomFibonacci(request), expectedError); - }); - }); - - describe('slowFibonacci', () => { - it('invokes slowFibonacci without error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.slowFibonacci = stubSimpleCall(expectedResponse); - const [response] = await client.slowFibonacci(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci without error using callback', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.slowFibonacci = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.slowFibonacci( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci with error', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedHeaderRequestParams = 'routing_id=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.slowFibonacci = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.slowFibonacci(request), expectedError); - const actualRequest = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.slowFibonacci as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes slowFibonacci with closed client', async () => { - const client = new testserviceModule.v1.TestServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.routingtest.v1.FibonacciRequest() - ); - // path template: {routing_id=projects/*}/databases/*/documents - request.anotherParentId = 'projects/value/databases/value/documents'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.slowFibonacci(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/routingtest/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/routingtest/webpack.config.js.baseline deleted file mode 100644 index 2ae70cdfddb4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/routingtest/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TestService', - filename: './test-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 0b1a54f4109e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/README.md.baseline deleted file mode 100644 index a917f8a6a614..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Client Libraries Showcase API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Client Libraries Showcase API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Client Libraries Showcase API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Client Libraries Showcase API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/index.ts.baseline deleted file mode 100644 index 485391ab99b2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const ComplianceClient = v1beta1.ComplianceClient; -type ComplianceClient = v1beta1.ComplianceClient; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -const IdentityClient = v1beta1.IdentityClient; -type IdentityClient = v1beta1.IdentityClient; -const MessagingClient = v1beta1.MessagingClient; -type MessagingClient = v1beta1.MessagingClient; -const SequenceServiceClient = v1beta1.SequenceServiceClient; -type SequenceServiceClient = v1beta1.SequenceServiceClient; -const TestingClient = v1beta1.TestingClient; -type TestingClient = v1beta1.TestingClient; -export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client.ts.baseline deleted file mode 100644 index af5997018d20..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client.ts.baseline +++ /dev/null @@ -1,1795 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as compliance_client_config from './compliance_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/compliance_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'compliance_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format - * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped - * correctly. - * @class - * @memberof v1beta1 - */ -export class ComplianceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - complianceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ComplianceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 ComplianceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ComplianceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, - 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.complianceStub) { - return this.complianceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Compliance. - this.complianceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Compliance, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const complianceStubMethods = - ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; - for (const methodName of complianceStubMethods) { - const callPromise = this.complianceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.complianceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * This method echoes the ComplianceData request. This method exercises - * sending the entire request object in the REST body. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async - */ - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBody request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBody response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBody(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBody response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending the a message-type field in the REST body. Per AIP-127, only - * top-level, non-repeated fields can be sent this way. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async - */ - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyInfo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyInfo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyInfo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyInfo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending all request fields as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async - */ - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataQuery request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataQuery response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending some parameters as "simple" path variables (i.e., of the form - * "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async - */ - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_int32': request.info!.fInt32 ?? '', - 'info.f_double': request.info!.fDouble ?? '', - 'info.f_bool': request.info!.fBool ?? '', - 'info.f_kingdom': request.info!.fKingdom ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataSimplePath request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataSimplePath response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataSimplePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataSimplePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a path resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async - */ - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - 'info.f_bool': request.info!.fBool ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathResource response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataPathResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataPathResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a trailing resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async - */ - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathTrailingResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataPathTrailingResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PUT method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async - */ - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPut request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPut response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyPut(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyPut response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PATCH method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async - */ - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPatch request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPatch response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.repeatDataBodyPatch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]) => { - this._log.info('repeatDataBodyPatch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - * response from this RPC as the request to VerifyEnum() - * - * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {boolean} request.unknownEnum - * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.get_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async - */ - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('getEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getEnum response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]) => { - this._log.info('getEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - * with the same EnumResponse; otherwise, the RPC errors. - * - * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - * although they are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.EnumRequest} request.request - * The original request for a known or unknown enum from the server. - * @param {google.showcase.v1beta1.Continent} request.continent - * The actual enum the server provided. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.verify_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async - */ - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('verifyEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyEnum response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.verifyEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]) => { - this._log.info('verifyEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.complianceStub && !this._terminated) { - return this.complianceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client_config.json.baseline deleted file mode 100644 index 43582a4ff828..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Compliance": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "RepeatDataBody": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyInfo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataQuery": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataSimplePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathTrailingResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPut": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/compliance_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index c4105b158a90..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1700 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as echo_client_config from './echo_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'echo_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 EchoClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - if (!request.requestId) { - request.requestId = gax.makeUUID(); - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/gapic_metadata.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/gapic_metadata.json.baseline deleted file mode 100644 index 21a8c17c76b9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/gapic_metadata.json.baseline +++ /dev/null @@ -1,592 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.showcase.v1beta1", - "libraryPackage": "showcase", - "services": { - "Compliance": { - "clients": { - "grpc": { - "libraryClient": "ComplianceClient", - "rpcs": { - "RepeatDataBody": { - "methods": [ - "repeatDataBody" - ] - }, - "RepeatDataBodyInfo": { - "methods": [ - "repeatDataBodyInfo" - ] - }, - "RepeatDataQuery": { - "methods": [ - "repeatDataQuery" - ] - }, - "RepeatDataSimplePath": { - "methods": [ - "repeatDataSimplePath" - ] - }, - "RepeatDataPathResource": { - "methods": [ - "repeatDataPathResource" - ] - }, - "RepeatDataPathTrailingResource": { - "methods": [ - "repeatDataPathTrailingResource" - ] - }, - "RepeatDataBodyPut": { - "methods": [ - "repeatDataBodyPut" - ] - }, - "RepeatDataBodyPatch": { - "methods": [ - "repeatDataBodyPatch" - ] - }, - "GetEnum": { - "methods": [ - "getEnum" - ] - }, - "VerifyEnum": { - "methods": [ - "verifyEnum" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ComplianceClient", - "rpcs": { - "RepeatDataBody": { - "methods": [ - "repeatDataBody" - ] - }, - "RepeatDataBodyInfo": { - "methods": [ - "repeatDataBodyInfo" - ] - }, - "RepeatDataQuery": { - "methods": [ - "repeatDataQuery" - ] - }, - "RepeatDataSimplePath": { - "methods": [ - "repeatDataSimplePath" - ] - }, - "RepeatDataPathResource": { - "methods": [ - "repeatDataPathResource" - ] - }, - "RepeatDataPathTrailingResource": { - "methods": [ - "repeatDataPathTrailingResource" - ] - }, - "RepeatDataBodyPut": { - "methods": [ - "repeatDataBodyPut" - ] - }, - "RepeatDataBodyPatch": { - "methods": [ - "repeatDataBodyPatch" - ] - }, - "GetEnum": { - "methods": [ - "getEnum" - ] - }, - "VerifyEnum": { - "methods": [ - "verifyEnum" - ] - } - } - } - } - }, - "Echo": { - "apiVersion": "v1_20240408", - "clients": { - "grpc": { - "libraryClient": "EchoClient", - "rpcs": { - "Echo": { - "methods": [ - "echo" - ] - }, - "EchoErrorDetails": { - "methods": [ - "echoErrorDetails" - ] - }, - "PagedExpandLegacy": { - "methods": [ - "pagedExpandLegacy" - ] - }, - "Block": { - "methods": [ - "block" - ] - }, - "Expand": { - "methods": [ - "expand" - ] - }, - "Collect": { - "methods": [ - "collect" - ] - }, - "Chat": { - "methods": [ - "chat" - ] - }, - "Wait": { - "methods": [ - "wait" - ] - }, - "PagedExpand": { - "methods": [ - "pagedExpand", - "pagedExpandStream", - "pagedExpandAsync" - ] - }, - "PagedExpandLegacyMapped": { - "methods": [ - "pagedExpandLegacyMapped", - "pagedExpandLegacyMappedStream", - "pagedExpandLegacyMappedAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EchoClient", - "rpcs": { - "Echo": { - "methods": [ - "echo" - ] - }, - "EchoErrorDetails": { - "methods": [ - "echoErrorDetails" - ] - }, - "PagedExpandLegacy": { - "methods": [ - "pagedExpandLegacy" - ] - }, - "Block": { - "methods": [ - "block" - ] - }, - "Wait": { - "methods": [ - "wait" - ] - }, - "PagedExpand": { - "methods": [ - "pagedExpand", - "pagedExpandStream", - "pagedExpandAsync" - ] - }, - "PagedExpandLegacyMapped": { - "methods": [ - "pagedExpandLegacyMapped", - "pagedExpandLegacyMappedStream", - "pagedExpandLegacyMappedAsync" - ] - } - } - } - } - }, - "Identity": { - "clients": { - "grpc": { - "libraryClient": "IdentityClient", - "rpcs": { - "CreateUser": { - "methods": [ - "createUser" - ] - }, - "GetUser": { - "methods": [ - "getUser" - ] - }, - "UpdateUser": { - "methods": [ - "updateUser" - ] - }, - "DeleteUser": { - "methods": [ - "deleteUser" - ] - }, - "ListUsers": { - "methods": [ - "listUsers", - "listUsersStream", - "listUsersAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IdentityClient", - "rpcs": { - "CreateUser": { - "methods": [ - "createUser" - ] - }, - "GetUser": { - "methods": [ - "getUser" - ] - }, - "UpdateUser": { - "methods": [ - "updateUser" - ] - }, - "DeleteUser": { - "methods": [ - "deleteUser" - ] - }, - "ListUsers": { - "methods": [ - "listUsers", - "listUsersStream", - "listUsersAsync" - ] - } - } - } - } - }, - "Messaging": { - "clients": { - "grpc": { - "libraryClient": "MessagingClient", - "rpcs": { - "CreateRoom": { - "methods": [ - "createRoom" - ] - }, - "GetRoom": { - "methods": [ - "getRoom" - ] - }, - "UpdateRoom": { - "methods": [ - "updateRoom" - ] - }, - "DeleteRoom": { - "methods": [ - "deleteRoom" - ] - }, - "CreateBlurb": { - "methods": [ - "createBlurb" - ] - }, - "GetBlurb": { - "methods": [ - "getBlurb" - ] - }, - "UpdateBlurb": { - "methods": [ - "updateBlurb" - ] - }, - "DeleteBlurb": { - "methods": [ - "deleteBlurb" - ] - }, - "StreamBlurbs": { - "methods": [ - "streamBlurbs" - ] - }, - "SendBlurbs": { - "methods": [ - "sendBlurbs" - ] - }, - "Connect": { - "methods": [ - "connect" - ] - }, - "SearchBlurbs": { - "methods": [ - "searchBlurbs" - ] - }, - "ListRooms": { - "methods": [ - "listRooms", - "listRoomsStream", - "listRoomsAsync" - ] - }, - "ListBlurbs": { - "methods": [ - "listBlurbs", - "listBlurbsStream", - "listBlurbsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MessagingClient", - "rpcs": { - "CreateRoom": { - "methods": [ - "createRoom" - ] - }, - "GetRoom": { - "methods": [ - "getRoom" - ] - }, - "UpdateRoom": { - "methods": [ - "updateRoom" - ] - }, - "DeleteRoom": { - "methods": [ - "deleteRoom" - ] - }, - "CreateBlurb": { - "methods": [ - "createBlurb" - ] - }, - "GetBlurb": { - "methods": [ - "getBlurb" - ] - }, - "UpdateBlurb": { - "methods": [ - "updateBlurb" - ] - }, - "DeleteBlurb": { - "methods": [ - "deleteBlurb" - ] - }, - "SearchBlurbs": { - "methods": [ - "searchBlurbs" - ] - }, - "ListRooms": { - "methods": [ - "listRooms", - "listRoomsStream", - "listRoomsAsync" - ] - }, - "ListBlurbs": { - "methods": [ - "listBlurbs", - "listBlurbsStream", - "listBlurbsAsync" - ] - } - } - } - } - }, - "SequenceService": { - "clients": { - "grpc": { - "libraryClient": "SequenceServiceClient", - "rpcs": { - "CreateSequence": { - "methods": [ - "createSequence" - ] - }, - "GetSequenceReport": { - "methods": [ - "getSequenceReport" - ] - }, - "AttemptSequence": { - "methods": [ - "attemptSequence" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SequenceServiceClient", - "rpcs": { - "CreateSequence": { - "methods": [ - "createSequence" - ] - }, - "GetSequenceReport": { - "methods": [ - "getSequenceReport" - ] - }, - "AttemptSequence": { - "methods": [ - "attemptSequence" - ] - } - } - } - } - }, - "Testing": { - "clients": { - "grpc": { - "libraryClient": "TestingClient", - "rpcs": { - "CreateSession": { - "methods": [ - "createSession" - ] - }, - "GetSession": { - "methods": [ - "getSession" - ] - }, - "DeleteSession": { - "methods": [ - "deleteSession" - ] - }, - "ReportSession": { - "methods": [ - "reportSession" - ] - }, - "DeleteTest": { - "methods": [ - "deleteTest" - ] - }, - "VerifyTest": { - "methods": [ - "verifyTest" - ] - }, - "ListSessions": { - "methods": [ - "listSessions", - "listSessionsStream", - "listSessionsAsync" - ] - }, - "ListTests": { - "methods": [ - "listTests", - "listTestsStream", - "listTestsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TestingClient", - "rpcs": { - "CreateSession": { - "methods": [ - "createSession" - ] - }, - "GetSession": { - "methods": [ - "getSession" - ] - }, - "DeleteSession": { - "methods": [ - "deleteSession" - ] - }, - "ReportSession": { - "methods": [ - "reportSession" - ] - }, - "DeleteTest": { - "methods": [ - "deleteTest" - ] - }, - "VerifyTest": { - "methods": [ - "verifyTest" - ] - }, - "ListSessions": { - "methods": [ - "listSessions", - "listSessionsStream", - "listSessionsAsync" - ] - }, - "ListTests": { - "methods": [ - "listTests", - "listTestsStream", - "listTestsAsync" - ] - } - } - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client.ts.baseline deleted file mode 100644 index 8dfc40a7ac0d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client.ts.baseline +++ /dev/null @@ -1,1327 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as identity_client_config from './identity_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/identity_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'identity_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A simple identity service. - * @class - * @memberof v1beta1 - */ -export class IdentityClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - identityStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 IdentityClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listUsers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'users') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Identity', gapicConfig as gax.ClientConfig, - 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.identityStub) { - return this.identityStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Identity. - this.identityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Identity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Identity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const identityStubMethods = - ['createUser', 'getUser', 'updateUser', 'deleteUser', 'listUsers']; - for (const methodName of identityStubMethods) { - const callPromise = this.identityStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.identityStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.create_user.js - * region_tag:localhost_v1beta1_generated_Identity_CreateUser_async - */ - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]) => { - this._log.info('createUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the User with the given uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested user. - * @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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.get_user.js - * region_tag:localhost_v1beta1_generated_Identity_GetUser_async - */ - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]) => { - this._log.info('getUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.update_user.js - * region_tag:localhost_v1beta1_generated_Identity_UpdateUser_async - */ - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'user.name': request.user!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]) => { - this._log.info('updateUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a user, their profile, and all of their authored messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the user to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.delete_user.js - * region_tag:localhost_v1beta1_generated_Identity_DeleteUser_async - */ - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUser request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUser response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all users. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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 Array of {@link protos.google.showcase.v1beta1.User|User}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUsersAsync()` - * 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. - */ - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUsers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listUsers request %j', request); - return this.innerApiCalls - .listUsers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]) => { - this._log.info('listUsers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUsers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User} 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 `listUsersAsync()` - * 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. - */ - listUsersStream( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers stream %j', request); - return this.descriptors.page.listUsers.createStream( - this.innerApiCalls.listUsers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsers`, 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 {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User}. 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 include:samples/generated/v1beta1/identity.list_users.js - * region_tag:localhost_v1beta1_generated_Identity_ListUsers_async - */ - listUsersAsync( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers iterate %j', request); - return this.descriptors.page.listUsers.asyncIterate( - this.innerApiCalls['listUsers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.identityStub && !this._terminated) { - return this.identityStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client_config.json.baseline deleted file mode 100644 index 3a162c29cdc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Identity": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/identity_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index 3a94be5d9834..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {ComplianceClient} from './compliance_client.js'; -export {EchoClient} from './echo_client.js'; -export {IdentityClient} from './identity_client.js'; -export {MessagingClient} from './messaging_client.js'; -export {SequenceServiceClient} from './sequence_service_client.js'; -export {TestingClient} from './testing_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client.ts.baseline deleted file mode 100644 index 23e4c9dce498..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client.ts.baseline +++ /dev/null @@ -1,2193 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as messaging_client_config from './messaging_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/messaging_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'messaging_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A simple messaging service that implements chat rooms and profile posts. - * - * This messaging service showcases the features that API clients - * generated by gapic-generators implement. - * @class - * @memberof v1beta1 - */ -export class MessagingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - messagingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MessagingClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 MessagingClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MessagingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listRooms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rooms'), - listBlurbs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'blurbs') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const searchBlurbsResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsResponse') as gax.protobuf.Type; - const searchBlurbsMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - searchBlurbs: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - searchBlurbsResponse.decode.bind(searchBlurbsResponse), - searchBlurbsMetadata.decode.bind(searchBlurbsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Messaging', gapicConfig as gax.ClientConfig, - 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.messagingStub) { - return this.messagingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Messaging. - this.messagingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Messaging') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Messaging, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const messagingStubMethods = - ['createRoom', 'getRoom', 'updateRoom', 'deleteRoom', 'listRooms', 'createBlurb', 'getBlurb', 'updateBlurb', 'deleteBlurb', 'listBlurbs', 'searchBlurbs', 'streamBlurbs', 'sendBlurbs', 'connect']; - for (const methodName of messagingStubMethods) { - const callPromise = this.messagingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.messagingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_room.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateRoom_async - */ - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('createRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Room with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_room.js - * region_tag:localhost_v1beta1_generated_Messaging_GetRoom_async - */ - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('getRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_room.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateRoom_async - */ - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'room.name': request.room!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('updateRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a room and all of its blurbs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_room.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteRoom_async - */ - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoom request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoom response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a blurb. If the parent is a room, the blurb is understood to be a - * message in that room. If the parent is a profile, the blurb is understood - * to be a post on the profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the chat room or user profile that this blurb will - * be tied to. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateBlurb_async - */ - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('createBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Blurb with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_GetBlurb_async - */ - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('getBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateBlurb_async - */ - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'blurb.name': request.blurb!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('updateBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteBlurb_async - */ - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBlurb response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This returns a stream that emits the blurbs that are created for a - * particular chat room or user profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of a chat room or user profile whose blurbs to stream. - * @param {google.protobuf.Timestamp} request.expireTime - * The time at which this stream will close. - * @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 {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.stream_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_StreamBlurbs_async - */ - streamBlurbs( - request?: protos.google.showcase.v1beta1.IStreamBlurbsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('streamBlurbs stream %j', options); - return this.innerApiCalls.streamBlurbs(request, options); - } - -/** - * This is a stream to create multiple blurbs. If an invalid blurb is - * requested to be created, the stream will close with an error. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.CreateBlurbRequest|CreateBlurbRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.send_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SendBlurbs_async - */ - sendBlurbs( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('sendBlurbs stream %j', options); - return this.innerApiCalls.sendBlurbs(null, options, callback); - } - -/** - * This method starts a bidirectional stream that receives all blurbs that - * are being created after the stream has started and sends requests to create - * blurbs. If an invalid blurb is requested to be created, the stream will - * close with an error. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.ConnectRequest|ConnectRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.connect.js - * region_tag:localhost_v1beta1_generated_Messaging_Connect_async - */ - connect( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('connect stream %j', options); - return this.innerApiCalls.connect(null, options); - } - -/** - * This method searches through all blurbs across all rooms and profiles - * for blurbs containing to words found in the query. Only posts that - * contain an exact match of a queried word will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.query - * The query used to search for blurbs containing to words of this string. - * Only posts that contain an exact match of a queried word will be returned. - * @param {string} request.parent - * The rooms or profiles to search. If unset, `SearchBlurbs` will search all - * rooms and all profiles. - * @param {number} request.pageSize - * The maximum number of blurbs return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of - * google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('searchBlurbs response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('searchBlurbs request %j', request); - return this.innerApiCalls.searchBlurbs(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('searchBlurbs response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `searchBlurbs()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - async checkSearchBlurbsProgress(name: string): Promise>{ - this._log.info('searchBlurbs long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.searchBlurbs, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all chat rooms. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Room|Room}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoomsAsync()` - * 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. - */ - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRooms values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listRooms request %j', request); - return this.innerApiCalls - .listRooms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]) => { - this._log.info('listRooms values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRooms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room} 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 `listRoomsAsync()` - * 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. - */ - listRoomsStream( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms stream %j', request); - return this.descriptors.page.listRooms.createStream( - this.innerApiCalls.listRooms as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRooms`, 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 {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room}. 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 include:samples/generated/v1beta1/messaging.list_rooms.js - * region_tag:localhost_v1beta1_generated_Messaging_ListRooms_async - */ - listRoomsAsync( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms iterate %j', request); - return this.descriptors.page.listRooms.asyncIterate( - this.innerApiCalls['listRooms'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists blurbs for a specific chat room or user profile depending on the - * parent resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBlurbsAsync()` - * 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. - */ - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBlurbs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listBlurbs request %j', request); - return this.innerApiCalls - .listBlurbs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]) => { - this._log.info('listBlurbs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBlurbs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb} 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 `listBlurbsAsync()` - * 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. - */ - listBlurbsStream( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs stream %j', request); - return this.descriptors.page.listBlurbs.createStream( - this.innerApiCalls.listBlurbs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBlurbs`, 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 - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb}. 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 include:samples/generated/v1beta1/messaging.list_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_ListBlurbs_async - */ - listBlurbsAsync( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs iterate %j', request); - return this.descriptors.page.listBlurbs.asyncIterate( - this.innerApiCalls['listBlurbs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.messagingStub && !this._terminated) { - return this.messagingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client_config.json.baseline deleted file mode 100644 index 551a130c2342..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_client_config.json.baseline +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Messaging": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRooms": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SearchBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StreamBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Connect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/messaging_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client.ts.baseline deleted file mode 100644 index d4751443cbb4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client.ts.baseline +++ /dev/null @@ -1,1039 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as sequence_service_client_config from './sequence_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/sequence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'sequence_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * @class - * @memberof v1beta1 - */ -export class SequenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sequenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SequenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 SequenceServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SequenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, - 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.sequenceServiceStub) { - return this.sequenceServiceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.SequenceService. - this.sequenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.SequenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sequenceServiceStubMethods = - ['createSequence', 'getSequenceReport', 'attemptSequence']; - for (const methodName of sequenceServiceStubMethods) { - const callPromise = this.sequenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sequenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Sequence} request.sequence - * @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 {@link protos.google.showcase.v1beta1.Sequence|Sequence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async - */ - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSequence request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSequence response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]) => { - this._log.info('createSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.showcase.v1beta1.SequenceReport|SequenceReport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js - * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async - */ - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSequenceReport request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSequenceReport response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSequenceReport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]) => { - this._log.info('getSequenceReport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Attempts a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async - */ - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('attemptSequence request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('attemptSequence response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.attemptSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]) => { - this._log.info('attemptSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sequenceServiceStub && !this._terminated) { - return this.sequenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline deleted file mode 100644 index 77c80d32a901..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.SequenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSequenceReport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttemptSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/sequence_service_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client.ts.baseline deleted file mode 100644 index d176ece1e950..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client.ts.baseline +++ /dev/null @@ -1,1711 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as testing_client_config from './testing_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/testing_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'testing_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * A service to facilitate running discrete sets of tests - * against Showcase. - * @class - * @memberof v1beta1 - */ -export class TestingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - testingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestingClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TestingClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listSessions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessions'), - listTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tests') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Testing', gapicConfig as gax.ClientConfig, - 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.testingStub) { - return this.testingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Testing. - this.testingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Testing') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Testing, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testingStubMethods = - ['createSession', 'getSession', 'listSessions', 'deleteSession', 'reportSession', 'listTests', 'deleteTest', 'verifyTest']; - for (const methodName of testingStubMethods) { - const callPromise = this.testingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.testingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Session} request.session - * The session to be created. - * Sessions are immutable once they are created (although they can - * be deleted). - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.create_session.js - * region_tag:localhost_v1beta1_generated_Testing_CreateSession_async - */ - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('createSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be retrieved. - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.get_session.js - * region_tag:localhost_v1beta1_generated_Testing_GetSession_async - */ - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('getSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete a test session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_session.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteSession_async - */ - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSession request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Report on the status of a session. - * This generates a report detailing which tests have been completed, - * and an overall rollup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be reported on. - * @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 {@link protos.google.showcase.v1beta1.ReportSessionResponse|ReportSessionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.report_session.js - * region_tag:localhost_v1beta1_generated_Testing_ReportSession_async - */ - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reportSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reportSession response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.reportSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]) => { - this._log.info('reportSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Explicitly decline to implement a test. - * - * This removes the test from subsequent `ListTests` calls, and - * attempting to do the test will error. - * - * This method will error if attempting to delete a required test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_test.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteTest_async - */ - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTest request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTest response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Register a response to a test. - * - * In cases where a test involves registering a final answer at the - * end of the test, this method provides the means to do so. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to have an answer registered to it. - * @param {Buffer} request.answer - * The answer from the test. - * @param {Buffer[]} request.answers - * The answers from the test if multiple are to be checked - * @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 {@link protos.google.showcase.v1beta1.VerifyTestResponse|VerifyTestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.verify_test.js - * region_tag:localhost_v1beta1_generated_Testing_VerifyTest_async - */ - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyTest request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyTest response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.verifyTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]) => { - this._log.info('verifyTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the current test sessions. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Session|Session}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionsAsync()` - * 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. - */ - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSessions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listSessions request %j', request); - return this.innerApiCalls - .listSessions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]) => { - this._log.info('listSessions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSessions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session} 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 `listSessionsAsync()` - * 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. - */ - listSessionsStream( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions stream %j', request); - return this.descriptors.page.listSessions.createStream( - this.innerApiCalls.listSessions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessions`, 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 {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session}. 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 include:samples/generated/v1beta1/testing.list_sessions.js - * region_tag:localhost_v1beta1_generated_Testing_ListSessions_async - */ - listSessionsAsync( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions iterate %j', request); - return this.descriptors.page.listSessions.asyncIterate( - this.innerApiCalls['listSessions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the tests of a sessesion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Test|Test}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTestsAsync()` - * 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. - */ - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTests values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listTests request %j', request); - return this.innerApiCalls - .listTests(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]) => { - this._log.info('listTests values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTests`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test} 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 `listTestsAsync()` - * 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. - */ - listTestsStream( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests stream %j', request); - return this.descriptors.page.listTests.createStream( - this.innerApiCalls.listTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTests`, 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 - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test}. 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 include:samples/generated/v1beta1/testing.list_tests.js - * region_tag:localhost_v1beta1_generated_Testing_ListTests_async - */ - listTestsAsync( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests iterate %j', request); - return this.descriptors.page.listTests.asyncIterate( - this.innerApiCalls['listTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testingStub && !this._terminated) { - return this.testingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client_config.json.baseline deleted file mode 100644 index 03815dc3f5e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Testing": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSessions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReportSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTests": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/src/v1beta1/testing_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index acd7e61b97d1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const showcase = require('showcase'); - -function main() { - const complianceClient = new showcase.ComplianceClient(); - const echoClient = new showcase.EchoClient(); - const identityClient = new showcase.IdentityClient(); - const messagingClient = new showcase.MessagingClient(); - const sequenceServiceClient = new showcase.SequenceServiceClient(); - const testingClient = new showcase.TestingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 156c00af163e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as showcase from 'showcase'; - -function main() { - const complianceClient = new showcase.ComplianceClient(); - const echoClient = new showcase.EchoClient(); - const identityClient = new showcase.IdentityClient(); - const messagingClient = new showcase.MessagingClient(); - const sequenceServiceClient = new showcase.SequenceServiceClient(); - const testingClient = new showcase.TestingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 54230b252a83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,63 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient} from 'showcase'; - -// check that the client class type name can be used -function doStuffWithComplianceClient(client: ComplianceClient) { - client.close(); -} -function doStuffWithEchoClient(client: EchoClient) { - client.close(); -} -function doStuffWithIdentityClient(client: IdentityClient) { - client.close(); -} -function doStuffWithMessagingClient(client: MessagingClient) { - client.close(); -} -function doStuffWithSequenceServiceClient(client: SequenceServiceClient) { - client.close(); -} -function doStuffWithTestingClient(client: TestingClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const complianceClient = new ComplianceClient(); - doStuffWithComplianceClient(complianceClient); - // check that the client instance can be created - const echoClient = new EchoClient(); - doStuffWithEchoClient(echoClient); - // check that the client instance can be created - const identityClient = new IdentityClient(); - doStuffWithIdentityClient(identityClient); - // check that the client instance can be created - const messagingClient = new MessagingClient(); - doStuffWithMessagingClient(messagingClient); - // check that the client instance can be created - const sequenceServiceClient = new SequenceServiceClient(); - doStuffWithSequenceServiceClient(sequenceServiceClient); - // check that the client instance can be created - const testingClient = new TestingClient(); - doStuffWithTestingClient(testingClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_compliance_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_compliance_v1beta1.ts.baseline deleted file mode 100644 index 7403c5712d59..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_compliance_v1beta1.ts.baseline +++ /dev/null @@ -1,1568 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as complianceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.ComplianceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new complianceModule.v1beta1.ComplianceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = complianceModule.v1beta1.ComplianceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - await client.initialize(); - assert(client.complianceStub); - }); - - it('has close method for the initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.complianceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('repeatDataBody', () => { - it('invokes repeatDataBody without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBody(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBody( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - - it('invokes repeatDataBody with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - }); - - describe('repeatDataBodyInfo', () => { - it('invokes repeatDataBodyInfo without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyInfo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyInfo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - - it('invokes repeatDataBodyInfo with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - }); - - describe('repeatDataQuery', () => { - it('invokes repeatDataQuery without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataQuery(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataQuery( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - - it('invokes repeatDataQuery with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - }); - - describe('repeatDataSimplePath', () => { - it('invokes repeatDataSimplePath without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataSimplePath(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataSimplePath( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - }); - }); - - describe('repeatDataPathResource', () => { - it('invokes repeatDataPathResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - }); - }); - - describe('repeatDataPathTrailingResource', () => { - it('invokes repeatDataPathTrailingResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathTrailingResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathTrailingResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - }); - }); - - describe('repeatDataBodyPut', () => { - it('invokes repeatDataBodyPut without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPut(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPut( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - - it('invokes repeatDataBodyPut with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - }); - - describe('repeatDataBodyPatch', () => { - it('invokes repeatDataBodyPatch without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPatch(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPatch( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - - it('invokes repeatDataBodyPatch with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - }); - - describe('getEnum', () => { - it('invokes getEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); - const [response] = await client.getEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnum(request), expectedError); - }); - - it('invokes getEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEnum(request), expectedError); - }); - }); - - describe('verifyEnum', () => { - it('invokes verifyEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); - const [response] = await client.verifyEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - - it('invokes verifyEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index dbae7ddd07fc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1543 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new echoModule.v1beta1.EchoClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_identity_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_identity_v1beta1.ts.baseline deleted file mode 100644 index 2da43f67b837..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_identity_v1beta1.ts.baseline +++ /dev/null @@ -1,1212 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as identityModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.IdentityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = identityModule.v1beta1.IdentityClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = identityModule.v1beta1.IdentityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new identityModule.v1beta1.IdentityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = identityModule.v1beta1.IdentityClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityModule.v1beta1.IdentityClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityModule.v1beta1.IdentityClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - await client.initialize(); - assert(client.identityStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.identityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createUser', () => { - it('invokes createUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCall(expectedResponse); - const [response] = await client.createUser(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUser(request), expectedError); - }); - - it('invokes createUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUser(request), expectedError); - }); - }); - - describe('getUser', () => { - it('invokes getUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCall(expectedResponse); - const [response] = await client.getUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUser(request), expectedError); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUser(request), expectedError); - }); - }); - - describe('updateUser', () => { - it('invokes updateUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCall(expectedResponse); - const [response] = await client.updateUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUser(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUser(request), expectedError); - }); - }); - - describe('deleteUser', () => { - it('invokes deleteUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUser( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUser(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUser(request), expectedError); - }); - }); - - describe('listUsers', () => { - it('invokes listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCall(expectedResponse); - const [response] = await client.listUsers(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsers( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUsers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsers(request), expectedError); - }); - - it('invokes listUsersStream without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('invokes listUsersStream with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('uses async iteration with listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IUser[] = []; - const iterable = client.listUsersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IUser[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_messaging_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_messaging_v1beta1.ts.baseline deleted file mode 100644 index e65f87dfaf42..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_messaging_v1beta1.ts.baseline +++ /dev/null @@ -1,2364 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as messagingModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.MessagingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = messagingModule.v1beta1.MessagingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = messagingModule.v1beta1.MessagingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new messagingModule.v1beta1.MessagingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = messagingModule.v1beta1.MessagingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - await client.initialize(); - assert(client.messagingStub); - }); - - it('has close method for the initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.messagingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createRoom', () => { - it('invokes createRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCall(expectedResponse); - const [response] = await client.createRoom(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createRoom(request), expectedError); - }); - - it('invokes createRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createRoom(request), expectedError); - }); - }); - - describe('getRoom', () => { - it('invokes getRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCall(expectedResponse); - const [response] = await client.getRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoom(request), expectedError); - }); - }); - - describe('updateRoom', () => { - it('invokes updateRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoom(request), expectedError); - }); - }); - - describe('deleteRoom', () => { - it('invokes deleteRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoom( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoom(request), expectedError); - }); - }); - - describe('createBlurb', () => { - it('invokes createBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.createBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBlurb(request), expectedError); - }); - }); - - describe('getBlurb', () => { - it('invokes getBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.getBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBlurb(request), expectedError); - }); - }); - - describe('updateBlurb', () => { - it('invokes updateBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.updateBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBlurb(request), expectedError); - }); - }); - - describe('deleteBlurb', () => { - it('invokes deleteBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBlurb( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBlurb(request), expectedError); - }); - }); - - describe('searchBlurbs', () => { - it('invokes searchBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(expectedResponse); - const [operation] = await client.searchBlurbs(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchBlurbs( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with call error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.searchBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with LRO error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.searchBlurbs(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSearchBlurbsProgress without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSearchBlurbsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSearchBlurbsProgress with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSearchBlurbsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('streamBlurbs', () => { - it('invokes streamBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs without error and gaxServerStreamingRetries enabled', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(undefined, expectedError); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('connect', () => { - it('invokes connect without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.connect = stubBidiStreamingCall(expectedResponse); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes connect with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.connect = stubBidiStreamingCall(undefined, expectedError); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('sendBlurbs', () => { - it('invokes sendBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SendBlurbsResponse() - ); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes sendBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('listRooms', () => { - it('invokes listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCall(expectedResponse); - const [response] = await client.listRooms(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRooms( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listRooms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRooms(request), expectedError); - }); - - it('invokes listRoomsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('invokes listRoomsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('uses async iteration with listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - const iterable = client.listRoomsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoomsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listBlurbs', () => { - it('invokes listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCall(expectedResponse); - const [response] = await client.listBlurbs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBlurbs( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBlurbs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBlurbsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - const iterable = client.listBlurbsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBlurbsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline deleted file mode 100644 index 6ad653d66ad9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_sequence_service_v1beta1.ts.baseline +++ /dev/null @@ -1,878 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as sequenceserviceModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.SequenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sequenceserviceModule.v1beta1.SequenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - await client.initialize(); - assert(client.sequenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sequenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSequence', () => { - it('invokes createSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); - const [response] = await client.createSequence(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSequence( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSequence(request), expectedError); - }); - - it('invokes createSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSequence(request), expectedError); - }); - }); - - describe('getSequenceReport', () => { - it('invokes getSequenceReport without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); - const [response] = await client.getSequenceReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSequenceReport( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSequenceReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSequenceReport(request), expectedError); - }); - }); - - describe('attemptSequence', () => { - it('invokes attemptSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); - const [response] = await client.attemptSequence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attemptSequence( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.attemptSequence(request), expectedError); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.attemptSequence(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_testing_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_testing_v1beta1.ts.baseline deleted file mode 100644 index f19fcdb3cbb3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/esm/test/gapic_testing_v1beta1.ts.baseline +++ /dev/null @@ -1,1669 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testingModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.TestingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testingModule.v1beta1.TestingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testingModule.v1beta1.TestingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testingModule.v1beta1.TestingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testingModule.v1beta1.TestingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testingModule.v1beta1.TestingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testingModule.v1beta1.TestingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testingModule.v1beta1.TestingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testingModule.v1beta1.TestingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - await client.initialize(); - assert(client.testingStub); - }); - - it('has close method for the initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSession', () => { - it('invokes createSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCall(expectedResponse); - const [response] = await client.createSession(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSession(request), expectedError); - }); - - it('invokes createSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSession(request), expectedError); - }); - }); - - describe('getSession', () => { - it('invokes getSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCall(expectedResponse); - const [response] = await client.getSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSession(request), expectedError); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSession(request), expectedError); - }); - }); - - describe('deleteSession', () => { - it('invokes deleteSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSession( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSession(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSession(request), expectedError); - }); - }); - - describe('reportSession', () => { - it('invokes reportSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCall(expectedResponse); - const [response] = await client.reportSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reportSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IReportSessionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reportSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reportSession(request), expectedError); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reportSession(request), expectedError); - }); - }); - - describe('deleteTest', () => { - it('invokes deleteTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTest( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTest(request), expectedError); - }); - }); - - describe('verifyTest', () => { - it('invokes verifyTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCall(expectedResponse); - const [response] = await client.verifyTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyTest( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IVerifyTestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyTest(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyTest(request), expectedError); - }); - }); - - describe('listSessions', () => { - it('invokes listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCall(expectedResponse); - const [response] = await client.listSessions(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessions( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listSessions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessions(request), expectedError); - }); - - it('invokes listSessionsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('invokes listSessionsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('uses async iteration with listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ISession[] = []; - const iterable = client.listSessionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ISession[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listTests', () => { - it('invokes listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCall(expectedResponse); - const [response] = await client.listTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTests( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ITest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTestsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTestsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ITest[] = []; - const iterable = client.listTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ITest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json b/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json deleted file mode 100644 index 6de66ad2bdaf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "compliance", - "echo", - "identity", - "messaging", - "sequence service", - "testing" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/compliance.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/compliance.proto.baseline deleted file mode 100644 index 9b6c0b7d757e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/compliance.proto.baseline +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format -// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped -// correctly. -service Compliance { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // This method echoes the ComplianceData request. This method exercises - // sending the entire request object in the REST body. - rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:body" - body: "*" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending the a message-type field in the REST body. Per AIP-127, only - // top-level, non-repeated fields can be sent this way. - rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:bodyinfo" - body: "info" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending all request fields as query parameters. - rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat:query" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending some parameters as "simple" path variables (i.e., of the form - // "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" - }; - } - - // Same as RepeatDataSimplePath, but with a path resource. - rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" - additional_bindings { - get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" - } - }; - } - - // Same as RepeatDataSimplePath, but with a trailing resource. - rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PUT method. - rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - put: "/v1beta1/repeat:bodyput" - body: "*" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PATCH method. - rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - patch: "/v1beta1/repeat:bodypatch" - body: "*" - }; - } - - // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - // response from this RPC as the request to VerifyEnum() - // - // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - rpc GetEnum(EnumRequest) returns (EnumResponse) { - option (google.api.http) = { - get: "/v1beta1/compliance/enum" - }; - } - - // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - // with the same EnumResponse; otherwise, the RPC errors. - // - // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - // although they are not guaranteed to be the same across separate Showcase server runs. - rpc VerifyEnum(EnumResponse) returns (EnumResponse) { - option (google.api.http) = { - post: "/v1beta1/compliance/enum" - }; - } - -} - -message RepeatRequest { - string name = 1; - ComplianceData info = 2; - - // If true, the server will verify that the received request matches - // the request with the same name in the compliance test suite. - bool server_verify = 3; - - // The URI template this request is expected to be bound to server-side. - optional string intended_binding_uri = 10; - - // Some top level fields, to test that these are encoded correctly - // in query params. - int32 f_int32 = 4; - int64 f_int64 = 5; - double f_double = 6; - - optional int32 p_int32 = 7; - optional int64 p_int64 = 8; - optional double p_double = 9; -} - -message RepeatResponse { - RepeatRequest request = 1; - - // The URI template the request was bound to server-side. - string binding_uri = 2; -} - -// ComplianceSuite contains a set of requests that microgenerators should issue -// over REST to the Compliance service to test their gRPC-to-REST transcoding -// implementation. -message ComplianceSuite { - repeated ComplianceGroup group = 1; -} - -// ComplianceGroups encapsulates a group of RPC requests to the Compliance -// server: one request for each combination of elements of `rpcs` and of -// `requests`. -message ComplianceGroup { - string name = 1; - repeated string rpcs = 2; - repeated RepeatRequest requests = 3; -} - -// ComplianceData is a message used for testing REST transcoding of -// different data types. -message ComplianceData { - enum LifeKingdom { - LIFE_KINGDOM_UNSPECIFIED = 0; - ARCHAEBACTERIA = 1; - EUBACTERIA = 2; - PROTISTA = 3; - FUNGI = 4; - PLANTAE = 5; - ANIMALIA = 6; -} - // scalar types - - string f_string = 1; - - int32 f_int32 = 2; - sint32 f_sint32 = 3; - sfixed32 f_sfixed32 = 4; - - uint32 f_uint32 = 5; - fixed32 f_fixed32 = 6; - - int64 f_int64 = 7; - sint64 f_sint64 = 8; - sfixed64 f_sfixed64 = 9; - - uint64 f_uint64 = 10; - fixed64 f_fixed64 = 11; - - double f_double = 12; - float f_float = 13; - - bool f_bool = 14; - - bytes f_bytes = 15; - - LifeKingdom f_kingdom = 22; - - ComplianceDataChild f_child = 16; - - // optional fields - - optional string p_string = 17; - optional int32 p_int32 = 18; - optional double p_double = 19; - optional bool p_bool = 20; - optional LifeKingdom p_kingdom = 23; - optional ComplianceDataChild p_child = 21; -} - -message ComplianceDataChild { - string f_string = 1; - float f_float = 2; - double f_double = 3; - bool f_bool = 4; - Continent f_continent = 11; - ComplianceDataGrandchild f_child = 5; - - optional string p_string = 6; - optional float p_float = 7; - optional double p_double = 8; - optional bool p_bool = 9; - Continent p_continent = 12; - optional ComplianceDataGrandchild p_child = 10; -} - -message ComplianceDataGrandchild { - string f_string = 1; - double f_double = 2; - bool f_bool = 3; -} - -enum Continent { - CONTINENT_UNSPECIFIED = 0; - AFRICA = 1; - AMERICA = 2; - ANTARTICA = 3; - AUSTRALIA = 4; - EUROPE = 5; -} - - -message EnumRequest { - // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - bool unknown_enum = 1; -} - -message EnumResponse { - // The original request for a known or unknown enum from the server. - EnumRequest request = 1; - - // The actual enum the server provided. - Continent continent = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/identity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/identity.proto.baseline deleted file mode 100644 index 569c604d78fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/identity.proto.baseline +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple identity service. -service Identity { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a user. - rpc CreateUser(CreateUserRequest) returns (User) { - option (google.api.http) = { - post: "/v1beta1/users" - body: "*" - }; - option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = - "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; - } - - // Retrieves the User with the given uri. - rpc GetUser(GetUserRequest) returns (User) { - option (google.api.http) = { - get: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a user. - rpc UpdateUser(UpdateUserRequest) returns (User) { - option (google.api.http) = { - patch: "/v1beta1/{user.name=users/*}" - body: "user" - }; - } - - // Deletes a user, their profile, and all of their authored messages. - rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all users. - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { - option (google.api.http) = { - get: "/v1beta1/users" - }; - } -} - -// A user. -message User { - option (google.api.resource) = { - type: "showcase.googleapis.com/User" - pattern: "users/{user}" - }; - - // The resource name of the user. - string name = 1; - - // The display_name of the user. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The email address of the user. - string email = 3 [(google.api.field_behavior) = REQUIRED]; - - // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The age of the user in years. - optional int32 age = 6; - - // The height of the user in feet. - optional double height_feet = 7; - - // The nickname of the user. - // - // (-- aip.dev/not-precedent: An empty string is a valid nickname. - // Ordinarily, proto3_optional should not be used on a `string` field. --) - optional string nickname = 8; - - // Enables the receiving of notifications. The default is true if unset. - // - // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) - optional bool enable_notifications = 9; -} - -// The request message for the google.showcase.v1beta1.Identity\CreateUser -// method. -message CreateUserRequest { - // The user to create. - User user = 1; -} - -// The request message for the google.showcase.v1beta1.Identity\GetUser -// method. -message GetUserRequest { - // The resource name of the requested user. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\UpdateUser -// method. -message UpdateUserRequest { - // The user to update. - User user = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Identity\DeleteUser -// method. -message DeleteUserRequest { - // The resource name of the user to delete. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersRequest { - // The maximum number of users to return. Server may return fewer users - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Identity\ListUsers` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersResponse { - // The list of users. - repeated User users = 1; - - // A token to retrieve next page of results. - // Pass this value in ListUsersRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Message\ListUsers` method to retrieve the - // next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/messaging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/messaging.proto.baseline deleted file mode 100644 index 62196dfced39..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/messaging.proto.baseline +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/error_details.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple messaging service that implements chat rooms and profile posts. -// -// This messaging service showcases the features that API clients -// generated by gapic-generators implement. -service Messaging { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a room. - rpc CreateRoom(CreateRoomRequest) returns (Room) { - option (google.api.http) = { - post: "/v1beta1/rooms" - body: "*" - }; - option (google.api.method_signature) = "room.display_name,room.description"; - } - - // Retrieves the Room with the given resource name. - rpc GetRoom(GetRoomRequest) returns (Room) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a room. - rpc UpdateRoom(UpdateRoomRequest) returns (Room) { - option (google.api.http) = { - patch: "/v1beta1/{room.name=rooms/*}" - body: "room" - }; - } - - // Deletes a room and all of its blurbs. - rpc DeleteRoom(DeleteRoomRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all chat rooms. - rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) { - option (google.api.http) = { - get: "/v1beta1/rooms" - }; - } - - // Creates a blurb. If the parent is a room, the blurb is understood to be a - // message in that room. If the parent is a profile, the blurb is understood - // to be a post on the profile. - rpc CreateBlurb(CreateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,blurb.user,blurb.text"; - option (google.api.method_signature) = "parent,blurb.user,blurb.image"; - } - - // Retrieves the Blurb with the given resource name. - rpc GetBlurb(GetBlurbRequest) returns (Blurb) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a blurb. - rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "blurb" - additional_bindings: { - patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "blurb" - } - }; - } - - // Deletes a blurb. - rpc DeleteBlurb(DeleteBlurbRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - delete: "/v1beta1/{name=users/*/profile/blurbs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists blurbs for a specific chat room or user profile depending on the - // parent resource name. - rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } - }; - option (google.api.method_signature) = "parent"; - } - - // This method searches through all blurbs across all rooms and profiles - // for blurbs containing to words found in the query. Only posts that - // contain an exact match of a queried word will be returned. - rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:search" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:search" - } - }; - option (google.longrunning.operation_info) = { - response_type: "SearchBlurbsResponse" - metadata_type: "SearchBlurbsMetadata" - }; - option (google.api.method_signature) = "parent,query"; - } - - // This returns a stream that emits the blurbs that are created for a - // particular chat room or user profile. - rpc StreamBlurbs(StreamBlurbsRequest) returns (stream StreamBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=rooms/*}/blurbs:stream" - body: "*" - additional_bindings: { - post: "/v1beta1/{name=users/*/profile}/blurbs:stream" - body: "*" - } - }; - } - - // This is a stream to create multiple blurbs. If an invalid blurb is - // requested to be created, the stream will close with an error. - rpc SendBlurbs(stream CreateBlurbRequest) returns (SendBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:send" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:send" - body: "*" - } - }; - } - - // This method starts a bidirectional stream that receives all blurbs that - // are being created after the stream has started and sends requests to create - // blurbs. If an invalid blurb is requested to be created, the stream will - // close with an error. - rpc Connect(stream ConnectRequest) returns (stream StreamBlurbsResponse); -} - -// A chat room. -message Room { - option (google.api.resource) = { - type: "showcase.googleapis.com/Room" - pattern: "rooms/{room}" - }; - - // The resource name of the chat room. - string name = 1; - - // The human readable name of the chat room. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The description of the chat room. - string description = 3; - - // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateRoom -// method. -message CreateRoomRequest { - // The room to create. - Room room = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetRoom -// method. -message GetRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateRoom -// method. -message UpdateRoomRequest { - // The room to update. - Room room = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteRoom -// method. -message DeleteRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsRequest { - // The maximum number of rooms return. Server may return fewer rooms - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListRooms` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsResponse { - // The list of rooms. - repeated Room rooms = 1; - - // A token to retrieve next page of results. - // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// This protocol buffer message represents a blurb sent to a chat room or -// posted on a user profile. -message Blurb { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blurb" - pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" - pattern: "users/{user}/profile/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" - }; - - // The resource name of the chat room. - string name = 1; - - // The resource name of the blurb's author. - string user = 2 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; - - oneof content { - // The textual content of this blurb. - string text = 3; - - // The image content of this blurb. - bytes image = 4; - } - - // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. - // --) - oneof legacy_id { - // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern - // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` - string legacy_room_id = 7; - - // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern - // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` - string legacy_user_id = 8; - } -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateBlurb -// method. -message CreateBlurbRequest { - // The resource name of the chat room or user profile that this blurb will - // be tied to. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The blurb to create. - Blurb blurb = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetBlurb -// method. -message GetBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateBlurb -// method. -message UpdateBlurbRequest { - // The blurb to update. - Blurb blurb = 1; - - // The field mask to determine wich fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteBlurb -// method. -message DeleteBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsRequest { - // The resource name of the requested room or profile whos blurbs to list. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The maximum number of blurbs to return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 2; - - // The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListBlurbs` method. - string page_token = 3; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsResponse { - // The list of blurbs. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in ListBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\ListBlurbs` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\SearchBlurbs -// method. -message SearchBlurbsRequest { - // The query used to search for blurbs containing to words of this string. - // Only posts that contain an exact match of a queried word will be returned. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // The rooms or profiles to search. If unset, `SearchBlurbs` will search all - // rooms and all profiles. - string parent = 2 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - - // The maximum number of blurbs return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 3; - - // The value of - // google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - string page_token = 4; -} - -// The operation metadata message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsMetadata { - // This signals to the client when to next poll for response. - google.rpc.RetryInfo retry_info = 1; -} - -// The operation response message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsResponse { - // Blurbs that matched the search query. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in SearchBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\SearchBlurbs` method to - // retrieve the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsRequest { - // The resource name of a chat room or user profile whose blurbs to stream. - string name = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsResponse { - // The blurb that was either created, updated, or deleted. - Blurb blurb = 1; - - // The action that triggered the blurb to be returned. - enum Action { - ACTION_UNSPECIFIED = 0; - - // Specifies that the blurb was created. - CREATE = 1; - - // Specifies that the blurb was updated. - UPDATE = 2; - - // Specifies that the blurb was deleted. - DELETE = 3; - } - - // The action that triggered the blurb to be returned. - Action action = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\SendBlurbs -// method. -message SendBlurbsResponse { - // The names of successful blurb creations. - repeated string names = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\Connect -// method. -message ConnectRequest { - message ConnectConfig { - // The room or profile to follow and create messages for. - string parent = 1 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - } - - oneof request { - // Provides information that specifies how to process subsequent requests. - // The first `ConnectRequest` message must contain a `config` message. - ConnectConfig config = 1; - - // The blurb to be created. - Blurb blurb = 2; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/sequence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/sequence.proto.baseline deleted file mode 100644 index 26158fdd861f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/sequence.proto.baseline +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -service SequenceService { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a sequence. - rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { - option (google.api.http) = { - post: "/v1beta1/sequences" - body: "sequence" - }; - option (google.api.method_signature) = "sequence"; - }; - - // Retrieves a sequence. - rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { - option (google.api.http) = { - get: "/v1beta1/{name=sequences/*/sequenceReport}" - }; - option (google.api.method_signature) = "name"; - }; - - // Attempts a sequence. - rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=sequences/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - }; -} - -message Sequence { - option (google.api.resource) = { - type: "showcase.googleapis.com/Sequence" - pattern: "sequences/{sequence}" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A server response to an RPC Attempt in a sequence. - message Response { - // The status to return for an individual attempt. - google.rpc.Status status = 1; - - // The amount of time to delay sending the response. - google.protobuf.Duration delay = 2; - } - - // Sequence of responses to return in order for each attempt. If empty, the - // default response is an immediate OK. - repeated Response responses = 2; -} - -message SequenceReport { - option (google.api.resource) = { - type: "showcase.googleapis.com/SequenceReport" - pattern: "sequences/{sequence}/sequenceReport" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains metrics on individual RPC Attempts in a sequence. - message Attempt { - // The attempt number - starting at 0. - int32 attempt_number = 1; - - // The deadline dictated by the attempt to the server. - google.protobuf.Timestamp attempt_deadline = 2; - - // The time that the server responded to the RPC attempt. Used for - // calculating attempt_delay. - google.protobuf.Timestamp response_time = 3; - - // The server perceived delay between sending the last response and - // receiving this attempt. Used for validating attempt delay backoff. - google.protobuf.Duration attempt_delay = 4; - - // The status returned to the attempt. - google.rpc.Status status = 5; - } - - // The set of RPC attempts received by the server for a Sequence. - repeated Attempt attempts = 2; -} - -message CreateSequenceRequest { - Sequence sequence = 1; -} - -message AttemptSequenceRequest { - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", - (google.api.field_behavior) = REQUIRED - ]; -} - -message GetSequenceReportRequest { - string name = 1 [ - (google.api.resource_reference).type = - "showcase.googleapis.com/SequenceReport", - (google.api.field_behavior) = REQUIRED - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/testing.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/testing.proto.baseline deleted file mode 100644 index dbfe134c6fb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/protos/google/showcase/v1beta1/testing.proto.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2018 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. - -edition = "2023"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A service to facilitate running discrete sets of tests -// against Showcase. -service Testing { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a new testing session. - rpc CreateSession(CreateSessionRequest) returns (Session) { - option (google.api.http) = { - post: "/v1beta1/sessions" - body: "session" - }; - } - - // Gets a testing session. - rpc GetSession(GetSessionRequest) returns (Session) { - option (google.api.http) = { - get: "/v1beta1/{name=sessions/*}" - }; - } - - // Lists the current test sessions. - rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { - option (google.api.http) = { - get: "/v1beta1/sessions" - }; - } - - // Delete a test session. - rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*}" - }; - } - - // Report on the status of a session. - // This generates a report detailing which tests have been completed, - // and an overall rollup. - rpc ReportSession(ReportSessionRequest) returns (ReportSessionResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*}:report" - }; - } - - // List the tests of a sessesion. - rpc ListTests(ListTestsRequest) returns (ListTestsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=sessions/*}/tests" - }; - } - - // Explicitly decline to implement a test. - // - // This removes the test from subsequent `ListTests` calls, and - // attempting to do the test will error. - // - // This method will error if attempting to delete a required test. - rpc DeleteTest(DeleteTestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*/tests/*}" - }; - } - - // Register a response to a test. - // - // In cases where a test involves registering a final answer at the - // end of the test, this method provides the means to do so. - rpc VerifyTest(VerifyTestRequest) returns (VerifyTestResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*/tests/*}:check" - }; - } -} - -// A session is a suite of tests, generally being made in the context -// of testing code generation. -// -// A session defines tests it may expect, based on which version of the -// code generation spec is in use. -message Session { - option (google.api.resource) = { - type: "showcase.googleapis.com/Session" - pattern: "sessions/{session}" - }; - - // The name of the session. The ID must conform to ^[a-z]+$ - // If this is not provided, Showcase chooses one at random. - string name = 1; - - // The specification versions understood by Showcase. - enum Version { - // Unspecified version. If passed on creation, the session will default - // to using the latest stable release. - VERSION_UNSPECIFIED = 0; - - // The latest v1. Currently, this is v1.0. - V1_LATEST = 1; - - // v1.0. (Until the spec is "GA", this will be a moving target.) - V1_0 = 2; - } - - // Required. The version this session is using. - Version version = 2; -} - -// The request for the CreateSession method. -message CreateSessionRequest { - // The session to be created. - // Sessions are immutable once they are created (although they can - // be deleted). - Session session = 1; -} - -// The request for the GetSession method. -message GetSessionRequest { - // The session to be retrieved. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// The request for the ListSessions method. -message ListSessionsRequest { - // The maximum number of sessions to return per page. - int32 page_size = 1; - - // The page token, for retrieving subsequent pages. - string page_token = 2; -} - -// Response for the ListSessions method. -message ListSessionsResponse { - // The sessions being returned. - repeated Session sessions = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// Request for the DeleteSession method. -message DeleteSessionRequest { - // The session to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Request message for reporting on a session. -message ReportSessionRequest { - // The session to be reported on. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Response message for reporting on a session. -message ReportSessionResponse { - // The topline state of the report. - enum Result { - RESULT_UNSPECIFIED = 0; - - // The session is complete, and everything passed. - PASSED = 1; - - // The session had an explicit failure. - FAILED = 2; - - // The session is incomplete. This is a failure response. - INCOMPLETE = 3; - } - - // The state of the report. - Result result = 1; - - // The test runs of this session. - repeated TestRun test_runs = 2; -} - -message Test { - option (google.api.resource) = { - type: "showcase.googleapis.com/Test" - pattern: "sessions/{session}/tests/{test}" - }; - - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string name = 1; - - // Whether or not a test is required, recommended, or optional. - enum ExpectationLevel { - EXPECTATION_LEVEL_UNSPECIFIED = 0; - - // This test is strictly required. - REQUIRED = 1; - - // This test is recommended. - // - // If a generator explicitly ignores a recommended test (see `DeleteTest`), - // then the report may still pass, but with a warning. - // - // If a generator skips a recommended test and does not explicitly - // express that intention, the report will fail. - RECOMMENDED = 2; - - // This test is optional. - // - // If a generator explicitly ignores an optional test (see `DeleteTest`), - // then the report may still pass, and no warning will be issued. - // - // If a generator skips an optional test and does not explicitly - // express that intention, the report may still pass, but with a - // warning. - OPTIONAL = 3; - } - - // The expectation level for this test. - ExpectationLevel expectation_level = 2; - - // A description of the test. - string description = 3; - - // A blueprint is an explicit definition of methods and requests that are needed - // to be made to test this specific test case. Ideally this would be represented - // by something more robust like CEL, but as of writing this, I am unsure if CEL - // is ready. - message Blueprint { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blueprint" - pattern: "sessions/{session}/tests/{test}/blueprints/{blueprint}" - }; - - // The name of this blueprint. - string name = 1; - - // A description of this blueprint. - string description = 2; - - // A message representing a method invocation. - message Invocation { - // The fully qualified name of the showcase method to be invoked. - string method = 1; - - // The request to be made if a specific request is necessary. - bytes serialized_request = 2; - } - - // The initial request to trigger this test. - Invocation request = 3; - - // An ordered list of method calls that can be called to trigger this test. - repeated Invocation additional_requests = 4; - } - - // The blueprints that will satisfy this test. There may be multiple blueprints - // that can signal to the server that this test case is being exercised. Although - // multiple blueprints are specified, only a single blueprint needs to be run to - // signal that the test case was exercised. - repeated Blueprint blueprints = 4; -} - -// An issue found in the test. -message Issue { - // The different potential types of issues. - enum Type { - TYPE_UNSPECIFIED = 0; - - // The test was never instrumented. - SKIPPED = 1; - - // The test was started but never confirmed. - PENDING = 2; - - // The test was instrumented, but Showcase got an unexpected - // value when the generator tried to confirm success. - INCORRECT_CONFIRMATION = 3; - } - - // The type of the issue. - Type type = 1; - - // Severity levels. - enum Severity { - SEVERITY_UNSPECIFIED = 0; - - // Errors. - ERROR = 1; - - // Warnings. - WARNING = 2; - } - - // The severity of the issue. - Severity severity = 2; - - // A description of the issue. - string description = 3; -} - -// The request for the ListTests method. -message ListTestsRequest { - // The session. - string parent = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; - - // The maximum number of tests to return per page. - int32 page_size = 2; - - // The page token, for retrieving subsequent pages. - string page_token = 3; -} - -// The response for the ListTests method. -message ListTestsResponse { - // The tests being returned. - repeated Test tests = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// A TestRun is the result of running a Test. -message TestRun { - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string test = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - - // An issue found with the test run. If empty, this test run was successful. - Issue issue = 2; -} - -// Request message for deleting a test. -message DeleteTestRequest { - // The test to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; -} - -message VerifyTestRequest { - // The test to have an answer registered to it. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - // The answer from the test. - bytes answer = 2; - - // The answers from the test if multiple are to be checked - repeated bytes answers = 3; -} - -message VerifyTestResponse { - // An issue if check answer was unsuccessful. This will be empty if the check answer succeeded. - Issue issue = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-esm/webpack.config.cjs.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 0b1a54f4109e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/README.md.baseline deleted file mode 100644 index ccf41b264f5e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Showcase: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Showcase client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Showcase Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Showcase API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/index.ts.baseline deleted file mode 100644 index 6499b5483840..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1/index.js'; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -export {v1beta1, EchoClient}; -export default {v1beta1, EchoClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index 8b80d7a015d2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1238 +0,0 @@ -// Copyright 2026 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. ** - -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as echo_client_config from './echo_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'echo_client_config.json') -); - -import {loggingUtils as logging} from 'google-gax'; - -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax; - private _gaxGrpc: gax.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - opts = Object.assign({servicePath, port, clientConfig}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = gax; - - // 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProto( - path.join(dirname, '..', '..', '..', 'protos'), - 'google/showcase/v1beta1/echo.proto' - ); - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - let protoFilesRoot = new this._gaxModule.GoogleProtoFilesRoot(); - protoFilesRoot = this._gaxModule.protobuf.loadSync( - path.join(dirname, '..', '..', '..', 'protos', 'google/showcase/v1beta1/echo.proto'), - protoFilesRoot) as (typeof protoFilesRoot); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 4d911013ee82..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/echo.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/index.ts.baseline deleted file mode 100644 index 54412c29f55d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {EchoClient} from './echo_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index e8ca2ec96597..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const showcase = require('showcase'); - -function main() { - const echoClient = new showcase.EchoClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index dc2f0f6ff5f5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as showcase from 'showcase'; - -function main() { - const echoClient = new showcase.EchoClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 1e660d0737f9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {EchoClient} from 'showcase'; - -// check that the client class type name can be used -function doStuffWithEchoClient(client: EchoClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const echoClient = new EchoClient(); - doStuffWithEchoClient(echoClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index 047db4ae9dda..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/esm/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1111 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - // non-string x-goog-request-param values are not supported; - // we always assume that it's a string. - return ''; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json deleted file mode 100644 index 14a70ca73ffb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "echo" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm --skip-json ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.block.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.block.js.baseline deleted file mode 100644 index 4abdcfaa51c2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.block.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Block_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The amount of time to block before returning a response. - */ - // const responseDelay = {} - /** - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - */ - // const error = {} - /** - * The response to be returned that will signify successful method call. - */ - // const success = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callBlock() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.block(request); - console.log(response); - } - - callBlock(); - // [END localhost_v1beta1_generated_Echo_Block_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.chat.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.chat.js.baseline deleted file mode 100644 index 4019c5307eb9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.chat.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Chat_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callChat() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.chat(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callChat(); - // [END localhost_v1beta1_generated_Echo_Chat_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.collect.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.collect.js.baseline deleted file mode 100644 index e1813b91710a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.collect.js.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Collect_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callCollect() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.collect((response) => console.log(response)); - stream.write(request); - stream.end(); - } - - callCollect(); - // [END localhost_v1beta1_generated_Echo_Collect_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo.js.baseline deleted file mode 100644 index 214e54ed8dac..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Echo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callEcho() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.echo(request); - console.log(response); - } - - callEcho(); - // [END localhost_v1beta1_generated_Echo_Echo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo_error_details.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo_error_details.js.baseline deleted file mode 100644 index 8677b4f6bf81..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.echo_error_details.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_EchoErrorDetails_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - */ - // const singleDetailText = 'abc123' - /** - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - */ - // const multiDetailText = ['abc','def'] - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callEchoErrorDetails() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.echoErrorDetails(request); - console.log(response); - } - - callEchoErrorDetails(); - // [END localhost_v1beta1_generated_Echo_EchoErrorDetails_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.expand.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.expand.js.baseline deleted file mode 100644 index 71196b897c53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.expand.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Expand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content that will be split into words and returned on the stream. - */ - // const content = 'abc123' - /** - * The error that is thrown after all words are sent on the stream. - */ - // const error = {} - /** - * The wait time between each server streaming messages - */ - // const streamWaitTime = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callExpand() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.expand(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callExpand(); - // [END localhost_v1beta1_generated_Echo_Expand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand.js.baseline deleted file mode 100644 index 79549f66530d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - */ - // const pageSize = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpand() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = showcaseClient.pagedExpandAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPagedExpand(); - // [END localhost_v1beta1_generated_Echo_PagedExpand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline deleted file mode 100644 index bdbd6b565942..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - */ - // const maxResults = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpandLegacy() { - // Construct request - const request = { - content, - }; - - // Run request - const response = await showcaseClient.pagedExpandLegacy(request); - console.log(response); - } - - callPagedExpandLegacy(); - // [END localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline deleted file mode 100644 index 372bbe08d4d1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - */ - // const pageSize = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpandLegacyMapped() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = showcaseClient.pagedExpandLegacyMappedAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPagedExpandLegacyMapped(); - // [END localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.wait.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.wait.js.baseline deleted file mode 100644 index b506630802ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/echo.wait.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Wait_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The time that this operation will complete. - */ - // const endTime = {} - /** - * The duration of this operation. - */ - // const ttl = {} - /** - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - */ - // const error = {} - /** - * The response to be returned on operation completion. - */ - // const success = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callWait() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await showcaseClient.wait(request); - const [response] = await operation.promise(); - console.log(response); - } - - callWait(); - // [END localhost_v1beta1_generated_Echo_Wait_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline deleted file mode 100644 index 7f35074a6b0e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline +++ /dev/null @@ -1,543 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-showcase", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.showcase.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1beta1_generated_Echo_Echo_async", - "title": "ShowcaseService echo Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "echo.echo.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo.Echo", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo.Echo", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_EchoErrorDetails_async", - "title": "ShowcaseService echoErrorDetails Sample", - "origin": "API_DEFINITION", - "description": " This method returns error details in a repeated \"google.protobuf.Any\" field. This method showcases handling errors thus encoded, particularly over REST transport. Note that GAPICs only allow the type \"google.protobuf.Any\" for field paths ending in \"error.details\", and, at run-time, the actual types for these fields must be one of the types in google/rpc/error_details.proto.", - "canonical": true, - "file": "echo.echo_error_details.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EchoErrorDetails", - "fullName": "google.showcase.v1beta1.Echo.EchoErrorDetails", - "async": true, - "parameters": [ - { - "name": "single_detail_text", - "type": "TYPE_STRING" - }, - { - "name": "multi_detail_text", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.showcase.v1beta1.EchoErrorDetailsResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "EchoErrorDetails", - "fullName": "google.showcase.v1beta1.Echo.EchoErrorDetails", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Expand_async", - "title": "ShowcaseService expand Sample", - "origin": "API_DEFINITION", - "description": " This method splits the given content into words and will pass each word back through the stream. This method showcases server-side streaming RPCs.", - "canonical": true, - "file": "echo.expand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Expand", - "fullName": "google.showcase.v1beta1.Echo.Expand", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "stream_wait_time", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Expand", - "fullName": "google.showcase.v1beta1.Echo.Expand", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Collect_async", - "title": "ShowcaseService collect Sample", - "origin": "API_DEFINITION", - "description": " This method will collect the words given to it. When the stream is closed by the client, this method will return the a concatenation of the strings passed to it. This method showcases client-side streaming RPCs.", - "canonical": true, - "file": "echo.collect.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Collect", - "fullName": "google.showcase.v1beta1.Echo.Collect", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Collect", - "fullName": "google.showcase.v1beta1.Echo.Collect", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Chat_async", - "title": "ShowcaseService chat Sample", - "origin": "API_DEFINITION", - "description": " This method, upon receiving a request on the stream, will pass the same content back on the stream. This method showcases bidirectional streaming RPCs.", - "canonical": true, - "file": "echo.chat.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Chat", - "fullName": "google.showcase.v1beta1.Echo.Chat", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Chat", - "fullName": "google.showcase.v1beta1.Echo.Chat", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpand_async", - "title": "ShowcaseService pagedExpand Sample", - "origin": "API_DEFINITION", - "description": " This is similar to the Expand method but instead of returning a stream of expanded words, this method returns a paged list of expanded words.", - "canonical": true, - "file": "echo.paged_expand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpand", - "fullName": "google.showcase.v1beta1.Echo.PagedExpand", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpand", - "fullName": "google.showcase.v1beta1.Echo.PagedExpand", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacy_async", - "title": "ShowcaseService pagedExpandLegacy Sample", - "origin": "API_DEFINITION", - "description": " This is similar to the PagedExpand except that it uses max_results instead of page_size, as some legacy APIs still do. New APIs should NOT use this pattern.", - "canonical": true, - "file": "echo.paged_expand_legacy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpandLegacy", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpandLegacy", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async", - "title": "ShowcaseService pagedExpandLegacyMapped Sample", - "origin": "API_DEFINITION", - "description": " This method returns a map containing lists of words that appear in the input, keyed by their initial character. The only words returned are the ones included in the current page, as determined by page_token and page_size, which both refer to the word indices in the input. This paging result consisting of a map of lists is a pattern used by some legacy APIs. New APIs should NOT use this pattern.", - "canonical": true, - "file": "echo.paged_expand_legacy_mapped.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpandLegacyMapped", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandLegacyMappedResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpandLegacyMapped", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Wait_async", - "title": "ShowcaseService wait Sample", - "origin": "API_DEFINITION", - "description": " This method will wait for the requested amount of time and then return. This method showcases how a client handles a request timeout.", - "canonical": true, - "file": "echo.wait.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Wait", - "fullName": "google.showcase.v1beta1.Echo.Wait", - "async": true, - "parameters": [ - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "success", - "type": ".google.showcase.v1beta1.WaitResponse" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Wait", - "fullName": "google.showcase.v1beta1.Echo.Wait", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Block_async", - "title": "ShowcaseService block Sample", - "origin": "API_DEFINITION", - "description": " This method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.", - "canonical": true, - "file": "echo.block.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Block", - "fullName": "google.showcase.v1beta1.Echo.Block", - "async": true, - "parameters": [ - { - "name": "response_delay", - "type": ".google.protobuf.Duration" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "success", - "type": ".google.showcase.v1beta1.BlockResponse" - } - ], - "resultType": ".google.showcase.v1beta1.BlockResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Block", - "fullName": "google.showcase.v1beta1.Echo.Block", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/webpack.config.cjs.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.jsdoc.js.baseline deleted file mode 100644 index ba97f7f80544..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/README.md.baseline deleted file mode 100644 index ccf41b264f5e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Showcase: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Showcase client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Showcase Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Showcase API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json deleted file mode 100644 index a77345c1a7cf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "echo" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos --skip-json src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.block.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.block.js.baseline deleted file mode 100644 index 4abdcfaa51c2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.block.js.baseline +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Block_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The amount of time to block before returning a response. - */ - // const responseDelay = {} - /** - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - */ - // const error = {} - /** - * The response to be returned that will signify successful method call. - */ - // const success = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callBlock() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.block(request); - console.log(response); - } - - callBlock(); - // [END localhost_v1beta1_generated_Echo_Block_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline deleted file mode 100644 index 4019c5307eb9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.chat.js.baseline +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Chat_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callChat() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.chat(); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - stream.write(request); - stream.end(); - } - - callChat(); - // [END localhost_v1beta1_generated_Echo_Chat_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline deleted file mode 100644 index e1813b91710a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.collect.js.baseline +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Collect_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callCollect() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.collect((response) => console.log(response)); - stream.write(request); - stream.end(); - } - - callCollect(); - // [END localhost_v1beta1_generated_Echo_Collect_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline deleted file mode 100644 index 214e54ed8dac..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo.js.baseline +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Echo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content to be echoed by the server. - */ - // const content = 'abc123' - /** - * The error to be thrown by the server. - */ - // const error = {} - /** - * The severity to be echoed by the server. - */ - // const severity = {} - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const header = 'abc123' - /** - * Optional. This field can be set to test the routing annotation on the Echo method. - */ - // const otherHeader = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const requestId = 'abc123' - /** - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - */ - // const otherRequestId = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callEcho() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.echo(request); - console.log(response); - } - - callEcho(); - // [END localhost_v1beta1_generated_Echo_Echo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo_error_details.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo_error_details.js.baseline deleted file mode 100644 index 8677b4f6bf81..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.echo_error_details.js.baseline +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_EchoErrorDetails_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - */ - // const singleDetailText = 'abc123' - /** - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - */ - // const multiDetailText = ['abc','def'] - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callEchoErrorDetails() { - // Construct request - const request = { - }; - - // Run request - const response = await showcaseClient.echoErrorDetails(request); - console.log(response); - } - - callEchoErrorDetails(); - // [END localhost_v1beta1_generated_Echo_EchoErrorDetails_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.expand.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.expand.js.baseline deleted file mode 100644 index 71196b897c53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.expand.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Expand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The content that will be split into words and returned on the stream. - */ - // const content = 'abc123' - /** - * The error that is thrown after all words are sent on the stream. - */ - // const error = {} - /** - * The wait time between each server streaming messages - */ - // const streamWaitTime = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callExpand() { - // Construct request - const request = { - }; - - // Run request - const stream = await showcaseClient.expand(request); - stream.on('data', (response) => { console.log(response) }); - stream.on('error', (err) => { throw(err) }); - stream.on('end', () => { /* API call completed */ }); - } - - callExpand(); - // [END localhost_v1beta1_generated_Echo_Expand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline deleted file mode 100644 index 79549f66530d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpand_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - */ - // const pageSize = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpand() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = showcaseClient.pagedExpandAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPagedExpand(); - // [END localhost_v1beta1_generated_Echo_PagedExpand_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline deleted file mode 100644 index bdbd6b565942..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - */ - // const maxResults = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpandLegacy() { - // Construct request - const request = { - content, - }; - - // Run request - const response = await showcaseClient.pagedExpandLegacy(request); - console.log(response); - } - - callPagedExpandLegacy(); - // [END localhost_v1beta1_generated_Echo_PagedExpandLegacy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline deleted file mode 100644 index 372bbe08d4d1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.paged_expand_legacy_mapped.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(content) { - // [START localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The string to expand. - */ - // const content = 'abc123' - /** - * The number of words to returned in each page. - */ - // const pageSize = 1234 - /** - * The position of the page to be returned. - */ - // const pageToken = 'abc123' - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callPagedExpandLegacyMapped() { - // Construct request - const request = { - content, - }; - - // Run request - const iterable = showcaseClient.pagedExpandLegacyMappedAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callPagedExpandLegacyMapped(); - // [END localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.wait.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.wait.js.baseline deleted file mode 100644 index b506630802ce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/echo.wait.js.baseline +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START localhost_v1beta1_generated_Echo_Wait_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The time that this operation will complete. - */ - // const endTime = {} - /** - * The duration of this operation. - */ - // const ttl = {} - /** - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - */ - // const error = {} - /** - * The response to be returned on operation completion. - */ - // const success = {} - - // Imports the Showcase library - const {EchoClient} = require('showcase').v1beta1; - - // Instantiates a client - const showcaseClient = new EchoClient(); - - async function callWait() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await showcaseClient.wait(request); - const [response] = await operation.promise(); - console.log(response); - } - - callWait(); - // [END localhost_v1beta1_generated_Echo_Wait_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline deleted file mode 100644 index 7f35074a6b0e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/samples/generated/v1beta1/snippet_metadata_google.showcase.v1beta1.json.baseline +++ /dev/null @@ -1,543 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-showcase", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.showcase.v1beta1", - "version": "v1beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "localhost_v1beta1_generated_Echo_Echo_async", - "title": "ShowcaseService echo Sample", - "origin": "API_DEFINITION", - "description": "", - "canonical": true, - "file": "echo.echo.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo.Echo", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo.Echo", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_EchoErrorDetails_async", - "title": "ShowcaseService echoErrorDetails Sample", - "origin": "API_DEFINITION", - "description": " This method returns error details in a repeated \"google.protobuf.Any\" field. This method showcases handling errors thus encoded, particularly over REST transport. Note that GAPICs only allow the type \"google.protobuf.Any\" for field paths ending in \"error.details\", and, at run-time, the actual types for these fields must be one of the types in google/rpc/error_details.proto.", - "canonical": true, - "file": "echo.echo_error_details.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EchoErrorDetails", - "fullName": "google.showcase.v1beta1.Echo.EchoErrorDetails", - "async": true, - "parameters": [ - { - "name": "single_detail_text", - "type": "TYPE_STRING" - }, - { - "name": "multi_detail_text", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.showcase.v1beta1.EchoErrorDetailsResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "EchoErrorDetails", - "fullName": "google.showcase.v1beta1.Echo.EchoErrorDetails", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Expand_async", - "title": "ShowcaseService expand Sample", - "origin": "API_DEFINITION", - "description": " This method splits the given content into words and will pass each word back through the stream. This method showcases server-side streaming RPCs.", - "canonical": true, - "file": "echo.expand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Expand", - "fullName": "google.showcase.v1beta1.Echo.Expand", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "stream_wait_time", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Expand", - "fullName": "google.showcase.v1beta1.Echo.Expand", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Collect_async", - "title": "ShowcaseService collect Sample", - "origin": "API_DEFINITION", - "description": " This method will collect the words given to it. When the stream is closed by the client, this method will return the a concatenation of the strings passed to it. This method showcases client-side streaming RPCs.", - "canonical": true, - "file": "echo.collect.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 77, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Collect", - "fullName": "google.showcase.v1beta1.Echo.Collect", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Collect", - "fullName": "google.showcase.v1beta1.Echo.Collect", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Chat_async", - "title": "ShowcaseService chat Sample", - "origin": "API_DEFINITION", - "description": " This method, upon receiving a request on the stream, will pass the same content back on the stream. This method showcases bidirectional streaming RPCs.", - "canonical": true, - "file": "echo.chat.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 80, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Chat", - "fullName": "google.showcase.v1beta1.Echo.Chat", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "severity", - "type": ".google.showcase.v1beta1.Severity" - }, - { - "name": "header", - "type": "TYPE_STRING" - }, - { - "name": "other_header", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "other_request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.EchoResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Chat", - "fullName": "google.showcase.v1beta1.Echo.Chat", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpand_async", - "title": "ShowcaseService pagedExpand Sample", - "origin": "API_DEFINITION", - "description": " This is similar to the Expand method but instead of returning a stream of expanded words, this method returns a paged list of expanded words.", - "canonical": true, - "file": "echo.paged_expand.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpand", - "fullName": "google.showcase.v1beta1.Echo.PagedExpand", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpand", - "fullName": "google.showcase.v1beta1.Echo.PagedExpand", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacy_async", - "title": "ShowcaseService pagedExpandLegacy Sample", - "origin": "API_DEFINITION", - "description": " This is similar to the PagedExpand except that it uses max_results instead of page_size, as some legacy APIs still do. New APIs should NOT use this pattern.", - "canonical": true, - "file": "echo.paged_expand_legacy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpandLegacy", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpandLegacy", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacy", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_PagedExpandLegacyMapped_async", - "title": "ShowcaseService pagedExpandLegacyMapped Sample", - "origin": "API_DEFINITION", - "description": " This method returns a map containing lists of words that appear in the input, keyed by their initial character. The only words returned are the ones included in the current page, as determined by page_token and page_size, which both refer to the word indices in the input. This paging result consisting of a map of lists is a pattern used by some legacy APIs. New APIs should NOT use this pattern.", - "canonical": true, - "file": "echo.paged_expand_legacy_mapped.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PagedExpandLegacyMapped", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", - "async": true, - "parameters": [ - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.showcase.v1beta1.PagedExpandLegacyMappedResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "PagedExpandLegacyMapped", - "fullName": "google.showcase.v1beta1.Echo.PagedExpandLegacyMapped", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Wait_async", - "title": "ShowcaseService wait Sample", - "origin": "API_DEFINITION", - "description": " This method will wait for the requested amount of time and then return. This method showcases how a client handles a request timeout.", - "canonical": true, - "file": "echo.wait.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Wait", - "fullName": "google.showcase.v1beta1.Echo.Wait", - "async": true, - "parameters": [ - { - "name": "end_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "ttl", - "type": ".google.protobuf.Duration" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "success", - "type": ".google.showcase.v1beta1.WaitResponse" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Wait", - "fullName": "google.showcase.v1beta1.Echo.Wait", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - }, - { - "regionTag": "localhost_v1beta1_generated_Echo_Block_async", - "title": "ShowcaseService block Sample", - "origin": "API_DEFINITION", - "description": " This method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.", - "canonical": true, - "file": "echo.block.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Block", - "fullName": "google.showcase.v1beta1.Echo.Block", - "async": true, - "parameters": [ - { - "name": "response_delay", - "type": ".google.protobuf.Duration" - }, - { - "name": "error", - "type": ".google.rpc.Status" - }, - { - "name": "success", - "type": ".google.showcase.v1beta1.BlockResponse" - } - ], - "resultType": ".google.showcase.v1beta1.BlockResponse", - "client": { - "shortName": "EchoClient", - "fullName": "google.showcase.v1beta1.EchoClient" - }, - "method": { - "shortName": "Block", - "fullName": "google.showcase.v1beta1.Echo.Block", - "service": { - "shortName": "Echo", - "fullName": "google.showcase.v1beta1.Echo" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/index.ts.baseline deleted file mode 100644 index cc71fdcb10f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -export {v1beta1, EchoClient}; -export default {v1beta1, EchoClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index 8f57a2c0fa0b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1225 +0,0 @@ -// Copyright 2026 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. ** - -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import * as path from 'path'; -import {loggingUtils as logging} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './echo_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax; - private _gaxGrpc: gax.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - opts = Object.assign({servicePath, port, clientConfig}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = gax; - - // 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProto( - path.join(__dirname, '..', '..', 'protos'), - 'google/showcase/v1beta1/echo.proto' - ); - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - let protoFilesRoot = new this._gaxModule.GoogleProtoFilesRoot(); - protoFilesRoot = this._gaxModule.protobuf.loadSync( - path.join(__dirname, '..', '..', 'protos', 'google/showcase/v1beta1/echo.proto'), - protoFilesRoot) as (typeof protoFilesRoot); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, - {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, - {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, - {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, - {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 4d911013ee82..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/echo.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/index.ts.baseline deleted file mode 100644 index 3eb609f3454f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {EchoClient} from './echo_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index f396c191bad8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const showcase = require('showcase'); - -function main() { - const echoClient = new showcase.EchoClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 8a0366728d76..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {EchoClient} from 'showcase'; - -// check that the client class type name can be used -function doStuffWithEchoClient(client: EchoClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const echoClient = new EchoClient(); - doStuffWithEchoClient(echoClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index 338049d52e79..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1111 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - // non-string x-goog-request-param values are not supported; - // we always assume that it's a string. - return ''; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase-legacy/webpack.config.js.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase-legacy/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.OwlBot.yaml.baseline deleted file mode 100644 index b5223f05533d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/showcase/google-showcase-nodejs - dest: /owl-bot-staging/google-showcase - -api-name: showcase \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.jsdoc.js.baseline deleted file mode 100644 index ba97f7f80544..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'showcase', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/README.md.baseline deleted file mode 100644 index a917f8a6a614..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Client Libraries Showcase API: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/showcase.svg)](https://www.npmjs.org/package/showcase) - -Client Libraries Showcase API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Client Libraries Showcase API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/showcase/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Client Libraries Showcase API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install showcase -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install showcase@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=localhost -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-showcase diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/package.json b/core/generator/gapic-generator-typescript/baselines/showcase/package.json deleted file mode 100644 index e02a97d7b12a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "showcase", - "version": "0.1.0", - "description": "Showcase client for Node.js", - "repository": "googleapis/nodejs-showcase", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google showcase", - "showcase", - "compliance", - "echo", - "identity", - "messaging", - "sequence service", - "testing" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline deleted file mode 100644 index 9b6c0b7d757e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/compliance.proto.baseline +++ /dev/null @@ -1,269 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format -// correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped -// correctly. -service Compliance { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // This method echoes the ComplianceData request. This method exercises - // sending the entire request object in the REST body. - rpc RepeatDataBody(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:body" - body: "*" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending the a message-type field in the REST body. Per AIP-127, only - // top-level, non-repeated fields can be sent this way. - rpc RepeatDataBodyInfo(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - post: "/v1beta1/repeat:bodyinfo" - body: "info" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending all request fields as query parameters. - rpc RepeatDataQuery(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat:query" - }; - } - - // This method echoes the ComplianceData request. This method exercises - // sending some parameters as "simple" path variables (i.e., of the form - // "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - rpc RepeatDataSimplePath(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string}/{info.f_int32}/{info.f_double}/{info.f_bool}/{info.f_kingdom}:simplepath" - }; - } - - // Same as RepeatDataSimplePath, but with a path resource. - rpc RepeatDataPathResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/*}/bool/{info.f_bool}:pathresource" - additional_bindings { - get: "/v1beta1/repeat/{info.f_child.f_string=first/*}/{info.f_string=second/*}/bool/{info.f_bool}:childfirstpathresource" - } - }; - } - - // Same as RepeatDataSimplePath, but with a trailing resource. - rpc RepeatDataPathTrailingResource(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - get: "/v1beta1/repeat/{info.f_string=first/*}/{info.f_child.f_string=second/**}:pathtrailingresource" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PUT method. - rpc RepeatDataBodyPut(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - put: "/v1beta1/repeat:bodyput" - body: "*" - }; - } - - // This method echoes the ComplianceData request, using the HTTP PATCH method. - rpc RepeatDataBodyPatch(RepeatRequest) returns (RepeatResponse) { - option (google.api.http) = { - patch: "/v1beta1/repeat:bodypatch" - body: "*" - }; - } - - // This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - // .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - // response from this RPC as the request to VerifyEnum() - // - // The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - // VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - rpc GetEnum(EnumRequest) returns (EnumResponse) { - option (google.api.http) = { - get: "/v1beta1/compliance/enum" - }; - } - - // This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - // verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - // with the same EnumResponse; otherwise, the RPC errors. - // - // This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - // although they are not guaranteed to be the same across separate Showcase server runs. - rpc VerifyEnum(EnumResponse) returns (EnumResponse) { - option (google.api.http) = { - post: "/v1beta1/compliance/enum" - }; - } - -} - -message RepeatRequest { - string name = 1; - ComplianceData info = 2; - - // If true, the server will verify that the received request matches - // the request with the same name in the compliance test suite. - bool server_verify = 3; - - // The URI template this request is expected to be bound to server-side. - optional string intended_binding_uri = 10; - - // Some top level fields, to test that these are encoded correctly - // in query params. - int32 f_int32 = 4; - int64 f_int64 = 5; - double f_double = 6; - - optional int32 p_int32 = 7; - optional int64 p_int64 = 8; - optional double p_double = 9; -} - -message RepeatResponse { - RepeatRequest request = 1; - - // The URI template the request was bound to server-side. - string binding_uri = 2; -} - -// ComplianceSuite contains a set of requests that microgenerators should issue -// over REST to the Compliance service to test their gRPC-to-REST transcoding -// implementation. -message ComplianceSuite { - repeated ComplianceGroup group = 1; -} - -// ComplianceGroups encapsulates a group of RPC requests to the Compliance -// server: one request for each combination of elements of `rpcs` and of -// `requests`. -message ComplianceGroup { - string name = 1; - repeated string rpcs = 2; - repeated RepeatRequest requests = 3; -} - -// ComplianceData is a message used for testing REST transcoding of -// different data types. -message ComplianceData { - enum LifeKingdom { - LIFE_KINGDOM_UNSPECIFIED = 0; - ARCHAEBACTERIA = 1; - EUBACTERIA = 2; - PROTISTA = 3; - FUNGI = 4; - PLANTAE = 5; - ANIMALIA = 6; -} - // scalar types - - string f_string = 1; - - int32 f_int32 = 2; - sint32 f_sint32 = 3; - sfixed32 f_sfixed32 = 4; - - uint32 f_uint32 = 5; - fixed32 f_fixed32 = 6; - - int64 f_int64 = 7; - sint64 f_sint64 = 8; - sfixed64 f_sfixed64 = 9; - - uint64 f_uint64 = 10; - fixed64 f_fixed64 = 11; - - double f_double = 12; - float f_float = 13; - - bool f_bool = 14; - - bytes f_bytes = 15; - - LifeKingdom f_kingdom = 22; - - ComplianceDataChild f_child = 16; - - // optional fields - - optional string p_string = 17; - optional int32 p_int32 = 18; - optional double p_double = 19; - optional bool p_bool = 20; - optional LifeKingdom p_kingdom = 23; - optional ComplianceDataChild p_child = 21; -} - -message ComplianceDataChild { - string f_string = 1; - float f_float = 2; - double f_double = 3; - bool f_bool = 4; - Continent f_continent = 11; - ComplianceDataGrandchild f_child = 5; - - optional string p_string = 6; - optional float p_float = 7; - optional double p_double = 8; - optional bool p_bool = 9; - Continent p_continent = 12; - optional ComplianceDataGrandchild p_child = 10; -} - -message ComplianceDataGrandchild { - string f_string = 1; - double f_double = 2; - bool f_bool = 3; -} - -enum Continent { - CONTINENT_UNSPECIFIED = 0; - AFRICA = 1; - AMERICA = 2; - ANTARTICA = 3; - AUSTRALIA = 4; - EUROPE = 5; -} - - -message EnumRequest { - // Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - bool unknown_enum = 1; -} - -message EnumResponse { - // The original request for a known or unknown enum from the server. - EnumRequest request = 1; - - // The actual enum the server provided. - Continent continent = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline deleted file mode 100644 index d189889f5221..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/echo.proto.baseline +++ /dev/null @@ -1,392 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/routing.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// This service is used showcase the four main types of rpcs - unary, server -// side streaming, client side streaming, and bidirectional streaming. This -// service also exposes methods that explicitly implement server delay, and -// paginated calls. Set the 'showcase-trailer' metadata key on any method -// to have the values echoed in the response trailers. Set the -// 'x-goog-request-params' metadata key on any method to have the values -// echoed in the response headers. -service Echo { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - // See https://github.com/aip-dev/google.aip.dev/pull/1331 - option (google.api.api_version) = "v1_20240408"; - - // This method simply echoes the request. This method showcases unary RPCs. - rpc Echo(EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:echo" - body: "*" - }; - option (google.api.routing) = { - routing_parameters{ - field: "header" - } - routing_parameters{ - field: "header" - path_template: "{routing_id=**}" - } - routing_parameters{ - field: "header" - path_template: "{table_name=regions/*/zones/*/**}" - } - routing_parameters{ - field: "header" - path_template: "{super_id=projects/*}/**" - } - routing_parameters{ - field: "header" - path_template: "{table_name=projects/*/instances/*/**}" - } - routing_parameters{ - field: "header" - path_template: "projects/*/{instance_id=instances/*}/**" - } - routing_parameters{ - field: "other_header" - path_template: "{baz=**}" - } - routing_parameters{ - field: "other_header" - path_template: "{qux=projects/*}/**" - } - }; - } - - // This method returns error details in a repeated "google.protobuf.Any" - // field. This method showcases handling errors thus encoded, particularly - // over REST transport. Note that GAPICs only allow the type - // "google.protobuf.Any" for field paths ending in "error.details", and, at - // run-time, the actual types for these fields must be one of the types in - // google/rpc/error_details.proto. - rpc EchoErrorDetails(EchoErrorDetailsRequest) returns (EchoErrorDetailsResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:error-details" - body: "*" - }; - } - - // This method splits the given content into words and will pass each word back - // through the stream. This method showcases server-side streaming RPCs. - rpc Expand(ExpandRequest) returns (stream EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:expand" - body: "*" - }; - // TODO(landrito): change this to be `fields: ["content", "error"]` once - // github.com/dcodeIO/protobuf.js/issues/1094 has been resolved. - option (google.api.method_signature) = "content,error"; - } - - // This method will collect the words given to it. When the stream is closed - // by the client, this method will return the a concatenation of the strings - // passed to it. This method showcases client-side streaming RPCs. - rpc Collect(stream EchoRequest) returns (EchoResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:collect" - body: "*" - }; - } - - // This method, upon receiving a request on the stream, will pass the same - // content back on the stream. This method showcases bidirectional - // streaming RPCs. - rpc Chat(stream EchoRequest) returns (stream EchoResponse); - - // This is similar to the Expand method but instead of returning a stream of - // expanded words, this method returns a paged list of expanded words. - rpc PagedExpand(PagedExpandRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpand" - body: "*" - }; - } - - // This is similar to the PagedExpand except that it uses - // max_results instead of page_size, as some legacy APIs still - // do. New APIs should NOT use this pattern. - rpc PagedExpandLegacy(PagedExpandLegacyRequest) returns (PagedExpandResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacy" - body: "*" - }; - } - - // This method returns a map containing lists of words that appear in the input, keyed by their - // initial character. The only words returned are the ones included in the current page, - // as determined by page_token and page_size, which both refer to the word indices in the - // input. This paging result consisting of a map of lists is a pattern used by some legacy - // APIs. New APIs should NOT use this pattern. - rpc PagedExpandLegacyMapped(PagedExpandRequest) returns (PagedExpandLegacyMappedResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:pagedExpandLegacyMapped" - body: "*" - }; - } - - // This method will wait for the requested amount of time and then return. - // This method showcases how a client handles a request timeout. - rpc Wait(WaitRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/echo:wait" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "WaitResponse" - metadata_type: "WaitMetadata" - }; - } - - // This method will block (wait) for the requested amount of time - // and then return the response or error. - // This method showcases how a client handles delays or retries. - rpc Block(BlockRequest) returns (BlockResponse) { - option (google.api.http) = { - post: "/v1beta1/echo:block" - body: "*" - }; - }; -} - -// A severity enum used to test enum capabilities in GAPIC surfaces. -enum Severity { - UNNECESSARY = 0; - NECESSARY = 1; - URGENT = 2; - CRITICAL = 3; -} - - -// The request message used for the Echo, Collect and Chat methods. -// If content or opt are set in this message then the request will succeed. -// If status is set in this message then the status will be returned as an -// error. -message EchoRequest { - oneof response { - // The content to be echoed by the server. - string content = 1; - - // The error to be thrown by the server. - google.rpc.Status error = 2; - } - - // The severity to be echoed by the server. - Severity severity = 3; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string header = 4; - - // Optional. This field can be set to test the routing annotation on the Echo method. - string other_header = 5; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - string request_id = 7 [ - (google.api.field_info).format = UUID4 - ]; - - // To facilitate testing of https://google.aip.dev/client-libraries/4235 - optional string other_request_id = 8 [ - (google.api.field_info).format = UUID4 - ]; -} - -// The response message for the Echo methods. -message EchoResponse { - // The content specified in the request. - string content = 1; - - // The severity specified in the request. - Severity severity = 2; - - // The request ID specified or autopopulated in the request. - string request_id = 3; - - // The other request ID specified or autopopulated in the request. - string other_request_id = 4; -} - -// The request message used for the EchoErrorDetails method. -message EchoErrorDetailsRequest { - // Content to return in a singular `*.error.details` field of type - // `google.protobuf.Any` - string single_detail_text = 1; - - // Content to return in a repeated `*.error.details` field of type - // `google.protobuf.Any` - repeated string multi_detail_text = 2; -} - -// The response message used for the EchoErrorDetails method. -message EchoErrorDetailsResponse { - - message SingleDetail { - ErrorWithSingleDetail error = 1; - } - - message MultipleDetails { - ErrorWithMultipleDetails error = 1; - } - - SingleDetail single_detail = 1; - MultipleDetails multiple_details = 2; -} - -message ErrorWithSingleDetail { - google.protobuf.Any details = 1; -} - -message ErrorWithMultipleDetails { - repeated google.protobuf.Any details = 1; -} - -// The request message for the Expand method. -message ExpandRequest { - // The content that will be split into words and returned on the stream. - string content = 1; - - // The error that is thrown after all words are sent on the stream. - google.rpc.Status error = 2; - - //The wait time between each server streaming messages - google.protobuf.Duration stream_wait_time = 3; -} - -// The request for the PagedExpand method. -message PagedExpandRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - int32 page_size = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The request for the PagedExpandLegacy method. This is a pattern used by some legacy APIs. New -// APIs should NOT use this pattern, but rather something like PagedExpandRequest which conforms to -// aip.dev/158. -message PagedExpandLegacyRequest { - // The string to expand. - string content = 1 [(google.api.field_behavior) = REQUIRED]; - - // The number of words to returned in each page. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - // violates aip.dev/158. Ordinarily, this should be page_size. --) - int32 max_results = 2; - - // The position of the page to be returned. - string page_token = 3; -} - -// The response for the PagedExpand method. -message PagedExpandResponse { - // The words that were expanded. - repeated EchoResponse responses = 1; - - // The next page token. - string next_page_token = 2; -} - -// A list of words. -message PagedExpandResponseList { - repeated string words = 1; -} - -message PagedExpandLegacyMappedResponse { - // The words that were expanded, indexed by their initial character. - // (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that violates - // aip.dev/158. Ordinarily, this should be a `repeated` field, as in PagedExpandResponse. --) - map alphabetized = 1; - - // The next page token. - string next_page_token = 2; -} - -// The request for Wait method. -message WaitRequest { - oneof end { - // The time that this operation will complete. - google.protobuf.Timestamp end_time = 1; - - // The duration of this operation. - google.protobuf.Duration ttl = 4; - } - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned on operation completion. - WaitResponse success = 3; - } -} - -// The result of the Wait operation. -message WaitResponse { - // This content of the result. - string content = 1; -} - -// The metadata for Wait operation. -message WaitMetadata { - // The time that this operation will complete. - google.protobuf.Timestamp end_time =1; -} - -// The request for Block method. -message BlockRequest { - // The amount of time to block before returning a response. - google.protobuf.Duration response_delay = 1; - - oneof response { - // The error that will be returned by the server. If this code is specified - // to be the OK rpc code, an empty response will be returned. - google.rpc.Status error = 2; - - // The response to be returned that will signify successful method call. - BlockResponse success = 3; - } -} - -// The response for Block method. -message BlockResponse { - // This content can contain anything, the server will not depend on a value - // here. - string content = 1; -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline deleted file mode 100644 index 569c604d78fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/identity.proto.baseline +++ /dev/null @@ -1,186 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple identity service. -service Identity { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a user. - rpc CreateUser(CreateUserRequest) returns (User) { - option (google.api.http) = { - post: "/v1beta1/users" - body: "*" - }; - option (google.api.method_signature) = "user.display_name,user.email"; - option (google.api.method_signature) = - "user.display_name,user.email,user.age,user.nickname,user.enable_notifications,user.height_feet"; - } - - // Retrieves the User with the given uri. - rpc GetUser(GetUserRequest) returns (User) { - option (google.api.http) = { - get: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a user. - rpc UpdateUser(UpdateUserRequest) returns (User) { - option (google.api.http) = { - patch: "/v1beta1/{user.name=users/*}" - body: "user" - }; - } - - // Deletes a user, their profile, and all of their authored messages. - rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=users/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all users. - rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) { - option (google.api.http) = { - get: "/v1beta1/users" - }; - } -} - -// A user. -message User { - option (google.api.resource) = { - type: "showcase.googleapis.com/User" - pattern: "users/{user}" - }; - - // The resource name of the user. - string name = 1; - - // The display_name of the user. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The email address of the user. - string email = 3 [(google.api.field_behavior) = REQUIRED]; - - // The timestamp at which the user was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the user was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The age of the user in years. - optional int32 age = 6; - - // The height of the user in feet. - optional double height_feet = 7; - - // The nickname of the user. - // - // (-- aip.dev/not-precedent: An empty string is a valid nickname. - // Ordinarily, proto3_optional should not be used on a `string` field. --) - optional string nickname = 8; - - // Enables the receiving of notifications. The default is true if unset. - // - // (-- aip.dev/not-precedent: The default for the feature is true. - // Ordinarily, the default for a `bool` field should be false. --) - optional bool enable_notifications = 9; -} - -// The request message for the google.showcase.v1beta1.Identity\CreateUser -// method. -message CreateUserRequest { - // The user to create. - User user = 1; -} - -// The request message for the google.showcase.v1beta1.Identity\GetUser -// method. -message GetUserRequest { - // The resource name of the requested user. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\UpdateUser -// method. -message UpdateUserRequest { - // The user to update. - User user = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Identity\DeleteUser -// method. -message DeleteUserRequest { - // The resource name of the user to delete. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersRequest { - // The maximum number of users to return. Server may return fewer users - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Identity\ListUsers` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Identity\ListUsers -// method. -message ListUsersResponse { - // The list of users. - repeated User users = 1; - - // A token to retrieve next page of results. - // Pass this value in ListUsersRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Message\ListUsers` method to retrieve the - // next page of results. - string next_page_token = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline deleted file mode 100644 index 62196dfced39..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/messaging.proto.baseline +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright 2018 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/error_details.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A simple messaging service that implements chat rooms and profile posts. -// -// This messaging service showcases the features that API clients -// generated by gapic-generators implement. -service Messaging { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a room. - rpc CreateRoom(CreateRoomRequest) returns (Room) { - option (google.api.http) = { - post: "/v1beta1/rooms" - body: "*" - }; - option (google.api.method_signature) = "room.display_name,room.description"; - } - - // Retrieves the Room with the given resource name. - rpc GetRoom(GetRoomRequest) returns (Room) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a room. - rpc UpdateRoom(UpdateRoomRequest) returns (Room) { - option (google.api.http) = { - patch: "/v1beta1/{room.name=rooms/*}" - body: "room" - }; - } - - // Deletes a room and all of its blurbs. - rpc DeleteRoom(DeleteRoomRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all chat rooms. - rpc ListRooms(ListRoomsRequest) returns (ListRoomsResponse) { - option (google.api.http) = { - get: "/v1beta1/rooms" - }; - } - - // Creates a blurb. If the parent is a room, the blurb is understood to be a - // message in that room. If the parent is a profile, the blurb is understood - // to be a post on the profile. - rpc CreateBlurb(CreateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs" - body: "*" - } - }; - option (google.api.method_signature) = "parent,blurb.user,blurb.text"; - option (google.api.method_signature) = "parent,blurb.user,blurb.image"; - } - - // Retrieves the Blurb with the given resource name. - rpc GetBlurb(GetBlurbRequest) returns (Blurb) { - option (google.api.http) = { - get: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { get: "/v1beta1/{name=users/*/profile/blurbs/*}" } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a blurb. - rpc UpdateBlurb(UpdateBlurbRequest) returns (Blurb) { - option (google.api.http) = { - patch: "/v1beta1/{blurb.name=rooms/*/blurbs/*}" - body: "blurb" - additional_bindings: { - patch: "/v1beta1/{blurb.name=users/*/profile/blurbs/*}" - body: "blurb" - } - }; - } - - // Deletes a blurb. - rpc DeleteBlurb(DeleteBlurbRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=rooms/*/blurbs/*}" - additional_bindings: { - delete: "/v1beta1/{name=users/*/profile/blurbs/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists blurbs for a specific chat room or user profile depending on the - // parent resource name. - rpc ListBlurbs(ListBlurbsRequest) returns (ListBlurbsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=rooms/*}/blurbs" - additional_bindings: { get: "/v1beta1/{parent=users/*/profile}/blurbs" } - }; - option (google.api.method_signature) = "parent"; - } - - // This method searches through all blurbs across all rooms and profiles - // for blurbs containing to words found in the query. Only posts that - // contain an exact match of a queried word will be returned. - rpc SearchBlurbs(SearchBlurbsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:search" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:search" - } - }; - option (google.longrunning.operation_info) = { - response_type: "SearchBlurbsResponse" - metadata_type: "SearchBlurbsMetadata" - }; - option (google.api.method_signature) = "parent,query"; - } - - // This returns a stream that emits the blurbs that are created for a - // particular chat room or user profile. - rpc StreamBlurbs(StreamBlurbsRequest) returns (stream StreamBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=rooms/*}/blurbs:stream" - body: "*" - additional_bindings: { - post: "/v1beta1/{name=users/*/profile}/blurbs:stream" - body: "*" - } - }; - } - - // This is a stream to create multiple blurbs. If an invalid blurb is - // requested to be created, the stream will close with an error. - rpc SendBlurbs(stream CreateBlurbRequest) returns (SendBlurbsResponse) { - option (google.api.http) = { - post: "/v1beta1/{parent=rooms/*}/blurbs:send" - body: "*" - additional_bindings: { - post: "/v1beta1/{parent=users/*/profile}/blurbs:send" - body: "*" - } - }; - } - - // This method starts a bidirectional stream that receives all blurbs that - // are being created after the stream has started and sends requests to create - // blurbs. If an invalid blurb is requested to be created, the stream will - // close with an error. - rpc Connect(stream ConnectRequest) returns (stream StreamBlurbsResponse); -} - -// A chat room. -message Room { - option (google.api.resource) = { - type: "showcase.googleapis.com/Room" - pattern: "rooms/{room}" - }; - - // The resource name of the chat room. - string name = 1; - - // The human readable name of the chat room. - string display_name = 2 [(google.api.field_behavior) = REQUIRED]; - - // The description of the chat room. - string description = 3; - - // The timestamp at which the room was created. - google.protobuf.Timestamp create_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the room was updated. - google.protobuf.Timestamp update_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateRoom -// method. -message CreateRoomRequest { - // The room to create. - Room room = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetRoom -// method. -message GetRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateRoom -// method. -message UpdateRoomRequest { - // The room to update. - Room room = 1; - - // The field mask to determine which fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteRoom -// method. -message DeleteRoomRequest { - // The resource name of the requested room. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Room", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsRequest { - // The maximum number of rooms return. Server may return fewer rooms - // than requested. If unspecified, server will pick an appropriate default. - int32 page_size = 1; - - // The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListRooms` method. - string page_token = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListRooms -// method. -message ListRoomsResponse { - // The list of rooms. - repeated Room rooms = 1; - - // A token to retrieve next page of results. - // Pass this value in ListRoomsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Messaging\ListRooms` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// This protocol buffer message represents a blurb sent to a chat room or -// posted on a user profile. -message Blurb { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blurb" - pattern: "users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}" - pattern: "users/{user}/profile/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/{blurb}" - pattern: "rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}" - }; - - // The resource name of the chat room. - string name = 1; - - // The resource name of the blurb's author. - string user = 2 [ - (google.api.resource_reference).type = "showcase.googleapis.com/User", - (google.api.field_behavior) = REQUIRED - ]; - - oneof content { - // The textual content of this blurb. - string text = 3; - - // The image content of this blurb. - bytes image = 4; - } - - // The timestamp at which the blurb was created. - google.protobuf.Timestamp create_time = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest timestamp at which the blurb was updated. - google.protobuf.Timestamp update_time = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // (-- aip.dev/not-precedent: This is designed for testing non-slash - // resource patterns. Ordinarily, non-slash separators are discouraged. - // --) - oneof legacy_id { - // The legacy id of the room. This field is used to signal - // the use of the compound resource pattern - // `rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}` - string legacy_room_id = 7; - - // The legacy id of the user. This field is used to signal - // the use of the compound resource pattern - // `users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}` - string legacy_user_id = 8; - } -} - -// The request message for the google.showcase.v1beta1.Messaging\CreateBlurb -// method. -message CreateBlurbRequest { - // The resource name of the chat room or user profile that this blurb will - // be tied to. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The blurb to create. - Blurb blurb = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\GetBlurb -// method. -message GetBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\UpdateBlurb -// method. -message UpdateBlurbRequest { - // The blurb to update. - Blurb blurb = 1; - - // The field mask to determine wich fields are to be updated. If empty, the - // server will assume all fields are to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\DeleteBlurb -// method. -message DeleteBlurbRequest { - // The resource name of the requested blurb. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; -} - -// The request message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsRequest { - // The resource name of the requested room or profile whos blurbs to list. - string parent = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The maximum number of blurbs to return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 2; - - // The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\ListBlurbs` method. - string page_token = 3; -} - -// The response message for the google.showcase.v1beta1.Messaging\ListBlurbs -// method. -message ListBlurbsResponse { - // The list of blurbs. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in ListBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\ListBlurbs` method to retrieve - // the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\SearchBlurbs -// method. -message SearchBlurbsRequest { - // The query used to search for blurbs containing to words of this string. - // Only posts that contain an exact match of a queried word will be returned. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // The rooms or profiles to search. If unset, `SearchBlurbs` will search all - // rooms and all profiles. - string parent = 2 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - - // The maximum number of blurbs return. Server may return fewer - // blurbs than requested. If unspecified, server will pick an appropriate - // default. - int32 page_size = 3; - - // The value of - // google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - // returned from the previous call to - // `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - string page_token = 4; -} - -// The operation metadata message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsMetadata { - // This signals to the client when to next poll for response. - google.rpc.RetryInfo retry_info = 1; -} - -// The operation response message for the -// google.showcase.v1beta1.Messaging\SearchBlurbs method. -message SearchBlurbsResponse { - // Blurbs that matched the search query. - repeated Blurb blurbs = 1; - - // A token to retrieve next page of results. - // Pass this value in SearchBlurbsRequest.page_token field in the subsequent - // call to `google.showcase.v1beta1.Blurb\SearchBlurbs` method to - // retrieve the next page of results. - string next_page_token = 2; -} - -// The request message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsRequest { - // The resource name of a chat room or user profile whose blurbs to stream. - string name = 1 [ - (google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb", - (google.api.field_behavior) = REQUIRED - ]; - - // The time at which this stream will close. - google.protobuf.Timestamp expire_time = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// The response message for the google.showcase.v1beta1.Messaging\StreamBlurbs -// method. -message StreamBlurbsResponse { - // The blurb that was either created, updated, or deleted. - Blurb blurb = 1; - - // The action that triggered the blurb to be returned. - enum Action { - ACTION_UNSPECIFIED = 0; - - // Specifies that the blurb was created. - CREATE = 1; - - // Specifies that the blurb was updated. - UPDATE = 2; - - // Specifies that the blurb was deleted. - DELETE = 3; - } - - // The action that triggered the blurb to be returned. - Action action = 2; -} - -// The response message for the google.showcase.v1beta1.Messaging\SendBlurbs -// method. -message SendBlurbsResponse { - // The names of successful blurb creations. - repeated string names = 1; -} - -// The request message for the google.showcase.v1beta1.Messaging\Connect -// method. -message ConnectRequest { - message ConnectConfig { - // The room or profile to follow and create messages for. - string parent = 1 [(google.api.resource_reference).child_type = - "showcase.googleapis.com/Blurb"]; - } - - oneof request { - // Provides information that specifies how to process subsequent requests. - // The first `ConnectRequest` message must contain a `config` message. - ConnectConfig config = 1; - - // The blurb to be created. - Blurb blurb = 2; - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline deleted file mode 100644 index 26158fdd861f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/sequence.proto.baseline +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2020 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. - -syntax = "proto3"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -service SequenceService { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a sequence. - rpc CreateSequence(CreateSequenceRequest) returns (Sequence) { - option (google.api.http) = { - post: "/v1beta1/sequences" - body: "sequence" - }; - option (google.api.method_signature) = "sequence"; - }; - - // Retrieves a sequence. - rpc GetSequenceReport(GetSequenceReportRequest) returns (SequenceReport) { - option (google.api.http) = { - get: "/v1beta1/{name=sequences/*/sequenceReport}" - }; - option (google.api.method_signature) = "name"; - }; - - // Attempts a sequence. - rpc AttemptSequence(AttemptSequenceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1beta1/{name=sequences/*}" - body: "*" - }; - option (google.api.method_signature) = "name"; - }; -} - -message Sequence { - option (google.api.resource) = { - type: "showcase.googleapis.com/Sequence" - pattern: "sequences/{sequence}" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A server response to an RPC Attempt in a sequence. - message Response { - // The status to return for an individual attempt. - google.rpc.Status status = 1; - - // The amount of time to delay sending the response. - google.protobuf.Duration delay = 2; - } - - // Sequence of responses to return in order for each attempt. If empty, the - // default response is an immediate OK. - repeated Response responses = 2; -} - -message SequenceReport { - option (google.api.resource) = { - type: "showcase.googleapis.com/SequenceReport" - pattern: "sequences/{sequence}/sequenceReport" - }; - - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Contains metrics on individual RPC Attempts in a sequence. - message Attempt { - // The attempt number - starting at 0. - int32 attempt_number = 1; - - // The deadline dictated by the attempt to the server. - google.protobuf.Timestamp attempt_deadline = 2; - - // The time that the server responded to the RPC attempt. Used for - // calculating attempt_delay. - google.protobuf.Timestamp response_time = 3; - - // The server perceived delay between sending the last response and - // receiving this attempt. Used for validating attempt delay backoff. - google.protobuf.Duration attempt_delay = 4; - - // The status returned to the attempt. - google.rpc.Status status = 5; - } - - // The set of RPC attempts received by the server for a Sequence. - repeated Attempt attempts = 2; -} - -message CreateSequenceRequest { - Sequence sequence = 1; -} - -message AttemptSequenceRequest { - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Sequence", - (google.api.field_behavior) = REQUIRED - ]; -} - -message GetSequenceReportRequest { - string name = 1 [ - (google.api.resource_reference).type = - "showcase.googleapis.com/SequenceReport", - (google.api.field_behavior) = REQUIRED - ]; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline deleted file mode 100644 index dbfe134c6fb5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/protos/google/showcase/v1beta1/testing.proto.baseline +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright 2018 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. - -edition = "2023"; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/resource.proto"; -import "google/protobuf/empty.proto"; - -package google.showcase.v1beta1; - -option go_package = "github.com/googleapis/gapic-showcase/server/genproto"; -option java_package = "com.google.showcase.v1beta1"; -option java_multiple_files = true; -option ruby_package = "Google::Showcase::V1beta1"; - -// A service to facilitate running discrete sets of tests -// against Showcase. -service Testing { - // This service is meant to only run locally on the port 7469 (keypad digits - // for "show"). - option (google.api.default_host) = "localhost:7469"; - - // Creates a new testing session. - rpc CreateSession(CreateSessionRequest) returns (Session) { - option (google.api.http) = { - post: "/v1beta1/sessions" - body: "session" - }; - } - - // Gets a testing session. - rpc GetSession(GetSessionRequest) returns (Session) { - option (google.api.http) = { - get: "/v1beta1/{name=sessions/*}" - }; - } - - // Lists the current test sessions. - rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { - option (google.api.http) = { - get: "/v1beta1/sessions" - }; - } - - // Delete a test session. - rpc DeleteSession(DeleteSessionRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*}" - }; - } - - // Report on the status of a session. - // This generates a report detailing which tests have been completed, - // and an overall rollup. - rpc ReportSession(ReportSessionRequest) returns (ReportSessionResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*}:report" - }; - } - - // List the tests of a sessesion. - rpc ListTests(ListTestsRequest) returns (ListTestsResponse) { - option (google.api.http) = { - get: "/v1beta1/{parent=sessions/*}/tests" - }; - } - - // Explicitly decline to implement a test. - // - // This removes the test from subsequent `ListTests` calls, and - // attempting to do the test will error. - // - // This method will error if attempting to delete a required test. - rpc DeleteTest(DeleteTestRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1beta1/{name=sessions/*/tests/*}" - }; - } - - // Register a response to a test. - // - // In cases where a test involves registering a final answer at the - // end of the test, this method provides the means to do so. - rpc VerifyTest(VerifyTestRequest) returns (VerifyTestResponse) { - option (google.api.http) = { - post: "/v1beta1/{name=sessions/*/tests/*}:check" - }; - } -} - -// A session is a suite of tests, generally being made in the context -// of testing code generation. -// -// A session defines tests it may expect, based on which version of the -// code generation spec is in use. -message Session { - option (google.api.resource) = { - type: "showcase.googleapis.com/Session" - pattern: "sessions/{session}" - }; - - // The name of the session. The ID must conform to ^[a-z]+$ - // If this is not provided, Showcase chooses one at random. - string name = 1; - - // The specification versions understood by Showcase. - enum Version { - // Unspecified version. If passed on creation, the session will default - // to using the latest stable release. - VERSION_UNSPECIFIED = 0; - - // The latest v1. Currently, this is v1.0. - V1_LATEST = 1; - - // v1.0. (Until the spec is "GA", this will be a moving target.) - V1_0 = 2; - } - - // Required. The version this session is using. - Version version = 2; -} - -// The request for the CreateSession method. -message CreateSessionRequest { - // The session to be created. - // Sessions are immutable once they are created (although they can - // be deleted). - Session session = 1; -} - -// The request for the GetSession method. -message GetSessionRequest { - // The session to be retrieved. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// The request for the ListSessions method. -message ListSessionsRequest { - // The maximum number of sessions to return per page. - int32 page_size = 1; - - // The page token, for retrieving subsequent pages. - string page_token = 2; -} - -// Response for the ListSessions method. -message ListSessionsResponse { - // The sessions being returned. - repeated Session sessions = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// Request for the DeleteSession method. -message DeleteSessionRequest { - // The session to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Request message for reporting on a session. -message ReportSessionRequest { - // The session to be reported on. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; -} - -// Response message for reporting on a session. -message ReportSessionResponse { - // The topline state of the report. - enum Result { - RESULT_UNSPECIFIED = 0; - - // The session is complete, and everything passed. - PASSED = 1; - - // The session had an explicit failure. - FAILED = 2; - - // The session is incomplete. This is a failure response. - INCOMPLETE = 3; - } - - // The state of the report. - Result result = 1; - - // The test runs of this session. - repeated TestRun test_runs = 2; -} - -message Test { - option (google.api.resource) = { - type: "showcase.googleapis.com/Test" - pattern: "sessions/{session}/tests/{test}" - }; - - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string name = 1; - - // Whether or not a test is required, recommended, or optional. - enum ExpectationLevel { - EXPECTATION_LEVEL_UNSPECIFIED = 0; - - // This test is strictly required. - REQUIRED = 1; - - // This test is recommended. - // - // If a generator explicitly ignores a recommended test (see `DeleteTest`), - // then the report may still pass, but with a warning. - // - // If a generator skips a recommended test and does not explicitly - // express that intention, the report will fail. - RECOMMENDED = 2; - - // This test is optional. - // - // If a generator explicitly ignores an optional test (see `DeleteTest`), - // then the report may still pass, and no warning will be issued. - // - // If a generator skips an optional test and does not explicitly - // express that intention, the report may still pass, but with a - // warning. - OPTIONAL = 3; - } - - // The expectation level for this test. - ExpectationLevel expectation_level = 2; - - // A description of the test. - string description = 3; - - // A blueprint is an explicit definition of methods and requests that are needed - // to be made to test this specific test case. Ideally this would be represented - // by something more robust like CEL, but as of writing this, I am unsure if CEL - // is ready. - message Blueprint { - option (google.api.resource) = { - type: "showcase.googleapis.com/Blueprint" - pattern: "sessions/{session}/tests/{test}/blueprints/{blueprint}" - }; - - // The name of this blueprint. - string name = 1; - - // A description of this blueprint. - string description = 2; - - // A message representing a method invocation. - message Invocation { - // The fully qualified name of the showcase method to be invoked. - string method = 1; - - // The request to be made if a specific request is necessary. - bytes serialized_request = 2; - } - - // The initial request to trigger this test. - Invocation request = 3; - - // An ordered list of method calls that can be called to trigger this test. - repeated Invocation additional_requests = 4; - } - - // The blueprints that will satisfy this test. There may be multiple blueprints - // that can signal to the server that this test case is being exercised. Although - // multiple blueprints are specified, only a single blueprint needs to be run to - // signal that the test case was exercised. - repeated Blueprint blueprints = 4; -} - -// An issue found in the test. -message Issue { - // The different potential types of issues. - enum Type { - TYPE_UNSPECIFIED = 0; - - // The test was never instrumented. - SKIPPED = 1; - - // The test was started but never confirmed. - PENDING = 2; - - // The test was instrumented, but Showcase got an unexpected - // value when the generator tried to confirm success. - INCORRECT_CONFIRMATION = 3; - } - - // The type of the issue. - Type type = 1; - - // Severity levels. - enum Severity { - SEVERITY_UNSPECIFIED = 0; - - // Errors. - ERROR = 1; - - // Warnings. - WARNING = 2; - } - - // The severity of the issue. - Severity severity = 2; - - // A description of the issue. - string description = 3; -} - -// The request for the ListTests method. -message ListTestsRequest { - // The session. - string parent = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Session"]; - - // The maximum number of tests to return per page. - int32 page_size = 2; - - // The page token, for retrieving subsequent pages. - string page_token = 3; -} - -// The response for the ListTests method. -message ListTestsResponse { - // The tests being returned. - repeated Test tests = 1; - - // The next page token, if any. - // An empty value here means the last page has been reached. - string next_page_token = 2; -} - -// A TestRun is the result of running a Test. -message TestRun { - // The name of the test. - // The tests/* portion of the names are hard-coded, and do not change - // from session to session. - string test = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - - // An issue found with the test run. If empty, this test run was successful. - Issue issue = 2; -} - -// Request message for deleting a test. -message DeleteTestRequest { - // The test to be deleted. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; -} - -message VerifyTestRequest { - // The test to have an answer registered to it. - string name = 1 [ - (google.api.resource_reference).type = "showcase.googleapis.com/Test"]; - - // The answer from the test. - bytes answer = 2; - - // The answers from the test if multiple are to be checked - repeated bytes answers = 3; -} - -message VerifyTestResponse { - // An issue if check answer was unsuccessful. This will be empty if the check answer succeeded. - Issue issue = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/index.ts.baseline deleted file mode 100644 index 55fd8ef14d16..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/index.ts.baseline +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1beta1 from './v1beta1'; -const ComplianceClient = v1beta1.ComplianceClient; -type ComplianceClient = v1beta1.ComplianceClient; -const EchoClient = v1beta1.EchoClient; -type EchoClient = v1beta1.EchoClient; -const IdentityClient = v1beta1.IdentityClient; -type IdentityClient = v1beta1.IdentityClient; -const MessagingClient = v1beta1.MessagingClient; -type MessagingClient = v1beta1.MessagingClient; -const SequenceServiceClient = v1beta1.SequenceServiceClient; -type SequenceServiceClient = v1beta1.SequenceServiceClient; -const TestingClient = v1beta1.TestingClient; -type TestingClient = v1beta1.TestingClient; -export {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -export default {v1beta1, ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client.ts.baseline deleted file mode 100644 index c46fdb04a76c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client.ts.baseline +++ /dev/null @@ -1,1785 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/compliance_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './compliance_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format - * correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped - * correctly. - * @class - * @memberof v1beta1 - */ -export class ComplianceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - complianceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ComplianceClient. - * - * @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://cloud.google.com/docs/authentication/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 ComplianceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ComplianceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Compliance', gapicConfig as gax.ClientConfig, - 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.complianceStub) { - return this.complianceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Compliance. - this.complianceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Compliance') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Compliance, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const complianceStubMethods = - ['repeatDataBody', 'repeatDataBodyInfo', 'repeatDataQuery', 'repeatDataSimplePath', 'repeatDataPathResource', 'repeatDataPathTrailingResource', 'repeatDataBodyPut', 'repeatDataBodyPatch', 'getEnum', 'verifyEnum']; - for (const methodName of complianceStubMethods) { - const callPromise = this.complianceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.complianceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * This method echoes the ComplianceData request. This method exercises - * sending the entire request object in the REST body. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBody_async - */ - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBody( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBody request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBody response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBody(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBody response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending the a message-type field in the REST body. Per AIP-127, only - * top-level, non-repeated fields can be sent this way. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_info.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyInfo_async - */ - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyInfo( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyInfo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyInfo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyInfo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyInfo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending all request fields as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_query.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataQuery_async - */ - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataQuery( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataQuery request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataQuery response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataQuery(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataQuery response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request. This method exercises - * sending some parameters as "simple" path variables (i.e., of the form - * "/bar/{foo}" rather than "/{foo=bar/*}"), and the rest as query parameters. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_simple_path.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataSimplePath_async - */ - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataSimplePath( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_int32': request.info!.fInt32 ?? '', - 'info.f_double': request.info!.fDouble ?? '', - 'info.f_bool': request.info!.fBool ?? '', - 'info.f_kingdom': request.info!.fKingdom ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataSimplePath request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataSimplePath response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataSimplePath(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataSimplePath response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a path resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathResource_async - */ - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - 'info.f_bool': request.info!.fBool ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathResource response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataPathResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataPathResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Same as RepeatDataSimplePath, but with a trailing resource. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_path_trailing_resource.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataPathTrailingResource_async - */ - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataPathTrailingResource( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'info.f_string': request.info!.fString ?? '', - 'info.f_child.f_string': request.info!.fChild!.fString ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataPathTrailingResource request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataPathTrailingResource(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataPathTrailingResource response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PUT method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_put.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPut_async - */ - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPut( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPut request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPut response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyPut(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyPut response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method echoes the ComplianceData request, using the HTTP PATCH method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @param {google.showcase.v1beta1.ComplianceData} request.info - * @param {boolean} request.serverVerify - * If true, the server will verify that the received request matches - * the request with the same name in the compliance test suite. - * @param {string} request.intendedBindingUri - * The URI template this request is expected to be bound to server-side. - * @param {number} request.fInt32 - * Some top level fields, to test that these are encoded correctly - * in query params. - * @param {number} request.fInt64 - * @param {number} request.fDouble - * @param {number} request.pInt32 - * @param {number} request.pInt64 - * @param {number} request.pDouble - * @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 {@link protos.google.showcase.v1beta1.RepeatResponse|RepeatResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.repeat_data_body_patch.js - * region_tag:localhost_v1beta1_generated_Compliance_RepeatDataBodyPatch_async - */ - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request: protos.google.showcase.v1beta1.IRepeatRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): void; - repeatDataBodyPatch( - request?: protos.google.showcase.v1beta1.IRepeatRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('repeatDataBodyPatch request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('repeatDataBodyPatch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.repeatDataBodyPatch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRepeatResponse, - protos.google.showcase.v1beta1.IRepeatRequest|undefined, - {}|undefined - ]) => { - this._log.info('repeatDataBodyPatch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the - * .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the - * response from this RPC as the request to VerifyEnum() - * - * The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for - * VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {boolean} request.unknownEnum - * Whether the client is requesting a new, unknown enum value or a known enum value already declard in this proto file. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.get_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_GetEnum_async - */ - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request: protos.google.showcase.v1beta1.IEnumRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): void; - getEnum( - request?: protos.google.showcase.v1beta1.IEnumRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('getEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getEnum response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumRequest|undefined, - {}|undefined - ]) => { - this._log.info('getEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() - * verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds - * with the same EnumResponse; otherwise, the RPC errors. - * - * This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, - * although they are not guaranteed to be the same across separate Showcase server runs. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.EnumRequest} request.request - * The original request for a known or unknown enum from the server. - * @param {google.showcase.v1beta1.Continent} request.continent - * The actual enum the server provided. - * @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 {@link protos.google.showcase.v1beta1.EnumResponse|EnumResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/compliance.verify_enum.js - * region_tag:localhost_v1beta1_generated_Compliance_VerifyEnum_async - */ - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request: protos.google.showcase.v1beta1.IEnumResponse, - callback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): void; - verifyEnum( - request?: protos.google.showcase.v1beta1.IEnumResponse, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('verifyEnum request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyEnum response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.verifyEnum(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEnumResponse, - protos.google.showcase.v1beta1.IEnumResponse|undefined, - {}|undefined - ]) => { - this._log.info('verifyEnum response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.complianceStub && !this._terminated) { - return this.complianceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline deleted file mode 100644 index 43582a4ff828..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Compliance": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "RepeatDataBody": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyInfo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataQuery": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataSimplePath": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataPathTrailingResource": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPut": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RepeatDataBodyPatch": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyEnum": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/compliance_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client.ts.baseline deleted file mode 100644 index 85ac6a74ccdd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client.ts.baseline +++ /dev/null @@ -1,1684 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/echo_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './echo_client_config.json'; -const version = require('../../../package.json').version; - -/** - * This service is used showcase the four main types of rpcs - unary, server - * side streaming, client side streaming, and bidirectional streaming. This - * service also exposes methods that explicitly implement server delay, and - * paginated calls. Set the 'showcase-trailer' metadata key on any method - * to have the values echoed in the response trailers. Set the - * 'x-goog-request-params' metadata key on any method to have the values - * echoed in the response headers. - * - * This client uses Echo version v1_20240408. - * @class - * @memberof v1beta1 - */ -export class EchoClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - echoStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of EchoClient. - * - * @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://cloud.google.com/docs/authentication/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 EchoClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof EchoClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - pagedExpand: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'responses') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - expand: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - collect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - chat: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const waitResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitResponse') as gax.protobuf.Type; - const waitMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.WaitMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - wait: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - waitResponse.decode.bind(waitResponse), - waitMetadata.decode.bind(waitMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Echo', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' '), 'x-goog-api-version': 'v1_20240408'}); - - // 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.echoStub) { - return this.echoStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Echo. - this.echoStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Echo') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Echo, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const echoStubMethods = - ['echo', 'echoErrorDetails', 'expand', 'collect', 'chat', 'pagedExpand', 'pagedExpandLegacy', 'wait', 'block']; - for (const methodName of echoStubMethods) { - const callPromise = this.echoStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.echoStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content to be echoed by the server. - * @param {google.rpc.Status} request.error - * The error to be thrown by the server. - * @param {google.showcase.v1beta1.Severity} request.severity - * The severity to be echoed by the server. - * @param {string} request.header - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.otherHeader - * Optional. This field can be set to test the routing annotation on the Echo method. - * @param {string} request.requestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @param {string} request.otherRequestId - * To facilitate testing of https://google.aip.dev/client-libraries/4235 - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo.js - * region_tag:localhost_v1beta1_generated_Echo_Echo_async - */ - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request: protos.google.showcase.v1beta1.IEchoRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): void; - echo( - request?: protos.google.showcase.v1beta1.IEchoRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - if (!request.requestId) { - request.requestId = gax.makeUUID(); - } - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - let routingParameter = {}; - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?
.*)')); - if (match) { - const parameterValue = match.groups?.['header'] ?? fieldValue; - Object.assign(routingParameter, { header: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['routing_id'] ?? fieldValue; - Object.assign(routingParameter, { routing_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?regions/[^/]+/zones/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['super_id'] ?? fieldValue; - Object.assign(routingParameter, { super_id: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+/instances/[^/]+(?:/.*)?)')); - if (match) { - const parameterValue = match.groups?.['table_name'] ?? fieldValue; - Object.assign(routingParameter, { table_name: parameterValue }); - } - } - } - { - const fieldValue = request.header; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('projects/[^/]+/(?instances/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['instance_id'] ?? fieldValue; - Object.assign(routingParameter, { instance_id: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?(?:.*)?)')); - if (match) { - const parameterValue = match.groups?.['baz'] ?? fieldValue; - Object.assign(routingParameter, { baz: parameterValue }); - } - } - } - { - const fieldValue = request.otherHeader; - if (fieldValue !== undefined && fieldValue !== null) { - const match = fieldValue.toString().match(RegExp('(?projects/[^/]+)(?:/.*)?')); - if (match) { - const parameterValue = match.groups?.['qux'] ?? fieldValue; - Object.assign(routingParameter, { qux: parameterValue }); - } - } - } - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams( - routingParameter - ); - this.initialize().catch(err => {throw err}); - this._log.info('echo request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echo response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echo(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|undefined, - {}|undefined - ]) => { - this._log.info('echo response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method returns error details in a repeated "google.protobuf.Any" - * field. This method showcases handling errors thus encoded, particularly - * over REST transport. Note that GAPICs only allow the type - * "google.protobuf.Any" for field paths ending in "error.details", and, at - * run-time, the actual types for these fields must be one of the types in - * google/rpc/error_details.proto. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.singleDetailText - * Content to return in a singular `*.error.details` field of type - * `google.protobuf.Any` - * @param {string[]} request.multiDetailText - * Content to return in a repeated `*.error.details` field of type - * `google.protobuf.Any` - * @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 {@link protos.google.showcase.v1beta1.EchoErrorDetailsResponse|EchoErrorDetailsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.echo_error_details.js - * region_tag:localhost_v1beta1_generated_Echo_EchoErrorDetails_async - */ - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - callback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): void; - echoErrorDetails( - request?: protos.google.showcase.v1beta1.IEchoErrorDetailsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('echoErrorDetails request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('echoErrorDetails response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.echoErrorDetails(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IEchoErrorDetailsResponse, - protos.google.showcase.v1beta1.IEchoErrorDetailsRequest|undefined, - {}|undefined - ]) => { - this._log.info('echoErrorDetails response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This is similar to the PagedExpand except that it uses - * max_results instead of page_size, as some legacy APIs still - * do. New APIs should NOT use this pattern. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.maxResults - * The number of words to returned in each page. - * (-- aip.dev/not-precedent: This is a legacy, non-standard pattern that - * violates aip.dev/158. Ordinarily, this should be page_size. --) - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.PagedExpandResponse|PagedExpandResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.paged_expand_legacy.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpandLegacy_async - */ - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - callback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): void; - pagedExpandLegacy( - request?: protos.google.showcase.v1beta1.IPagedExpandLegacyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpandLegacy request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pagedExpandLegacy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.pagedExpandLegacy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IPagedExpandResponse, - protos.google.showcase.v1beta1.IPagedExpandLegacyRequest|undefined, - {}|undefined - ]) => { - this._log.info('pagedExpandLegacy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * This method will block (wait) for the requested amount of time - * and then return the response or error. - * This method showcases how a client handles delays or retries. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Duration} request.responseDelay - * The amount of time to block before returning a response. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.BlockResponse} request.success - * The response to be returned that will signify successful method call. - * @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 {@link protos.google.showcase.v1beta1.BlockResponse|BlockResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.block.js - * region_tag:localhost_v1beta1_generated_Echo_Block_async - */ - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request: protos.google.showcase.v1beta1.IBlockRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): void; - block( - request?: protos.google.showcase.v1beta1.IBlockRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('block request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('block response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.block(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlockResponse, - protos.google.showcase.v1beta1.IBlockRequest|undefined, - {}|undefined - ]) => { - this._log.info('block response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This method splits the given content into words and will pass each word back - * through the stream. This method showcases server-side streaming RPCs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The content that will be split into words and returned on the stream. - * @param {google.rpc.Status} request.error - * The error that is thrown after all words are sent on the stream. - * @param {google.protobuf.Duration} request.streamWaitTime - * The wait time between each server streaming messages - * @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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.expand.js - * region_tag:localhost_v1beta1_generated_Echo_Expand_async - */ - expand( - request?: protos.google.showcase.v1beta1.IExpandRequest, - options?: CallOptions): - gax.CancellableStream{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('expand stream %j', options); - return this.innerApiCalls.expand(request, options); - } - -/** - * This method will collect the words given to it. When the stream is closed - * by the client, this method will return the a concatenation of the strings - * passed to it. This method showcases client-side streaming RPCs. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.collect.js - * region_tag:localhost_v1beta1_generated_Echo_Collect_async - */ - collect( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - collect( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IEchoResponse, - protos.google.showcase.v1beta1.IEchoRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('collect stream %j', options); - return this.innerApiCalls.collect(null, options, callback); - } - -/** - * This method, upon receiving a request on the stream, will pass the same - * content back on the stream. This method showcases bidirectional - * streaming RPCs. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.EchoRequest|EchoRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.chat.js - * region_tag:localhost_v1beta1_generated_Echo_Chat_async - */ - chat( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('chat stream %j', options); - return this.innerApiCalls.chat(null, options); - } - -/** - * This method will wait for the requested amount of time and then return. - * This method showcases how a client handles a request timeout. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.Timestamp} request.endTime - * The time that this operation will complete. - * @param {google.protobuf.Duration} request.ttl - * The duration of this operation. - * @param {google.rpc.Status} request.error - * The error that will be returned by the server. If this code is specified - * to be the OK rpc code, an empty response will be returned. - * @param {google.showcase.v1beta1.WaitResponse} request.success - * The response to be returned on operation completion. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request: protos.google.showcase.v1beta1.IWaitRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - wait( - request?: protos.google.showcase.v1beta1.IWaitRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('wait response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('wait request %j', request); - return this.innerApiCalls.wait(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('wait response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `wait()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/echo.wait.js - * region_tag:localhost_v1beta1_generated_Echo_Wait_async - */ - async checkWaitProgress(name: string): Promise>{ - this._log.info('wait long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.wait, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * This is similar to the Expand method but instead of returning a stream of - * expanded words, this method returns a paged list of expanded words. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 Array of {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `pagedExpandAsync()` - * 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. - */ - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request: protos.google.showcase.v1beta1.IPagedExpandRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): void; - pagedExpand( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>): - Promise<[ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IPagedExpandRequest, - protos.google.showcase.v1beta1.IPagedExpandResponse|null|undefined, - protos.google.showcase.v1beta1.IEchoResponse>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('pagedExpand values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('pagedExpand request %j', request); - return this.innerApiCalls - .pagedExpand(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IEchoResponse[], - protos.google.showcase.v1beta1.IPagedExpandRequest|null, - protos.google.showcase.v1beta1.IPagedExpandResponse - ]) => { - this._log.info('pagedExpand values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `pagedExpand`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be 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 {@link protos.google.showcase.v1beta1.EchoResponse|EchoResponse} 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 `pagedExpandAsync()` - * 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. - */ - pagedExpandStream( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand stream %j', request); - return this.descriptors.page.pagedExpand.createStream( - this.innerApiCalls.pagedExpand as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `pagedExpand`, 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.content - * The string to expand. - * @param {number} request.pageSize - * The number of words to returned in each page. - * @param {string} request.pageToken - * The position of the page to be returned. - * @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.showcase.v1beta1.EchoResponse|EchoResponse}. 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 include:samples/generated/v1beta1/echo.paged_expand.js - * region_tag:localhost_v1beta1_generated_Echo_PagedExpand_async - */ - pagedExpandAsync( - request?: protos.google.showcase.v1beta1.IPagedExpandRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['pagedExpand']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('pagedExpand iterate %j', request); - return this.descriptors.page.pagedExpand.asyncIterate( - this.innerApiCalls['pagedExpand'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.echoStub && !this._terminated) { - return this.echoStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client_config.json.baseline deleted file mode 100644 index 15d042d42e54..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_client_config.json.baseline +++ /dev/null @@ -1,66 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Echo": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Echo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EchoErrorDetails": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Expand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Collect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Chat": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpand": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PagedExpandLegacyMapped": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Wait": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Block": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/echo_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline deleted file mode 100644 index 21a8c17c76b9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/gapic_metadata.json.baseline +++ /dev/null @@ -1,592 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.showcase.v1beta1", - "libraryPackage": "showcase", - "services": { - "Compliance": { - "clients": { - "grpc": { - "libraryClient": "ComplianceClient", - "rpcs": { - "RepeatDataBody": { - "methods": [ - "repeatDataBody" - ] - }, - "RepeatDataBodyInfo": { - "methods": [ - "repeatDataBodyInfo" - ] - }, - "RepeatDataQuery": { - "methods": [ - "repeatDataQuery" - ] - }, - "RepeatDataSimplePath": { - "methods": [ - "repeatDataSimplePath" - ] - }, - "RepeatDataPathResource": { - "methods": [ - "repeatDataPathResource" - ] - }, - "RepeatDataPathTrailingResource": { - "methods": [ - "repeatDataPathTrailingResource" - ] - }, - "RepeatDataBodyPut": { - "methods": [ - "repeatDataBodyPut" - ] - }, - "RepeatDataBodyPatch": { - "methods": [ - "repeatDataBodyPatch" - ] - }, - "GetEnum": { - "methods": [ - "getEnum" - ] - }, - "VerifyEnum": { - "methods": [ - "verifyEnum" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ComplianceClient", - "rpcs": { - "RepeatDataBody": { - "methods": [ - "repeatDataBody" - ] - }, - "RepeatDataBodyInfo": { - "methods": [ - "repeatDataBodyInfo" - ] - }, - "RepeatDataQuery": { - "methods": [ - "repeatDataQuery" - ] - }, - "RepeatDataSimplePath": { - "methods": [ - "repeatDataSimplePath" - ] - }, - "RepeatDataPathResource": { - "methods": [ - "repeatDataPathResource" - ] - }, - "RepeatDataPathTrailingResource": { - "methods": [ - "repeatDataPathTrailingResource" - ] - }, - "RepeatDataBodyPut": { - "methods": [ - "repeatDataBodyPut" - ] - }, - "RepeatDataBodyPatch": { - "methods": [ - "repeatDataBodyPatch" - ] - }, - "GetEnum": { - "methods": [ - "getEnum" - ] - }, - "VerifyEnum": { - "methods": [ - "verifyEnum" - ] - } - } - } - } - }, - "Echo": { - "apiVersion": "v1_20240408", - "clients": { - "grpc": { - "libraryClient": "EchoClient", - "rpcs": { - "Echo": { - "methods": [ - "echo" - ] - }, - "EchoErrorDetails": { - "methods": [ - "echoErrorDetails" - ] - }, - "PagedExpandLegacy": { - "methods": [ - "pagedExpandLegacy" - ] - }, - "Block": { - "methods": [ - "block" - ] - }, - "Expand": { - "methods": [ - "expand" - ] - }, - "Collect": { - "methods": [ - "collect" - ] - }, - "Chat": { - "methods": [ - "chat" - ] - }, - "Wait": { - "methods": [ - "wait" - ] - }, - "PagedExpand": { - "methods": [ - "pagedExpand", - "pagedExpandStream", - "pagedExpandAsync" - ] - }, - "PagedExpandLegacyMapped": { - "methods": [ - "pagedExpandLegacyMapped", - "pagedExpandLegacyMappedStream", - "pagedExpandLegacyMappedAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "EchoClient", - "rpcs": { - "Echo": { - "methods": [ - "echo" - ] - }, - "EchoErrorDetails": { - "methods": [ - "echoErrorDetails" - ] - }, - "PagedExpandLegacy": { - "methods": [ - "pagedExpandLegacy" - ] - }, - "Block": { - "methods": [ - "block" - ] - }, - "Wait": { - "methods": [ - "wait" - ] - }, - "PagedExpand": { - "methods": [ - "pagedExpand", - "pagedExpandStream", - "pagedExpandAsync" - ] - }, - "PagedExpandLegacyMapped": { - "methods": [ - "pagedExpandLegacyMapped", - "pagedExpandLegacyMappedStream", - "pagedExpandLegacyMappedAsync" - ] - } - } - } - } - }, - "Identity": { - "clients": { - "grpc": { - "libraryClient": "IdentityClient", - "rpcs": { - "CreateUser": { - "methods": [ - "createUser" - ] - }, - "GetUser": { - "methods": [ - "getUser" - ] - }, - "UpdateUser": { - "methods": [ - "updateUser" - ] - }, - "DeleteUser": { - "methods": [ - "deleteUser" - ] - }, - "ListUsers": { - "methods": [ - "listUsers", - "listUsersStream", - "listUsersAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "IdentityClient", - "rpcs": { - "CreateUser": { - "methods": [ - "createUser" - ] - }, - "GetUser": { - "methods": [ - "getUser" - ] - }, - "UpdateUser": { - "methods": [ - "updateUser" - ] - }, - "DeleteUser": { - "methods": [ - "deleteUser" - ] - }, - "ListUsers": { - "methods": [ - "listUsers", - "listUsersStream", - "listUsersAsync" - ] - } - } - } - } - }, - "Messaging": { - "clients": { - "grpc": { - "libraryClient": "MessagingClient", - "rpcs": { - "CreateRoom": { - "methods": [ - "createRoom" - ] - }, - "GetRoom": { - "methods": [ - "getRoom" - ] - }, - "UpdateRoom": { - "methods": [ - "updateRoom" - ] - }, - "DeleteRoom": { - "methods": [ - "deleteRoom" - ] - }, - "CreateBlurb": { - "methods": [ - "createBlurb" - ] - }, - "GetBlurb": { - "methods": [ - "getBlurb" - ] - }, - "UpdateBlurb": { - "methods": [ - "updateBlurb" - ] - }, - "DeleteBlurb": { - "methods": [ - "deleteBlurb" - ] - }, - "StreamBlurbs": { - "methods": [ - "streamBlurbs" - ] - }, - "SendBlurbs": { - "methods": [ - "sendBlurbs" - ] - }, - "Connect": { - "methods": [ - "connect" - ] - }, - "SearchBlurbs": { - "methods": [ - "searchBlurbs" - ] - }, - "ListRooms": { - "methods": [ - "listRooms", - "listRoomsStream", - "listRoomsAsync" - ] - }, - "ListBlurbs": { - "methods": [ - "listBlurbs", - "listBlurbsStream", - "listBlurbsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "MessagingClient", - "rpcs": { - "CreateRoom": { - "methods": [ - "createRoom" - ] - }, - "GetRoom": { - "methods": [ - "getRoom" - ] - }, - "UpdateRoom": { - "methods": [ - "updateRoom" - ] - }, - "DeleteRoom": { - "methods": [ - "deleteRoom" - ] - }, - "CreateBlurb": { - "methods": [ - "createBlurb" - ] - }, - "GetBlurb": { - "methods": [ - "getBlurb" - ] - }, - "UpdateBlurb": { - "methods": [ - "updateBlurb" - ] - }, - "DeleteBlurb": { - "methods": [ - "deleteBlurb" - ] - }, - "SearchBlurbs": { - "methods": [ - "searchBlurbs" - ] - }, - "ListRooms": { - "methods": [ - "listRooms", - "listRoomsStream", - "listRoomsAsync" - ] - }, - "ListBlurbs": { - "methods": [ - "listBlurbs", - "listBlurbsStream", - "listBlurbsAsync" - ] - } - } - } - } - }, - "SequenceService": { - "clients": { - "grpc": { - "libraryClient": "SequenceServiceClient", - "rpcs": { - "CreateSequence": { - "methods": [ - "createSequence" - ] - }, - "GetSequenceReport": { - "methods": [ - "getSequenceReport" - ] - }, - "AttemptSequence": { - "methods": [ - "attemptSequence" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SequenceServiceClient", - "rpcs": { - "CreateSequence": { - "methods": [ - "createSequence" - ] - }, - "GetSequenceReport": { - "methods": [ - "getSequenceReport" - ] - }, - "AttemptSequence": { - "methods": [ - "attemptSequence" - ] - } - } - } - } - }, - "Testing": { - "clients": { - "grpc": { - "libraryClient": "TestingClient", - "rpcs": { - "CreateSession": { - "methods": [ - "createSession" - ] - }, - "GetSession": { - "methods": [ - "getSession" - ] - }, - "DeleteSession": { - "methods": [ - "deleteSession" - ] - }, - "ReportSession": { - "methods": [ - "reportSession" - ] - }, - "DeleteTest": { - "methods": [ - "deleteTest" - ] - }, - "VerifyTest": { - "methods": [ - "verifyTest" - ] - }, - "ListSessions": { - "methods": [ - "listSessions", - "listSessionsStream", - "listSessionsAsync" - ] - }, - "ListTests": { - "methods": [ - "listTests", - "listTestsStream", - "listTestsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "TestingClient", - "rpcs": { - "CreateSession": { - "methods": [ - "createSession" - ] - }, - "GetSession": { - "methods": [ - "getSession" - ] - }, - "DeleteSession": { - "methods": [ - "deleteSession" - ] - }, - "ReportSession": { - "methods": [ - "reportSession" - ] - }, - "DeleteTest": { - "methods": [ - "deleteTest" - ] - }, - "VerifyTest": { - "methods": [ - "verifyTest" - ] - }, - "ListSessions": { - "methods": [ - "listSessions", - "listSessionsStream", - "listSessionsAsync" - ] - }, - "ListTests": { - "methods": [ - "listTests", - "listTestsStream", - "listTestsAsync" - ] - } - } - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client.ts.baseline deleted file mode 100644 index 43eb3f62e443..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client.ts.baseline +++ /dev/null @@ -1,1311 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/identity_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './identity_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A simple identity service. - * @class - * @memberof v1beta1 - */ -export class IdentityClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - identityStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of IdentityClient. - * - * @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://cloud.google.com/docs/authentication/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 IdentityClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof IdentityClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listUsers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'users') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Identity', gapicConfig as gax.ClientConfig, - 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.identityStub) { - return this.identityStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Identity. - this.identityStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Identity') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Identity, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const identityStubMethods = - ['createUser', 'getUser', 'updateUser', 'deleteUser', 'listUsers']; - for (const methodName of identityStubMethods) { - const callPromise = this.identityStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.identityStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.create_user.js - * region_tag:localhost_v1beta1_generated_Identity_CreateUser_async - */ - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request: protos.google.showcase.v1beta1.ICreateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): void; - createUser( - request?: protos.google.showcase.v1beta1.ICreateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.ICreateUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('createUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the User with the given uri. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested user. - * @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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.get_user.js - * region_tag:localhost_v1beta1_generated_Identity_GetUser_async - */ - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request: protos.google.showcase.v1beta1.IGetUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): void; - getUser( - request?: protos.google.showcase.v1beta1.IGetUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IGetUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('getUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.User} request.user - * The user to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.update_user.js - * region_tag:localhost_v1beta1_generated_Identity_UpdateUser_async - */ - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request: protos.google.showcase.v1beta1.IUpdateUserRequest, - callback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): void; - updateUser( - request?: protos.google.showcase.v1beta1.IUpdateUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'user.name': request.user!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateUser request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IUser, - protos.google.showcase.v1beta1.IUpdateUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a user, their profile, and all of their authored messages. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the user to delete. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/identity.delete_user.js - * region_tag:localhost_v1beta1_generated_Identity_DeleteUser_async - */ - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request: protos.google.showcase.v1beta1.IDeleteUserRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): void; - deleteUser( - request?: protos.google.showcase.v1beta1.IDeleteUserRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteUser request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteUser response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteUser(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteUserRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteUser response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists all users. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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 Array of {@link protos.google.showcase.v1beta1.User|User}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listUsersAsync()` - * 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. - */ - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request: protos.google.showcase.v1beta1.IListUsersRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): void; - listUsers( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>): - Promise<[ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListUsersRequest, - protos.google.showcase.v1beta1.IListUsersResponse|null|undefined, - protos.google.showcase.v1beta1.IUser>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listUsers values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listUsers request %j', request); - return this.innerApiCalls - .listUsers(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IUser[], - protos.google.showcase.v1beta1.IListUsersRequest|null, - protos.google.showcase.v1beta1.IListUsersResponse - ]) => { - this._log.info('listUsers values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listUsers`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User} 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 `listUsersAsync()` - * 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. - */ - listUsersStream( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers stream %j', request); - return this.descriptors.page.listUsers.createStream( - this.innerApiCalls.listUsers as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listUsers`, 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 {number} request.pageSize - * The maximum number of users to return. Server may return fewer users - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListUsersResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Identity\ListUsers` method. - * @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.showcase.v1beta1.User|User}. 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 include:samples/generated/v1beta1/identity.list_users.js - * region_tag:localhost_v1beta1_generated_Identity_ListUsers_async - */ - listUsersAsync( - request?: protos.google.showcase.v1beta1.IListUsersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listUsers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listUsers iterate %j', request); - return this.descriptors.page.listUsers.asyncIterate( - this.innerApiCalls['listUsers'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.identityStub && !this._terminated) { - return this.identityStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client_config.json.baseline deleted file mode 100644 index 3a162c29cdc9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_client_config.json.baseline +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Identity": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteUser": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListUsers": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/identity_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/index.ts.baseline deleted file mode 100644 index f3bb4c129cce..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/index.ts.baseline +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2026 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. ** - -export {ComplianceClient} from './compliance_client'; -export {EchoClient} from './echo_client'; -export {IdentityClient} from './identity_client'; -export {MessagingClient} from './messaging_client'; -export {SequenceServiceClient} from './sequence_service_client'; -export {TestingClient} from './testing_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client.ts.baseline deleted file mode 100644 index ce1319861341..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client.ts.baseline +++ /dev/null @@ -1,2181 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform, PassThrough} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/messaging_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './messaging_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A simple messaging service that implements chat rooms and profile posts. - * - * This messaging service showcases the features that API clients - * generated by gapic-generators implement. - * @class - * @memberof v1beta1 - */ -export class MessagingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - messagingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of MessagingClient. - * - * @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://cloud.google.com/docs/authentication/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 MessagingClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof MessagingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listRooms: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rooms'), - listBlurbs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'blurbs') - }; - - // Some of the methods on this service provide streaming responses. - // Provide descriptors for these. - this.descriptors.stream = { - streamBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), - sendBlurbs: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.CLIENT_STREAMING, !!opts.fallback), - connect: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries) - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1beta1/{name=projects/*}/locations',},{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1beta1/{name=projects/*/locations/*}',},{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1beta1/{resource=users/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:setIamPolicy',body: '*',},{post: '/v1beta1/{resource=sequences/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1beta1/{resource=users/*}:getIamPolicy',additional_bindings: [{get: '/v1beta1/{resource=rooms/*}:getIamPolicy',},{get: '/v1beta1/{resource=rooms/*/blurbs/*}:getIamPolicy',},{get: '/v1beta1/{resource=sequences/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1beta1/{resource=users/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1beta1/{resource=rooms/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=rooms/*/blurbs/*}:testIamPermissions',body: '*',},{post: '/v1beta1/{resource=sequences/*}:testIamPermissions',body: '*',}], - },{selector: 'google.longrunning.Operations.ListOperations',get: '/v1beta1/operations',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1beta1/{name=operations/**}',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1beta1/{name=operations/**}:cancel',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const searchBlurbsResponse = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsResponse') as gax.protobuf.Type; - const searchBlurbsMetadata = protoFilesRoot.lookup( - '.google.showcase.v1beta1.SearchBlurbsMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - searchBlurbs: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - searchBlurbsResponse.decode.bind(searchBlurbsResponse), - searchBlurbsMetadata.decode.bind(searchBlurbsMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Messaging', gapicConfig as gax.ClientConfig, - 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.messagingStub) { - return this.messagingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Messaging. - this.messagingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Messaging') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Messaging, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const messagingStubMethods = - ['createRoom', 'getRoom', 'updateRoom', 'deleteRoom', 'listRooms', 'createBlurb', 'getBlurb', 'updateBlurb', 'deleteBlurb', 'listBlurbs', 'searchBlurbs', 'streamBlurbs', 'sendBlurbs', 'connect']; - for (const methodName of messagingStubMethods) { - const callPromise = this.messagingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - if (methodName in this.descriptors.stream) { - const stream = new PassThrough({objectMode: true}); - setImmediate(() => { - stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); - }); - return stream; - } - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.stream[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.messagingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_room.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateRoom_async - */ - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request: protos.google.showcase.v1beta1.ICreateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): void; - createRoom( - request?: protos.google.showcase.v1beta1.ICreateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.ICreateRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('createRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Room with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_room.js - * region_tag:localhost_v1beta1_generated_Messaging_GetRoom_async - */ - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request: protos.google.showcase.v1beta1.IGetRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): void; - getRoom( - request?: protos.google.showcase.v1beta1.IGetRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IGetRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('getRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a room. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Room} request.room - * The room to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine which fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Room|Room}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_room.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateRoom_async - */ - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request: protos.google.showcase.v1beta1.IUpdateRoomRequest, - callback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): void; - updateRoom( - request?: protos.google.showcase.v1beta1.IUpdateRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'room.name': request.room!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateRoom request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IRoom, - protos.google.showcase.v1beta1.IUpdateRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a room and all of its blurbs. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested room. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_room.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteRoom_async - */ - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request: protos.google.showcase.v1beta1.IDeleteRoomRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): void; - deleteRoom( - request?: protos.google.showcase.v1beta1.IDeleteRoomRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteRoom request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteRoom response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteRoom(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteRoomRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteRoom response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a blurb. If the parent is a room, the blurb is understood to be a - * message in that room. If the parent is a profile, the blurb is understood - * to be a post on the profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the chat room or user profile that this blurb will - * be tied to. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.create_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_CreateBlurb_async - */ - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request: protos.google.showcase.v1beta1.ICreateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): void; - createBlurb( - request?: protos.google.showcase.v1beta1.ICreateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.ICreateBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('createBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves the Blurb with the given resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.get_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_GetBlurb_async - */ - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request: protos.google.showcase.v1beta1.IGetBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): void; - getBlurb( - request?: protos.google.showcase.v1beta1.IGetBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IGetBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Blurb} request.blurb - * The blurb to update. - * @param {google.protobuf.FieldMask} request.updateMask - * The field mask to determine wich fields are to be updated. If empty, the - * server will assume all fields are to 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 {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.update_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_UpdateBlurb_async - */ - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - callback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): void; - updateBlurb( - request?: protos.google.showcase.v1beta1.IUpdateBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'blurb.name': request.blurb!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IBlurb, - protos.google.showcase.v1beta1.IUpdateBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a blurb. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of the requested blurb. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.delete_blurb.js - * region_tag:localhost_v1beta1_generated_Messaging_DeleteBlurb_async - */ - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): void; - deleteBlurb( - request?: protos.google.showcase.v1beta1.IDeleteBlurbRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteBlurb request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBlurb response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteBlurb(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteBlurbRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteBlurb response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * This returns a stream that emits the blurbs that are created for a - * particular chat room or user profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource name of a chat room or user profile whose blurbs to stream. - * @param {google.protobuf.Timestamp} request.expireTime - * The time at which this stream will close. - * @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 {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.stream_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_StreamBlurbs_async - */ - streamBlurbs( - request?: protos.google.showcase.v1beta1.IStreamBlurbsRequest, - options?: CallOptions): - gax.CancellableStream{ - 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({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('streamBlurbs stream %j', options); - return this.innerApiCalls.streamBlurbs(request, options); - } - -/** - * This is a stream to create multiple blurbs. If an invalid blurb is - * requested to be created, the stream will close with an error. - * - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - A writable stream which accepts objects representing - * {@link protos.google.showcase.v1beta1.CreateBlurbRequest|CreateBlurbRequest}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#client-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.send_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SendBlurbs_async - */ - sendBlurbs( - options?: CallOptions, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream; - sendBlurbs( - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISendBlurbsResponse, - protos.google.showcase.v1beta1.ICreateBlurbRequest|null|undefined, - {}|null|undefined>): - gax.CancellableStream { - if (optionsOrCallback instanceof Function && callback === undefined) { - callback = optionsOrCallback; - optionsOrCallback = {}; - } - const options = optionsOrCallback as CallOptions; - this.initialize().catch(err => {throw err}); - this._log.info('sendBlurbs stream %j', options); - return this.innerApiCalls.sendBlurbs(null, options, callback); - } - -/** - * This method starts a bidirectional stream that receives all blurbs that - * are being created after the stream has started and sends requests to create - * blurbs. If an invalid blurb is requested to be created, the stream will - * close with an error. - * - * @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 is both readable and writable. It accepts objects - * representing {@link protos.google.showcase.v1beta1.ConnectRequest|ConnectRequest} for write() method, and - * will emit objects representing {@link protos.google.showcase.v1beta1.StreamBlurbsResponse|StreamBlurbsResponse} on 'data' event asynchronously. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.connect.js - * region_tag:localhost_v1beta1_generated_Messaging_Connect_async - */ - connect( - options?: CallOptions): - gax.CancellableStream { - this.initialize().catch(err => {throw err}); - this._log.info('connect stream %j', options); - return this.innerApiCalls.connect(null, options); - } - -/** - * This method searches through all blurbs across all rooms and profiles - * for blurbs containing to words found in the query. Only posts that - * contain an exact match of a queried word will be returned. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.query - * The query used to search for blurbs containing to words of this string. - * Only posts that contain an exact match of a queried word will be returned. - * @param {string} request.parent - * The rooms or profiles to search. If unset, `SearchBlurbs` will search all - * rooms and all profiles. - * @param {number} request.pageSize - * The maximum number of blurbs return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of - * google.showcase.v1beta1.SearchBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\SearchBlurbs` method. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - searchBlurbs( - request?: protos.google.showcase.v1beta1.ISearchBlurbsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('searchBlurbs response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('searchBlurbs request %j', request); - return this.innerApiCalls.searchBlurbs(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('searchBlurbs response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `searchBlurbs()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/messaging.search_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_SearchBlurbs_async - */ - async checkSearchBlurbsProgress(name: string): Promise>{ - this._log.info('searchBlurbs long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.searchBlurbs, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists all chat rooms. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Room|Room}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listRoomsAsync()` - * 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. - */ - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request: protos.google.showcase.v1beta1.IListRoomsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): void; - listRooms( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>): - Promise<[ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListRoomsRequest, - protos.google.showcase.v1beta1.IListRoomsResponse|null|undefined, - protos.google.showcase.v1beta1.IRoom>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listRooms values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listRooms request %j', request); - return this.innerApiCalls - .listRooms(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IRoom[], - protos.google.showcase.v1beta1.IListRoomsRequest|null, - protos.google.showcase.v1beta1.IListRoomsResponse - ]) => { - this._log.info('listRooms values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listRooms`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room} 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 `listRoomsAsync()` - * 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. - */ - listRoomsStream( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms stream %j', request); - return this.descriptors.page.listRooms.createStream( - this.innerApiCalls.listRooms as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRooms`, 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 {number} request.pageSize - * The maximum number of rooms return. Server may return fewer rooms - * than requested. If unspecified, server will pick an appropriate default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListRoomsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListRooms` method. - * @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.showcase.v1beta1.Room|Room}. 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 include:samples/generated/v1beta1/messaging.list_rooms.js - * region_tag:localhost_v1beta1_generated_Messaging_ListRooms_async - */ - listRoomsAsync( - request?: protos.google.showcase.v1beta1.IListRoomsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listRooms']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listRooms iterate %j', request); - return this.descriptors.page.listRooms.asyncIterate( - this.innerApiCalls['listRooms'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists blurbs for a specific chat room or user profile depending on the - * parent resource name. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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 Array of {@link protos.google.showcase.v1beta1.Blurb|Blurb}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBlurbsAsync()` - * 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. - */ - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request: protos.google.showcase.v1beta1.IListBlurbsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): void; - listBlurbs( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>): - Promise<[ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListBlurbsRequest, - protos.google.showcase.v1beta1.IListBlurbsResponse|null|undefined, - protos.google.showcase.v1beta1.IBlurb>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBlurbs values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listBlurbs request %j', request); - return this.innerApiCalls - .listBlurbs(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.IBlurb[], - protos.google.showcase.v1beta1.IListBlurbsRequest|null, - protos.google.showcase.v1beta1.IListBlurbsResponse - ]) => { - this._log.info('listBlurbs values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listBlurbs`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb} 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 `listBlurbsAsync()` - * 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. - */ - listBlurbsStream( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs stream %j', request); - return this.descriptors.page.listBlurbs.createStream( - this.innerApiCalls.listBlurbs as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listBlurbs`, 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 - * The resource name of the requested room or profile whos blurbs to list. - * @param {number} request.pageSize - * The maximum number of blurbs to return. Server may return fewer - * blurbs than requested. If unspecified, server will pick an appropriate - * default. - * @param {string} request.pageToken - * The value of google.showcase.v1beta1.ListBlurbsResponse.next_page_token - * returned from the previous call to - * `google.showcase.v1beta1.Messaging\ListBlurbs` method. - * @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.showcase.v1beta1.Blurb|Blurb}. 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 include:samples/generated/v1beta1/messaging.list_blurbs.js - * region_tag:localhost_v1beta1_generated_Messaging_ListBlurbs_async - */ - listBlurbsAsync( - request?: protos.google.showcase.v1beta1.IListBlurbsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBlurbs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listBlurbs iterate %j', request); - return this.descriptors.page.listBlurbs.asyncIterate( - this.innerApiCalls['listBlurbs'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.messagingStub && !this._terminated) { - return this.messagingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client_config.json.baseline deleted file mode 100644 index 551a130c2342..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_client_config.json.baseline +++ /dev/null @@ -1,82 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Messaging": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteRoom": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListRooms": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBlurb": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SearchBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StreamBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SendBlurbs": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Connect": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/messaging_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline deleted file mode 100644 index 6c019cf506ee..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client.ts.baseline +++ /dev/null @@ -1,1022 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/sequence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sequence_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta1 - */ -export class SequenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - sequenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SequenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 SequenceServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SequenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.SequenceService', gapicConfig as gax.ClientConfig, - 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.sequenceServiceStub) { - return this.sequenceServiceStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.SequenceService. - this.sequenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.SequenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.SequenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sequenceServiceStubMethods = - ['createSequence', 'getSequenceReport', 'attemptSequence']; - for (const methodName of sequenceServiceStubMethods) { - const callPromise = this.sequenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sequenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Sequence} request.sequence - * @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 {@link protos.google.showcase.v1beta1.Sequence|Sequence}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.create_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_CreateSequence_async - */ - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request: protos.google.showcase.v1beta1.ICreateSequenceRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): void; - createSequence( - request?: protos.google.showcase.v1beta1.ICreateSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSequence request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSequence response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequence, - protos.google.showcase.v1beta1.ICreateSequenceRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Retrieves a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.showcase.v1beta1.SequenceReport|SequenceReport}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.get_sequence_report.js - * region_tag:localhost_v1beta1_generated_SequenceService_GetSequenceReport_async - */ - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): void; - getSequenceReport( - request?: protos.google.showcase.v1beta1.IGetSequenceReportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSequenceReport request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSequenceReport response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSequenceReport(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISequenceReport, - protos.google.showcase.v1beta1.IGetSequenceReportRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSequenceReport response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Attempts a sequence. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/sequence_service.attempt_sequence.js - * region_tag:localhost_v1beta1_generated_SequenceService_AttemptSequence_async - */ - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): void; - attemptSequence( - request?: protos.google.showcase.v1beta1.IAttemptSequenceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('attemptSequence request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('attemptSequence response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.attemptSequence(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IAttemptSequenceRequest|undefined, - {}|undefined - ]) => { - this._log.info('attemptSequence response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sequenceServiceStub && !this._terminated) { - return this.sequenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline deleted file mode 100644 index 77c80d32a901..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_client_config.json.baseline +++ /dev/null @@ -1,38 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.SequenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSequenceReport": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AttemptSequence": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/sequence_service_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client.ts.baseline deleted file mode 100644 index a9bdd67780df..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client.ts.baseline +++ /dev/null @@ -1,1697 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta1/testing_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './testing_client_config.json'; -const version = require('../../../package.json').version; - -/** - * A service to facilitate running discrete sets of tests - * against Showcase. - * @class - * @memberof v1beta1 - */ -export class TestingClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('showcase'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - testingStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TestingClient. - * - * @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://cloud.google.com/docs/authentication/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 TestingClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TestingClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'localhost'; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof 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 !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - blueprintPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}/blueprints/{blueprint}' - ), - roomPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}' - ), - roomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/{blurb}' - ), - roomBlurbsLegacyRoomBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'rooms/{room}/blurbs/legacy/{legacy_room}.{blurb}' - ), - sequencePathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}' - ), - sequenceReportPathTemplate: new this._gaxModule.PathTemplate( - 'sequences/{sequence}/sequenceReport' - ), - sessionPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}' - ), - testPathTemplate: new this._gaxModule.PathTemplate( - 'sessions/{session}/tests/{test}' - ), - userPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}' - ), - userProfileBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/{blurb}' - ), - userProfileBlurbsLegacyUserBlurbPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile/blurbs/legacy/{legacy_user}~{blurb}' - ), - }; - - // 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 = { - listSessions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sessions'), - listTests: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tests') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.showcase.v1beta1.Testing', gapicConfig as gax.ClientConfig, - 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.testingStub) { - return this.testingStub; - } - - // Put together the "service stub" for - // google.showcase.v1beta1.Testing. - this.testingStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.showcase.v1beta1.Testing') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.showcase.v1beta1.Testing, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const testingStubMethods = - ['createSession', 'getSession', 'listSessions', 'deleteSession', 'reportSession', 'listTests', 'deleteTest', 'verifyTest']; - for (const methodName of testingStubMethods) { - const callPromise = this.testingStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.testingStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'localhost'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 7469; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.showcase.v1beta1.Session} request.session - * The session to be created. - * Sessions are immutable once they are created (although they can - * be deleted). - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.create_session.js - * region_tag:localhost_v1beta1_generated_Testing_CreateSession_async - */ - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request: protos.google.showcase.v1beta1.ICreateSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): void; - createSession( - request?: protos.google.showcase.v1beta1.ICreateSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('createSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.ICreateSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('createSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a testing session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be retrieved. - * @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 {@link protos.google.showcase.v1beta1.Session|Session}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.get_session.js - * region_tag:localhost_v1beta1_generated_Testing_GetSession_async - */ - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request: protos.google.showcase.v1beta1.IGetSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): void; - getSession( - request?: protos.google.showcase.v1beta1.IGetSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.ISession, - protos.google.showcase.v1beta1.IGetSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Delete a test session. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_session.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteSession_async - */ - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request: protos.google.showcase.v1beta1.IDeleteSessionRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): void; - deleteSession( - request?: protos.google.showcase.v1beta1.IDeleteSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteSession request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Report on the status of a session. - * This generates a report detailing which tests have been completed, - * and an overall rollup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The session to be reported on. - * @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 {@link protos.google.showcase.v1beta1.ReportSessionResponse|ReportSessionResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.report_session.js - * region_tag:localhost_v1beta1_generated_Testing_ReportSession_async - */ - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request: protos.google.showcase.v1beta1.IReportSessionRequest, - callback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): void; - reportSession( - request?: protos.google.showcase.v1beta1.IReportSessionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('reportSession request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reportSession response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.reportSession(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IReportSessionResponse, - protos.google.showcase.v1beta1.IReportSessionRequest|undefined, - {}|undefined - ]) => { - this._log.info('reportSession response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Explicitly decline to implement a test. - * - * This removes the test from subsequent `ListTests` calls, and - * attempting to do the test will error. - * - * This method will error if attempting to delete a required test. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to be deleted. - * @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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.delete_test.js - * region_tag:localhost_v1beta1_generated_Testing_DeleteTest_async - */ - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request: protos.google.showcase.v1beta1.IDeleteTestRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): void; - deleteTest( - request?: protos.google.showcase.v1beta1.IDeleteTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTest request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTest response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.showcase.v1beta1.IDeleteTestRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Register a response to a test. - * - * In cases where a test involves registering a final answer at the - * end of the test, this method provides the means to do so. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The test to have an answer registered to it. - * @param {Buffer} request.answer - * The answer from the test. - * @param {Buffer[]} request.answers - * The answers from the test if multiple are to be checked - * @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 {@link protos.google.showcase.v1beta1.VerifyTestResponse|VerifyTestResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta1/testing.verify_test.js - * region_tag:localhost_v1beta1_generated_Testing_VerifyTest_async - */ - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - options: CallOptions, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request: protos.google.showcase.v1beta1.IVerifyTestRequest, - callback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): void; - verifyTest( - request?: protos.google.showcase.v1beta1.IVerifyTestRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('verifyTest request %j', request); - const wrappedCallback: Callback< - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyTest response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.verifyTest(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.showcase.v1beta1.IVerifyTestResponse, - protos.google.showcase.v1beta1.IVerifyTestRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyTest response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists the current test sessions. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Session|Session}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listSessionsAsync()` - * 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. - */ - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request: protos.google.showcase.v1beta1.IListSessionsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): void; - listSessions( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>): - Promise<[ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListSessionsRequest, - protos.google.showcase.v1beta1.IListSessionsResponse|null|undefined, - protos.google.showcase.v1beta1.ISession>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listSessions values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listSessions request %j', request); - return this.innerApiCalls - .listSessions(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ISession[], - protos.google.showcase.v1beta1.IListSessionsRequest|null, - protos.google.showcase.v1beta1.IListSessionsResponse - ]) => { - this._log.info('listSessions values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listSessions`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session} 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 `listSessionsAsync()` - * 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. - */ - listSessionsStream( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions stream %j', request); - return this.descriptors.page.listSessions.createStream( - this.innerApiCalls.listSessions as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSessions`, 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 {number} request.pageSize - * The maximum number of sessions to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Session|Session}. 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 include:samples/generated/v1beta1/testing.list_sessions.js - * region_tag:localhost_v1beta1_generated_Testing_ListSessions_async - */ - listSessionsAsync( - request?: protos.google.showcase.v1beta1.IListSessionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - const defaultCallSettings = this._defaults['listSessions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listSessions iterate %j', request); - return this.descriptors.page.listSessions.asyncIterate( - this.innerApiCalls['listSessions'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * List the tests of a sessesion. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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 Array of {@link protos.google.showcase.v1beta1.Test|Test}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTestsAsync()` - * 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. - */ - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request: protos.google.showcase.v1beta1.IListTestsRequest, - callback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): void; - listTests( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>, - callback?: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>): - Promise<[ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.showcase.v1beta1.IListTestsRequest, - protos.google.showcase.v1beta1.IListTestsResponse|null|undefined, - protos.google.showcase.v1beta1.ITest>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTests values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTests request %j', request); - return this.innerApiCalls - .listTests(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.showcase.v1beta1.ITest[], - protos.google.showcase.v1beta1.IListTestsRequest|null, - protos.google.showcase.v1beta1.IListTestsResponse - ]) => { - this._log.info('listTests values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTests`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test} 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 `listTestsAsync()` - * 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. - */ - listTestsStream( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests stream %j', request); - return this.descriptors.page.listTests.createStream( - this.innerApiCalls.listTests as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTests`, 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 - * The session. - * @param {number} request.pageSize - * The maximum number of tests to return per page. - * @param {string} request.pageToken - * The page token, for retrieving subsequent pages. - * @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.showcase.v1beta1.Test|Test}. 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 include:samples/generated/v1beta1/testing.list_tests.js - * region_tag:localhost_v1beta1_generated_Testing_ListTests_async - */ - listTestsAsync( - request?: protos.google.showcase.v1beta1.IListTestsRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTests']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTests iterate %j', request); - return this.descriptors.page.listTests.asyncIterate( - this.innerApiCalls['listTests'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified blueprint resource name string. - * - * @param {string} session - * @param {string} test - * @param {string} blueprint - * @returns {string} Resource name string. - */ - blueprintPath(session:string,test:string,blueprint:string) { - return this.pathTemplates.blueprintPathTemplate.render({ - session: session, - test: test, - blueprint: blueprint, - }); - } - - /** - * Parse the session from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the session. - */ - matchSessionFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).session; - } - - /** - * Parse the test from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the test. - */ - matchTestFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).test; - } - - /** - * Parse the blueprint from Blueprint resource. - * - * @param {string} blueprintName - * A fully-qualified path representing Blueprint resource. - * @returns {string} A string representing the blueprint. - */ - matchBlueprintFromBlueprintName(blueprintName: string) { - return this.pathTemplates.blueprintPathTemplate.match(blueprintName).blueprint; - } - - /** - * Return a fully-qualified room resource name string. - * - * @param {string} room - * @returns {string} Resource name string. - */ - roomPath(room:string) { - return this.pathTemplates.roomPathTemplate.render({ - room: room, - }); - } - - /** - * Parse the room from Room resource. - * - * @param {string} roomName - * A fully-qualified path representing Room resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomName(roomName: string) { - return this.pathTemplates.roomPathTemplate.match(roomName).room; - } - - /** - * Return a fully-qualified roomBlurb resource name string. - * - * @param {string} room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbPath(room:string,blurb:string) { - return this.pathTemplates.roomBlurbPathTemplate.render({ - room: room, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).room; - } - - /** - * Parse the blurb from RoomBlurb resource. - * - * @param {string} roomBlurbName - * A fully-qualified path representing room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbName(roomBlurbName: string) { - return this.pathTemplates.roomBlurbPathTemplate.match(roomBlurbName).blurb; - } - - /** - * Return a fully-qualified roomBlurbsLegacyRoomBlurb resource name string. - * - * @param {string} room - * @param {string} legacy_room - * @param {string} blurb - * @returns {string} Resource name string. - */ - roomBlurbsLegacyRoomBlurbPath(room:string,legacyRoom:string,blurb:string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render({ - room: room, - legacy_room: legacyRoom, - blurb: blurb, - }); - } - - /** - * Parse the room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the room. - */ - matchRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).room; - } - - /** - * Parse the legacy_room from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the legacy_room. - */ - matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).legacy_room; - } - - /** - * Parse the blurb from RoomBlurbsLegacyRoomBlurb resource. - * - * @param {string} roomBlurbsLegacyRoomBlurbName - * A fully-qualified path representing room_blurbs_legacy_room_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromRoomBlurbsLegacyRoomBlurbName(roomBlurbsLegacyRoomBlurbName: string) { - return this.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match(roomBlurbsLegacyRoomBlurbName).blurb; - } - - /** - * Return a fully-qualified sequence resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequencePath(sequence:string) { - return this.pathTemplates.sequencePathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from Sequence resource. - * - * @param {string} sequenceName - * A fully-qualified path representing Sequence resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceName(sequenceName: string) { - return this.pathTemplates.sequencePathTemplate.match(sequenceName).sequence; - } - - /** - * Return a fully-qualified sequenceReport resource name string. - * - * @param {string} sequence - * @returns {string} Resource name string. - */ - sequenceReportPath(sequence:string) { - return this.pathTemplates.sequenceReportPathTemplate.render({ - sequence: sequence, - }); - } - - /** - * Parse the sequence from SequenceReport resource. - * - * @param {string} sequenceReportName - * A fully-qualified path representing SequenceReport resource. - * @returns {string} A string representing the sequence. - */ - matchSequenceFromSequenceReportName(sequenceReportName: string) { - return this.pathTemplates.sequenceReportPathTemplate.match(sequenceReportName).sequence; - } - - /** - * Return a fully-qualified session resource name string. - * - * @param {string} session - * @returns {string} Resource name string. - */ - sessionPath(session:string) { - return this.pathTemplates.sessionPathTemplate.render({ - session: session, - }); - } - - /** - * Parse the session from Session resource. - * - * @param {string} sessionName - * A fully-qualified path representing Session resource. - * @returns {string} A string representing the session. - */ - matchSessionFromSessionName(sessionName: string) { - return this.pathTemplates.sessionPathTemplate.match(sessionName).session; - } - - /** - * Return a fully-qualified test resource name string. - * - * @param {string} session - * @param {string} test - * @returns {string} Resource name string. - */ - testPath(session:string,test:string) { - return this.pathTemplates.testPathTemplate.render({ - session: session, - test: test, - }); - } - - /** - * Parse the session from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the session. - */ - matchSessionFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).session; - } - - /** - * Parse the test from Test resource. - * - * @param {string} testName - * A fully-qualified path representing Test resource. - * @returns {string} A string representing the test. - */ - matchTestFromTestName(testName: string) { - return this.pathTemplates.testPathTemplate.match(testName).test; - } - - /** - * Return a fully-qualified user resource name string. - * - * @param {string} user - * @returns {string} Resource name string. - */ - userPath(user:string) { - return this.pathTemplates.userPathTemplate.render({ - user: user, - }); - } - - /** - * Parse the user from User resource. - * - * @param {string} userName - * A fully-qualified path representing User resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserName(userName: string) { - return this.pathTemplates.userPathTemplate.match(userName).user; - } - - /** - * Return a fully-qualified userProfileBlurb resource name string. - * - * @param {string} user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbPath(user:string,blurb:string) { - return this.pathTemplates.userProfileBlurbPathTemplate.render({ - user: user, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).user; - } - - /** - * Parse the blurb from UserProfileBlurb resource. - * - * @param {string} userProfileBlurbName - * A fully-qualified path representing user_profile_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbName(userProfileBlurbName: string) { - return this.pathTemplates.userProfileBlurbPathTemplate.match(userProfileBlurbName).blurb; - } - - /** - * Return a fully-qualified userProfileBlurbsLegacyUserBlurb resource name string. - * - * @param {string} user - * @param {string} legacy_user - * @param {string} blurb - * @returns {string} Resource name string. - */ - userProfileBlurbsLegacyUserBlurbPath(user:string,legacyUser:string,blurb:string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render({ - user: user, - legacy_user: legacyUser, - blurb: blurb, - }); - } - - /** - * Parse the user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the user. - */ - matchUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).user; - } - - /** - * Parse the legacy_user from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the legacy_user. - */ - matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).legacy_user; - } - - /** - * Parse the blurb from UserProfileBlurbsLegacyUserBlurb resource. - * - * @param {string} userProfileBlurbsLegacyUserBlurbName - * A fully-qualified path representing user_profile_blurbs_legacy_user_blurb resource. - * @returns {string} A string representing the blurb. - */ - matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(userProfileBlurbsLegacyUserBlurbName: string) { - return this.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match(userProfileBlurbsLegacyUserBlurbName).blurb; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.testingStub && !this._terminated) { - return this.testingStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client_config.json.baseline deleted file mode 100644 index 03815dc3f5e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.showcase.v1beta1.Testing": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSessions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReportSession": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTests": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyTest": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline deleted file mode 100644 index 987b27b7e69c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/src/v1beta1/testing_proto_list.json.baseline +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/showcase/v1beta1/compliance.proto", - "../../protos/google/showcase/v1beta1/echo.proto", - "../../protos/google/showcase/v1beta1/identity.proto", - "../../protos/google/showcase/v1beta1/messaging.proto", - "../../protos/google/showcase/v1beta1/sequence.proto", - "../../protos/google/showcase/v1beta1/testing.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index a284de22984e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const showcase = require('showcase'); - -function main() { - const complianceClient = new showcase.ComplianceClient(); - const echoClient = new showcase.EchoClient(); - const identityClient = new showcase.IdentityClient(); - const messagingClient = new showcase.MessagingClient(); - const sequenceServiceClient = new showcase.SequenceServiceClient(); - const testingClient = new showcase.TestingClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 889fe60d8ffc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - -import {ComplianceClient, EchoClient, IdentityClient, MessagingClient, SequenceServiceClient, TestingClient} from 'showcase'; - -// check that the client class type name can be used -function doStuffWithComplianceClient(client: ComplianceClient) { - client.close(); -} -function doStuffWithEchoClient(client: EchoClient) { - client.close(); -} -function doStuffWithIdentityClient(client: IdentityClient) { - client.close(); -} -function doStuffWithMessagingClient(client: MessagingClient) { - client.close(); -} -function doStuffWithSequenceServiceClient(client: SequenceServiceClient) { - client.close(); -} -function doStuffWithTestingClient(client: TestingClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const complianceClient = new ComplianceClient(); - doStuffWithComplianceClient(complianceClient); - // check that the client instance can be created - const echoClient = new EchoClient(); - doStuffWithEchoClient(echoClient); - // check that the client instance can be created - const identityClient = new IdentityClient(); - doStuffWithIdentityClient(identityClient); - // check that the client instance can be created - const messagingClient = new MessagingClient(); - doStuffWithMessagingClient(messagingClient); - // check that the client instance can be created - const sequenceServiceClient = new SequenceServiceClient(); - doStuffWithSequenceServiceClient(sequenceServiceClient); - // check that the client instance can be created - const testingClient = new TestingClient(); - doStuffWithTestingClient(testingClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline deleted file mode 100644 index 33c4db06519a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_compliance_v1beta1.ts.baseline +++ /dev/null @@ -1,1559 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as complianceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.ComplianceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = complianceModule.v1beta1.ComplianceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = complianceModule.v1beta1.ComplianceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new complianceModule.v1beta1.ComplianceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = complianceModule.v1beta1.ComplianceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new complianceModule.v1beta1.ComplianceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - await client.initialize(); - assert(client.complianceStub); - }); - - it('has close method for the initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.complianceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.complianceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('repeatDataBody', () => { - it('invokes repeatDataBody without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBody(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBody = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBody( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBody with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBody = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - - it('invokes repeatDataBody with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBody(request), expectedError); - }); - }); - - describe('repeatDataBodyInfo', () => { - it('invokes repeatDataBodyInfo without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyInfo(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyInfo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyInfo with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyInfo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - - it('invokes repeatDataBodyInfo with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyInfo(request), expectedError); - }); - }); - - describe('repeatDataQuery', () => { - it('invokes repeatDataQuery without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataQuery(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataQuery = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataQuery( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataQuery with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataQuery = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - - it('invokes repeatDataQuery with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataQuery(request), expectedError); - }); - }); - - describe('repeatDataSimplePath', () => { - it('invokes repeatDataSimplePath without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataSimplePath(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataSimplePath( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_int32=${defaultValue2 ?? '' }&info.f_double=${defaultValue3 ?? '' }&info.f_bool=${defaultValue4 ?? '' }&info.f_kingdom=${defaultValue5 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataSimplePath = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataSimplePath as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataSimplePath with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fInt32']); - request.info.fInt32 = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fDouble']); - request.info.fDouble = defaultValue3; - request.info ??= {}; - const defaultValue4 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue4; - request.info ??= {}; - const defaultValue5 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fKingdom']); - request.info.fKingdom = defaultValue5; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataSimplePath(request), expectedError); - }); - }); - - describe('repeatDataPathResource', () => { - it('invokes repeatDataPathResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }&info.f_bool=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - request.info ??= {}; - const defaultValue3 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fBool']); - request.info.fBool = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathResource(request), expectedError); - }); - }); - - describe('repeatDataPathTrailingResource', () => { - it('invokes repeatDataPathTrailingResource without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataPathTrailingResource(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataPathTrailingResource( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedHeaderRequestParams = `info.f_string=${defaultValue1 ?? '' }&info.f_child.f_string=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataPathTrailingResource = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - const actualRequest = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.repeatDataPathTrailingResource as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes repeatDataPathTrailingResource with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - request.info ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fString']); - request.info.fString = defaultValue1; - request.info ??= {}; - request.info.fChild ??= {}; - const defaultValue2 = - getTypeDefaultValue('.google.showcase.v1beta1.RepeatRequest', ['info', 'fChild', 'fString']); - request.info.fChild.fString = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataPathTrailingResource(request), expectedError); - }); - }); - - describe('repeatDataBodyPut', () => { - it('invokes repeatDataBodyPut without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPut(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPut( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPut with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPut = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - - it('invokes repeatDataBodyPut with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPut(request), expectedError); - }); - }); - - describe('repeatDataBodyPatch', () => { - it('invokes repeatDataBodyPatch without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(expectedResponse); - const [response] = await client.repeatDataBodyPatch(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatResponse() - ); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.repeatDataBodyPatch( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRepeatResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes repeatDataBodyPatch with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.repeatDataBodyPatch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - - it('invokes repeatDataBodyPatch with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.RepeatRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.repeatDataBodyPatch(request), expectedError); - }); - }); - - describe('getEnum', () => { - it('invokes getEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCall(expectedResponse); - const [response] = await client.getEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.getEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes getEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.getEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getEnum(request), expectedError); - }); - - it('invokes getEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getEnum(request), expectedError); - }); - }); - - describe('verifyEnum', () => { - it('invokes verifyEnum without error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCall(expectedResponse); - const [response] = await client.verifyEnum(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum without error using callback', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - client.innerApiCalls.verifyEnum = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyEnum( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEnumResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes verifyEnum with error', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.verifyEnum = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - - it('invokes verifyEnum with closed client', async () => { - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EnumResponse() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyEnum(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new complianceModule.v1beta1.ComplianceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline deleted file mode 100644 index 1a1ffd031a22..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_echo_v1beta1.ts.baseline +++ /dev/null @@ -1,1535 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as echoModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.EchoClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new echoModule.v1beta1.EchoClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new echoModule.v1beta1.EchoClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = echoModule.v1beta1.EchoClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = echoModule.v1beta1.EchoClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new echoModule.v1beta1.EchoClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = echoModule.v1beta1.EchoClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new echoModule.v1beta1.EchoClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new echoModule.v1beta1.EchoClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - await client.initialize(); - assert(client.echoStub); - }); - - it('has close method for the initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.echoStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.echoStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('echo', () => { - it('invokes echo without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCall(expectedResponse); - const [response] = await client.echo(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.echo = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echo( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedHeaderRequestParams = 'qux=projects%2Fvalue'; - const expectedError = new Error('expected'); - client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echo(request), expectedError); - const actualRequest = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.echo as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - assert.match((client.innerApiCalls.echo as SinonStub) - .getCall(0).args[0].requestId, /[a-z0-9-]{36}/) - }); - - it('invokes echo with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - // path template: {qux=projects/*}/** - request.otherHeader = 'projects/value/value'; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echo(request), expectedError); - }); - }); - - describe('echoErrorDetails', () => { - it('invokes echoErrorDetails without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(expectedResponse); - const [response] = await client.echoErrorDetails(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsResponse() - ); - client.innerApiCalls.echoErrorDetails = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.echoErrorDetails( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoErrorDetailsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes echoErrorDetails with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.echoErrorDetails = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - - it('invokes echoErrorDetails with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoErrorDetailsRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.echoErrorDetails(request), expectedError); - }); - }); - - describe('pagedExpandLegacy', () => { - it('invokes pagedExpandLegacy without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpandLegacy(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandResponse() - ); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpandLegacy( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IPagedExpandResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpandLegacy with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpandLegacy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - - it('invokes pagedExpandLegacy with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandLegacyRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pagedExpandLegacy(request), expectedError); - }); - }); - - describe('block', () => { - it('invokes block without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCall(expectedResponse); - const [response] = await client.block(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockResponse() - ); - client.innerApiCalls.block = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.block( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlockResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes block with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.block = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.block(request), expectedError); - }); - - it('invokes block with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.BlockRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.block(request), expectedError); - }); - }); - - describe('wait', () => { - it('invokes wait without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCall(expectedResponse); - const [operation] = await client.wait(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.wait = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.wait( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes wait with call error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.wait(request), expectedError); - }); - - it('invokes wait with LRO error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.WaitRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.wait(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkWaitProgress without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkWaitProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkWaitProgress with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkWaitProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('expand', () => { - it('invokes expand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand without error and gaxServerStreamingRetries enabled', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.expand = stubServerStreamingCall(expectedResponse); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes expand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.expand = stubServerStreamingCall(undefined, expectedError); - const stream = client.expand(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - - it('invokes expand with closed client', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ExpandRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.expand(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new echoModule.v1beta1.EchoClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('chat', () => { - it('invokes chat without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.chat = stubBidiStreamingCall(expectedResponse); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes chat with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.chat = stubBidiStreamingCall(undefined, expectedError); - const stream = client.chat(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.chat as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('collect', () => { - it('invokes collect without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoResponse() - ); - client.innerApiCalls.collect = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes collect with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.EchoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.collect = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.collect( - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.collect as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('pagedExpand', () => { - it('invokes pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCall(expectedResponse); - const [response] = await client.pagedExpand(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand without error using callback', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.innerApiCalls.pagedExpand = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pagedExpand( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IEchoResponse[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pagedExpand(request), expectedError); - }); - - it('invokes pagedExpandStream without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('invokes pagedExpandStream with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.pagedExpandStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.EchoResponse[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.EchoResponse) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.pagedExpand.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.pagedExpand, request)); - }); - - it('uses async iteration with pagedExpand without error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - generateSampleMessage(new protos.google.showcase.v1beta1.EchoResponse()), - ]; - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - const iterable = client.pagedExpandAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with pagedExpand with error', async () => { - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.PagedExpandRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.pagedExpandAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IEchoResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.pagedExpand.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new echoModule.v1beta1.EchoClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline deleted file mode 100644 index b938f6196ed4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_identity_v1beta1.ts.baseline +++ /dev/null @@ -1,1203 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as identityModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.IdentityClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new identityModule.v1beta1.IdentityClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = identityModule.v1beta1.IdentityClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = identityModule.v1beta1.IdentityClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new identityModule.v1beta1.IdentityClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = identityModule.v1beta1.IdentityClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new identityModule.v1beta1.IdentityClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new identityModule.v1beta1.IdentityClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - await client.initialize(); - assert(client.identityStub); - }); - - it('has close method for the initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.identityStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.identityStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createUser', () => { - it('invokes createUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCall(expectedResponse); - const [response] = await client.createUser(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.createUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createUser(request), expectedError); - }); - - it('invokes createUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateUserRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createUser(request), expectedError); - }); - }); - - describe('getUser', () => { - it('invokes getUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCall(expectedResponse); - const [response] = await client.getUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.getUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getUser(request), expectedError); - const actualRequest = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getUser(request), expectedError); - }); - }); - - describe('updateUser', () => { - it('invokes updateUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCall(expectedResponse); - const [response] = await client.updateUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.User() - ); - client.innerApiCalls.updateUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateUser( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedHeaderRequestParams = `user.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateUser(request), expectedError); - const actualRequest = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateUserRequest() - ); - request.user ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateUserRequest', ['user', 'name']); - request.user.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateUser(request), expectedError); - }); - }); - - describe('deleteUser', () => { - it('invokes deleteUser without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCall(expectedResponse); - const [response] = await client.deleteUser(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteUser = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteUser( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteUser = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteUser(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteUser as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteUser with closed client', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteUserRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteUserRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteUser(request), expectedError); - }); - }); - - describe('listUsers', () => { - it('invokes listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCall(expectedResponse); - const [response] = await client.listUsers(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers without error using callback', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.innerApiCalls.listUsers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listUsers( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IUser[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listUsers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listUsers(request), expectedError); - }); - - it('invokes listUsersStream without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('invokes listUsersStream with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listUsersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.User[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.User) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listUsers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listUsers, request)); - }); - - it('uses async iteration with listUsers without error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - generateSampleMessage(new protos.google.showcase.v1beta1.User()), - ]; - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IUser[] = []; - const iterable = client.listUsersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listUsers with error', async () => { - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListUsersRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listUsersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IUser[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listUsers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new identityModule.v1beta1.IdentityClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline deleted file mode 100644 index d7b2ff9708e6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_messaging_v1beta1.ts.baseline +++ /dev/null @@ -1,2356 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as messagingModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubServerStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // write something to the stream to trigger transformStub and send the response back to the client - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - return sinon.stub().returns(mockStream); -} - -function stubBidiStreamingCall(response?: ResponseType, error?: Error) { - const transformStub = error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream); -} - -function stubClientStreamingCall(response?: ResponseType, error?: Error) { - if (error) { - return sinon.stub().callsArgWith(2, error); - } - const transformStub = sinon.stub(); - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - return sinon.stub().returns(mockStream).callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.MessagingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = messagingModule.v1beta1.MessagingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = messagingModule.v1beta1.MessagingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new messagingModule.v1beta1.MessagingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = messagingModule.v1beta1.MessagingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new messagingModule.v1beta1.MessagingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - await client.initialize(); - assert(client.messagingStub); - }); - - it('has close method for the initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.messagingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.messagingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createRoom', () => { - it('invokes createRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCall(expectedResponse); - const [response] = await client.createRoom(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.createRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createRoom(request), expectedError); - }); - - it('invokes createRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateRoomRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createRoom(request), expectedError); - }); - }); - - describe('getRoom', () => { - it('invokes getRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCall(expectedResponse); - const [response] = await client.getRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.getRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getRoom(request), expectedError); - }); - }); - - describe('updateRoom', () => { - it('invokes updateRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCall(expectedResponse); - const [response] = await client.updateRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Room() - ); - client.innerApiCalls.updateRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateRoom( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedHeaderRequestParams = `room.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateRoomRequest() - ); - request.room ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateRoomRequest', ['room', 'name']); - request.room.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateRoom(request), expectedError); - }); - }); - - describe('deleteRoom', () => { - it('invokes deleteRoom without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCall(expectedResponse); - const [response] = await client.deleteRoom(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteRoom = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoom( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoom = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteRoom(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoom as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoom with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteRoomRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteRoomRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteRoom(request), expectedError); - }); - }); - - describe('createBlurb', () => { - it('invokes createBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.createBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.createBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.CreateBlurbRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBlurb(request), expectedError); - }); - }); - - describe('getBlurb', () => { - it('invokes getBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.getBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.getBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBlurb(request), expectedError); - }); - }); - - describe('updateBlurb', () => { - it('invokes updateBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.updateBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Blurb() - ); - client.innerApiCalls.updateBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBlurb( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedHeaderRequestParams = `blurb.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.UpdateBlurbRequest() - ); - request.blurb ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.UpdateBlurbRequest', ['blurb', 'name']); - request.blurb.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBlurb(request), expectedError); - }); - }); - - describe('deleteBlurb', () => { - it('invokes deleteBlurb without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBlurb(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteBlurb = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBlurb( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBlurb = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBlurb(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBlurb as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBlurb with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteBlurbRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteBlurbRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBlurb(request), expectedError); - }); - }); - - describe('searchBlurbs', () => { - it('invokes searchBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(expectedResponse); - const [operation] = await client.searchBlurbs(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.searchBlurbs = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.searchBlurbs( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with call error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.searchBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes searchBlurbs with LRO error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.SearchBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.SearchBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.searchBlurbs = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.searchBlurbs(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.searchBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkSearchBlurbsProgress without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkSearchBlurbsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkSearchBlurbsProgress with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkSearchBlurbsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('streamBlurbs', () => { - it('invokes streamBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs without error and gaxServerStreamingRetries enabled', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - gaxServerStreamingRetries: true - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(expectedResponse); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.streamBlurbs = stubServerStreamingCall(undefined, expectedError); - const stream = client.streamBlurbs(request); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - const actualRequest = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.streamBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes streamBlurbs with closed client', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.StreamBlurbsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - const stream = client.streamBlurbs(request, {retryRequestOptions: {noResponseRetries: 0}}); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - }); - it('should create a client with gaxServerStreamingRetries enabled', () => { - const client = new messagingModule.v1beta1.MessagingClient({ - gaxServerStreamingRetries: true, - }); - assert(client); - }); - }); - - describe('connect', () => { - it('invokes connect without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.StreamBlurbsResponse() - ); - client.innerApiCalls.connect = stubBidiStreamingCall(expectedResponse); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes connect with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ConnectRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.connect = stubBidiStreamingCall(undefined, expectedError); - const stream = client.connect(); - const promise = new Promise((resolve, reject) => { - stream.on('data', (response: protos.google.showcase.v1beta1.StreamBlurbsResponse) => { - resolve(response); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.connect as SinonStub) - .getCall(0).calledWith(null)); - assert.deepStrictEqual(((stream as unknown as PassThrough) - ._transform as SinonStub).getCall(0).args[0], request); - }); - }); - - describe('sendBlurbs', () => { - it('invokes sendBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SendBlurbsResponse() - ); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(expectedResponse); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - assert.deepStrictEqual((stream!._transform as SinonStub).getCall(0).args[0], request); - }); - - it('invokes sendBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateBlurbRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.sendBlurbs = stubClientStreamingCall(undefined, expectedError); - let stream: PassThrough; - const promise = new Promise((resolve, reject) => { - stream = client.sendBlurbs( - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISendBlurbsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }) as unknown as PassThrough; - stream.write(request); - stream.end(); - }); - await assert.rejects(promise, expectedError); - assert((client.innerApiCalls.sendBlurbs as SinonStub) - .getCall(0).calledWith(null, {} /*, callback defined above */)); - }); - }); - - describe('listRooms', () => { - it('invokes listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCall(expectedResponse); - const [response] = await client.listRooms(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.innerApiCalls.listRooms = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRooms( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IRoom[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listRooms = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRooms(request), expectedError); - }); - - it('invokes listRoomsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('invokes listRoomsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoomsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Room[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Room) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRooms.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRooms, request)); - }); - - it('uses async iteration with listRooms without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - generateSampleMessage(new protos.google.showcase.v1beta1.Room()), - ]; - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - const iterable = client.listRoomsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listRooms with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListRoomsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listRooms.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoomsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IRoom[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRooms.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listBlurbs', () => { - it('invokes listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCall(expectedResponse); - const [response] = await client.listBlurbs(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs without error using callback', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.innerApiCalls.listBlurbs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBlurbs( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IBlurb[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBlurbs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBlurbs(request), expectedError); - const actualRequest = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBlurbs as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBlurbsStream without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listBlurbsStream with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBlurbsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Blurb[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Blurb) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBlurbs, request)); - assert( - (client.descriptors.page.listBlurbs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs without error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - generateSampleMessage(new protos.google.showcase.v1beta1.Blurb()), - ]; - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - const iterable = client.listBlurbsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listBlurbs with error', async () => { - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListBlurbsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListBlurbsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBlurbs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBlurbsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.IBlurb[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBlurbs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new messagingModule.v1beta1.MessagingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline deleted file mode 100644 index e772cf81a761..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_sequence_service_v1beta1.ts.baseline +++ /dev/null @@ -1,869 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as sequenceserviceModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1beta1.SequenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sequenceserviceModule.v1beta1.SequenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sequenceserviceModule.v1beta1.SequenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sequenceserviceModule.v1beta1.SequenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = sequenceserviceModule.v1beta1.SequenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - await client.initialize(); - assert(client.sequenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sequenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sequenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSequence', () => { - it('invokes createSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCall(expectedResponse); - const [response] = await client.createSequence(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Sequence() - ); - client.innerApiCalls.createSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSequence( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequence|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSequence(request), expectedError); - }); - - it('invokes createSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSequenceRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSequence(request), expectedError); - }); - }); - - describe('getSequenceReport', () => { - it('invokes getSequenceReport without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCall(expectedResponse); - const [response] = await client.getSequenceReport(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.SequenceReport() - ); - client.innerApiCalls.getSequenceReport = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSequenceReport( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISequenceReport|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSequenceReport = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSequenceReport(request), expectedError); - const actualRequest = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSequenceReport as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSequenceReport with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSequenceReportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSequenceReportRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSequenceReport(request), expectedError); - }); - }); - - describe('attemptSequence', () => { - it('invokes attemptSequence without error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCall(expectedResponse); - const [response] = await client.attemptSequence(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence without error using callback', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.attemptSequence = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.attemptSequence( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with error', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.attemptSequence = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.attemptSequence(request), expectedError); - const actualRequest = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.attemptSequence as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes attemptSequence with closed client', async () => { - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.AttemptSequenceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.AttemptSequenceRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.attemptSequence(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new sequenceserviceModule.v1beta1.SequenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline deleted file mode 100644 index 55e55cff9e27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/test/gapic_testing_v1beta1.ts.baseline +++ /dev/null @@ -1,1660 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as testingModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta1.TestingClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new testingModule.v1beta1.TestingClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - }); - - it('has universeDomain', () => { - const client = new testingModule.v1beta1.TestingClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = testingModule.v1beta1.TestingClient.servicePath; - assert.strictEqual(servicePath, 'localhost'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = testingModule.v1beta1.TestingClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'localhost'); - assert(stub.called); - stub.restore(); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new testingModule.v1beta1.TestingClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = testingModule.v1beta1.TestingClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new testingModule.v1beta1.TestingClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new testingModule.v1beta1.TestingClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - await client.initialize(); - assert(client.testingStub); - }); - - it('has close method for the initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.testingStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.testingStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createSession', () => { - it('invokes createSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCall(expectedResponse); - const [response] = await client.createSession(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.createSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes createSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.createSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSession(request), expectedError); - }); - - it('invokes createSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.CreateSessionRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createSession(request), expectedError); - }); - }); - - describe('getSession', () => { - it('invokes getSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCall(expectedResponse); - const [response] = await client.getSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.Session() - ); - client.innerApiCalls.getSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSession(request), expectedError); - const actualRequest = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.GetSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.GetSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSession(request), expectedError); - }); - }); - - describe('deleteSession', () => { - it('invokes deleteSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSession( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSession(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteSession(request), expectedError); - }); - }); - - describe('reportSession', () => { - it('invokes reportSession without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCall(expectedResponse); - const [response] = await client.reportSession(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionResponse() - ); - client.innerApiCalls.reportSession = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reportSession( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IReportSessionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reportSession = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reportSession(request), expectedError); - const actualRequest = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reportSession as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reportSession with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ReportSessionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ReportSessionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reportSession(request), expectedError); - }); - }); - - describe('deleteTest', () => { - it('invokes deleteTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTest( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTest(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.DeleteTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.DeleteTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTest(request), expectedError); - }); - }); - - describe('verifyTest', () => { - it('invokes verifyTest without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCall(expectedResponse); - const [response] = await client.verifyTest(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestResponse() - ); - client.innerApiCalls.verifyTest = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyTest( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.IVerifyTestResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyTest = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyTest(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyTest as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyTest with closed client', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.VerifyTestRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.VerifyTestRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyTest(request), expectedError); - }); - }); - - describe('listSessions', () => { - it('invokes listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCall(expectedResponse); - const [response] = await client.listSessions(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - );const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.innerApiCalls.listSessions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSessions( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ISession[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listSessions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSessions(request), expectedError); - }); - - it('invokes listSessionsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('invokes listSessionsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSessionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Session[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Session) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSessions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSessions, request)); - }); - - it('uses async iteration with listSessions without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - generateSampleMessage(new protos.google.showcase.v1beta1.Session()), - ]; - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ISession[] = []; - const iterable = client.listSessionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - - it('uses async iteration with listSessions with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListSessionsRequest() - ); - const expectedError = new Error('expected'); - client.descriptors.page.listSessions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSessionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ISession[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSessions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('listTests', () => { - it('invokes listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCall(expectedResponse); - const [response] = await client.listTests(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests without error using callback', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.innerApiCalls.listTests = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTests( - request, - (err?: Error|null, result?: protos.google.showcase.v1beta1.ITest[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTests = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTests(request), expectedError); - const actualRequest = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTests as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTestsStream without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTestsStream with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTestsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.showcase.v1beta1.Test[] = []; - stream.on('data', (response: protos.google.showcase.v1beta1.Test) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTests, request)); - assert( - (client.descriptors.page.listTests.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests without error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - generateSampleMessage(new protos.google.showcase.v1beta1.Test()), - ]; - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.showcase.v1beta1.ITest[] = []; - const iterable = client.listTestsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTests with error', async () => { - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.showcase.v1beta1.ListTestsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.showcase.v1beta1.ListTestsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTests.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTestsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.showcase.v1beta1.ITest[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTests.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('blueprint', async () => { - const fakePath = "/rendered/path/blueprint"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - blueprint: "blueprintValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.blueprintPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.blueprintPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('blueprintPath', () => { - const result = client.blueprintPath("sessionValue", "testValue", "blueprintValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.blueprintPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromBlueprintName', () => { - const result = client.matchSessionFromBlueprintName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromBlueprintName', () => { - const result = client.matchTestFromBlueprintName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlueprintFromBlueprintName', () => { - const result = client.matchBlueprintFromBlueprintName(fakePath); - assert.strictEqual(result, "blueprintValue"); - assert((client.pathTemplates.blueprintPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('room', async () => { - const fakePath = "/rendered/path/room"; - const expectedParameters = { - room: "roomValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomPath', () => { - const result = client.roomPath("roomValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomName', () => { - const result = client.matchRoomFromRoomName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurb"; - const expectedParameters = { - room: "roomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbPath', () => { - const result = client.roomBlurbPath("roomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('roomBlurbsLegacyRoomBlurb', async () => { - const fakePath = "/rendered/path/roomBlurbsLegacyRoomBlurb"; - const expectedParameters = { - room: "roomValue", - legacy_room: "legacyRoomValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('roomBlurbsLegacyRoomBlurbPath', () => { - const result = client.roomBlurbsLegacyRoomBlurbPath("roomValue", "legacyRoomValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "roomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchLegacyRoomFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "legacyRoomValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromRoomBlurbsLegacyRoomBlurbName', () => { - const result = client.matchBlurbFromRoomBlurbsLegacyRoomBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.roomBlurbsLegacyRoomBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequence', async () => { - const fakePath = "/rendered/path/sequence"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequencePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequencePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequencePath', () => { - const result = client.sequencePath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequencePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceName', () => { - const result = client.matchSequenceFromSequenceName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequencePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('sequenceReport', async () => { - const fakePath = "/rendered/path/sequenceReport"; - const expectedParameters = { - sequence: "sequenceValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sequenceReportPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sequenceReportPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sequenceReportPath', () => { - const result = client.sequenceReportPath("sequenceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sequenceReportPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSequenceFromSequenceReportName', () => { - const result = client.matchSequenceFromSequenceReportName(fakePath); - assert.strictEqual(result, "sequenceValue"); - assert((client.pathTemplates.sequenceReportPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('session', async () => { - const fakePath = "/rendered/path/session"; - const expectedParameters = { - session: "sessionValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.sessionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.sessionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('sessionPath', () => { - const result = client.sessionPath("sessionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.sessionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromSessionName', () => { - const result = client.matchSessionFromSessionName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.sessionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('test', async () => { - const fakePath = "/rendered/path/test"; - const expectedParameters = { - session: "sessionValue", - test: "testValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.testPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.testPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('testPath', () => { - const result = client.testPath("sessionValue", "testValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.testPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchSessionFromTestName', () => { - const result = client.matchSessionFromTestName(fakePath); - assert.strictEqual(result, "sessionValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTestFromTestName', () => { - const result = client.matchTestFromTestName(fakePath); - assert.strictEqual(result, "testValue"); - assert((client.pathTemplates.testPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('user', async () => { - const fakePath = "/rendered/path/user"; - const expectedParameters = { - user: "userValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userPath', () => { - const result = client.userPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserName', () => { - const result = client.matchUserFromUserName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurb"; - const expectedParameters = { - user: "userValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbPath', () => { - const result = client.userProfileBlurbPath("userValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('userProfileBlurbsLegacyUserBlurb', async () => { - const fakePath = "/rendered/path/userProfileBlurbsLegacyUserBlurb"; - const expectedParameters = { - user: "userValue", - legacy_user: "legacyUserValue", - blurb: "blurbValue", - }; - const client = new testingModule.v1beta1.TestingClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('userProfileBlurbsLegacyUserBlurbPath', () => { - const result = client.userProfileBlurbsLegacyUserBlurbPath("userValue", "legacyUserValue", "blurbValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchLegacyUserFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "legacyUserValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBlurbFromUserProfileBlurbsLegacyUserBlurbName', () => { - const result = client.matchBlurbFromUserProfileBlurbsLegacyUserBlurbName(fakePath); - assert.strictEqual(result, "blurbValue"); - assert((client.pathTemplates.userProfileBlurbsLegacyUserBlurbPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/showcase/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/showcase/webpack.config.js.baseline deleted file mode 100644 index d97e67fe24c7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/showcase/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ShowcaseService', - filename: './showcase-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 9567c016dd2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/tasks/google-cloud-tasks-nodejs - dest: /owl-bot-staging/google-cloud-tasks - -api-name: tasks \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 82e73d599da1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'tasks', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/README.md.baseline deleted file mode 100644 index 8def741f4ae3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Tasks: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/tasks.svg)](https://www.npmjs.org/package/tasks) - -Tasks client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Tasks Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/tasks/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Tasks API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install tasks -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install tasks@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudtasks.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/index.ts.baseline deleted file mode 100644 index c75be9420e92..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2/index.js'; -const CloudTasksClient = v2.CloudTasksClient; -type CloudTasksClient = v2.CloudTasksClient; -export {v2, CloudTasksClient}; -export default {v2, CloudTasksClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client.ts.baseline deleted file mode 100644 index 99acceadff63..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client.ts.baseline +++ /dev/null @@ -1,2587 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as cloud_tasks_client_config from './cloud_tasks_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v2/cloud_tasks_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'cloud_tasks_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Cloud Tasks allows developers to manage the execution of background - * work in their applications. - * @class - * @memberof v2 - */ -export class CloudTasksClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('tasks'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - cloudTasksStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudTasksClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 CloudTasksClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudTasksClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudtasks.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - queuePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/queues/{queue}' - ), - taskPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' - ), - }; - - // 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 = { - listQueues: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'queues'), - listTasks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tasks') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.tasks.v2.CloudTasks', gapicConfig as gax.ClientConfig, - 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.cloudTasksStub) { - return this.cloudTasksStub; - } - - // Put together the "service stub" for - // google.cloud.tasks.v2.CloudTasks. - this.cloudTasksStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.tasks.v2.CloudTasks') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.tasks.v2.CloudTasks, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudTasksStubMethods = - ['listQueues', 'getQueue', 'createQueue', 'updateQueue', 'deleteQueue', 'purgeQueue', 'pauseQueue', 'resumeQueue', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', 'listTasks', 'getTask', 'createTask', 'deleteTask', 'runTask']; - for (const methodName of cloudTasksStubMethods) { - const callPromise = this.cloudTasksStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.cloudTasksStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudtasks.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudtasks.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a queue. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the queue. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetQueue_async - */ - getQueue( - request?: protos.google.cloud.tasks.v2.IGetQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, {}|undefined - ]>; - getQueue( - request: protos.google.cloud.tasks.v2.IGetQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): void; - getQueue( - request: protos.google.cloud.tasks.v2.IGetQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): void; - getQueue( - request?: protos.google.cloud.tasks.v2.IGetQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('getQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a queue. - * - * Queues created with this method allow tasks to live for a maximum of 31 - * days. After a task is 31 days old, the task will be deleted regardless of whether - * it was dispatched or not. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name in which the queue will be created. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * - * The list of allowed locations can be obtained by calling Cloud - * Tasks' implementation of - * {@link protos.google.cloud.location.Locations.ListLocations|ListLocations}. - * @param {google.cloud.tasks.v2.Queue} request.queue - * Required. The queue to create. - * - * {@link protos.google.cloud.tasks.v2.Queue.name|Queue's name} cannot be the same as an existing queue. - * @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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.create_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_CreateQueue_async - */ - createQueue( - request?: protos.google.cloud.tasks.v2.ICreateQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, {}|undefined - ]>; - createQueue( - request: protos.google.cloud.tasks.v2.ICreateQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): void; - createQueue( - request: protos.google.cloud.tasks.v2.ICreateQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): void; - createQueue( - request?: protos.google.cloud.tasks.v2.ICreateQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('createQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a queue. - * - * This method creates the queue if it does not exist and updates - * the queue if it does exist. - * - * Queues created with this method allow tasks to live for a maximum of 31 - * days. After a task is 31 days old, the task will be deleted regardless of whether - * it was dispatched or not. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.tasks.v2.Queue} request.queue - * Required. The queue to create or update. - * - * The queue's {@link protos.google.cloud.tasks.v2.Queue.name|name} must be specified. - * - * Output only fields cannot be modified using UpdateQueue. - * Any value specified for an output only field will be ignored. - * The queue's {@link protos.google.cloud.tasks.v2.Queue.name|name} cannot be changed. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask used to specify which fields of the queue are being updated. - * - * If empty, then all fields 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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.update_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_UpdateQueue_async - */ - updateQueue( - request?: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, {}|undefined - ]>; - updateQueue( - request: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): void; - updateQueue( - request: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): void; - updateQueue( - request?: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'queue.name': request.queue!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.updateQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('updateQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a queue. - * - * This command will delete the queue even if it has tasks in it. - * - * Note: If you delete a queue, a queue with the same name can't be created - * for 7 days. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.delete_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_DeleteQueue_async - */ - deleteQueue( - request?: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, {}|undefined - ]>; - deleteQueue( - request: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): void; - deleteQueue( - request: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): void; - deleteQueue( - request?: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteQueue request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Purges a queue by deleting all of its tasks. - * - * All tasks created before this method is called are permanently deleted. - * - * Purge operations can take up to one minute to take effect. Tasks - * might be dispatched before the purge takes effect. A purge is irreversible. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.purge_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_PurgeQueue_async - */ - purgeQueue( - request?: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, {}|undefined - ]>; - purgeQueue( - request: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): void; - purgeQueue( - request: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): void; - purgeQueue( - request?: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('purgeQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('purgeQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.purgeQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('purgeQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Pauses the queue. - * - * If a queue is paused then the system will stop dispatching tasks - * until the queue is resumed via - * {@link protos.google.cloud.tasks.v2.CloudTasks.ResumeQueue|ResumeQueue}. Tasks can still be added - * when the queue is paused. A queue is paused if its - * {@link protos.google.cloud.tasks.v2.Queue.state|state} is {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.pause_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_PauseQueue_async - */ - pauseQueue( - request?: protos.google.cloud.tasks.v2.IPauseQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, {}|undefined - ]>; - pauseQueue( - request: protos.google.cloud.tasks.v2.IPauseQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): void; - pauseQueue( - request: protos.google.cloud.tasks.v2.IPauseQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): void; - pauseQueue( - request?: protos.google.cloud.tasks.v2.IPauseQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('pauseQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pauseQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.pauseQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('pauseQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Resume a queue. - * - * This method resumes a queue after it has been - * {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED} or - * {@link protos.google.cloud.tasks.v2.Queue.State.DISABLED|DISABLED}. The state of a queue is stored - * in the queue's {@link protos.google.cloud.tasks.v2.Queue.state|state}; after calling this method it - * will be set to {@link protos.google.cloud.tasks.v2.Queue.State.RUNNING|RUNNING}. - * - * WARNING: Resuming many high-QPS queues at the same time can - * lead to target overloading. If you are resuming high-QPS - * queues, follow the 500/50/5 pattern described in - * [Managing Cloud Tasks Scaling - * Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.resume_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ResumeQueue_async - */ - resumeQueue( - request?: protos.google.cloud.tasks.v2.IResumeQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, {}|undefined - ]>; - resumeQueue( - request: protos.google.cloud.tasks.v2.IResumeQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): void; - resumeQueue( - request: protos.google.cloud.tasks.v2.IResumeQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): void; - resumeQueue( - request?: protos.google.cloud.tasks.v2.IResumeQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('resumeQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resumeQueue response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.resumeQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, {}|undefined - ]) => { - this._log.info('resumeQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the access control policy for a {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Returns an empty policy if the resource exists and does not have a policy - * set. - * - * Authorization requires the following - * [Google IAM](https://cloud.google.com/iam) permission on the specified - * resource parent: - * - * * `cloudtasks.queues.getIamPolicy` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_iam_policy.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getIamPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('getIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Sets the access control policy for a {@link protos.google.cloud.tasks.v2.Queue|Queue}. Replaces any existing - * policy. - * - * Note: The Cloud Console does not check queue-level IAM permissions yet. - * Project-level permissions are required to use the Cloud Console. - * - * Authorization requires the following - * [Google IAM](https://cloud.google.com/iam) permission on the specified - * resource parent: - * - * * `cloudtasks.queues.setIamPolicy` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.set_iam_policy.js - * region_tag:cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('setIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('setIamPolicy response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.setIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]) => { - this._log.info('setIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns permissions that a caller has on a {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * If the resource does not exist, this will return an empty set of - * permissions, not a {@link protos.google.rpc.Code.NOT_FOUND|NOT_FOUND} error. - * - * Note: This operation is designed to be used for building permission-aware - * UIs and command-line tools, not for authorization checking. This operation - * may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 {@link protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.test_iam_permissions.js - * region_tag:cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('testIamPermissions request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('testIamPermissions response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.testIamPermissions(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]) => { - this._log.info('testIamPermissions response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a task. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetTask_async - */ - getTask( - request?: protos.google.cloud.tasks.v2.IGetTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, {}|undefined - ]>; - getTask( - request: protos.google.cloud.tasks.v2.IGetTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): void; - getTask( - request: protos.google.cloud.tasks.v2.IGetTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): void; - getTask( - request?: protos.google.cloud.tasks.v2.IGetTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getTask response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, {}|undefined - ]) => { - this._log.info('getTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a task and adds it to a queue. - * - * Tasks cannot be updated after creation; there is no UpdateTask command. - * - * * The maximum task size is 100KB. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * - * The queue must already exist. - * @param {google.cloud.tasks.v2.Task} request.task - * Required. The task to add. - * - * Task names have the following format: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task {@link protos.google.cloud.tasks.v2.Task.name|name}. If a - * name is not specified then the system will generate a random - * unique task id, which will be set in the task returned in the - * {@link protos.google.cloud.tasks.v2.Task.name|response}. - * - * If {@link protos.google.cloud.tasks.v2.Task.schedule_time|schedule_time} is not set or is in the - * past then Cloud Tasks will set it to the current time. - * - * Task De-duplication: - * - * Explicitly specifying a task ID enables task de-duplication. If - * a task's ID is identical to that of an existing task or a task - * that was deleted or executed recently then the call will fail - * with {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS}. - * If the task's queue was created using Cloud Tasks, then another task with - * the same name can't be created for ~1hour after the original task was - * deleted or executed. If the task's queue was created using queue.yaml or - * queue.xml, then another task with the same name can't be created - * for ~9days after the original task was deleted or executed. - * - * Because there is an extra lookup cost to identify duplicate task - * names, these {@link protos.google.cloud.tasks.v2.CloudTasks.CreateTask|CreateTask} calls have significantly - * increased latency. Using hashed strings for the task id or for - * the prefix of the task id is recommended. Choosing task ids that - * are sequential or have sequential prefixes, for example using a - * timestamp, causes an increase in latency and error rates in all - * task commands. The infrastructure relies on an approximately - * uniform distribution of task ids to store and serve tasks - * efficiently. - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.create_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_CreateTask_async - */ - createTask( - request?: protos.google.cloud.tasks.v2.ICreateTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, {}|undefined - ]>; - createTask( - request: protos.google.cloud.tasks.v2.ICreateTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): void; - createTask( - request: protos.google.cloud.tasks.v2.ICreateTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): void; - createTask( - request?: protos.google.cloud.tasks.v2.ICreateTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createTask response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.createTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, {}|undefined - ]) => { - this._log.info('createTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a task. - * - * A task can be deleted if it is scheduled or dispatched. A task - * cannot be deleted if it has executed successfully or permanently - * failed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.delete_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_DeleteTask_async - */ - deleteTask( - request?: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, {}|undefined - ]>; - deleteTask( - request: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): void; - deleteTask( - request: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): void; - deleteTask( - request?: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTask request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTask response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.deleteTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, {}|undefined - ]) => { - this._log.info('deleteTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Forces a task to run now. - * - * When this method is called, Cloud Tasks will dispatch the task, even if - * the task is already running, the queue has reached its {@link protos.google.cloud.tasks.v2.RateLimits|RateLimits} or - * is {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. - * - * This command is meant to be used for manual debugging. For - * example, {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} can be used to retry a failed - * task after a fix has been made or to manually force a task to be - * dispatched now. - * - * The dispatched task is returned. That is, the task that is returned - * contains the {@link protos.Task.status|status} after the task is dispatched but - * before the task is received by its target. - * - * If Cloud Tasks receives a successful response from the task's - * target, then the task will be deleted; otherwise the task's - * {@link protos.google.cloud.tasks.v2.Task.schedule_time|schedule_time} will be reset to the time that - * {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} was called plus the retry delay specified - * in the queue's {@link protos.google.cloud.tasks.v2.RetryConfig|RetryConfig}. - * - * {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} returns - * {@link protos.google.rpc.Code.NOT_FOUND|NOT_FOUND} when it is called on a - * task that has already succeeded or permanently failed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.run_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_RunTask_async - */ - runTask( - request?: protos.google.cloud.tasks.v2.IRunTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, {}|undefined - ]>; - runTask( - request: protos.google.cloud.tasks.v2.IRunTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): void; - runTask( - request: protos.google.cloud.tasks.v2.IRunTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): void; - runTask( - request?: protos.google.cloud.tasks.v2.IRunTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('runTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('runTask response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.runTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, {}|undefined - ]) => { - this._log.info('runTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists queues. - * - * Queues are returned in lexicographical order. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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 Array of {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listQueuesAsync()` - * 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. - */ - listQueues( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]>; - listQueues( - request: protos.google.cloud.tasks.v2.IListQueuesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): void; - listQueues( - request: protos.google.cloud.tasks.v2.IListQueuesRequest, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): void; - listQueues( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>, - callback?: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listQueues values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listQueues request %j', request); - return this.innerApiCalls - .listQueues(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]) => { - this._log.info('listQueues values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listQueues`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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.cloud.tasks.v2.Queue|Queue} 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 `listQueuesAsync()` - * 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. - */ - listQueuesStream( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listQueues']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listQueues stream %j', request); - return this.descriptors.page.listQueues.createStream( - this.innerApiCalls.listQueues as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listQueues`, 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. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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.cloud.tasks.v2.Queue|Queue}. 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 include:samples/generated/v2/cloud_tasks.list_queues.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ListQueues_async - */ - listQueuesAsync( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listQueues']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listQueues iterate %j', request); - return this.descriptors.page.listQueues.asyncIterate( - this.innerApiCalls['listQueues'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the tasks in a queue. - * - * By default, only the {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC} view is retrieved - * due to performance considerations; - * {@link protos.google.cloud.tasks.v2.ListTasksRequest.response_view|response_view} controls the - * subset of information which is returned. - * - * The tasks may be returned in any order. The ordering may change at any - * time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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 Array of {@link protos.google.cloud.tasks.v2.Task|Task}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTasksAsync()` - * 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. - */ - listTasks( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]>; - listTasks( - request: protos.google.cloud.tasks.v2.IListTasksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): void; - listTasks( - request: protos.google.cloud.tasks.v2.IListTasksRequest, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): void; - listTasks( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>, - callback?: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): - Promise<[ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTasks values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listTasks request %j', request); - return this.innerApiCalls - .listTasks(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]) => { - this._log.info('listTasks values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTasks`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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.cloud.tasks.v2.Task|Task} 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 `listTasksAsync()` - * 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. - */ - listTasksStream( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTasks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTasks stream %j', request); - return this.descriptors.page.listTasks.createStream( - this.innerApiCalls.listTasks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTasks`, 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. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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.cloud.tasks.v2.Task|Task}. 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 include:samples/generated/v2/cloud_tasks.list_tasks.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ListTasks_async - */ - listTasksAsync( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTasks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTasks iterate %j', request); - return this.descriptors.page.listTasks.asyncIterate( - this.innerApiCalls['listTasks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified queue resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} queue - * @returns {string} Resource name string. - */ - queuePath(project:string,location:string,queue:string) { - return this.pathTemplates.queuePathTemplate.render({ - project: project, - location: location, - queue: queue, - }); - } - - /** - * Parse the project from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the project. - */ - matchProjectFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).project; - } - - /** - * Parse the location from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the location. - */ - matchLocationFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).location; - } - - /** - * Parse the queue from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the queue. - */ - matchQueueFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).queue; - } - - /** - * Return a fully-qualified task resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} queue - * @param {string} task - * @returns {string} Resource name string. - */ - taskPath(project:string,location:string,queue:string,task:string) { - return this.pathTemplates.taskPathTemplate.render({ - project: project, - location: location, - queue: queue, - task: task, - }); - } - - /** - * Parse the project from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).project; - } - - /** - * Parse the location from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).location; - } - - /** - * Parse the queue from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the queue. - */ - matchQueueFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).queue; - } - - /** - * Parse the task from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the task. - */ - matchTaskFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).task; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudTasksStub && !this._terminated) { - return this.cloudTasksStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client_config.json.baseline deleted file mode 100644 index 06d26a67eb68..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_client_config.json.baseline +++ /dev/null @@ -1,90 +0,0 @@ -{ - "interfaces": { - "google.cloud.tasks.v2.CloudTasks": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListQueues": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PurgeQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PauseQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResumeQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTasks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_proto_list.json.baseline deleted file mode 100644 index 1f64b04d38a1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/cloud_tasks_proto_list.json.baseline +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/cloud/tasks/v2/cloudtasks.proto", - "../../protos/google/cloud/tasks/v2/queue.proto", - "../../protos/google/cloud/tasks/v2/target.proto", - "../../protos/google/cloud/tasks/v2/task.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/index.ts.baseline deleted file mode 100644 index 9500073e7175..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/src/v2/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {CloudTasksClient} from './cloud_tasks_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index af88f8121ce6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const tasks = require('tasks'); - -function main() { - const cloudTasksClient = new tasks.CloudTasksClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 6aec0f5af462..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as tasks from 'tasks'; - -function main() { - const cloudTasksClient = new tasks.CloudTasksClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index ec89e07d98c8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {CloudTasksClient} from 'tasks'; - -// check that the client class type name can be used -function doStuffWithCloudTasksClient(client: CloudTasksClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudTasksClient = new CloudTasksClient(); - doStuffWithCloudTasksClient(cloudTasksClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/test/gapic_cloud_tasks_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/test/gapic_cloud_tasks_v2.ts.baseline deleted file mode 100644 index c5117b2279a0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/esm/test/gapic_cloud_tasks_v2.ts.baseline +++ /dev/null @@ -1,2379 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as cloudtasksModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.CloudTasksClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudtasks.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = cloudtasksModule.v2.CloudTasksClient.servicePath; - assert.strictEqual(servicePath, 'cloudtasks.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = cloudtasksModule.v2.CloudTasksClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudtasks.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudtasksModule.v2.CloudTasksClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudtasksModule.v2.CloudTasksClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new cloudtasksModule.v2.CloudTasksClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = cloudtasksModule.v2.CloudTasksClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudTasksStub, undefined); - await client.initialize(); - assert(client.cloudTasksStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.cloudTasksStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudTasksStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getQueue', () => { - it('invokes getQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.getQueue = stubSimpleCall(expectedResponse); - const [response] = await client.getQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.getQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getQueue(request), expectedError); - }); - }); - - describe('createQueue', () => { - it('invokes createQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.createQueue = stubSimpleCall(expectedResponse); - const [response] = await client.createQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.createQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createQueue(request), expectedError); - }); - }); - - describe('updateQueue', () => { - it('invokes updateQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.updateQueue = stubSimpleCall(expectedResponse); - const [response] = await client.updateQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.updateQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateQueue(request), expectedError); - }); - }); - - describe('deleteQueue', () => { - it('invokes deleteQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteQueue = stubSimpleCall(expectedResponse); - const [response] = await client.deleteQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteQueue( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteQueue(request), expectedError); - }); - }); - - describe('purgeQueue', () => { - it('invokes purgeQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.purgeQueue = stubSimpleCall(expectedResponse); - const [response] = await client.purgeQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.purgeQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.purgeQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.purgeQueue(request), expectedError); - }); - }); - - describe('pauseQueue', () => { - it('invokes pauseQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.pauseQueue = stubSimpleCall(expectedResponse); - const [response] = await client.pauseQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.pauseQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pauseQueue(request), expectedError); - }); - }); - - describe('resumeQueue', () => { - it('invokes resumeQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.resumeQueue = stubSimpleCall(expectedResponse); - const [response] = await client.resumeQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.resumeQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resumeQueue(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('getTask', () => { - it('invokes getTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.getTask = stubSimpleCall(expectedResponse); - const [response] = await client.getTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.getTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTask(request), expectedError); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTask(request), expectedError); - }); - }); - - describe('createTask', () => { - it('invokes createTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.createTask = stubSimpleCall(expectedResponse); - const [response] = await client.createTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.createTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTask(request), expectedError); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createTask(request), expectedError); - }); - }); - - describe('deleteTask', () => { - it('invokes deleteTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTask = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTask( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTask(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTask(request), expectedError); - }); - }); - - describe('runTask', () => { - it('invokes runTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.runTask = stubSimpleCall(expectedResponse); - const [response] = await client.runTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.runTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.runTask(request), expectedError); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.runTask(request), expectedError); - }); - }); - - describe('listQueues', () => { - it('invokes listQueues without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.innerApiCalls.listQueues = stubSimpleCall(expectedResponse); - const [response] = await client.listQueues(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueues without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.innerApiCalls.listQueues = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listQueues( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueues with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listQueues = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listQueues(request), expectedError); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueuesStream without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.descriptors.page.listQueues.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listQueuesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Queue[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Queue) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueues, request)); - assert( - (client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listQueuesStream with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueues.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listQueuesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Queue[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Queue) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueues, request)); - assert( - (client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueues without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.descriptors.page.listQueues.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tasks.v2.IQueue[] = []; - const iterable = client.listQueuesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueues with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueues.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listQueuesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tasks.v2.IQueue[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTasks', () => { - it('invokes listTasks without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.innerApiCalls.listTasks = stubSimpleCall(expectedResponse); - const [response] = await client.listTasks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasks without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.innerApiCalls.listTasks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTasks( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasks with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTasks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTasks(request), expectedError); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasksStream without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.descriptors.page.listTasks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTasksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Task[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Task) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTasks, request)); - assert( - (client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTasksStream with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTasks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTasksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Task[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Task) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTasks, request)); - assert( - (client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTasks without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.descriptors.page.listTasks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tasks.v2.ITask[] = []; - const iterable = client.listTasksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTasks with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTasks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTasksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tasks.v2.ITask[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('queue', () => { - const fakePath = "/rendered/path/queue"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - queue: "queueValue", - }; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.queuePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.queuePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('queuePath', () => { - const result = client.queuePath("projectValue", "locationValue", "queueValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.queuePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromQueueName', () => { - const result = client.matchProjectFromQueueName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromQueueName', () => { - const result = client.matchLocationFromQueueName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchQueueFromQueueName', () => { - const result = client.matchQueueFromQueueName(fakePath); - assert.strictEqual(result, "queueValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('task', () => { - const fakePath = "/rendered/path/task"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - queue: "queueValue", - task: "taskValue", - }; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.taskPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.taskPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('taskPath', () => { - const result = client.taskPath("projectValue", "locationValue", "queueValue", "taskValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.taskPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTaskName', () => { - const result = client.matchProjectFromTaskName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTaskName', () => { - const result = client.matchLocationFromTaskName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchQueueFromTaskName', () => { - const result = client.matchQueueFromTaskName(fakePath); - assert.strictEqual(result, "queueValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTaskFromTaskName', () => { - const result = client.matchTaskFromTaskName(fakePath); - assert.strictEqual(result, "taskValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json b/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json deleted file mode 100644 index 6d4ca6260b1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "tasks", - "version": "0.1.0", - "description": "Tasks client for Node.js", - "repository": "googleapis/nodejs-tasks", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google tasks", - "tasks", - "cloud tasks" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline deleted file mode 100644 index d30aae519a88..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline +++ /dev/null @@ -1,655 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/queue.proto"; -import "google/cloud/tasks/v2/task.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "CloudTasksProto"; -option java_package = "com.google.cloud.tasks.v2"; -option objc_class_prefix = "TASKS"; - -// Cloud Tasks allows developers to manage the execution of background -// work in their applications. -service CloudTasks { - option (google.api.default_host) = "cloudtasks.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists queues. - // - // Queues are returned in lexicographical order. - rpc ListQueues(ListQueuesRequest) returns (ListQueuesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/queues" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a queue. - rpc GetQueue(GetQueueRequest) returns (Queue) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/queues/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a queue. - // - // Queues created with this method allow tasks to live for a maximum of 31 - // days. After a task is 31 days old, the task will be deleted regardless of whether - // it was dispatched or not. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc CreateQueue(CreateQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/queues" - body: "queue" - }; - option (google.api.method_signature) = "parent,queue"; - } - - // Updates a queue. - // - // This method creates the queue if it does not exist and updates - // the queue if it does exist. - // - // Queues created with this method allow tasks to live for a maximum of 31 - // days. After a task is 31 days old, the task will be deleted regardless of whether - // it was dispatched or not. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc UpdateQueue(UpdateQueueRequest) returns (Queue) { - option (google.api.http) = { - patch: "/v2/{queue.name=projects/*/locations/*/queues/*}" - body: "queue" - }; - option (google.api.method_signature) = "queue,update_mask"; - } - - // Deletes a queue. - // - // This command will delete the queue even if it has tasks in it. - // - // Note: If you delete a queue, a queue with the same name can't be created - // for 7 days. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc DeleteQueue(DeleteQueueRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/queues/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Purges a queue by deleting all of its tasks. - // - // All tasks created before this method is called are permanently deleted. - // - // Purge operations can take up to one minute to take effect. Tasks - // might be dispatched before the purge takes effect. A purge is irreversible. - rpc PurgeQueue(PurgeQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:purge" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses the queue. - // - // If a queue is paused then the system will stop dispatching tasks - // until the queue is resumed via - // [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added - // when the queue is paused. A queue is paused if its - // [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. - rpc PauseQueue(PauseQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resume a queue. - // - // This method resumes a queue after it has been - // [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or - // [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored - // in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it - // will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING]. - // - // WARNING: Resuming many high-QPS queues at the same time can - // lead to target overloading. If you are resuming high-QPS - // queues, follow the 500/50/5 pattern described in - // [Managing Cloud Tasks Scaling - // Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). - rpc ResumeQueue(ResumeQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. - // Returns an empty policy if the resource exists and does not have a policy - // set. - // - // Authorization requires the following - // [Google IAM](https://cloud.google.com/iam) permission on the specified - // resource parent: - // - // * `cloudtasks.queues.getIamPolicy` - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any existing - // policy. - // - // Note: The Cloud Console does not check queue-level IAM permissions yet. - // Project-level permissions are required to use the Cloud Console. - // - // Authorization requires the following - // [Google IAM](https://cloud.google.com/iam) permission on the specified - // resource parent: - // - // * `cloudtasks.queues.setIamPolicy` - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue]. - // If the resource does not exist, this will return an empty set of - // permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Lists the tasks in a queue. - // - // By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved - // due to performance considerations; - // [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the - // subset of information which is returned. - // - // The tasks may be returned in any order. The ordering may change at any - // time. - rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*/queues/*}/tasks" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a task. - rpc GetTask(GetTaskRequest) returns (Task) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a task and adds it to a queue. - // - // Tasks cannot be updated after creation; there is no UpdateTask command. - // - // * The maximum task size is 100KB. - rpc CreateTask(CreateTaskRequest) returns (Task) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/queues/*}/tasks" - body: "*" - }; - option (google.api.method_signature) = "parent,task"; - } - - // Deletes a task. - // - // A task can be deleted if it is scheduled or dispatched. A task - // cannot be deleted if it has executed successfully or permanently - // failed. - rpc DeleteTask(DeleteTaskRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Forces a task to run now. - // - // When this method is called, Cloud Tasks will dispatch the task, even if - // the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or - // is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. - // - // This command is meant to be used for manual debugging. For - // example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed - // task after a fix has been made or to manually force a task to be - // dispatched now. - // - // The dispatched task is returned. That is, the task that is returned - // contains the [status][Task.status] after the task is dispatched but - // before the task is received by its target. - // - // If Cloud Tasks receives a successful response from the task's - // target, then the task will be deleted; otherwise the task's - // [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that - // [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified - // in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig]. - // - // [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns - // [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a - // task that has already succeeded or permanently failed. - rpc RunTask(RunTaskRequest) returns (Task) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}:run" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues]. -message ListQueuesRequest { - // Required. The location name. - // For example: `projects/PROJECT_ID/locations/LOCATION_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Queue" - } - ]; - - // `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2.Queue] - // field can be used as a filter and several operators as supported. - // For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - // described in - // [Stackdriver's Advanced Logs - // Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - // - // Sample filter "state: PAUSED". - // - // Note that using filters might cause fewer queues than the - // requested page_size to be returned. - string filter = 2; - - // Requested page size. - // - // The maximum page size is 9800. If unspecified, the page size will - // be the maximum. Fewer queues than requested might be returned, - // even if more queues exist; use the - // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] in the - // response to determine if more queues exist. - int32 page_size = 3; - - // A token identifying the page of results to return. - // - // To request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] returned - // from the previous call to [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] - // method. It is an error to switch the value of the - // [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating through pages. - string page_token = 4; -} - -// Response message for [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues]. -message ListQueuesResponse { - // The list of queues. - repeated Queue queues = 1; - - // A token to retrieve next page of results. - // - // To return the next page of results, call - // [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] with this value as the - // [page_token][google.cloud.tasks.v2.ListQueuesRequest.page_token]. - // - // If the next_page_token is empty, there are no more results. - // - // The page token is valid for only 2 hours. - string next_page_token = 2; -} - -// Request message for [GetQueue][google.cloud.tasks.v2.CloudTasks.GetQueue]. -message GetQueueRequest { - // Required. The resource name of the queue. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue]. -message CreateQueueRequest { - // Required. The location name in which the queue will be created. - // For example: `projects/PROJECT_ID/locations/LOCATION_ID` - // - // The list of allowed locations can be obtained by calling Cloud - // Tasks' implementation of - // [ListLocations][google.cloud.location.Locations.ListLocations]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Queue" - } - ]; - - // Required. The queue to create. - // - // [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue. - Queue queue = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue]. -message UpdateQueueRequest { - // Required. The queue to create or update. - // - // The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified. - // - // Output only fields cannot be modified using UpdateQueue. - // Any value specified for an output only field will be ignored. - // The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed. - Queue queue = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask used to specify which fields of the queue are being updated. - // - // If empty, then all fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue]. -message DeleteQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue]. -message PurgeQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue]. -message PauseQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. -message ResumeQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for listing tasks using [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks]. -message ListTasksRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; - - // Maximum page size. - // - // Fewer tasks than requested might be returned, even if more tasks exist; use - // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] in the response to - // determine if more tasks exist. - // - // The maximum page size is 1000. If unspecified, the page size will be the - // maximum. - int32 page_size = 3; - - // A token identifying the page of results to return. - // - // To request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] returned - // from the previous call to [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] - // method. - // - // The page token is valid for only 2 hours. - string page_token = 4; -} - -// Response message for listing tasks using [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks]. -message ListTasksResponse { - // The list of tasks. - repeated Task tasks = 1; - - // A token to retrieve next page of results. - // - // To return the next page of results, call - // [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] with this value as the - // [page_token][google.cloud.tasks.v2.ListTasksRequest.page_token]. - // - // If the next_page_token is empty, there are no more results. - string next_page_token = 2; -} - -// Request message for getting a task using [GetTask][google.cloud.tasks.v2.CloudTasks.GetTask]. -message GetTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; -} - -// Request message for [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]. -message CreateTaskRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - // - // The queue must already exist. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Task" - } - ]; - - // Required. The task to add. - // - // Task names have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - // The user can optionally specify a task [name][google.cloud.tasks.v2.Task.name]. If a - // name is not specified then the system will generate a random - // unique task id, which will be set in the task returned in the - // [response][google.cloud.tasks.v2.Task.name]. - // - // If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or is in the - // past then Cloud Tasks will set it to the current time. - // - // Task De-duplication: - // - // Explicitly specifying a task ID enables task de-duplication. If - // a task's ID is identical to that of an existing task or a task - // that was deleted or executed recently then the call will fail - // with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. - // If the task's queue was created using Cloud Tasks, then another task with - // the same name can't be created for ~1hour after the original task was - // deleted or executed. If the task's queue was created using queue.yaml or - // queue.xml, then another task with the same name can't be created - // for ~9days after the original task was deleted or executed. - // - // Because there is an extra lookup cost to identify duplicate task - // names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] calls have significantly - // increased latency. Using hashed strings for the task id or for - // the prefix of the task id is recommended. Choosing task ids that - // are sequential or have sequential prefixes, for example using a - // timestamp, causes an increase in latency and error rates in all - // task commands. The infrastructure relies on an approximately - // uniform distribution of task ids to store and serve tasks - // efficiently. - Task task = 2 [(google.api.field_behavior) = REQUIRED]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 3; -} - -// Request message for deleting a task using -// [DeleteTask][google.cloud.tasks.v2.CloudTasks.DeleteTask]. -message DeleteTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; -} - -// Request message for forcing a task to run now using -// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask]. -message RunTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/queue.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/queue.proto.baseline deleted file mode 100644 index 483a1f61ff94..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/queue.proto.baseline +++ /dev/null @@ -1,361 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "QueueProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// A queue is a container of related tasks. Queues are configured to manage -// how those tasks are dispatched. Configurable properties include rate limits, -// retry options, queue types, and others. -message Queue { - option (google.api.resource) = { - type: "cloudtasks.googleapis.com/Queue" - pattern: "projects/{project}/locations/{location}/queues/{queue}" - }; - - // State of the queue. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The queue is running. Tasks can be dispatched. - // - // If the queue was created using Cloud Tasks and the queue has - // had no activity (method calls or task dispatches) for 30 days, - // the queue may take a few minutes to re-activate. Some method - // calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and - // tasks may not be dispatched for a few minutes until the queue - // has been re-activated. - RUNNING = 1; - - // Tasks are paused by the user. If the queue is paused then Cloud - // Tasks will stop delivering tasks from it, but more tasks can - // still be added to it by the user. - PAUSED = 2; - - // The queue is disabled. - // - // A queue becomes `DISABLED` when - // [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref) - // or - // [queue.xml](https://cloud.google.com/appengine/docs/standard/java/config/queueref) - // is uploaded which does not contain the queue. You cannot directly disable - // a queue. - // - // When a queue is disabled, tasks can still be added to a queue - // but the tasks are not dispatched. - // - // To permanently delete this queue and all of its tasks, call - // [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue]. - DISABLED = 3; - } - - // Caller-specified and required in [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue], - // after which it becomes output only. - // - // The queue name. - // - // The queue name must have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the queue's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - // hyphens (-). The maximum length is 100 characters. - string name = 1; - - // Overrides for - // [task-level app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]. - // These settings apply only to - // [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in this queue. - // [Http tasks][google.cloud.tasks.v2.HttpRequest] are not affected. - // - // If set, `app_engine_routing_override` is used for all - // [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in the queue, no matter what the - // setting is for the - // [task-level app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]. - AppEngineRouting app_engine_routing_override = 2; - - // Rate limits for task dispatches. - // - // [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] and [retry_config][google.cloud.tasks.v2.Queue.retry_config] are - // related because they both control task attempts. However they control task - // attempts in different ways: - // - // * [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] controls the total rate of - // dispatches from a queue (i.e. all traffic dispatched from the - // queue, regardless of whether the dispatch is from a first - // attempt or a retry). - // * [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls what happens to - // particular a task after its first attempt fails. That is, - // [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls task retries (the - // second attempt, third attempt, etc). - // - // The queue's actual dispatch rate is the result of: - // - // * Number of tasks in the queue - // * User-specified throttling: [rate_limits][google.cloud.tasks.v2.Queue.rate_limits], - // [retry_config][google.cloud.tasks.v2.Queue.retry_config], and the - // [queue's state][google.cloud.tasks.v2.Queue.state]. - // * System throttling due to `429` (Too Many Requests) or `503` (Service - // Unavailable) responses from the worker, high error rates, or to smooth - // sudden large traffic spikes. - RateLimits rate_limits = 3; - - // Settings that determine the retry behavior. - // - // * For tasks created using Cloud Tasks: the queue-level retry settings - // apply to all tasks in the queue that were created using Cloud Tasks. - // Retry settings cannot be set on individual tasks. - // * For tasks created using the App Engine SDK: the queue-level retry - // settings apply to all tasks in the queue which do not have retry settings - // explicitly set on the task and were created by the App Engine SDK. See - // [App Engine - // documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). - RetryConfig retry_config = 4; - - // Output only. The state of the queue. - // - // `state` can only be changed by called - // [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue], - // [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue], or uploading - // [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). - // [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] cannot be used to change `state`. - State state = 5; - - // Output only. The last time this queue was purged. - // - // All tasks that were [created][google.cloud.tasks.v2.Task.create_time] before this time - // were purged. - // - // A queue can be purged using [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue], the - // [App Engine Task Queue SDK, or the Cloud - // Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). - // - // Purge time will be truncated to the nearest microsecond. Purge - // time will be unset if the queue has never been purged. - google.protobuf.Timestamp purge_time = 6; - - // Configuration options for writing logs to - // [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this - // field is unset, then no logs are written. - StackdriverLoggingConfig stackdriver_logging_config = 9; -} - -// Rate limits. -// -// This message determines the maximum rate that tasks can be dispatched by a -// queue, regardless of whether the dispatch is a first task attempt or a retry. -// -// Note: The debugging command, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task -// even if the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits]. -message RateLimits { - // The maximum rate at which tasks are dispatched from this queue. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // * The maximum allowed value is 500. - // - // - // This field has the same meaning as - // [rate in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). - double max_dispatches_per_second = 1; - - // Output only. The max burst size. - // - // Max burst size limits how fast tasks in queue are processed when - // many tasks are in the queue and the rate is high. This field - // allows the queue to have a high rate so processing starts shortly - // after a task is enqueued, but still limits resource usage when - // many tasks are enqueued in a short period of time. - // - // The [token bucket](https://wikipedia.org/wiki/Token_Bucket) - // algorithm is used to control the rate of task dispatches. Each - // queue has a token bucket that holds tokens, up to the maximum - // specified by `max_burst_size`. Each time a task is dispatched, a - // token is removed from the bucket. Tasks will be dispatched until - // the queue's bucket runs out of tokens. The bucket will be - // continuously refilled with new tokens based on - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. - // - // Cloud Tasks will pick the value of `max_burst_size` based on the - // value of - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. - // - // For queues that were created or updated using - // `queue.yaml/xml`, `max_burst_size` is equal to - // [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). - // Since `max_burst_size` is output only, if - // [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a queue - // created by `queue.yaml/xml`, `max_burst_size` will be reset based - // on the value of - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], - // regardless of whether - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] - // is updated. - // - int32 max_burst_size = 2; - - // The maximum number of concurrent tasks that Cloud Tasks allows - // to be dispatched for this queue. After this threshold has been - // reached, Cloud Tasks stops dispatching tasks until the number of - // concurrent requests decreases. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // The maximum allowed value is 5,000. - // - // - // This field has the same meaning as - // [max_concurrent_requests in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). - int32 max_concurrent_dispatches = 3; -} - -// Retry config. -// -// These settings determine when a failed task attempt is retried. -message RetryConfig { - // Number of attempts per task. - // - // Cloud Tasks will attempt the task `max_attempts` times (that is, if the - // first attempt fails, then there will be `max_attempts - 1` retries). Must - // be >= -1. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // -1 indicates unlimited attempts. - // - // This field has the same meaning as - // [task_retry_limit in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - int32 max_attempts = 1; - - // If positive, `max_retry_duration` specifies the time limit for - // retrying a failed task, measured from when the task was first - // attempted. Once `max_retry_duration` time has passed *and* the - // task has been attempted [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] - // times, no further attempts will be made and the task will be - // deleted. - // - // If zero, then the task age is unlimited. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `max_retry_duration` will be truncated to the nearest second. - // - // This field has the same meaning as - // [task_age_limit in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration max_retry_duration = 2; - - // A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for retry between - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] and - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration after it fails, - // if the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task should be - // retried. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `min_backoff` will be truncated to the nearest second. - // - // This field has the same meaning as - // [min_backoff_seconds in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration min_backoff = 3; - - // A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for retry between - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] and - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration after it fails, - // if the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task should be - // retried. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `max_backoff` will be truncated to the nearest second. - // - // This field has the same meaning as - // [max_backoff_seconds in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration max_backoff = 4; - - // The time between retries will double `max_doublings` times. - // - // A task's retry interval starts at - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles - // `max_doublings` times, then increases linearly, and finally - // retries retries at intervals of - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to - // [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times. - // - // For example, if [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] is 10s, - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] is 300s, and - // `max_doublings` is 3, then the a task will first be retried in - // 10s. The retry interval will double three times, and then - // increase linearly by 2^3 * 10s. Finally, the task will retry at - // intervals of [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] until the - // task has been attempted [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] - // times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, - // 240s, 300s, 300s, .... - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // This field has the same meaning as - // [max_doublings in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - int32 max_doublings = 5; -} - -// Configuration options for writing logs to -// [Stackdriver Logging](https://cloud.google.com/logging/docs/). -message StackdriverLoggingConfig { - // Specifies the fraction of operations to write to - // [Stackdriver Logging](https://cloud.google.com/logging/docs/). - // This field may contain any value between 0.0 and 1.0, inclusive. - // 0.0 is the default and means that no operations are logged. - double sampling_ratio = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/target.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/target.proto.baseline deleted file mode 100644 index 558ca4afc5e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/target.proto.baseline +++ /dev/null @@ -1,424 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/field_behavior.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "TargetProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// HTTP request. -// -// The task will be pushed to the worker as an HTTP request. If the worker -// or the redirected worker acknowledges the task by returning a successful HTTP -// response code ([`200` - `299`]), the task will be removed from the queue. If -// any other HTTP response code is returned or no response is received, the -// task will be retried according to the following: -// -// * User-specified throttling: [retry configuration][google.cloud.tasks.v2.Queue.retry_config], -// [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's state][google.cloud.tasks.v2.Queue.state]. -// -// * System throttling: To prevent the worker from overloading, Cloud Tasks may -// temporarily reduce the queue's effective rate. User-specified settings -// will not be changed. -// -// System throttling happens because: -// -// * Cloud Tasks backs off on all errors. Normally the backoff specified in -// [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But if the worker returns -// `429` (Too Many Requests), `503` (Service Unavailable), or the rate of -// errors is high, Cloud Tasks will use a higher backoff rate. The retry -// specified in the `Retry-After` HTTP response header is considered. -// -// * To prevent traffic spikes and to smooth sudden increases in traffic, -// dispatches ramp up slowly when the queue is newly created or idle and -// if large numbers of tasks suddenly become available to dispatch (due to -// spikes in create task rates, the queue being unpaused, or many tasks -// that are scheduled at the same time). -message HttpRequest { - // Required. The full url path that the request will be sent to. - // - // This string must begin with either "http://" or "https://". Some examples - // are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Tasks will - // encode some characters for safety and compatibility. The maximum allowed - // URL length is 2083 characters after encoding. - // - // The `Location` header response from a redirect response [`300` - `399`] - // may be followed. The redirect is not counted as a separate attempt. - string url = 1 [(google.api.field_behavior) = REQUIRED]; - - // The HTTP method to use for the request. The default is POST. - HttpMethod http_method = 2; - - // HTTP request headers. - // - // This map contains the header field names and values. - // Headers can be set when the - // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. - // - // These headers represent a subset of the headers that will accompany the - // task's HTTP request. Some HTTP request headers will be ignored or replaced. - // - // A partial list of headers that will be ignored or replaced is: - // - // * Host: This will be computed by Cloud Tasks and derived from - // [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url]. - // * Content-Length: This will be computed by Cloud Tasks. - // * User-Agent: This will be set to `"Google-Cloud-Tasks"`. - // * X-Google-*: Google use only. - // * X-AppEngine-*: Google use only. - // - // `Content-Type` won't be set by Cloud Tasks. You can explicitly set - // `Content-Type` to a media type when the - // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. - // For example, `Content-Type` can be set to `"application/octet-stream"` or - // `"application/json"`. - // - // Headers which can have multiple values (according to RFC2616) can be - // specified using comma-separated values. - // - // The size of the headers must be less than 80KB. - map headers = 3; - - // HTTP request body. - // - // A request body is allowed only if the - // [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT, or PATCH. It is an - // error to set body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod]. - bytes body = 4; - - // The mode for generating an `Authorization` header for HTTP requests. - // - // If specified, all `Authorization` headers in the [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] - // field will be overridden. - oneof authorization_header { - // If specified, an - // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) - // will be generated and attached as an `Authorization` header in the HTTP - // request. - // - // This type of authorization should generally only be used when calling - // Google APIs hosted on *.googleapis.com. - OAuthToken oauth_token = 5; - - // If specified, an - // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) - // token will be generated and attached as an `Authorization` header in the - // HTTP request. - // - // This type of authorization can be used for many scenarios, including - // calling Cloud Run, or endpoints where you intend to validate the token - // yourself. - OidcToken oidc_token = 6; - } -} - -// App Engine HTTP request. -// -// The message defines the HTTP request that is sent to an App Engine app when -// the task is dispatched. -// -// Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] requires -// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) -// Google IAM permission for the project -// and the following scope: -// -// `https://www.googleapis.com/auth/cloud-platform` -// -// The task will be delivered to the App Engine app which belongs to the same -// project as the queue. For more information, see -// [How Requests are -// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) -// and how routing is affected by -// [dispatch -// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). -// Traffic is encrypted during transport and never leaves Google datacenters. -// Because this traffic is carried over a communication mechanism internal to -// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). -// The request to the handler, however, will appear to have used the HTTP -// protocol. -// -// The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to construct the URL that the task is -// delivered to can be set at the queue-level or task-level: -// -// * If [app_engine_routing_override is set on the -// queue][Queue.app_engine_routing_override], this value is used for all -// tasks in the queue, no matter what the setting is for the [task-level -// app_engine_routing][AppEngineHttpRequest.app_engine_routing]. -// -// -// The `url` that the task will be sent to is: -// -// * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+` -// [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri] -// -// Tasks can be dispatched to secure app handlers, unsecure app handlers, and -// URIs restricted with -// [`login: -// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). -// Because tasks are not run as any user, they cannot be dispatched to URIs -// restricted with -// [`login: -// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) -// Task dispatches also do not follow redirects. -// -// The task attempt has succeeded if the app's request handler returns an HTTP -// response code in the range [`200` - `299`]. The task attempt has failed if -// the app's handler returns a non-2xx response code or Cloud Tasks does -// not receive response before the [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed -// tasks will be retried according to the -// [retry configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service Unavailable) is -// considered an App Engine system error instead of an application error and -// will cause Cloud Tasks' traffic congestion control to temporarily throttle -// the queue's dispatches. Unlike other types of task targets, a `429` (Too Many -// Requests) response from an app handler does not cause traffic congestion -// control to throttle the queue. -message AppEngineHttpRequest { - // The HTTP method to use for the request. The default is POST. - // - // The app's request handler for the task's target URL must be able to handle - // HTTP requests with this http_method, otherwise the task attempt will fail - // with error code 405 (Method Not Allowed). See - // [Writing a push task request - // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) - // and the documentation for the request handlers in the language your app is - // written in e.g. - // [Python Request - // Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). - HttpMethod http_method = 1; - - // Task-level setting for App Engine routing. - // - // * If [app_engine_routing_override is set on the - // queue][Queue.app_engine_routing_override], this value is used for all - // tasks in the queue, no matter what the setting is for the [task-level - // app_engine_routing][AppEngineHttpRequest.app_engine_routing]. - AppEngineRouting app_engine_routing = 2; - - // The relative URI. - // - // The relative URI must begin with "/" and must be a valid HTTP relative URI. - // It can contain a path and query string arguments. - // If the relative URI is empty, then the root path "/" will be used. - // No spaces are allowed, and the maximum length allowed is 2083 characters. - string relative_uri = 3; - - // HTTP request headers. - // - // This map contains the header field names and values. - // Headers can be set when the - // [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // Repeated headers are not supported but a header value can contain commas. - // - // Cloud Tasks sets some headers to default values: - // - // * `User-Agent`: By default, this header is - // `"AppEngine-Google; (+http://code.google.com/appengine)"`. - // This header can be modified, but Cloud Tasks will append - // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the - // modified `User-Agent`. - // - // If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], Cloud - // Tasks sets the following headers: - // - // * `Content-Type`: By default, the `Content-Type` header is set to - // `"application/octet-stream"`. The default can be overridden by explicitly - // setting `Content-Type` to a particular media type when the - // [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // For example, `Content-Type` can be set to `"application/json"`. - // * `Content-Length`: This is computed by Cloud Tasks. This value is - // output only. It cannot be changed. - // - // The headers below cannot be set or overridden: - // - // * `Host` - // * `X-Google-*` - // * `X-AppEngine-*` - // - // In addition, Cloud Tasks sets some headers when the task is dispatched, - // such as headers containing information about the task; see - // [request - // headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). - // These headers are set only when the task is dispatched, so they are not - // visible when the task is returned in a Cloud Tasks response. - // - // Although there is no specific limit for the maximum number of headers or - // the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2.Task]. For more - // information, see the [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. - map headers = 4; - - // HTTP request body. - // - // A request body is allowed only if the HTTP method is POST or PUT. It is - // an error to set a body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod]. - bytes body = 5; -} - -// App Engine Routing. -// -// Defines routing characteristics specific to App Engine - service, version, -// and instance. -// -// For more information about services, versions, and instances see -// [An Overview of App -// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -// [Microservices Architecture on Google App -// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -// [App Engine Standard request -// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -// and [App Engine Flex request -// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). -// -// Using [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] requires -// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) -// Google IAM permission for the project -// and the following scope: -// -// `https://www.googleapis.com/auth/cloud-platform` -message AppEngineRouting { - // App service. - // - // By default, the task is sent to the service which is the default - // service when the task is attempted. - // - // For some queues or tasks which were created using the App Engine - // Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable - // into [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example, some tasks - // which were created using the App Engine SDK use a custom domain - // name; custom domains are not parsed by Cloud Tasks. If - // [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then - // [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty string. - string service = 1; - - // App version. - // - // By default, the task is sent to the version which is the default - // version when the task is attempted. - // - // For some queues or tasks which were created using the App Engine - // Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable - // into [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example, some tasks - // which were created using the App Engine SDK use a custom domain - // name; custom domains are not parsed by Cloud Tasks. If - // [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then - // [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty string. - string version = 2; - - // App instance. - // - // By default, the task is sent to an instance which is available when - // the task is attempted. - // - // Requests can only be sent to a specific instance if - // [manual scaling is used in App Engine - // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). - // App Engine Flex does not support instances. For more information, see - // [App Engine Standard request - // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - // and [App Engine Flex request - // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). - string instance = 3; - - // Output only. The host that the task is sent to. - // - // The host is constructed from the domain name of the app associated with - // the queue's project ID (for example .appspot.com), and the - // [service][google.cloud.tasks.v2.AppEngineRouting.service], [version][google.cloud.tasks.v2.AppEngineRouting.version], - // and [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. Tasks which were created using - // the App Engine SDK might have a custom domain name. - // - // For more information, see - // [How Requests are - // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). - string host = 4; -} - -// The HTTP method used to deliver the task. -enum HttpMethod { - // HTTP method unspecified - HTTP_METHOD_UNSPECIFIED = 0; - - // HTTP POST - POST = 1; - - // HTTP GET - GET = 2; - - // HTTP HEAD - HEAD = 3; - - // HTTP PUT - PUT = 4; - - // HTTP DELETE - DELETE = 5; - - // HTTP PATCH - PATCH = 6; - - // HTTP OPTIONS - OPTIONS = 7; -} - -// Contains information needed for generating an -// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). -// This type of authorization should generally only be used when calling Google -// APIs hosted on *.googleapis.com. -message OAuthToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OAuth token. - // The service account must be within the same project as the queue. The - // caller must have iam.serviceAccounts.actAs permission for the service - // account. - string service_account_email = 1; - - // OAuth scope to be used for generating OAuth access token. - // If not specified, "https://www.googleapis.com/auth/cloud-platform" - // will be used. - string scope = 2; -} - -// Contains information needed for generating an -// [OpenID Connect -// token](https://developers.google.com/identity/protocols/OpenIDConnect). -// This type of authorization can be used for many scenarios, including -// calling Cloud Run, or endpoints where you intend to validate the token -// yourself. -message OidcToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OIDC token. - // The service account must be within the same project as the queue. The - // caller must have iam.serviceAccounts.actAs permission for the service - // account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. If not specified, the URI - // specified in target will be used. - string audience = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/task.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/task.proto.baseline deleted file mode 100644 index 70a2baba4c53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/protos/google/cloud/tasks/v2/task.proto.baseline +++ /dev/null @@ -1,191 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "TaskProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// A unit of scheduled work. -message Task { - option (google.api.resource) = { - type: "cloudtasks.googleapis.com/Task" - pattern: "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}" - }; - - // The view specifies a subset of [Task][google.cloud.tasks.v2.Task] data. - // - // When a task is returned in a response, not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - enum View { - // Unspecified. Defaults to BASIC. - VIEW_UNSPECIFIED = 0; - - // The basic view omits fields which can be large or can contain - // sensitive data. - // - // This view does not include the - // [body in AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest.body]. - // Bodies are desirable to return only when needed, because they - // can be large and because of the sensitivity of the data that you - // choose to store in it. - BASIC = 1; - - // All information is returned. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Queue][google.cloud.tasks.v2.Queue] resource. - FULL = 2; - } - - // Optionally caller-specified in [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // - // The task name. - // - // The task name must have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the task's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - // hyphens (-). The maximum length is 100 characters. - // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), or underscores (_). The maximum length is 500 characters. - string name = 1; - - // Required. The message to send to the worker. - oneof message_type { - // HTTP request that is sent to the App Engine app handler. - // - // An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set. - AppEngineHttpRequest app_engine_http_request = 2; - - // HTTP request that is sent to the worker. - // - // An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2.HttpRequest] set. - HttpRequest http_request = 3; - } - - // The time when the task is scheduled to be attempted or retried. - // - // `schedule_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp schedule_time = 4; - - // Output only. The time that the task was created. - // - // `create_time` will be truncated to the nearest second. - google.protobuf.Timestamp create_time = 5; - - // The deadline for requests sent to the worker. If the worker does not - // respond by this deadline then the request is cancelled and the attempt - // is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the - // task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig]. - // - // Note that when the request is cancelled, Cloud Tasks will stop listing for - // the response, but whether the worker stops processing depends on the - // worker. For example, if the worker is stuck, it may not react to cancelled - // requests. - // - // The default and maximum values depend on the type of request: - // - // * For [HTTP tasks][google.cloud.tasks.v2.HttpRequest], the default is 10 minutes. The deadline - // must be in the interval [15 seconds, 30 minutes]. - // - // * For [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest], 0 indicates that the - // request has the default deadline. The default deadline depends on the - // [scaling - // type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) - // of the service: 10 minutes for standard apps with automatic scaling, 24 - // hours for standard apps with manual and basic scaling, and 60 minutes for - // flex apps. If the request deadline is set, it must be in the interval [15 - // seconds, 24 hours 15 seconds]. Regardless of the task's - // `dispatch_deadline`, the app handler will not run for longer than than - // the service's timeout. We recommend setting the `dispatch_deadline` to - // at most a few seconds more than the app handler's timeout. For more - // information see - // [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). - // - // `dispatch_deadline` will be truncated to the nearest millisecond. The - // deadline is an approximate deadline. - google.protobuf.Duration dispatch_deadline = 6; - - // Output only. The number of attempts dispatched. - // - // This count includes attempts which have been dispatched but haven't - // received a response. - int32 dispatch_count = 7; - - // Output only. The number of attempts which have received a response. - int32 response_count = 8; - - // Output only. The status of the task's first attempt. - // - // Only [dispatch_time][google.cloud.tasks.v2.Attempt.dispatch_time] will be set. - // The other [Attempt][google.cloud.tasks.v2.Attempt] information is not retained by Cloud Tasks. - Attempt first_attempt = 9; - - // Output only. The status of the task's last attempt. - Attempt last_attempt = 10; - - // Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2.Task] has - // been returned. - View view = 11; -} - -// The status of a task attempt. -message Attempt { - // Output only. The time that this attempt was scheduled. - // - // `schedule_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp schedule_time = 1; - - // Output only. The time that this attempt was dispatched. - // - // `dispatch_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp dispatch_time = 2; - - // Output only. The time that this attempt response was received. - // - // `response_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp response_time = 3; - - // Output only. The response from the worker for this attempt. - // - // If `response_time` is unset, then the task has not been attempted or is - // currently running and the `response_status` field is meaningless. - google.rpc.Status response_status = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_queue.js.baseline deleted file mode 100644 index 793424e000b8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_queue.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, queue) { - // [START cloudtasks_v2_generated_CloudTasks_CreateQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The location name in which the queue will be created. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * The list of allowed locations can be obtained by calling Cloud - * Tasks' implementation of - * ListLocations google.cloud.location.Locations.ListLocations. - */ - // const parent = 'abc123' - /** - * Required. The queue to create. - * Queue's name google.cloud.tasks.v2.Queue.name cannot be the same as an existing queue. - */ - // const queue = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callCreateQueue() { - // Construct request - const request = { - parent, - queue, - }; - - // Run request - const response = await tasksClient.createQueue(request); - console.log(response); - } - - callCreateQueue(); - // [END cloudtasks_v2_generated_CloudTasks_CreateQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_task.js.baseline deleted file mode 100644 index af4ea46decd4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.create_task.js.baseline +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, task) { - // [START cloudtasks_v2_generated_CloudTasks_CreateTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * The queue must already exist. - */ - // const parent = 'abc123' - /** - * Required. The task to add. - * Task names have the following format: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task name google.cloud.tasks.v2.Task.name. If a - * name is not specified then the system will generate a random - * unique task id, which will be set in the task returned in the - * response google.cloud.tasks.v2.Task.name. - * If schedule_time google.cloud.tasks.v2.Task.schedule_time is not set or is in the - * past then Cloud Tasks will set it to the current time. - * Task De-duplication: - * Explicitly specifying a task ID enables task de-duplication. If - * a task's ID is identical to that of an existing task or a task - * that was deleted or executed recently then the call will fail - * with ALREADY_EXISTS google.rpc.Code.ALREADY_EXISTS. - * If the task's queue was created using Cloud Tasks, then another task with - * the same name can't be created for ~1hour after the original task was - * deleted or executed. If the task's queue was created using queue.yaml or - * queue.xml, then another task with the same name can't be created - * for ~9days after the original task was deleted or executed. - * Because there is an extra lookup cost to identify duplicate task - * names, these CreateTask google.cloud.tasks.v2.CloudTasks.CreateTask calls have significantly - * increased latency. Using hashed strings for the task id or for - * the prefix of the task id is recommended. Choosing task ids that - * are sequential or have sequential prefixes, for example using a - * timestamp, causes an increase in latency and error rates in all - * task commands. The infrastructure relies on an approximately - * uniform distribution of task ids to store and serve tasks - * efficiently. - */ - // const task = {} - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callCreateTask() { - // Construct request - const request = { - parent, - task, - }; - - // Run request - const response = await tasksClient.createTask(request); - console.log(response); - } - - callCreateTask(); - // [END cloudtasks_v2_generated_CloudTasks_CreateTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_queue.js.baseline deleted file mode 100644 index 33eced925e1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_DeleteQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callDeleteQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.deleteQueue(request); - console.log(response); - } - - callDeleteQueue(); - // [END cloudtasks_v2_generated_CloudTasks_DeleteQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_task.js.baseline deleted file mode 100644 index 8e896cf45c1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.delete_task.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_DeleteTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callDeleteTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.deleteTask(request); - console.log(response); - } - - callDeleteTask(); - // [END cloudtasks_v2_generated_CloudTasks_DeleteTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline deleted file mode 100644 index 840e6c7e02fa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource) { - // [START cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await tasksClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_queue.js.baseline deleted file mode 100644 index 4dfcfd43205f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_GetQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the queue. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.getQueue(request); - console.log(response); - } - - callGetQueue(); - // [END cloudtasks_v2_generated_CloudTasks_GetQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_task.js.baseline deleted file mode 100644 index a309622aa5c9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.get_task.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_GetTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.getTask(request); - console.log(response); - } - - callGetTask(); - // [END cloudtasks_v2_generated_CloudTasks_GetTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_queues.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_queues.js.baseline deleted file mode 100644 index 34343dff6b4c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_queues.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudtasks_v2_generated_CloudTasks_ListQueues_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - */ - // const parent = 'abc123' - /** - * `filter` can be used to specify a subset of queues. Any Queue google.cloud.tasks.v2.Queue - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * Stackdriver's Advanced Logs - * Filters (https://cloud.google.com/logging/docs/view/advanced_filters). - * Sample filter "state: PAUSED". - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - */ - // const filter = 'abc123' - /** - * Requested page size. - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * next_page_token google.cloud.tasks.v2.ListQueuesResponse.next_page_token in the - * response to determine if more queues exist. - */ - // const pageSize = 1234 - /** - * A token identifying the page of results to return. - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * next_page_token google.cloud.tasks.v2.ListQueuesResponse.next_page_token returned - * from the previous call to ListQueues google.cloud.tasks.v2.CloudTasks.ListQueues - * method. It is an error to switch the value of the - * filter google.cloud.tasks.v2.ListQueuesRequest.filter while iterating through pages. - */ - // const pageToken = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callListQueues() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = tasksClient.listQueuesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListQueues(); - // [END cloudtasks_v2_generated_CloudTasks_ListQueues_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_tasks.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_tasks.js.baseline deleted file mode 100644 index 67ab843cfa69..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.list_tasks.js.baseline +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudtasks_v2_generated_CloudTasks_ListTasks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const parent = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - /** - * Maximum page size. - * Fewer tasks than requested might be returned, even if more tasks exist; use - * next_page_token google.cloud.tasks.v2.ListTasksResponse.next_page_token in the response to - * determine if more tasks exist. - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - */ - // const pageSize = 1234 - /** - * A token identifying the page of results to return. - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * next_page_token google.cloud.tasks.v2.ListTasksResponse.next_page_token returned - * from the previous call to ListTasks google.cloud.tasks.v2.CloudTasks.ListTasks - * method. - * The page token is valid for only 2 hours. - */ - // const pageToken = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callListTasks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = tasksClient.listTasksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTasks(); - // [END cloudtasks_v2_generated_CloudTasks_ListTasks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.pause_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.pause_queue.js.baseline deleted file mode 100644 index e613a3bc2765..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.pause_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_PauseQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callPauseQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.pauseQueue(request); - console.log(response); - } - - callPauseQueue(); - // [END cloudtasks_v2_generated_CloudTasks_PauseQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.purge_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.purge_queue.js.baseline deleted file mode 100644 index 013fd7ffed6e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.purge_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_PurgeQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callPurgeQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.purgeQueue(request); - console.log(response); - } - - callPurgeQueue(); - // [END cloudtasks_v2_generated_CloudTasks_PurgeQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.resume_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.resume_queue.js.baseline deleted file mode 100644 index 823bc77d776a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.resume_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_ResumeQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callResumeQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.resumeQueue(request); - console.log(response); - } - - callResumeQueue(); - // [END cloudtasks_v2_generated_CloudTasks_ResumeQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.run_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.run_task.js.baseline deleted file mode 100644 index a4fe587e1f3a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.run_task.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_RunTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callRunTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.runTask(request); - console.log(response); - } - - callRunTask(); - // [END cloudtasks_v2_generated_CloudTasks_RunTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline deleted file mode 100644 index 682db87c8e83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource, policy) { - // [START cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await tasksClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline deleted file mode 100644 index 7b8e52d8db02..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = ['abc','def'] - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await tasksClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.update_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.update_queue.js.baseline deleted file mode 100644 index 904ccf73d576..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/cloud_tasks.update_queue.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(queue) { - // [START cloudtasks_v2_generated_CloudTasks_UpdateQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue to create or update. - * The queue's name google.cloud.tasks.v2.Queue.name must be specified. - * Output only fields cannot be modified using UpdateQueue. - * Any value specified for an output only field will be ignored. - * The queue's name google.cloud.tasks.v2.Queue.name cannot be changed. - */ - // const queue = {} - /** - * A mask used to specify which fields of the queue are being updated. - * If empty, then all fields will be updated. - */ - // const updateMask = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callUpdateQueue() { - // Construct request - const request = { - queue, - }; - - // Run request - const response = await tasksClient.updateQueue(request); - console.log(response); - } - - callUpdateQueue(); - // [END cloudtasks_v2_generated_CloudTasks_UpdateQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline deleted file mode 100644 index db6c76ae14b6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline +++ /dev/null @@ -1,715 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-tasks", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.tasks.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ListQueues_async", - "title": "CloudTasks listQueues Sample", - "origin": "API_DEFINITION", - "description": " Lists queues. Queues are returned in lexicographical order.", - "canonical": true, - "file": "cloud_tasks.list_queues.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListQueues", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListQueues", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.ListQueuesResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ListQueues", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListQueues", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetQueue_async", - "title": "CloudTasks getQueue Sample", - "origin": "API_DEFINITION", - "description": " Gets a queue.", - "canonical": true, - "file": "cloud_tasks.get_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_CreateQueue_async", - "title": "CloudTasks createQueue Sample", - "origin": "API_DEFINITION", - "description": " Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.create_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateQueue", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "queue", - "type": ".google.cloud.tasks.v2.Queue" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "CreateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_UpdateQueue_async", - "title": "CloudTasks updateQueue Sample", - "origin": "API_DEFINITION", - "description": " Updates a queue. This method creates the queue if it does not exist and updates the queue if it does exist. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.update_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.UpdateQueue", - "async": true, - "parameters": [ - { - "name": "queue", - "type": ".google.cloud.tasks.v2.Queue" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "UpdateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.UpdateQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_DeleteQueue_async", - "title": "CloudTasks deleteQueue Sample", - "origin": "API_DEFINITION", - "description": " Deletes a queue. This command will delete the queue even if it has tasks in it. Note: If you delete a queue, a queue with the same name can't be created for 7 days. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.delete_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "DeleteQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_PurgeQueue_async", - "title": "CloudTasks purgeQueue Sample", - "origin": "API_DEFINITION", - "description": " Purges a queue by deleting all of its tasks. All tasks created before this method is called are permanently deleted. Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.", - "canonical": true, - "file": "cloud_tasks.purge_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PurgeQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "PurgeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PurgeQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_PauseQueue_async", - "title": "CloudTasks pauseQueue Sample", - "origin": "API_DEFINITION", - "description": " Pauses the queue. If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].", - "canonical": true, - "file": "cloud_tasks.pause_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PauseQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "PauseQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PauseQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ResumeQueue_async", - "title": "CloudTasks resumeQueue Sample", - "origin": "API_DEFINITION", - "description": " Resume a queue. This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING]. WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).", - "canonical": true, - "file": "cloud_tasks.resume_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.ResumeQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ResumeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.ResumeQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async", - "title": "CloudTasks getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Returns an empty policy if the resource exists and does not have a policy set. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.getIamPolicy`", - "canonical": true, - "file": "cloud_tasks.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetIamPolicy", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async", - "title": "CloudTasks setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any existing policy. Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.setIamPolicy`", - "canonical": true, - "file": "cloud_tasks.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.SetIamPolicy", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async", - "title": "CloudTasks testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue]. If the resource does not exist, this will return an empty set of permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", - "canonical": true, - "file": "cloud_tasks.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.tasks.v2.CloudTasks.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.tasks.v2.CloudTasks.TestIamPermissions", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ListTasks_async", - "title": "CloudTasks listTasks Sample", - "origin": "API_DEFINITION", - "description": " Lists the tasks in a queue. By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time.", - "canonical": true, - "file": "cloud_tasks.list_tasks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListTasks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.ListTasksResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ListTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListTasks", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetTask_async", - "title": "CloudTasks getTask Sample", - "origin": "API_DEFINITION", - "description": " Gets a task.", - "canonical": true, - "file": "cloud_tasks.get_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_CreateTask_async", - "title": "CloudTasks createTask Sample", - "origin": "API_DEFINITION", - "description": " Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * The maximum task size is 100KB.", - "canonical": true, - "file": "cloud_tasks.create_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 100, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateTask", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "task", - "type": ".google.cloud.tasks.v2.Task" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "CreateTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_DeleteTask_async", - "title": "CloudTasks deleteTask Sample", - "origin": "API_DEFINITION", - "description": " Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.", - "canonical": true, - "file": "cloud_tasks.delete_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "DeleteTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_RunTask_async", - "title": "CloudTasks runTask Sample", - "origin": "API_DEFINITION", - "description": " Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig]. [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.", - "canonical": true, - "file": "cloud_tasks.run_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.RunTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "RunTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.RunTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/tasks-esm/webpack.config.cjs.baseline deleted file mode 100644 index b558c6fdd19e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'CloudTasks', - filename: './cloud-tasks.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.OwlBot.yaml.baseline deleted file mode 100644 index 9567c016dd2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/tasks/google-cloud-tasks-nodejs - dest: /owl-bot-staging/google-cloud-tasks - -api-name: tasks \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.jsdoc.js.baseline deleted file mode 100644 index b300a65a1847..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'tasks', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/README.md.baseline deleted file mode 100644 index 8def741f4ae3..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Tasks: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/tasks.svg)](https://www.npmjs.org/package/tasks) - -Tasks client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Tasks Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/tasks/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Tasks API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install tasks -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install tasks@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudtasks.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-tasks diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/package.json b/core/generator/gapic-generator-typescript/baselines/tasks/package.json deleted file mode 100644 index 2717514a26d4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "tasks", - "version": "0.1.0", - "description": "Tasks client for Node.js", - "repository": "googleapis/nodejs-tasks", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google tasks", - "tasks", - "cloud tasks" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline deleted file mode 100644 index d30aae519a88..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/cloudtasks.proto.baseline +++ /dev/null @@ -1,655 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/queue.proto"; -import "google/cloud/tasks/v2/task.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "CloudTasksProto"; -option java_package = "com.google.cloud.tasks.v2"; -option objc_class_prefix = "TASKS"; - -// Cloud Tasks allows developers to manage the execution of background -// work in their applications. -service CloudTasks { - option (google.api.default_host) = "cloudtasks.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists queues. - // - // Queues are returned in lexicographical order. - rpc ListQueues(ListQueuesRequest) returns (ListQueuesResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*}/queues" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a queue. - rpc GetQueue(GetQueueRequest) returns (Queue) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/queues/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a queue. - // - // Queues created with this method allow tasks to live for a maximum of 31 - // days. After a task is 31 days old, the task will be deleted regardless of whether - // it was dispatched or not. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc CreateQueue(CreateQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*}/queues" - body: "queue" - }; - option (google.api.method_signature) = "parent,queue"; - } - - // Updates a queue. - // - // This method creates the queue if it does not exist and updates - // the queue if it does exist. - // - // Queues created with this method allow tasks to live for a maximum of 31 - // days. After a task is 31 days old, the task will be deleted regardless of whether - // it was dispatched or not. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc UpdateQueue(UpdateQueueRequest) returns (Queue) { - option (google.api.http) = { - patch: "/v2/{queue.name=projects/*/locations/*/queues/*}" - body: "queue" - }; - option (google.api.method_signature) = "queue,update_mask"; - } - - // Deletes a queue. - // - // This command will delete the queue even if it has tasks in it. - // - // Note: If you delete a queue, a queue with the same name can't be created - // for 7 days. - // - // WARNING: Using this method may have unintended side effects if you are - // using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - // Read - // [Overview of Queue Management and - // queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - // this method. - rpc DeleteQueue(DeleteQueueRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/queues/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Purges a queue by deleting all of its tasks. - // - // All tasks created before this method is called are permanently deleted. - // - // Purge operations can take up to one minute to take effect. Tasks - // might be dispatched before the purge takes effect. A purge is irreversible. - rpc PurgeQueue(PurgeQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:purge" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Pauses the queue. - // - // If a queue is paused then the system will stop dispatching tasks - // until the queue is resumed via - // [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added - // when the queue is paused. A queue is paused if its - // [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. - rpc PauseQueue(PauseQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:pause" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Resume a queue. - // - // This method resumes a queue after it has been - // [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or - // [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored - // in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it - // will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING]. - // - // WARNING: Resuming many high-QPS queues at the same time can - // lead to target overloading. If you are resuming high-QPS - // queues, follow the 500/50/5 pattern described in - // [Managing Cloud Tasks Scaling - // Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). - rpc ResumeQueue(ResumeQueueRequest) returns (Queue) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*}:resume" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. - // Returns an empty policy if the resource exists and does not have a policy - // set. - // - // Authorization requires the following - // [Google IAM](https://cloud.google.com/iam) permission on the specified - // resource parent: - // - // * `cloudtasks.queues.getIamPolicy` - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:getIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource"; - } - - // Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any existing - // policy. - // - // Note: The Cloud Console does not check queue-level IAM permissions yet. - // Project-level permissions are required to use the Cloud Console. - // - // Authorization requires the following - // [Google IAM](https://cloud.google.com/iam) permission on the specified - // resource parent: - // - // * `cloudtasks.queues.setIamPolicy` - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:setIamPolicy" - body: "*" - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue]. - // If the resource does not exist, this will return an empty set of - // permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v2/{resource=projects/*/locations/*/queues/*}:testIamPermissions" - body: "*" - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Lists the tasks in a queue. - // - // By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved - // due to performance considerations; - // [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the - // subset of information which is returned. - // - // The tasks may be returned in any order. The ordering may change at any - // time. - rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) { - option (google.api.http) = { - get: "/v2/{parent=projects/*/locations/*/queues/*}/tasks" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets a task. - rpc GetTask(GetTaskRequest) returns (Task) { - option (google.api.http) = { - get: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a task and adds it to a queue. - // - // Tasks cannot be updated after creation; there is no UpdateTask command. - // - // * The maximum task size is 100KB. - rpc CreateTask(CreateTaskRequest) returns (Task) { - option (google.api.http) = { - post: "/v2/{parent=projects/*/locations/*/queues/*}/tasks" - body: "*" - }; - option (google.api.method_signature) = "parent,task"; - } - - // Deletes a task. - // - // A task can be deleted if it is scheduled or dispatched. A task - // cannot be deleted if it has executed successfully or permanently - // failed. - rpc DeleteTask(DeleteTaskRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Forces a task to run now. - // - // When this method is called, Cloud Tasks will dispatch the task, even if - // the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or - // is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. - // - // This command is meant to be used for manual debugging. For - // example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed - // task after a fix has been made or to manually force a task to be - // dispatched now. - // - // The dispatched task is returned. That is, the task that is returned - // contains the [status][Task.status] after the task is dispatched but - // before the task is received by its target. - // - // If Cloud Tasks receives a successful response from the task's - // target, then the task will be deleted; otherwise the task's - // [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that - // [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified - // in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig]. - // - // [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns - // [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a - // task that has already succeeded or permanently failed. - rpc RunTask(RunTaskRequest) returns (Task) { - option (google.api.http) = { - post: "/v2/{name=projects/*/locations/*/queues/*/tasks/*}:run" - body: "*" - }; - option (google.api.method_signature) = "name"; - } -} - -// Request message for [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues]. -message ListQueuesRequest { - // Required. The location name. - // For example: `projects/PROJECT_ID/locations/LOCATION_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Queue" - } - ]; - - // `filter` can be used to specify a subset of queues. Any [Queue][google.cloud.tasks.v2.Queue] - // field can be used as a filter and several operators as supported. - // For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - // described in - // [Stackdriver's Advanced Logs - // Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - // - // Sample filter "state: PAUSED". - // - // Note that using filters might cause fewer queues than the - // requested page_size to be returned. - string filter = 2; - - // Requested page size. - // - // The maximum page size is 9800. If unspecified, the page size will - // be the maximum. Fewer queues than requested might be returned, - // even if more queues exist; use the - // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] in the - // response to determine if more queues exist. - int32 page_size = 3; - - // A token identifying the page of results to return. - // - // To request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.tasks.v2.ListQueuesResponse.next_page_token] returned - // from the previous call to [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] - // method. It is an error to switch the value of the - // [filter][google.cloud.tasks.v2.ListQueuesRequest.filter] while iterating through pages. - string page_token = 4; -} - -// Response message for [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues]. -message ListQueuesResponse { - // The list of queues. - repeated Queue queues = 1; - - // A token to retrieve next page of results. - // - // To return the next page of results, call - // [ListQueues][google.cloud.tasks.v2.CloudTasks.ListQueues] with this value as the - // [page_token][google.cloud.tasks.v2.ListQueuesRequest.page_token]. - // - // If the next_page_token is empty, there are no more results. - // - // The page token is valid for only 2 hours. - string next_page_token = 2; -} - -// Request message for [GetQueue][google.cloud.tasks.v2.CloudTasks.GetQueue]. -message GetQueueRequest { - // Required. The resource name of the queue. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue]. -message CreateQueueRequest { - // Required. The location name in which the queue will be created. - // For example: `projects/PROJECT_ID/locations/LOCATION_ID` - // - // The list of allowed locations can be obtained by calling Cloud - // Tasks' implementation of - // [ListLocations][google.cloud.location.Locations.ListLocations]. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Queue" - } - ]; - - // Required. The queue to create. - // - // [Queue's name][google.cloud.tasks.v2.Queue.name] cannot be the same as an existing queue. - Queue queue = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue]. -message UpdateQueueRequest { - // Required. The queue to create or update. - // - // The queue's [name][google.cloud.tasks.v2.Queue.name] must be specified. - // - // Output only fields cannot be modified using UpdateQueue. - // Any value specified for an output only field will be ignored. - // The queue's [name][google.cloud.tasks.v2.Queue.name] cannot be changed. - Queue queue = 1 [(google.api.field_behavior) = REQUIRED]; - - // A mask used to specify which fields of the queue are being updated. - // - // If empty, then all fields will be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request message for [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue]. -message DeleteQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue]. -message PurgeQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue]. -message PauseQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. -message ResumeQueueRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Queue" - } - ]; -} - -// Request message for listing tasks using [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks]. -message ListTasksRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; - - // Maximum page size. - // - // Fewer tasks than requested might be returned, even if more tasks exist; use - // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] in the response to - // determine if more tasks exist. - // - // The maximum page size is 1000. If unspecified, the page size will be the - // maximum. - int32 page_size = 3; - - // A token identifying the page of results to return. - // - // To request the first page results, page_token must be empty. To - // request the next page of results, page_token must be the value of - // [next_page_token][google.cloud.tasks.v2.ListTasksResponse.next_page_token] returned - // from the previous call to [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] - // method. - // - // The page token is valid for only 2 hours. - string page_token = 4; -} - -// Response message for listing tasks using [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks]. -message ListTasksResponse { - // The list of tasks. - repeated Task tasks = 1; - - // A token to retrieve next page of results. - // - // To return the next page of results, call - // [ListTasks][google.cloud.tasks.v2.CloudTasks.ListTasks] with this value as the - // [page_token][google.cloud.tasks.v2.ListTasksRequest.page_token]. - // - // If the next_page_token is empty, there are no more results. - string next_page_token = 2; -} - -// Request message for getting a task using [GetTask][google.cloud.tasks.v2.CloudTasks.GetTask]. -message GetTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; -} - -// Request message for [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]. -message CreateTaskRequest { - // Required. The queue name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - // - // The queue must already exist. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "cloudtasks.googleapis.com/Task" - } - ]; - - // Required. The task to add. - // - // Task names have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - // The user can optionally specify a task [name][google.cloud.tasks.v2.Task.name]. If a - // name is not specified then the system will generate a random - // unique task id, which will be set in the task returned in the - // [response][google.cloud.tasks.v2.Task.name]. - // - // If [schedule_time][google.cloud.tasks.v2.Task.schedule_time] is not set or is in the - // past then Cloud Tasks will set it to the current time. - // - // Task De-duplication: - // - // Explicitly specifying a task ID enables task de-duplication. If - // a task's ID is identical to that of an existing task or a task - // that was deleted or executed recently then the call will fail - // with [ALREADY_EXISTS][google.rpc.Code.ALREADY_EXISTS]. - // If the task's queue was created using Cloud Tasks, then another task with - // the same name can't be created for ~1hour after the original task was - // deleted or executed. If the task's queue was created using queue.yaml or - // queue.xml, then another task with the same name can't be created - // for ~9days after the original task was deleted or executed. - // - // Because there is an extra lookup cost to identify duplicate task - // names, these [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] calls have significantly - // increased latency. Using hashed strings for the task id or for - // the prefix of the task id is recommended. Choosing task ids that - // are sequential or have sequential prefixes, for example using a - // timestamp, causes an increase in latency and error rates in all - // task commands. The infrastructure relies on an approximately - // uniform distribution of task ids to store and serve tasks - // efficiently. - Task task = 2 [(google.api.field_behavior) = REQUIRED]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 3; -} - -// Request message for deleting a task using -// [DeleteTask][google.cloud.tasks.v2.CloudTasks.DeleteTask]. -message DeleteTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; -} - -// Request message for forcing a task to run now using -// [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask]. -message RunTaskRequest { - // Required. The task name. For example: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudtasks.googleapis.com/Task" - } - ]; - - // The response_view specifies which subset of the [Task][google.cloud.tasks.v2.Task] will be - // returned. - // - // By default response_view is [BASIC][google.cloud.tasks.v2.Task.View.BASIC]; not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Task][google.cloud.tasks.v2.Task] resource. - Task.View response_view = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/queue.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/queue.proto.baseline deleted file mode 100644 index 483a1f61ff94..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/queue.proto.baseline +++ /dev/null @@ -1,361 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "QueueProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// A queue is a container of related tasks. Queues are configured to manage -// how those tasks are dispatched. Configurable properties include rate limits, -// retry options, queue types, and others. -message Queue { - option (google.api.resource) = { - type: "cloudtasks.googleapis.com/Queue" - pattern: "projects/{project}/locations/{location}/queues/{queue}" - }; - - // State of the queue. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The queue is running. Tasks can be dispatched. - // - // If the queue was created using Cloud Tasks and the queue has - // had no activity (method calls or task dispatches) for 30 days, - // the queue may take a few minutes to re-activate. Some method - // calls may return [NOT_FOUND][google.rpc.Code.NOT_FOUND] and - // tasks may not be dispatched for a few minutes until the queue - // has been re-activated. - RUNNING = 1; - - // Tasks are paused by the user. If the queue is paused then Cloud - // Tasks will stop delivering tasks from it, but more tasks can - // still be added to it by the user. - PAUSED = 2; - - // The queue is disabled. - // - // A queue becomes `DISABLED` when - // [queue.yaml](https://cloud.google.com/appengine/docs/python/config/queueref) - // or - // [queue.xml](https://cloud.google.com/appengine/docs/standard/java/config/queueref) - // is uploaded which does not contain the queue. You cannot directly disable - // a queue. - // - // When a queue is disabled, tasks can still be added to a queue - // but the tasks are not dispatched. - // - // To permanently delete this queue and all of its tasks, call - // [DeleteQueue][google.cloud.tasks.v2.CloudTasks.DeleteQueue]. - DISABLED = 3; - } - - // Caller-specified and required in [CreateQueue][google.cloud.tasks.v2.CloudTasks.CreateQueue], - // after which it becomes output only. - // - // The queue name. - // - // The queue name must have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the queue's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - // hyphens (-). The maximum length is 100 characters. - string name = 1; - - // Overrides for - // [task-level app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]. - // These settings apply only to - // [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in this queue. - // [Http tasks][google.cloud.tasks.v2.HttpRequest] are not affected. - // - // If set, `app_engine_routing_override` is used for all - // [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest] in the queue, no matter what the - // setting is for the - // [task-level app_engine_routing][google.cloud.tasks.v2.AppEngineHttpRequest.app_engine_routing]. - AppEngineRouting app_engine_routing_override = 2; - - // Rate limits for task dispatches. - // - // [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] and [retry_config][google.cloud.tasks.v2.Queue.retry_config] are - // related because they both control task attempts. However they control task - // attempts in different ways: - // - // * [rate_limits][google.cloud.tasks.v2.Queue.rate_limits] controls the total rate of - // dispatches from a queue (i.e. all traffic dispatched from the - // queue, regardless of whether the dispatch is from a first - // attempt or a retry). - // * [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls what happens to - // particular a task after its first attempt fails. That is, - // [retry_config][google.cloud.tasks.v2.Queue.retry_config] controls task retries (the - // second attempt, third attempt, etc). - // - // The queue's actual dispatch rate is the result of: - // - // * Number of tasks in the queue - // * User-specified throttling: [rate_limits][google.cloud.tasks.v2.Queue.rate_limits], - // [retry_config][google.cloud.tasks.v2.Queue.retry_config], and the - // [queue's state][google.cloud.tasks.v2.Queue.state]. - // * System throttling due to `429` (Too Many Requests) or `503` (Service - // Unavailable) responses from the worker, high error rates, or to smooth - // sudden large traffic spikes. - RateLimits rate_limits = 3; - - // Settings that determine the retry behavior. - // - // * For tasks created using Cloud Tasks: the queue-level retry settings - // apply to all tasks in the queue that were created using Cloud Tasks. - // Retry settings cannot be set on individual tasks. - // * For tasks created using the App Engine SDK: the queue-level retry - // settings apply to all tasks in the queue which do not have retry settings - // explicitly set on the task and were created by the App Engine SDK. See - // [App Engine - // documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks). - RetryConfig retry_config = 4; - - // Output only. The state of the queue. - // - // `state` can only be changed by called - // [PauseQueue][google.cloud.tasks.v2.CloudTasks.PauseQueue], - // [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue], or uploading - // [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). - // [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] cannot be used to change `state`. - State state = 5; - - // Output only. The last time this queue was purged. - // - // All tasks that were [created][google.cloud.tasks.v2.Task.create_time] before this time - // were purged. - // - // A queue can be purged using [PurgeQueue][google.cloud.tasks.v2.CloudTasks.PurgeQueue], the - // [App Engine Task Queue SDK, or the Cloud - // Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). - // - // Purge time will be truncated to the nearest microsecond. Purge - // time will be unset if the queue has never been purged. - google.protobuf.Timestamp purge_time = 6; - - // Configuration options for writing logs to - // [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this - // field is unset, then no logs are written. - StackdriverLoggingConfig stackdriver_logging_config = 9; -} - -// Rate limits. -// -// This message determines the maximum rate that tasks can be dispatched by a -// queue, regardless of whether the dispatch is a first task attempt or a retry. -// -// Note: The debugging command, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask], will run a task -// even if the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits]. -message RateLimits { - // The maximum rate at which tasks are dispatched from this queue. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // * The maximum allowed value is 500. - // - // - // This field has the same meaning as - // [rate in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#rate). - double max_dispatches_per_second = 1; - - // Output only. The max burst size. - // - // Max burst size limits how fast tasks in queue are processed when - // many tasks are in the queue and the rate is high. This field - // allows the queue to have a high rate so processing starts shortly - // after a task is enqueued, but still limits resource usage when - // many tasks are enqueued in a short period of time. - // - // The [token bucket](https://wikipedia.org/wiki/Token_Bucket) - // algorithm is used to control the rate of task dispatches. Each - // queue has a token bucket that holds tokens, up to the maximum - // specified by `max_burst_size`. Each time a task is dispatched, a - // token is removed from the bucket. Tasks will be dispatched until - // the queue's bucket runs out of tokens. The bucket will be - // continuously refilled with new tokens based on - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. - // - // Cloud Tasks will pick the value of `max_burst_size` based on the - // value of - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second]. - // - // For queues that were created or updated using - // `queue.yaml/xml`, `max_burst_size` is equal to - // [bucket_size](https://cloud.google.com/appengine/docs/standard/python/config/queueref#bucket_size). - // Since `max_burst_size` is output only, if - // [UpdateQueue][google.cloud.tasks.v2.CloudTasks.UpdateQueue] is called on a queue - // created by `queue.yaml/xml`, `max_burst_size` will be reset based - // on the value of - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second], - // regardless of whether - // [max_dispatches_per_second][google.cloud.tasks.v2.RateLimits.max_dispatches_per_second] - // is updated. - // - int32 max_burst_size = 2; - - // The maximum number of concurrent tasks that Cloud Tasks allows - // to be dispatched for this queue. After this threshold has been - // reached, Cloud Tasks stops dispatching tasks until the number of - // concurrent requests decreases. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // The maximum allowed value is 5,000. - // - // - // This field has the same meaning as - // [max_concurrent_requests in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#max_concurrent_requests). - int32 max_concurrent_dispatches = 3; -} - -// Retry config. -// -// These settings determine when a failed task attempt is retried. -message RetryConfig { - // Number of attempts per task. - // - // Cloud Tasks will attempt the task `max_attempts` times (that is, if the - // first attempt fails, then there will be `max_attempts - 1` retries). Must - // be >= -1. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // -1 indicates unlimited attempts. - // - // This field has the same meaning as - // [task_retry_limit in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - int32 max_attempts = 1; - - // If positive, `max_retry_duration` specifies the time limit for - // retrying a failed task, measured from when the task was first - // attempted. Once `max_retry_duration` time has passed *and* the - // task has been attempted [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] - // times, no further attempts will be made and the task will be - // deleted. - // - // If zero, then the task age is unlimited. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `max_retry_duration` will be truncated to the nearest second. - // - // This field has the same meaning as - // [task_age_limit in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration max_retry_duration = 2; - - // A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for retry between - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] and - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration after it fails, - // if the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task should be - // retried. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `min_backoff` will be truncated to the nearest second. - // - // This field has the same meaning as - // [min_backoff_seconds in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration min_backoff = 3; - - // A task will be [scheduled][google.cloud.tasks.v2.Task.schedule_time] for retry between - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] and - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] duration after it fails, - // if the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig] specifies that the task should be - // retried. - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // `max_backoff` will be truncated to the nearest second. - // - // This field has the same meaning as - // [max_backoff_seconds in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - google.protobuf.Duration max_backoff = 4; - - // The time between retries will double `max_doublings` times. - // - // A task's retry interval starts at - // [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff], then doubles - // `max_doublings` times, then increases linearly, and finally - // retries retries at intervals of - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] up to - // [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] times. - // - // For example, if [min_backoff][google.cloud.tasks.v2.RetryConfig.min_backoff] is 10s, - // [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] is 300s, and - // `max_doublings` is 3, then the a task will first be retried in - // 10s. The retry interval will double three times, and then - // increase linearly by 2^3 * 10s. Finally, the task will retry at - // intervals of [max_backoff][google.cloud.tasks.v2.RetryConfig.max_backoff] until the - // task has been attempted [max_attempts][google.cloud.tasks.v2.RetryConfig.max_attempts] - // times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, - // 240s, 300s, 300s, .... - // - // If unspecified when the queue is created, Cloud Tasks will pick the - // default. - // - // - // This field has the same meaning as - // [max_doublings in - // queue.yaml/xml](https://cloud.google.com/appengine/docs/standard/python/config/queueref#retry_parameters). - int32 max_doublings = 5; -} - -// Configuration options for writing logs to -// [Stackdriver Logging](https://cloud.google.com/logging/docs/). -message StackdriverLoggingConfig { - // Specifies the fraction of operations to write to - // [Stackdriver Logging](https://cloud.google.com/logging/docs/). - // This field may contain any value between 0.0 and 1.0, inclusive. - // 0.0 is the default and means that no operations are logged. - double sampling_ratio = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/target.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/target.proto.baseline deleted file mode 100644 index 558ca4afc5e4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/target.proto.baseline +++ /dev/null @@ -1,424 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/field_behavior.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "TargetProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// HTTP request. -// -// The task will be pushed to the worker as an HTTP request. If the worker -// or the redirected worker acknowledges the task by returning a successful HTTP -// response code ([`200` - `299`]), the task will be removed from the queue. If -// any other HTTP response code is returned or no response is received, the -// task will be retried according to the following: -// -// * User-specified throttling: [retry configuration][google.cloud.tasks.v2.Queue.retry_config], -// [rate limits][google.cloud.tasks.v2.Queue.rate_limits], and the [queue's state][google.cloud.tasks.v2.Queue.state]. -// -// * System throttling: To prevent the worker from overloading, Cloud Tasks may -// temporarily reduce the queue's effective rate. User-specified settings -// will not be changed. -// -// System throttling happens because: -// -// * Cloud Tasks backs off on all errors. Normally the backoff specified in -// [rate limits][google.cloud.tasks.v2.Queue.rate_limits] will be used. But if the worker returns -// `429` (Too Many Requests), `503` (Service Unavailable), or the rate of -// errors is high, Cloud Tasks will use a higher backoff rate. The retry -// specified in the `Retry-After` HTTP response header is considered. -// -// * To prevent traffic spikes and to smooth sudden increases in traffic, -// dispatches ramp up slowly when the queue is newly created or idle and -// if large numbers of tasks suddenly become available to dispatch (due to -// spikes in create task rates, the queue being unpaused, or many tasks -// that are scheduled at the same time). -message HttpRequest { - // Required. The full url path that the request will be sent to. - // - // This string must begin with either "http://" or "https://". Some examples - // are: `http://acme.com` and `https://acme.com/sales:8080`. Cloud Tasks will - // encode some characters for safety and compatibility. The maximum allowed - // URL length is 2083 characters after encoding. - // - // The `Location` header response from a redirect response [`300` - `399`] - // may be followed. The redirect is not counted as a separate attempt. - string url = 1 [(google.api.field_behavior) = REQUIRED]; - - // The HTTP method to use for the request. The default is POST. - HttpMethod http_method = 2; - - // HTTP request headers. - // - // This map contains the header field names and values. - // Headers can be set when the - // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. - // - // These headers represent a subset of the headers that will accompany the - // task's HTTP request. Some HTTP request headers will be ignored or replaced. - // - // A partial list of headers that will be ignored or replaced is: - // - // * Host: This will be computed by Cloud Tasks and derived from - // [HttpRequest.url][google.cloud.tasks.v2.HttpRequest.url]. - // * Content-Length: This will be computed by Cloud Tasks. - // * User-Agent: This will be set to `"Google-Cloud-Tasks"`. - // * X-Google-*: Google use only. - // * X-AppEngine-*: Google use only. - // - // `Content-Type` won't be set by Cloud Tasks. You can explicitly set - // `Content-Type` to a media type when the - // [task is created][google.cloud.tasks.v2beta3.CloudTasks.CreateTask]. - // For example, `Content-Type` can be set to `"application/octet-stream"` or - // `"application/json"`. - // - // Headers which can have multiple values (according to RFC2616) can be - // specified using comma-separated values. - // - // The size of the headers must be less than 80KB. - map headers = 3; - - // HTTP request body. - // - // A request body is allowed only if the - // [HTTP method][google.cloud.tasks.v2.HttpRequest.http_method] is POST, PUT, or PATCH. It is an - // error to set body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod]. - bytes body = 4; - - // The mode for generating an `Authorization` header for HTTP requests. - // - // If specified, all `Authorization` headers in the [HttpRequest.headers][google.cloud.tasks.v2.HttpRequest.headers] - // field will be overridden. - oneof authorization_header { - // If specified, an - // [OAuth token](https://developers.google.com/identity/protocols/OAuth2) - // will be generated and attached as an `Authorization` header in the HTTP - // request. - // - // This type of authorization should generally only be used when calling - // Google APIs hosted on *.googleapis.com. - OAuthToken oauth_token = 5; - - // If specified, an - // [OIDC](https://developers.google.com/identity/protocols/OpenIDConnect) - // token will be generated and attached as an `Authorization` header in the - // HTTP request. - // - // This type of authorization can be used for many scenarios, including - // calling Cloud Run, or endpoints where you intend to validate the token - // yourself. - OidcToken oidc_token = 6; - } -} - -// App Engine HTTP request. -// -// The message defines the HTTP request that is sent to an App Engine app when -// the task is dispatched. -// -// Using [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] requires -// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) -// Google IAM permission for the project -// and the following scope: -// -// `https://www.googleapis.com/auth/cloud-platform` -// -// The task will be delivered to the App Engine app which belongs to the same -// project as the queue. For more information, see -// [How Requests are -// Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) -// and how routing is affected by -// [dispatch -// files](https://cloud.google.com/appengine/docs/python/config/dispatchref). -// Traffic is encrypted during transport and never leaves Google datacenters. -// Because this traffic is carried over a communication mechanism internal to -// Google, you cannot explicitly set the protocol (for example, HTTP or HTTPS). -// The request to the handler, however, will appear to have used the HTTP -// protocol. -// -// The [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] used to construct the URL that the task is -// delivered to can be set at the queue-level or task-level: -// -// * If [app_engine_routing_override is set on the -// queue][Queue.app_engine_routing_override], this value is used for all -// tasks in the queue, no matter what the setting is for the [task-level -// app_engine_routing][AppEngineHttpRequest.app_engine_routing]. -// -// -// The `url` that the task will be sent to is: -// -// * `url =` [host][google.cloud.tasks.v2.AppEngineRouting.host] `+` -// [relative_uri][google.cloud.tasks.v2.AppEngineHttpRequest.relative_uri] -// -// Tasks can be dispatched to secure app handlers, unsecure app handlers, and -// URIs restricted with -// [`login: -// admin`](https://cloud.google.com/appengine/docs/standard/python/config/appref). -// Because tasks are not run as any user, they cannot be dispatched to URIs -// restricted with -// [`login: -// required`](https://cloud.google.com/appengine/docs/standard/python/config/appref) -// Task dispatches also do not follow redirects. -// -// The task attempt has succeeded if the app's request handler returns an HTTP -// response code in the range [`200` - `299`]. The task attempt has failed if -// the app's handler returns a non-2xx response code or Cloud Tasks does -// not receive response before the [deadline][google.cloud.tasks.v2.Task.dispatch_deadline]. Failed -// tasks will be retried according to the -// [retry configuration][google.cloud.tasks.v2.Queue.retry_config]. `503` (Service Unavailable) is -// considered an App Engine system error instead of an application error and -// will cause Cloud Tasks' traffic congestion control to temporarily throttle -// the queue's dispatches. Unlike other types of task targets, a `429` (Too Many -// Requests) response from an app handler does not cause traffic congestion -// control to throttle the queue. -message AppEngineHttpRequest { - // The HTTP method to use for the request. The default is POST. - // - // The app's request handler for the task's target URL must be able to handle - // HTTP requests with this http_method, otherwise the task attempt will fail - // with error code 405 (Method Not Allowed). See - // [Writing a push task request - // handler](https://cloud.google.com/appengine/docs/java/taskqueue/push/creating-handlers#writing_a_push_task_request_handler) - // and the documentation for the request handlers in the language your app is - // written in e.g. - // [Python Request - // Handler](https://cloud.google.com/appengine/docs/python/tools/webapp/requesthandlerclass). - HttpMethod http_method = 1; - - // Task-level setting for App Engine routing. - // - // * If [app_engine_routing_override is set on the - // queue][Queue.app_engine_routing_override], this value is used for all - // tasks in the queue, no matter what the setting is for the [task-level - // app_engine_routing][AppEngineHttpRequest.app_engine_routing]. - AppEngineRouting app_engine_routing = 2; - - // The relative URI. - // - // The relative URI must begin with "/" and must be a valid HTTP relative URI. - // It can contain a path and query string arguments. - // If the relative URI is empty, then the root path "/" will be used. - // No spaces are allowed, and the maximum length allowed is 2083 characters. - string relative_uri = 3; - - // HTTP request headers. - // - // This map contains the header field names and values. - // Headers can be set when the - // [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // Repeated headers are not supported but a header value can contain commas. - // - // Cloud Tasks sets some headers to default values: - // - // * `User-Agent`: By default, this header is - // `"AppEngine-Google; (+http://code.google.com/appengine)"`. - // This header can be modified, but Cloud Tasks will append - // `"AppEngine-Google; (+http://code.google.com/appengine)"` to the - // modified `User-Agent`. - // - // If the task has a [body][google.cloud.tasks.v2.AppEngineHttpRequest.body], Cloud - // Tasks sets the following headers: - // - // * `Content-Type`: By default, the `Content-Type` header is set to - // `"application/octet-stream"`. The default can be overridden by explicitly - // setting `Content-Type` to a particular media type when the - // [task is created][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // For example, `Content-Type` can be set to `"application/json"`. - // * `Content-Length`: This is computed by Cloud Tasks. This value is - // output only. It cannot be changed. - // - // The headers below cannot be set or overridden: - // - // * `Host` - // * `X-Google-*` - // * `X-AppEngine-*` - // - // In addition, Cloud Tasks sets some headers when the task is dispatched, - // such as headers containing information about the task; see - // [request - // headers](https://cloud.google.com/tasks/docs/creating-appengine-handlers#reading_request_headers). - // These headers are set only when the task is dispatched, so they are not - // visible when the task is returned in a Cloud Tasks response. - // - // Although there is no specific limit for the maximum number of headers or - // the size, there is a limit on the maximum size of the [Task][google.cloud.tasks.v2.Task]. For more - // information, see the [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask] documentation. - map headers = 4; - - // HTTP request body. - // - // A request body is allowed only if the HTTP method is POST or PUT. It is - // an error to set a body on a task with an incompatible [HttpMethod][google.cloud.tasks.v2.HttpMethod]. - bytes body = 5; -} - -// App Engine Routing. -// -// Defines routing characteristics specific to App Engine - service, version, -// and instance. -// -// For more information about services, versions, and instances see -// [An Overview of App -// Engine](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine), -// [Microservices Architecture on Google App -// Engine](https://cloud.google.com/appengine/docs/python/microservices-on-app-engine), -// [App Engine Standard request -// routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed), -// and [App Engine Flex request -// routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). -// -// Using [AppEngineRouting][google.cloud.tasks.v2.AppEngineRouting] requires -// [`appengine.applications.get`](https://cloud.google.com/appengine/docs/admin-api/access-control) -// Google IAM permission for the project -// and the following scope: -// -// `https://www.googleapis.com/auth/cloud-platform` -message AppEngineRouting { - // App service. - // - // By default, the task is sent to the service which is the default - // service when the task is attempted. - // - // For some queues or tasks which were created using the App Engine - // Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable - // into [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example, some tasks - // which were created using the App Engine SDK use a custom domain - // name; custom domains are not parsed by Cloud Tasks. If - // [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then - // [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty string. - string service = 1; - - // App version. - // - // By default, the task is sent to the version which is the default - // version when the task is attempted. - // - // For some queues or tasks which were created using the App Engine - // Task Queue API, [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable - // into [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. For example, some tasks - // which were created using the App Engine SDK use a custom domain - // name; custom domains are not parsed by Cloud Tasks. If - // [host][google.cloud.tasks.v2.AppEngineRouting.host] is not parsable, then - // [service][google.cloud.tasks.v2.AppEngineRouting.service], - // [version][google.cloud.tasks.v2.AppEngineRouting.version], and - // [instance][google.cloud.tasks.v2.AppEngineRouting.instance] are the empty string. - string version = 2; - - // App instance. - // - // By default, the task is sent to an instance which is available when - // the task is attempted. - // - // Requests can only be sent to a specific instance if - // [manual scaling is used in App Engine - // Standard](https://cloud.google.com/appengine/docs/python/an-overview-of-app-engine?hl=en_US#scaling_types_and_instance_classes). - // App Engine Flex does not support instances. For more information, see - // [App Engine Standard request - // routing](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed) - // and [App Engine Flex request - // routing](https://cloud.google.com/appengine/docs/flexible/python/how-requests-are-routed). - string instance = 3; - - // Output only. The host that the task is sent to. - // - // The host is constructed from the domain name of the app associated with - // the queue's project ID (for example .appspot.com), and the - // [service][google.cloud.tasks.v2.AppEngineRouting.service], [version][google.cloud.tasks.v2.AppEngineRouting.version], - // and [instance][google.cloud.tasks.v2.AppEngineRouting.instance]. Tasks which were created using - // the App Engine SDK might have a custom domain name. - // - // For more information, see - // [How Requests are - // Routed](https://cloud.google.com/appengine/docs/standard/python/how-requests-are-routed). - string host = 4; -} - -// The HTTP method used to deliver the task. -enum HttpMethod { - // HTTP method unspecified - HTTP_METHOD_UNSPECIFIED = 0; - - // HTTP POST - POST = 1; - - // HTTP GET - GET = 2; - - // HTTP HEAD - HEAD = 3; - - // HTTP PUT - PUT = 4; - - // HTTP DELETE - DELETE = 5; - - // HTTP PATCH - PATCH = 6; - - // HTTP OPTIONS - OPTIONS = 7; -} - -// Contains information needed for generating an -// [OAuth token](https://developers.google.com/identity/protocols/OAuth2). -// This type of authorization should generally only be used when calling Google -// APIs hosted on *.googleapis.com. -message OAuthToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OAuth token. - // The service account must be within the same project as the queue. The - // caller must have iam.serviceAccounts.actAs permission for the service - // account. - string service_account_email = 1; - - // OAuth scope to be used for generating OAuth access token. - // If not specified, "https://www.googleapis.com/auth/cloud-platform" - // will be used. - string scope = 2; -} - -// Contains information needed for generating an -// [OpenID Connect -// token](https://developers.google.com/identity/protocols/OpenIDConnect). -// This type of authorization can be used for many scenarios, including -// calling Cloud Run, or endpoints where you intend to validate the token -// yourself. -message OidcToken { - // [Service account email](https://cloud.google.com/iam/docs/service-accounts) - // to be used for generating OIDC token. - // The service account must be within the same project as the queue. The - // caller must have iam.serviceAccounts.actAs permission for the service - // account. - string service_account_email = 1; - - // Audience to be used when generating OIDC token. If not specified, the URI - // specified in target will be used. - string audience = 2; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/task.proto.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/task.proto.baseline deleted file mode 100644 index 70a2baba4c53..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/protos/google/cloud/tasks/v2/task.proto.baseline +++ /dev/null @@ -1,191 +0,0 @@ -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.tasks.v2; - -import "google/api/resource.proto"; -import "google/cloud/tasks/v2/target.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; -import "google/api/annotations.proto"; - -option go_package = "google.golang.org/genproto/googleapis/cloud/tasks/v2;tasks"; -option java_multiple_files = true; -option java_outer_classname = "TaskProto"; -option java_package = "com.google.cloud.tasks.v2"; - -// A unit of scheduled work. -message Task { - option (google.api.resource) = { - type: "cloudtasks.googleapis.com/Task" - pattern: "projects/{project}/locations/{location}/queues/{queue}/tasks/{task}" - }; - - // The view specifies a subset of [Task][google.cloud.tasks.v2.Task] data. - // - // When a task is returned in a response, not all - // information is retrieved by default because some data, such as - // payloads, might be desirable to return only when needed because - // of its large size or because of the sensitivity of data that it - // contains. - enum View { - // Unspecified. Defaults to BASIC. - VIEW_UNSPECIFIED = 0; - - // The basic view omits fields which can be large or can contain - // sensitive data. - // - // This view does not include the - // [body in AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest.body]. - // Bodies are desirable to return only when needed, because they - // can be large and because of the sensitivity of the data that you - // choose to store in it. - BASIC = 1; - - // All information is returned. - // - // Authorization for [FULL][google.cloud.tasks.v2.Task.View.FULL] requires - // `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - // permission on the [Queue][google.cloud.tasks.v2.Queue] resource. - FULL = 2; - } - - // Optionally caller-specified in [CreateTask][google.cloud.tasks.v2.CloudTasks.CreateTask]. - // - // The task name. - // - // The task name must have the following format: - // `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - // - // * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), colons (:), or periods (.). - // For more information, see - // [Identifying - // projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) - // * `LOCATION_ID` is the canonical ID for the task's location. - // The list of available locations can be obtained by calling - // [ListLocations][google.cloud.location.Locations.ListLocations]. - // For more information, see https://cloud.google.com/about/locations/. - // * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or - // hyphens (-). The maximum length is 100 characters. - // * `TASK_ID` can contain only letters ([A-Za-z]), numbers ([0-9]), - // hyphens (-), or underscores (_). The maximum length is 500 characters. - string name = 1; - - // Required. The message to send to the worker. - oneof message_type { - // HTTP request that is sent to the App Engine app handler. - // - // An App Engine task is a task that has [AppEngineHttpRequest][google.cloud.tasks.v2.AppEngineHttpRequest] set. - AppEngineHttpRequest app_engine_http_request = 2; - - // HTTP request that is sent to the worker. - // - // An HTTP task is a task that has [HttpRequest][google.cloud.tasks.v2.HttpRequest] set. - HttpRequest http_request = 3; - } - - // The time when the task is scheduled to be attempted or retried. - // - // `schedule_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp schedule_time = 4; - - // Output only. The time that the task was created. - // - // `create_time` will be truncated to the nearest second. - google.protobuf.Timestamp create_time = 5; - - // The deadline for requests sent to the worker. If the worker does not - // respond by this deadline then the request is cancelled and the attempt - // is marked as a `DEADLINE_EXCEEDED` failure. Cloud Tasks will retry the - // task according to the [RetryConfig][google.cloud.tasks.v2.RetryConfig]. - // - // Note that when the request is cancelled, Cloud Tasks will stop listing for - // the response, but whether the worker stops processing depends on the - // worker. For example, if the worker is stuck, it may not react to cancelled - // requests. - // - // The default and maximum values depend on the type of request: - // - // * For [HTTP tasks][google.cloud.tasks.v2.HttpRequest], the default is 10 minutes. The deadline - // must be in the interval [15 seconds, 30 minutes]. - // - // * For [App Engine tasks][google.cloud.tasks.v2.AppEngineHttpRequest], 0 indicates that the - // request has the default deadline. The default deadline depends on the - // [scaling - // type](https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_scaling) - // of the service: 10 minutes for standard apps with automatic scaling, 24 - // hours for standard apps with manual and basic scaling, and 60 minutes for - // flex apps. If the request deadline is set, it must be in the interval [15 - // seconds, 24 hours 15 seconds]. Regardless of the task's - // `dispatch_deadline`, the app handler will not run for longer than than - // the service's timeout. We recommend setting the `dispatch_deadline` to - // at most a few seconds more than the app handler's timeout. For more - // information see - // [Timeouts](https://cloud.google.com/tasks/docs/creating-appengine-handlers#timeouts). - // - // `dispatch_deadline` will be truncated to the nearest millisecond. The - // deadline is an approximate deadline. - google.protobuf.Duration dispatch_deadline = 6; - - // Output only. The number of attempts dispatched. - // - // This count includes attempts which have been dispatched but haven't - // received a response. - int32 dispatch_count = 7; - - // Output only. The number of attempts which have received a response. - int32 response_count = 8; - - // Output only. The status of the task's first attempt. - // - // Only [dispatch_time][google.cloud.tasks.v2.Attempt.dispatch_time] will be set. - // The other [Attempt][google.cloud.tasks.v2.Attempt] information is not retained by Cloud Tasks. - Attempt first_attempt = 9; - - // Output only. The status of the task's last attempt. - Attempt last_attempt = 10; - - // Output only. The view specifies which subset of the [Task][google.cloud.tasks.v2.Task] has - // been returned. - View view = 11; -} - -// The status of a task attempt. -message Attempt { - // Output only. The time that this attempt was scheduled. - // - // `schedule_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp schedule_time = 1; - - // Output only. The time that this attempt was dispatched. - // - // `dispatch_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp dispatch_time = 2; - - // Output only. The time that this attempt response was received. - // - // `response_time` will be truncated to the nearest microsecond. - google.protobuf.Timestamp response_time = 3; - - // Output only. The response from the worker for this attempt. - // - // If `response_time` is unset, then the task has not been attempted or is - // currently running and the `response_status` field is meaningless. - google.rpc.Status response_status = 4; -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_queue.js.baseline deleted file mode 100644 index 793424e000b8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_queue.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, queue) { - // [START cloudtasks_v2_generated_CloudTasks_CreateQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The location name in which the queue will be created. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * The list of allowed locations can be obtained by calling Cloud - * Tasks' implementation of - * ListLocations google.cloud.location.Locations.ListLocations. - */ - // const parent = 'abc123' - /** - * Required. The queue to create. - * Queue's name google.cloud.tasks.v2.Queue.name cannot be the same as an existing queue. - */ - // const queue = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callCreateQueue() { - // Construct request - const request = { - parent, - queue, - }; - - // Run request - const response = await tasksClient.createQueue(request); - console.log(response); - } - - callCreateQueue(); - // [END cloudtasks_v2_generated_CloudTasks_CreateQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_task.js.baseline deleted file mode 100644 index af4ea46decd4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.create_task.js.baseline +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, task) { - // [START cloudtasks_v2_generated_CloudTasks_CreateTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * The queue must already exist. - */ - // const parent = 'abc123' - /** - * Required. The task to add. - * Task names have the following format: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task name google.cloud.tasks.v2.Task.name. If a - * name is not specified then the system will generate a random - * unique task id, which will be set in the task returned in the - * response google.cloud.tasks.v2.Task.name. - * If schedule_time google.cloud.tasks.v2.Task.schedule_time is not set or is in the - * past then Cloud Tasks will set it to the current time. - * Task De-duplication: - * Explicitly specifying a task ID enables task de-duplication. If - * a task's ID is identical to that of an existing task or a task - * that was deleted or executed recently then the call will fail - * with ALREADY_EXISTS google.rpc.Code.ALREADY_EXISTS. - * If the task's queue was created using Cloud Tasks, then another task with - * the same name can't be created for ~1hour after the original task was - * deleted or executed. If the task's queue was created using queue.yaml or - * queue.xml, then another task with the same name can't be created - * for ~9days after the original task was deleted or executed. - * Because there is an extra lookup cost to identify duplicate task - * names, these CreateTask google.cloud.tasks.v2.CloudTasks.CreateTask calls have significantly - * increased latency. Using hashed strings for the task id or for - * the prefix of the task id is recommended. Choosing task ids that - * are sequential or have sequential prefixes, for example using a - * timestamp, causes an increase in latency and error rates in all - * task commands. The infrastructure relies on an approximately - * uniform distribution of task ids to store and serve tasks - * efficiently. - */ - // const task = {} - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callCreateTask() { - // Construct request - const request = { - parent, - task, - }; - - // Run request - const response = await tasksClient.createTask(request); - console.log(response); - } - - callCreateTask(); - // [END cloudtasks_v2_generated_CloudTasks_CreateTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_queue.js.baseline deleted file mode 100644 index 33eced925e1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_DeleteQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callDeleteQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.deleteQueue(request); - console.log(response); - } - - callDeleteQueue(); - // [END cloudtasks_v2_generated_CloudTasks_DeleteQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_task.js.baseline deleted file mode 100644 index 8e896cf45c1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.delete_task.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_DeleteTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callDeleteTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.deleteTask(request); - console.log(response); - } - - callDeleteTask(); - // [END cloudtasks_v2_generated_CloudTasks_DeleteTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline deleted file mode 100644 index 840e6c7e02fa..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_iam_policy.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource) { - // [START cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - */ - // const options = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await tasksClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_queue.js.baseline deleted file mode 100644 index 4dfcfd43205f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_GetQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the queue. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.getQueue(request); - console.log(response); - } - - callGetQueue(); - // [END cloudtasks_v2_generated_CloudTasks_GetQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_task.js.baseline deleted file mode 100644 index a309622aa5c9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.get_task.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_GetTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callGetTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.getTask(request); - console.log(response); - } - - callGetTask(); - // [END cloudtasks_v2_generated_CloudTasks_GetTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_queues.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_queues.js.baseline deleted file mode 100644 index 34343dff6b4c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_queues.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudtasks_v2_generated_CloudTasks_ListQueues_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - */ - // const parent = 'abc123' - /** - * `filter` can be used to specify a subset of queues. Any Queue google.cloud.tasks.v2.Queue - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * Stackdriver's Advanced Logs - * Filters (https://cloud.google.com/logging/docs/view/advanced_filters). - * Sample filter "state: PAUSED". - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - */ - // const filter = 'abc123' - /** - * Requested page size. - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * next_page_token google.cloud.tasks.v2.ListQueuesResponse.next_page_token in the - * response to determine if more queues exist. - */ - // const pageSize = 1234 - /** - * A token identifying the page of results to return. - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * next_page_token google.cloud.tasks.v2.ListQueuesResponse.next_page_token returned - * from the previous call to ListQueues google.cloud.tasks.v2.CloudTasks.ListQueues - * method. It is an error to switch the value of the - * filter google.cloud.tasks.v2.ListQueuesRequest.filter while iterating through pages. - */ - // const pageToken = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callListQueues() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = tasksClient.listQueuesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListQueues(); - // [END cloudtasks_v2_generated_CloudTasks_ListQueues_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_tasks.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_tasks.js.baseline deleted file mode 100644 index 67ab843cfa69..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.list_tasks.js.baseline +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START cloudtasks_v2_generated_CloudTasks_ListTasks_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - */ - // const parent = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - /** - * Maximum page size. - * Fewer tasks than requested might be returned, even if more tasks exist; use - * next_page_token google.cloud.tasks.v2.ListTasksResponse.next_page_token in the response to - * determine if more tasks exist. - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - */ - // const pageSize = 1234 - /** - * A token identifying the page of results to return. - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * next_page_token google.cloud.tasks.v2.ListTasksResponse.next_page_token returned - * from the previous call to ListTasks google.cloud.tasks.v2.CloudTasks.ListTasks - * method. - * The page token is valid for only 2 hours. - */ - // const pageToken = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callListTasks() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = tasksClient.listTasksAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListTasks(); - // [END cloudtasks_v2_generated_CloudTasks_ListTasks_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.pause_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.pause_queue.js.baseline deleted file mode 100644 index e613a3bc2765..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.pause_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_PauseQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callPauseQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.pauseQueue(request); - console.log(response); - } - - callPauseQueue(); - // [END cloudtasks_v2_generated_CloudTasks_PauseQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.purge_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.purge_queue.js.baseline deleted file mode 100644 index 013fd7ffed6e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.purge_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_PurgeQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callPurgeQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.purgeQueue(request); - console.log(response); - } - - callPurgeQueue(); - // [END cloudtasks_v2_generated_CloudTasks_PurgeQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.resume_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.resume_queue.js.baseline deleted file mode 100644 index 823bc77d776a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.resume_queue.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_ResumeQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_ID` - */ - // const name = 'abc123' - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callResumeQueue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.resumeQueue(request); - console.log(response); - } - - callResumeQueue(); - // [END cloudtasks_v2_generated_CloudTasks_ResumeQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.run_task.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.run_task.js.baseline deleted file mode 100644 index a4fe587e1f3a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.run_task.js.baseline +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START cloudtasks_v2_generated_CloudTasks_RunTask_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - */ - // const name = 'abc123' - /** - * The response_view specifies which subset of the Task google.cloud.tasks.v2.Task will be - * returned. - * By default response_view is BASIC google.cloud.tasks.v2.Task.View.BASIC; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * Authorization for FULL google.cloud.tasks.v2.Task.View.FULL requires - * `cloudtasks.tasks.fullView` Google IAM (https://cloud.google.com/iam/) - * permission on the Task google.cloud.tasks.v2.Task resource. - */ - // const responseView = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callRunTask() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await tasksClient.runTask(request); - console.log(response); - } - - callRunTask(); - // [END cloudtasks_v2_generated_CloudTasks_RunTask_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline deleted file mode 100644 index 682db87c8e83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.set_iam_policy.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource, policy) { - // [START cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await tasksClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline deleted file mode 100644 index 7b8e52d8db02..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.test_iam_permissions.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = ['abc','def'] - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await tasksClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.update_queue.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.update_queue.js.baseline deleted file mode 100644 index 904ccf73d576..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/cloud_tasks.update_queue.js.baseline +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(queue) { - // [START cloudtasks_v2_generated_CloudTasks_UpdateQueue_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The queue to create or update. - * The queue's name google.cloud.tasks.v2.Queue.name must be specified. - * Output only fields cannot be modified using UpdateQueue. - * Any value specified for an output only field will be ignored. - * The queue's name google.cloud.tasks.v2.Queue.name cannot be changed. - */ - // const queue = {} - /** - * A mask used to specify which fields of the queue are being updated. - * If empty, then all fields will be updated. - */ - // const updateMask = {} - - // Imports the Tasks library - const {CloudTasksClient} = require('tasks').v2; - - // Instantiates a client - const tasksClient = new CloudTasksClient(); - - async function callUpdateQueue() { - // Construct request - const request = { - queue, - }; - - // Run request - const response = await tasksClient.updateQueue(request); - console.log(response); - } - - callUpdateQueue(); - // [END cloudtasks_v2_generated_CloudTasks_UpdateQueue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline deleted file mode 100644 index db6c76ae14b6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/samples/generated/v2/snippet_metadata_google.cloud.tasks.v2.json.baseline +++ /dev/null @@ -1,715 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-tasks", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.tasks.v2", - "version": "v2" - } - ] - }, - "snippets": [ - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ListQueues_async", - "title": "CloudTasks listQueues Sample", - "origin": "API_DEFINITION", - "description": " Lists queues. Queues are returned in lexicographical order.", - "canonical": true, - "file": "cloud_tasks.list_queues.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListQueues", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListQueues", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.ListQueuesResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ListQueues", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListQueues", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetQueue_async", - "title": "CloudTasks getQueue Sample", - "origin": "API_DEFINITION", - "description": " Gets a queue.", - "canonical": true, - "file": "cloud_tasks.get_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_CreateQueue_async", - "title": "CloudTasks createQueue Sample", - "origin": "API_DEFINITION", - "description": " Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.create_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateQueue", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "queue", - "type": ".google.cloud.tasks.v2.Queue" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "CreateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_UpdateQueue_async", - "title": "CloudTasks updateQueue Sample", - "origin": "API_DEFINITION", - "description": " Updates a queue. This method creates the queue if it does not exist and updates the queue if it does exist. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.update_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.UpdateQueue", - "async": true, - "parameters": [ - { - "name": "queue", - "type": ".google.cloud.tasks.v2.Queue" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "UpdateQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.UpdateQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_DeleteQueue_async", - "title": "CloudTasks deleteQueue Sample", - "origin": "API_DEFINITION", - "description": " Deletes a queue. This command will delete the queue even if it has tasks in it. Note: If you delete a queue, a queue with the same name can't be created for 7 days. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.", - "canonical": true, - "file": "cloud_tasks.delete_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "DeleteQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_PurgeQueue_async", - "title": "CloudTasks purgeQueue Sample", - "origin": "API_DEFINITION", - "description": " Purges a queue by deleting all of its tasks. All tasks created before this method is called are permanently deleted. Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.", - "canonical": true, - "file": "cloud_tasks.purge_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PurgeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PurgeQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "PurgeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PurgeQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_PauseQueue_async", - "title": "CloudTasks pauseQueue Sample", - "origin": "API_DEFINITION", - "description": " Pauses the queue. If a queue is paused then the system will stop dispatching tasks until the queue is resumed via [ResumeQueue][google.cloud.tasks.v2.CloudTasks.ResumeQueue]. Tasks can still be added when the queue is paused. A queue is paused if its [state][google.cloud.tasks.v2.Queue.state] is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED].", - "canonical": true, - "file": "cloud_tasks.pause_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PauseQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PauseQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "PauseQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.PauseQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ResumeQueue_async", - "title": "CloudTasks resumeQueue Sample", - "origin": "API_DEFINITION", - "description": " Resume a queue. This method resumes a queue after it has been [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED] or [DISABLED][google.cloud.tasks.v2.Queue.State.DISABLED]. The state of a queue is stored in the queue's [state][google.cloud.tasks.v2.Queue.state]; after calling this method it will be set to [RUNNING][google.cloud.tasks.v2.Queue.State.RUNNING]. WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in [Managing Cloud Tasks Scaling Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling).", - "canonical": true, - "file": "cloud_tasks.resume_queue.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResumeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.ResumeQueue", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.Queue", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ResumeQueue", - "fullName": "google.cloud.tasks.v2.CloudTasks.ResumeQueue", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async", - "title": "CloudTasks getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Returns an empty policy if the resource exists and does not have a policy set. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.getIamPolicy`", - "canonical": true, - "file": "cloud_tasks.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetIamPolicy", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async", - "title": "CloudTasks setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy for a [Queue][google.cloud.tasks.v2.Queue]. Replaces any existing policy. Note: The Cloud Console does not check queue-level IAM permissions yet. Project-level permissions are required to use the Cloud Console. Authorization requires the following [Google IAM](https://cloud.google.com/iam) permission on the specified resource parent: * `cloudtasks.queues.setIamPolicy`", - "canonical": true, - "file": "cloud_tasks.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.tasks.v2.CloudTasks.SetIamPolicy", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async", - "title": "CloudTasks testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has on a [Queue][google.cloud.tasks.v2.Queue]. If the resource does not exist, this will return an empty set of permissions, not a [NOT_FOUND][google.rpc.Code.NOT_FOUND] error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", - "canonical": true, - "file": "cloud_tasks.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.tasks.v2.CloudTasks.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.tasks.v2.CloudTasks.TestIamPermissions", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_ListTasks_async", - "title": "CloudTasks listTasks Sample", - "origin": "API_DEFINITION", - "description": " Lists the tasks in a queue. By default, only the [BASIC][google.cloud.tasks.v2.Task.View.BASIC] view is retrieved due to performance considerations; [response_view][google.cloud.tasks.v2.ListTasksRequest.response_view] controls the subset of information which is returned. The tasks may be returned in any order. The ordering may change at any time.", - "canonical": true, - "file": "cloud_tasks.list_tasks.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListTasks", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.tasks.v2.ListTasksResponse", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "ListTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks.ListTasks", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_GetTask_async", - "title": "CloudTasks getTask Sample", - "origin": "API_DEFINITION", - "description": " Gets a task.", - "canonical": true, - "file": "cloud_tasks.get_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "GetTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.GetTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_CreateTask_async", - "title": "CloudTasks createTask Sample", - "origin": "API_DEFINITION", - "description": " Creates a task and adds it to a queue. Tasks cannot be updated after creation; there is no UpdateTask command. * The maximum task size is 100KB.", - "canonical": true, - "file": "cloud_tasks.create_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 100, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateTask", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "task", - "type": ".google.cloud.tasks.v2.Task" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "CreateTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.CreateTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_DeleteTask_async", - "title": "CloudTasks deleteTask Sample", - "origin": "API_DEFINITION", - "description": " Deletes a task. A task can be deleted if it is scheduled or dispatched. A task cannot be deleted if it has executed successfully or permanently failed.", - "canonical": true, - "file": "cloud_tasks.delete_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "DeleteTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.DeleteTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - }, - { - "regionTag": "cloudtasks_v2_generated_CloudTasks_RunTask_async", - "title": "CloudTasks runTask Sample", - "origin": "API_DEFINITION", - "description": " Forces a task to run now. When this method is called, Cloud Tasks will dispatch the task, even if the task is already running, the queue has reached its [RateLimits][google.cloud.tasks.v2.RateLimits] or is [PAUSED][google.cloud.tasks.v2.Queue.State.PAUSED]. This command is meant to be used for manual debugging. For example, [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] can be used to retry a failed task after a fix has been made or to manually force a task to be dispatched now. The dispatched task is returned. That is, the task that is returned contains the [status][Task.status] after the task is dispatched but before the task is received by its target. If Cloud Tasks receives a successful response from the task's target, then the task will be deleted; otherwise the task's [schedule_time][google.cloud.tasks.v2.Task.schedule_time] will be reset to the time that [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] was called plus the retry delay specified in the queue's [RetryConfig][google.cloud.tasks.v2.RetryConfig]. [RunTask][google.cloud.tasks.v2.CloudTasks.RunTask] returns [NOT_FOUND][google.rpc.Code.NOT_FOUND] when it is called on a task that has already succeeded or permanently failed.", - "canonical": true, - "file": "cloud_tasks.run_task.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RunTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.RunTask", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "response_view", - "type": ".google.cloud.tasks.v2.Task.View" - } - ], - "resultType": ".google.cloud.tasks.v2.Task", - "client": { - "shortName": "CloudTasksClient", - "fullName": "google.cloud.tasks.v2.CloudTasksClient" - }, - "method": { - "shortName": "RunTask", - "fullName": "google.cloud.tasks.v2.CloudTasks.RunTask", - "service": { - "shortName": "CloudTasks", - "fullName": "google.cloud.tasks.v2.CloudTasks" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/src/index.ts.baseline deleted file mode 100644 index 0e47f23a2bcf..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v2 from './v2'; -const CloudTasksClient = v2.CloudTasksClient; -type CloudTasksClient = v2.CloudTasksClient; -export {v2, CloudTasksClient}; -export default {v2, CloudTasksClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client.ts.baseline deleted file mode 100644 index 8a8d79b5ca1d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client.ts.baseline +++ /dev/null @@ -1,2581 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v2/cloud_tasks_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './cloud_tasks_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud Tasks allows developers to manage the execution of background - * work in their applications. - * @class - * @memberof v2 - */ -export class CloudTasksClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('tasks'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - cloudTasksStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of CloudTasksClient. - * - * @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://cloud.google.com/docs/authentication/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 CloudTasksClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof CloudTasksClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'cloudtasks.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - queuePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/queues/{queue}' - ), - taskPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/queues/{queue}/tasks/{task}' - ), - }; - - // 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 = { - listQueues: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'queues'), - listTasks: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tasks') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.tasks.v2.CloudTasks', gapicConfig as gax.ClientConfig, - 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.cloudTasksStub) { - return this.cloudTasksStub; - } - - // Put together the "service stub" for - // google.cloud.tasks.v2.CloudTasks. - this.cloudTasksStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.tasks.v2.CloudTasks') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.tasks.v2.CloudTasks, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const cloudTasksStubMethods = - ['listQueues', 'getQueue', 'createQueue', 'updateQueue', 'deleteQueue', 'purgeQueue', 'pauseQueue', 'resumeQueue', 'getIamPolicy', 'setIamPolicy', 'testIamPermissions', 'listTasks', 'getTask', 'createTask', 'deleteTask', 'runTask']; - for (const methodName of cloudTasksStubMethods) { - const callPromise = this.cloudTasksStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - 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.cloudTasksStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudtasks.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'cloudtasks.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets a queue. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the queue. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetQueue_async - */ - getQueue( - request?: protos.google.cloud.tasks.v2.IGetQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, {}|undefined - ]>; - getQueue( - request: protos.google.cloud.tasks.v2.IGetQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): void; - getQueue( - request: protos.google.cloud.tasks.v2.IGetQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): void; - getQueue( - request?: protos.google.cloud.tasks.v2.IGetQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IGetQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('getQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a queue. - * - * Queues created with this method allow tasks to live for a maximum of 31 - * days. After a task is 31 days old, the task will be deleted regardless of whether - * it was dispatched or not. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name in which the queue will be created. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * - * The list of allowed locations can be obtained by calling Cloud - * Tasks' implementation of - * {@link protos.google.cloud.location.Locations.ListLocations|ListLocations}. - * @param {google.cloud.tasks.v2.Queue} request.queue - * Required. The queue to create. - * - * {@link protos.google.cloud.tasks.v2.Queue.name|Queue's name} cannot be the same as an existing queue. - * @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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.create_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_CreateQueue_async - */ - createQueue( - request?: protos.google.cloud.tasks.v2.ICreateQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, {}|undefined - ]>; - createQueue( - request: protos.google.cloud.tasks.v2.ICreateQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): void; - createQueue( - request: protos.google.cloud.tasks.v2.ICreateQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): void; - createQueue( - request?: protos.google.cloud.tasks.v2.ICreateQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.ICreateQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('createQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Updates a queue. - * - * This method creates the queue if it does not exist and updates - * the queue if it does exist. - * - * Queues created with this method allow tasks to live for a maximum of 31 - * days. After a task is 31 days old, the task will be deleted regardless of whether - * it was dispatched or not. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.tasks.v2.Queue} request.queue - * Required. The queue to create or update. - * - * The queue's {@link protos.google.cloud.tasks.v2.Queue.name|name} must be specified. - * - * Output only fields cannot be modified using UpdateQueue. - * Any value specified for an output only field will be ignored. - * The queue's {@link protos.google.cloud.tasks.v2.Queue.name|name} cannot be changed. - * @param {google.protobuf.FieldMask} request.updateMask - * A mask used to specify which fields of the queue are being updated. - * - * If empty, then all fields 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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.update_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_UpdateQueue_async - */ - updateQueue( - request?: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, {}|undefined - ]>; - updateQueue( - request: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): void; - updateQueue( - request: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): void; - updateQueue( - request?: protos.google.cloud.tasks.v2.IUpdateQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'queue.name': request.queue!.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('updateQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.updateQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IUpdateQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a queue. - * - * This command will delete the queue even if it has tasks in it. - * - * Note: If you delete a queue, a queue with the same name can't be created - * for 7 days. - * - * WARNING: Using this method may have unintended side effects if you are - * using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. - * Read - * [Overview of Queue Management and - * queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using - * this method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.delete_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_DeleteQueue_async - */ - deleteQueue( - request?: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, {}|undefined - ]>; - deleteQueue( - request: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): void; - deleteQueue( - request: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): void; - deleteQueue( - request?: protos.google.cloud.tasks.v2.IDeleteQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteQueue request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Purges a queue by deleting all of its tasks. - * - * All tasks created before this method is called are permanently deleted. - * - * Purge operations can take up to one minute to take effect. Tasks - * might be dispatched before the purge takes effect. A purge is irreversible. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.purge_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_PurgeQueue_async - */ - purgeQueue( - request?: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, {}|undefined - ]>; - purgeQueue( - request: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): void; - purgeQueue( - request: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): void; - purgeQueue( - request?: protos.google.cloud.tasks.v2.IPurgeQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('purgeQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('purgeQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.purgeQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPurgeQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('purgeQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Pauses the queue. - * - * If a queue is paused then the system will stop dispatching tasks - * until the queue is resumed via - * {@link protos.google.cloud.tasks.v2.CloudTasks.ResumeQueue|ResumeQueue}. Tasks can still be added - * when the queue is paused. A queue is paused if its - * {@link protos.google.cloud.tasks.v2.Queue.state|state} is {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.pause_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_PauseQueue_async - */ - pauseQueue( - request?: protos.google.cloud.tasks.v2.IPauseQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, {}|undefined - ]>; - pauseQueue( - request: protos.google.cloud.tasks.v2.IPauseQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): void; - pauseQueue( - request: protos.google.cloud.tasks.v2.IPauseQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): void; - pauseQueue( - request?: protos.google.cloud.tasks.v2.IPauseQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('pauseQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pauseQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.pauseQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IPauseQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('pauseQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Resume a queue. - * - * This method resumes a queue after it has been - * {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED} or - * {@link protos.google.cloud.tasks.v2.Queue.State.DISABLED|DISABLED}. The state of a queue is stored - * in the queue's {@link protos.google.cloud.tasks.v2.Queue.state|state}; after calling this method it - * will be set to {@link protos.google.cloud.tasks.v2.Queue.State.RUNNING|RUNNING}. - * - * WARNING: Resuming many high-QPS queues at the same time can - * lead to target overloading. If you are resuming high-QPS - * queues, follow the 500/50/5 pattern described in - * [Managing Cloud Tasks Scaling - * Risks](https://cloud.google.com/tasks/docs/manage-cloud-task-scaling). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The queue name. For example: - * `projects/PROJECT_ID/location/LOCATION_ID/queues/QUEUE_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 {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.resume_queue.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ResumeQueue_async - */ - resumeQueue( - request?: protos.google.cloud.tasks.v2.IResumeQueueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, {}|undefined - ]>; - resumeQueue( - request: protos.google.cloud.tasks.v2.IResumeQueueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): void; - resumeQueue( - request: protos.google.cloud.tasks.v2.IResumeQueueRequest, - callback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): void; - resumeQueue( - request?: protos.google.cloud.tasks.v2.IResumeQueueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('resumeQueue request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resumeQueue response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.resumeQueue(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.IQueue, - protos.google.cloud.tasks.v2.IResumeQueueRequest|undefined, - {}|undefined - ]) => { - this._log.info('resumeQueue response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets the access control policy for a {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * Returns an empty policy if the resource exists and does not have a policy - * set. - * - * Authorization requires the following - * [Google IAM](https://cloud.google.com/iam) permission on the specified - * resource parent: - * - * * `cloudtasks.queues.getIamPolicy` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_iam_policy.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getIamPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('getIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Sets the access control policy for a {@link protos.google.cloud.tasks.v2.Queue|Queue}. Replaces any existing - * policy. - * - * Note: The Cloud Console does not check queue-level IAM permissions yet. - * Project-level permissions are required to use the Cloud Console. - * - * Authorization requires the following - * [Google IAM](https://cloud.google.com/iam) permission on the specified - * resource parent: - * - * * `cloudtasks.queues.setIamPolicy` - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @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 {@link protos.google.iam.v1.Policy|Policy}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.set_iam_policy.js - * region_tag:cloudtasks_v2_generated_CloudTasks_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('setIamPolicy request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('setIamPolicy response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.setIamPolicy(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, - {}|undefined - ]) => { - this._log.info('setIamPolicy response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns permissions that a caller has on a {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * If the resource does not exist, this will return an empty set of - * permissions, not a {@link protos.google.rpc.Code.NOT_FOUND|NOT_FOUND} error. - * - * Note: This operation is designed to be used for building permission-aware - * UIs and command-line tools, not for authorization checking. This operation - * may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @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 {@link protos.google.iam.v1.TestIamPermissionsResponse|TestIamPermissionsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.test_iam_permissions.js - * region_tag:cloudtasks_v2_generated_CloudTasks_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'resource': request.resource ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('testIamPermissions request %j', request); - const wrappedCallback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('testIamPermissions response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.testIamPermissions(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, - {}|undefined - ]) => { - this._log.info('testIamPermissions response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a task. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.get_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_GetTask_async - */ - getTask( - request?: protos.google.cloud.tasks.v2.IGetTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, {}|undefined - ]>; - getTask( - request: protos.google.cloud.tasks.v2.IGetTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): void; - getTask( - request: protos.google.cloud.tasks.v2.IGetTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): void; - getTask( - request?: protos.google.cloud.tasks.v2.IGetTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getTask response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IGetTaskRequest|undefined, - {}|undefined - ]) => { - this._log.info('getTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Creates a task and adds it to a queue. - * - * Tasks cannot be updated after creation; there is no UpdateTask command. - * - * * The maximum task size is 100KB. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * - * The queue must already exist. - * @param {google.cloud.tasks.v2.Task} request.task - * Required. The task to add. - * - * Task names have the following format: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID`. - * The user can optionally specify a task {@link protos.google.cloud.tasks.v2.Task.name|name}. If a - * name is not specified then the system will generate a random - * unique task id, which will be set in the task returned in the - * {@link protos.google.cloud.tasks.v2.Task.name|response}. - * - * If {@link protos.google.cloud.tasks.v2.Task.schedule_time|schedule_time} is not set or is in the - * past then Cloud Tasks will set it to the current time. - * - * Task De-duplication: - * - * Explicitly specifying a task ID enables task de-duplication. If - * a task's ID is identical to that of an existing task or a task - * that was deleted or executed recently then the call will fail - * with {@link protos.google.rpc.Code.ALREADY_EXISTS|ALREADY_EXISTS}. - * If the task's queue was created using Cloud Tasks, then another task with - * the same name can't be created for ~1hour after the original task was - * deleted or executed. If the task's queue was created using queue.yaml or - * queue.xml, then another task with the same name can't be created - * for ~9days after the original task was deleted or executed. - * - * Because there is an extra lookup cost to identify duplicate task - * names, these {@link protos.google.cloud.tasks.v2.CloudTasks.CreateTask|CreateTask} calls have significantly - * increased latency. Using hashed strings for the task id or for - * the prefix of the task id is recommended. Choosing task ids that - * are sequential or have sequential prefixes, for example using a - * timestamp, causes an increase in latency and error rates in all - * task commands. The infrastructure relies on an approximately - * uniform distribution of task ids to store and serve tasks - * efficiently. - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.create_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_CreateTask_async - */ - createTask( - request?: protos.google.cloud.tasks.v2.ICreateTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, {}|undefined - ]>; - createTask( - request: protos.google.cloud.tasks.v2.ICreateTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): void; - createTask( - request: protos.google.cloud.tasks.v2.ICreateTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): void; - createTask( - request?: protos.google.cloud.tasks.v2.ICreateTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('createTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createTask response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.createTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.ICreateTaskRequest|undefined, - {}|undefined - ]) => { - this._log.info('createTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Deletes a task. - * - * A task can be deleted if it is scheduled or dispatched. A task - * cannot be deleted if it has executed successfully or permanently - * failed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_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 {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.delete_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_DeleteTask_async - */ - deleteTask( - request?: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, {}|undefined - ]>; - deleteTask( - request: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): void; - deleteTask( - request: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): void; - deleteTask( - request?: protos.google.cloud.tasks.v2.IDeleteTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('deleteTask request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteTask response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.deleteTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.tasks.v2.IDeleteTaskRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Forces a task to run now. - * - * When this method is called, Cloud Tasks will dispatch the task, even if - * the task is already running, the queue has reached its {@link protos.google.cloud.tasks.v2.RateLimits|RateLimits} or - * is {@link protos.google.cloud.tasks.v2.Queue.State.PAUSED|PAUSED}. - * - * This command is meant to be used for manual debugging. For - * example, {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} can be used to retry a failed - * task after a fix has been made or to manually force a task to be - * dispatched now. - * - * The dispatched task is returned. That is, the task that is returned - * contains the {@link protos.Task.status|status} after the task is dispatched but - * before the task is received by its target. - * - * If Cloud Tasks receives a successful response from the task's - * target, then the task will be deleted; otherwise the task's - * {@link protos.google.cloud.tasks.v2.Task.schedule_time|schedule_time} will be reset to the time that - * {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} was called plus the retry delay specified - * in the queue's {@link protos.google.cloud.tasks.v2.RetryConfig|RetryConfig}. - * - * {@link protos.google.cloud.tasks.v2.CloudTasks.RunTask|RunTask} returns - * {@link protos.google.rpc.Code.NOT_FOUND|NOT_FOUND} when it is called on a - * task that has already succeeded or permanently failed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The task name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @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 {@link protos.google.cloud.tasks.v2.Task|Task}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v2/cloud_tasks.run_task.js - * region_tag:cloudtasks_v2_generated_CloudTasks_RunTask_async - */ - runTask( - request?: protos.google.cloud.tasks.v2.IRunTaskRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, {}|undefined - ]>; - runTask( - request: protos.google.cloud.tasks.v2.IRunTaskRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): void; - runTask( - request: protos.google.cloud.tasks.v2.IRunTaskRequest, - callback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): void; - runTask( - request?: protos.google.cloud.tasks.v2.IRunTaskRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('runTask request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('runTask response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.runTask(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.tasks.v2.ITask, - protos.google.cloud.tasks.v2.IRunTaskRequest|undefined, - {}|undefined - ]) => { - this._log.info('runTask response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - /** - * Lists queues. - * - * Queues are returned in lexicographical order. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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 Array of {@link protos.google.cloud.tasks.v2.Queue|Queue}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listQueuesAsync()` - * 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. - */ - listQueues( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]>; - listQueues( - request: protos.google.cloud.tasks.v2.IListQueuesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): void; - listQueues( - request: protos.google.cloud.tasks.v2.IListQueuesRequest, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): void; - listQueues( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>, - callback?: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>): - Promise<[ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.tasks.v2.IListQueuesRequest, - protos.google.cloud.tasks.v2.IListQueuesResponse|null|undefined, - protos.google.cloud.tasks.v2.IQueue>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listQueues values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listQueues request %j', request); - return this.innerApiCalls - .listQueues(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.tasks.v2.IQueue[], - protos.google.cloud.tasks.v2.IListQueuesRequest|null, - protos.google.cloud.tasks.v2.IListQueuesResponse - ]) => { - this._log.info('listQueues values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listQueues`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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.cloud.tasks.v2.Queue|Queue} 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 `listQueuesAsync()` - * 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. - */ - listQueuesStream( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listQueues']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listQueues stream %j', request); - return this.descriptors.page.listQueues.createStream( - this.innerApiCalls.listQueues as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listQueues`, 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. The location name. - * For example: `projects/PROJECT_ID/locations/LOCATION_ID` - * @param {string} request.filter - * `filter` can be used to specify a subset of queues. Any {@link protos.google.cloud.tasks.v2.Queue|Queue} - * field can be used as a filter and several operators as supported. - * For example: `<=, <, >=, >, !=, =, :`. The filter syntax is the same as - * described in - * [Stackdriver's Advanced Logs - * Filters](https://cloud.google.com/logging/docs/view/advanced_filters). - * - * Sample filter "state: PAUSED". - * - * Note that using filters might cause fewer queues than the - * requested page_size to be returned. - * @param {number} request.pageSize - * Requested page size. - * - * The maximum page size is 9800. If unspecified, the page size will - * be the maximum. Fewer queues than requested might be returned, - * even if more queues exist; use the - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} in the - * response to determine if more queues exist. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListQueuesResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListQueues|ListQueues} - * method. It is an error to switch the value of the - * {@link protos.google.cloud.tasks.v2.ListQueuesRequest.filter|filter} while iterating through pages. - * @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.cloud.tasks.v2.Queue|Queue}. 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 include:samples/generated/v2/cloud_tasks.list_queues.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ListQueues_async - */ - listQueuesAsync( - request?: protos.google.cloud.tasks.v2.IListQueuesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listQueues']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listQueues iterate %j', request); - return this.descriptors.page.listQueues.asyncIterate( - this.innerApiCalls['listQueues'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Lists the tasks in a queue. - * - * By default, only the {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC} view is retrieved - * due to performance considerations; - * {@link protos.google.cloud.tasks.v2.ListTasksRequest.response_view|response_view} controls the - * subset of information which is returned. - * - * The tasks may be returned in any order. The ordering may change at any - * time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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 Array of {@link protos.google.cloud.tasks.v2.Task|Task}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listTasksAsync()` - * 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. - */ - listTasks( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]>; - listTasks( - request: protos.google.cloud.tasks.v2.IListTasksRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): void; - listTasks( - request: protos.google.cloud.tasks.v2.IListTasksRequest, - callback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): void; - listTasks( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>, - callback?: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>): - Promise<[ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.tasks.v2.IListTasksRequest, - protos.google.cloud.tasks.v2.IListTasksResponse|null|undefined, - protos.google.cloud.tasks.v2.ITask>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listTasks values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listTasks request %j', request); - return this.innerApiCalls - .listTasks(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.tasks.v2.ITask[], - protos.google.cloud.tasks.v2.IListTasksRequest|null, - protos.google.cloud.tasks.v2.IListTasksResponse - ]) => { - this._log.info('listTasks values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listTasks`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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.cloud.tasks.v2.Task|Task} 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 `listTasksAsync()` - * 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. - */ - listTasksStream( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTasks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTasks stream %j', request); - return this.descriptors.page.listTasks.createStream( - this.innerApiCalls.listTasks as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listTasks`, 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. The queue name. For example: - * `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` - * @param {google.cloud.tasks.v2.Task.View} request.responseView - * The response_view specifies which subset of the {@link protos.google.cloud.tasks.v2.Task|Task} will be - * returned. - * - * By default response_view is {@link protos.google.cloud.tasks.v2.Task.View.BASIC|BASIC}; not all - * information is retrieved by default because some data, such as - * payloads, might be desirable to return only when needed because - * of its large size or because of the sensitivity of data that it - * contains. - * - * Authorization for {@link protos.google.cloud.tasks.v2.Task.View.FULL|FULL} requires - * `cloudtasks.tasks.fullView` [Google IAM](https://cloud.google.com/iam/) - * permission on the {@link protos.google.cloud.tasks.v2.Task|Task} resource. - * @param {number} request.pageSize - * Maximum page size. - * - * Fewer tasks than requested might be returned, even if more tasks exist; use - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} in the response to - * determine if more tasks exist. - * - * The maximum page size is 1000. If unspecified, the page size will be the - * maximum. - * @param {string} request.pageToken - * A token identifying the page of results to return. - * - * To request the first page results, page_token must be empty. To - * request the next page of results, page_token must be the value of - * {@link protos.google.cloud.tasks.v2.ListTasksResponse.next_page_token|next_page_token} returned - * from the previous call to {@link protos.google.cloud.tasks.v2.CloudTasks.ListTasks|ListTasks} - * method. - * - * The page token is valid for only 2 hours. - * @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.cloud.tasks.v2.Task|Task}. 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 include:samples/generated/v2/cloud_tasks.list_tasks.js - * region_tag:cloudtasks_v2_generated_CloudTasks_ListTasks_async - */ - listTasksAsync( - request?: protos.google.cloud.tasks.v2.IListTasksRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listTasks']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listTasks iterate %j', request); - return this.descriptors.page.listTasks.asyncIterate( - this.innerApiCalls['listTasks'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified queue resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} queue - * @returns {string} Resource name string. - */ - queuePath(project:string,location:string,queue:string) { - return this.pathTemplates.queuePathTemplate.render({ - project: project, - location: location, - queue: queue, - }); - } - - /** - * Parse the project from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the project. - */ - matchProjectFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).project; - } - - /** - * Parse the location from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the location. - */ - matchLocationFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).location; - } - - /** - * Parse the queue from Queue resource. - * - * @param {string} queueName - * A fully-qualified path representing Queue resource. - * @returns {string} A string representing the queue. - */ - matchQueueFromQueueName(queueName: string) { - return this.pathTemplates.queuePathTemplate.match(queueName).queue; - } - - /** - * Return a fully-qualified task resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} queue - * @param {string} task - * @returns {string} Resource name string. - */ - taskPath(project:string,location:string,queue:string,task:string) { - return this.pathTemplates.taskPathTemplate.render({ - project: project, - location: location, - queue: queue, - task: task, - }); - } - - /** - * Parse the project from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).project; - } - - /** - * Parse the location from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the location. - */ - matchLocationFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).location; - } - - /** - * Parse the queue from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the queue. - */ - matchQueueFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).queue; - } - - /** - * Parse the task from Task resource. - * - * @param {string} taskName - * A fully-qualified path representing Task resource. - * @returns {string} A string representing the task. - */ - matchTaskFromTaskName(taskName: string) { - return this.pathTemplates.taskPathTemplate.match(taskName).task; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.cloudTasksStub && !this._terminated) { - return this.cloudTasksStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client_config.json.baseline deleted file mode 100644 index 06d26a67eb68..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_client_config.json.baseline +++ /dev/null @@ -1,90 +0,0 @@ -{ - "interfaces": { - "google.cloud.tasks.v2.CloudTasks": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListQueues": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PurgeQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PauseQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResumeQueue": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListTasks": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RunTask": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_proto_list.json.baseline deleted file mode 100644 index 1f64b04d38a1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/cloud_tasks_proto_list.json.baseline +++ /dev/null @@ -1,6 +0,0 @@ -[ - "../../protos/google/cloud/tasks/v2/cloudtasks.proto", - "../../protos/google/cloud/tasks/v2/queue.proto", - "../../protos/google/cloud/tasks/v2/target.proto", - "../../protos/google/cloud/tasks/v2/task.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/index.ts.baseline deleted file mode 100644 index 98d67568c6ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/src/v2/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {CloudTasksClient} from './cloud_tasks_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 1312a0b8f56d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const tasks = require('tasks'); - -function main() { - const cloudTasksClient = new tasks.CloudTasksClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index df887c5a29f4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {CloudTasksClient} from 'tasks'; - -// check that the client class type name can be used -function doStuffWithCloudTasksClient(client: CloudTasksClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const cloudTasksClient = new CloudTasksClient(); - doStuffWithCloudTasksClient(cloudTasksClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/test/gapic_cloud_tasks_v2.ts.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/test/gapic_cloud_tasks_v2.ts.baseline deleted file mode 100644 index 1adb1dd2c4c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/test/gapic_cloud_tasks_v2.ts.baseline +++ /dev/null @@ -1,2370 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as cloudtasksModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v2.CloudTasksClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudtasks.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = cloudtasksModule.v2.CloudTasksClient.servicePath; - assert.strictEqual(servicePath, 'cloudtasks.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = cloudtasksModule.v2.CloudTasksClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'cloudtasks.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudtasksModule.v2.CloudTasksClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new cloudtasksModule.v2.CloudTasksClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'cloudtasks.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new cloudtasksModule.v2.CloudTasksClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = cloudtasksModule.v2.CloudTasksClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new cloudtasksModule.v2.CloudTasksClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudTasksStub, undefined); - await client.initialize(); - assert(client.cloudTasksStub); - }); - - it('has close method for the initialized client', done => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.cloudTasksStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.cloudTasksStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getQueue', () => { - it('invokes getQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.getQueue = stubSimpleCall(expectedResponse); - const [response] = await client.getQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.getQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getQueue(request), expectedError); - }); - }); - - describe('createQueue', () => { - it('invokes createQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.createQueue = stubSimpleCall(expectedResponse); - const [response] = await client.createQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.createQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateQueueRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createQueue(request), expectedError); - }); - }); - - describe('updateQueue', () => { - it('invokes updateQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.updateQueue = stubSimpleCall(expectedResponse); - const [response] = await client.updateQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.updateQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedHeaderRequestParams = `queue.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.UpdateQueueRequest() - ); - request.queue ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.UpdateQueueRequest', ['queue', 'name']); - request.queue.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateQueue(request), expectedError); - }); - }); - - describe('deleteQueue', () => { - it('invokes deleteQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteQueue = stubSimpleCall(expectedResponse); - const [response] = await client.deleteQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteQueue( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteQueue(request), expectedError); - }); - }); - - describe('purgeQueue', () => { - it('invokes purgeQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.purgeQueue = stubSimpleCall(expectedResponse); - const [response] = await client.purgeQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.purgeQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.purgeQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.purgeQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.purgeQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.purgeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes purgeQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PurgeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PurgeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.purgeQueue(request), expectedError); - }); - }); - - describe('pauseQueue', () => { - it('invokes pauseQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.pauseQueue = stubSimpleCall(expectedResponse); - const [response] = await client.pauseQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.pauseQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pauseQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pauseQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pauseQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pauseQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pauseQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.PauseQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.PauseQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pauseQueue(request), expectedError); - }); - }); - - describe('resumeQueue', () => { - it('invokes resumeQueue without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.resumeQueue = stubSimpleCall(expectedResponse); - const [response] = await client.resumeQueue(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Queue() - ); - client.innerApiCalls.resumeQueue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resumeQueue( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resumeQueue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resumeQueue(request), expectedError); - const actualRequest = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resumeQueue as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resumeQueue with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ResumeQueueRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ResumeQueueRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resumeQueue(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.GetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.GetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.Policy() - ); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - const actualRequest = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.SetIamPolicyRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.SetIamPolicyRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsResponse() - ); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedHeaderRequestParams = `resource=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - const actualRequest = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.iam.v1.TestIamPermissionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.iam.v1.TestIamPermissionsRequest', ['resource']); - request.resource = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('getTask', () => { - it('invokes getTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.getTask = stubSimpleCall(expectedResponse); - const [response] = await client.getTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.getTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getTask(request), expectedError); - const actualRequest = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.GetTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.GetTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getTask(request), expectedError); - }); - }); - - describe('createTask', () => { - it('invokes createTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.createTask = stubSimpleCall(expectedResponse); - const [response] = await client.createTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.createTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createTask(request), expectedError); - const actualRequest = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.CreateTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.CreateTaskRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createTask(request), expectedError); - }); - }); - - describe('deleteTask', () => { - it('invokes deleteTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTask = stubSimpleCall(expectedResponse); - const [response] = await client.deleteTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.deleteTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteTask( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteTask(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.DeleteTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.DeleteTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteTask(request), expectedError); - }); - }); - - describe('runTask', () => { - it('invokes runTask without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.runTask = stubSimpleCall(expectedResponse); - const [response] = await client.runTask(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.tasks.v2.Task() - ); - client.innerApiCalls.runTask = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.runTask( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.runTask = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.runTask(request), expectedError); - const actualRequest = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.runTask as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes runTask with closed client', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.RunTaskRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.RunTaskRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.runTask(request), expectedError); - }); - }); - - describe('listQueues', () => { - it('invokes listQueues without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.innerApiCalls.listQueues = stubSimpleCall(expectedResponse); - const [response] = await client.listQueues(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueues without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.innerApiCalls.listQueues = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listQueues( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.IQueue[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueues with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listQueues = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listQueues(request), expectedError); - const actualRequest = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listQueues as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listQueuesStream without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.descriptors.page.listQueues.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listQueuesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Queue[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Queue) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueues, request)); - assert( - (client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listQueuesStream with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueues.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listQueuesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Queue[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Queue) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listQueues, request)); - assert( - (client.descriptors.page.listQueues.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueues without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Queue()), - ]; - client.descriptors.page.listQueues.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tasks.v2.IQueue[] = []; - const iterable = client.listQueuesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listQueues with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListQueuesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListQueuesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listQueues.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listQueuesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tasks.v2.IQueue[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listQueues.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listTasks', () => { - it('invokes listTasks without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.innerApiCalls.listTasks = stubSimpleCall(expectedResponse); - const [response] = await client.listTasks(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasks without error using callback', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.innerApiCalls.listTasks = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listTasks( - request, - (err?: Error|null, result?: protos.google.cloud.tasks.v2.ITask[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasks with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listTasks = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listTasks(request), expectedError); - const actualRequest = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listTasks as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listTasksStream without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.descriptors.page.listTasks.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listTasksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Task[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Task) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTasks, request)); - assert( - (client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listTasksStream with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTasks.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listTasksStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.tasks.v2.Task[] = []; - stream.on('data', (response: protos.google.cloud.tasks.v2.Task) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listTasks, request)); - assert( - (client.descriptors.page.listTasks.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTasks without error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - generateSampleMessage(new protos.google.cloud.tasks.v2.Task()), - ]; - client.descriptors.page.listTasks.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.tasks.v2.ITask[] = []; - const iterable = client.listTasksAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listTasks with error', async () => { - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.tasks.v2.ListTasksRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.tasks.v2.ListTasksRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listTasks.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listTasksAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.tasks.v2.ITask[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listTasks.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('queue', async () => { - const fakePath = "/rendered/path/queue"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - queue: "queueValue", - }; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.queuePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.queuePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('queuePath', () => { - const result = client.queuePath("projectValue", "locationValue", "queueValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.queuePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromQueueName', () => { - const result = client.matchProjectFromQueueName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromQueueName', () => { - const result = client.matchLocationFromQueueName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchQueueFromQueueName', () => { - const result = client.matchQueueFromQueueName(fakePath); - assert.strictEqual(result, "queueValue"); - assert((client.pathTemplates.queuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('task', async () => { - const fakePath = "/rendered/path/task"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - queue: "queueValue", - task: "taskValue", - }; - const client = new cloudtasksModule.v2.CloudTasksClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.taskPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.taskPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('taskPath', () => { - const result = client.taskPath("projectValue", "locationValue", "queueValue", "taskValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.taskPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTaskName', () => { - const result = client.matchProjectFromTaskName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromTaskName', () => { - const result = client.matchLocationFromTaskName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchQueueFromTaskName', () => { - const result = client.matchQueueFromTaskName(fakePath); - assert.strictEqual(result, "queueValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTaskFromTaskName', () => { - const result = client.matchTaskFromTaskName(fakePath); - assert.strictEqual(result, "taskValue"); - assert((client.pathTemplates.taskPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/tasks/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/tasks/webpack.config.js.baseline deleted file mode 100644 index b558c6fdd19e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/tasks/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'CloudTasks', - filename: './cloud-tasks.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.OwlBot.yaml.baseline deleted file mode 100644 index d90268c62f2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/texttospeech/google-cloud-texttospeech-nodejs - dest: /owl-bot-staging/google-cloud-texttospeech - -api-name: texttospeech \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 4c9ebdc9cdd2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/text-to-speech', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/README.md.baseline deleted file mode 100644 index dab4135a4968..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Texttospeech: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/text-to-speech.svg)](https://www.npmjs.org/package/@google-cloud/text-to-speech) - -Texttospeech client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Texttospeech Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/texttospeech/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Texttospeech API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/text-to-speech -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/text-to-speech@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/index.ts.baseline deleted file mode 100644 index 8eecaa206fae..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const TextToSpeechClient = v1.TextToSpeechClient; -type TextToSpeechClient = v1.TextToSpeechClient; -export {v1, TextToSpeechClient}; -export default {v1, TextToSpeechClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index b53ab6649812..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TextToSpeechClient} from './text_to_speech_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client.ts.baseline deleted file mode 100644 index 78b7f9648850..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client.ts.baseline +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as text_to_speech_client_config from './text_to_speech_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/text_to_speech_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'text_to_speech_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service that implements Google Cloud Text-to-Speech API. - * @class - * @memberof v1 - */ -export class TextToSpeechClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('text-to-speech'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - textToSpeechStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TextToSpeechClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TextToSpeechClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TextToSpeechClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'texttospeech.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.texttospeech.v1.TextToSpeech', gapicConfig as gax.ClientConfig, - 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.textToSpeechStub) { - return this.textToSpeechStub; - } - - // Put together the "service stub" for - // google.cloud.texttospeech.v1.TextToSpeech. - this.textToSpeechStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.texttospeech.v1.TextToSpeech') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.texttospeech.v1.TextToSpeech, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const textToSpeechStubMethods = - ['listVoices', 'synthesizeSpeech']; - for (const methodName of textToSpeechStubMethods) { - const callPromise = this.textToSpeechStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.textToSpeechStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'texttospeech.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'texttospeech.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns a list of Voice supported for synthesis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.languageCode] - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - * specified, the ListVoices call will only return voices that can be used to - * synthesize this language_code. E.g. when specifying "en-NZ", you will get - * supported "en-*" voices; when specifying "no", you will get supported - * "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - * will also get supported "cmn-*" voices; specifying "zh-hk" will also get - * supported "yue-*" voices. - * @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 {@link protos.google.cloud.texttospeech.v1.ListVoicesResponse|ListVoicesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/text_to_speech.list_voices.js - * region_tag:texttospeech_v1_generated_TextToSpeech_ListVoices_async - */ - listVoices( - request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, {}|undefined - ]>; - listVoices( - request: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): void; - listVoices( - request: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - callback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): void; - listVoices( - request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('listVoices request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listVoices response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.listVoices(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, {}|undefined - ]) => { - this._log.info('listVoices response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Synthesizes speech synchronously: receive results after all text input - * has been processed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.texttospeech.v1.SynthesisInput} request.input - * Required. The Synthesizer requires either plain text or SSML as input. - * @param {google.cloud.texttospeech.v1.VoiceSelectionParams} request.voice - * Required. The desired voice of the synthesized audio. - * @param {google.cloud.texttospeech.v1.AudioConfig} request.audioConfig - * Required. The configuration of the synthesized audio. - * @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 {@link protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse|SynthesizeSpeechResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/text_to_speech.synthesize_speech.js - * region_tag:texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async - */ - synthesizeSpeech( - request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, {}|undefined - ]>; - synthesizeSpeech( - request: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): void; - synthesizeSpeech( - request: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - callback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): void; - synthesizeSpeech( - request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('synthesizeSpeech request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('synthesizeSpeech response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.synthesizeSpeech(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, {}|undefined - ]) => { - this._log.info('synthesizeSpeech response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.textToSpeechStub && !this._terminated) { - return this.textToSpeechStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client_config.json.baseline deleted file mode 100644 index e460d95484ac..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_client_config.json.baseline +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.texttospeech.v1.TextToSpeech": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListVoices": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SynthesizeSpeech": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_proto_list.json.baseline deleted file mode 100644 index a2b3f234f3fe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/src/v1/text_to_speech_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/texttospeech/v1/cloud_tts.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 4c8c03c15aa7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const texttospeech = require('@google-cloud/text-to-speech'); - -function main() { - const textToSpeechClient = new texttospeech.TextToSpeechClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index a399ed4be589..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as texttospeech from '@google-cloud/text-to-speech'; - -function main() { - const textToSpeechClient = new texttospeech.TextToSpeechClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 74618c48da6c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {TextToSpeechClient} from '@google-cloud/text-to-speech'; - -// check that the client class type name can be used -function doStuffWithTextToSpeechClient(client: TextToSpeechClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const textToSpeechClient = new TextToSpeechClient(); - doStuffWithTextToSpeechClient(textToSpeechClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/test/gapic_text_to_speech_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/test/gapic_text_to_speech_v1.ts.baseline deleted file mode 100644 index 58e28b8f3b9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/esm/test/gapic_text_to_speech_v1.ts.baseline +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as texttospeechModule from '../src/index.js'; - -import {protobuf} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.TextToSpeechClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'texttospeech.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = texttospeechModule.v1.TextToSpeechClient.servicePath; - assert.strictEqual(servicePath, 'texttospeech.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = texttospeechModule.v1.TextToSpeechClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'texttospeech.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new texttospeechModule.v1.TextToSpeechClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new texttospeechModule.v1.TextToSpeechClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new texttospeechModule.v1.TextToSpeechClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = texttospeechModule.v1.TextToSpeechClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.textToSpeechStub, undefined); - await client.initialize(); - assert(client.textToSpeechStub); - }); - - it('has close method for the initialized client', done => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.textToSpeechStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.textToSpeechStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listVoices', () => { - it('invokes listVoices without error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesResponse() - ); - client.innerApiCalls.listVoices = stubSimpleCall(expectedResponse); - const [response] = await client.listVoices(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listVoices without error using callback', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesResponse() - ); - client.innerApiCalls.listVoices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVoices( - request, - (err?: Error|null, result?: protos.google.cloud.texttospeech.v1.IListVoicesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listVoices with error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listVoices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVoices(request), expectedError); - }); - - it('invokes listVoices with closed client', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listVoices(request), expectedError); - }); - }); - - describe('synthesizeSpeech', () => { - it('invokes synthesizeSpeech without error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse() - ); - client.innerApiCalls.synthesizeSpeech = stubSimpleCall(expectedResponse); - const [response] = await client.synthesizeSpeech(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes synthesizeSpeech without error using callback', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse() - ); - client.innerApiCalls.synthesizeSpeech = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.synthesizeSpeech( - request, - (err?: Error|null, result?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes synthesizeSpeech with error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.synthesizeSpeech = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.synthesizeSpeech(request), expectedError); - }); - - it('invokes synthesizeSpeech with closed client', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.synthesizeSpeech(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json deleted file mode 100644 index 7acefc2a563d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "@google-cloud/text-to-speech", - "version": "0.1.0", - "description": "Texttospeech client for Node.js", - "repository": "googleapis/nodejs-texttospeech", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google texttospeech", - "texttospeech", - "text to speech" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline deleted file mode 100644 index 25b0065dde01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.texttospeech.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.TextToSpeech.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1;texttospeech"; -option java_multiple_files = true; -option java_outer_classname = "TextToSpeechProto"; -option java_package = "com.google.cloud.texttospeech.v1"; -option php_namespace = "Google\\Cloud\\TextToSpeech\\V1"; - -// Service that implements Google Cloud Text-to-Speech API. -service TextToSpeech { - option (google.api.default_host) = "texttospeech.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of Voice supported for synthesis. - rpc ListVoices(ListVoicesRequest) returns (ListVoicesResponse) { - option (google.api.http) = { - get: "/v1/voices" - }; - option (google.api.method_signature) = "language_code"; - } - - // Synthesizes speech synchronously: receive results after all text input - // has been processed. - rpc SynthesizeSpeech(SynthesizeSpeechRequest) returns (SynthesizeSpeechResponse) { - option (google.api.http) = { - post: "/v1/text:synthesize" - body: "*" - }; - option (google.api.method_signature) = "input,voice,audio_config"; - } -} - -// The top-level message sent by the client for the `ListVoices` method. -message ListVoicesRequest { - // Optional. Recommended. - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - // specified, the ListVoices call will only return voices that can be used to - // synthesize this language_code. E.g. when specifying "en-NZ", you will get - // supported "en-*" voices; when specifying "no", you will get supported - // "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - // will also get supported "cmn-*" voices; specifying "zh-hk" will also get - // supported "yue-*" voices. - string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Gender of the voice as described in -// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). -enum SsmlVoiceGender { - // An unspecified gender. - // In VoiceSelectionParams, this means that the client doesn't care which - // gender the selected voice will have. In the Voice field of - // ListVoicesResponse, this may mean that the voice doesn't fit any of the - // other categories in this enum, or that the gender of the voice isn't known. - SSML_VOICE_GENDER_UNSPECIFIED = 0; - - // A male voice. - MALE = 1; - - // A female voice. - FEMALE = 2; - - // A gender-neutral voice. - NEUTRAL = 3; -} - -// Configuration to set up audio encoder. The encoding determines the output -// audio format that we'd like. -enum AudioEncoding { - // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. - AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - // Audio content returned as LINEAR16 also contains a WAV header. - LINEAR16 = 1; - - // MP3 audio at 32kbps. - MP3 = 2; - - // Opus encoded audio wrapped in an ogg container. The result will be a - // file which can be played natively on Android, and in browsers (at least - // Chrome and Firefox). The quality of the encoding is considerably higher - // than MP3 while using approximately the same bitrate. - OGG_OPUS = 3; -} - -// The message returned to the client by the `ListVoices` method. -message ListVoicesResponse { - // The list of voices. - repeated Voice voices = 1; -} - -// Description of a voice supported by the TTS service. -message Voice { - // The languages that this voice supports, expressed as - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - // "en-US", "es-419", "cmn-tw"). - repeated string language_codes = 1; - - // The name of this voice. Each distinct voice has a unique name. - string name = 2; - - // The gender of this voice. - SsmlVoiceGender ssml_gender = 3; - - // The natural sample rate (in hertz) for this voice. - int32 natural_sample_rate_hertz = 4; -} - -// The top-level message sent by the client for the `SynthesizeSpeech` method. -message SynthesizeSpeechRequest { - // Required. The Synthesizer requires either plain text or SSML as input. - SynthesisInput input = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired voice of the synthesized audio. - VoiceSelectionParams voice = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The configuration of the synthesized audio. - AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Contains text input to be synthesized. Either `text` or `ssml` must be -// supplied. Supplying both or neither returns -// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000 -// characters. -message SynthesisInput { - // The input source, which is either plain text or SSML. - oneof input_source { - // The raw text to be synthesized. - string text = 1; - - // The SSML document to be synthesized. The SSML document must be valid - // and well-formed. Otherwise the RPC will fail and return - // [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see - // [SSML](/speech/text-to-speech/docs/ssml). - string ssml = 2; - } -} - -// Description of which voice to use for a synthesis request. -message VoiceSelectionParams { - // Required. The language (and potentially also the region) of the voice expressed as a - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. - // "en-US". This should not include a script tag (e.g. use - // "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - // from the input provided in the SynthesisInput. The TTS service - // will use this parameter to help choose an appropriate voice. Note that - // the TTS service may choose a voice with a slightly different language code - // than the one selected; it may substitute a different region - // (e.g. using en-US rather than en-CA if there isn't a Canadian voice - // available), or even a different language, e.g. using "nb" (Norwegian - // Bokmal) instead of "no" (Norwegian)". - string language_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // The name of the voice. If not set, the service will choose a - // voice based on the other parameters such as language_code and gender. - string name = 2; - - // The preferred gender of the voice. If not set, the service will - // choose a voice based on the other parameters such as language_code and - // name. Note that this is only a preference, not requirement; if a - // voice of the appropriate gender is not available, the synthesizer should - // substitute a voice with a different gender rather than failing the request. - SsmlVoiceGender ssml_gender = 3; -} - -// Description of audio data to be synthesized. -message AudioConfig { - // Required. The format of the audio byte stream. - AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - // the normal native speed supported by the specific voice. 2.0 is twice as - // fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - // speed. Any other values < 0.25 or > 4.0 will return an error. - double speaking_rate = 2 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - // increase 20 semitones from the original pitch. -20 means decrease 20 - // semitones from the original pitch. - double pitch = 3 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Input only. Volume gain (in dB) of the normal native volume - // supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - // set to a value of 0.0 (dB), will play at normal native signal amplitude. A - // value of -6.0 (dB) will play at approximately half the amplitude of the - // normal native signal amplitude. A value of +6.0 (dB) will play at - // approximately twice the amplitude of the normal native signal amplitude. - // Strongly recommend not to exceed +10 (dB) as there's usually no effective - // increase in loudness for any value greater than that. - double volume_gain_db = 4 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. The synthesis sample rate (in hertz) for this audio. When this is - // specified in SynthesizeSpeechRequest, if this is different from the voice's - // natural sample rate, then the synthesizer will honor this request by - // converting to the desired sample rate (which might result in worse audio - // quality), unless the specified sample rate is not supported for the - // encoding chosen, in which case it will fail the request and return - // [google.rpc.Code.INVALID_ARGUMENT][]. - int32 sample_rate_hertz = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Input only. An identifier which selects 'audio effects' profiles - // that are applied on (post synthesized) text to speech. Effects are applied - // on top of each other in the order they are given. See - // [audio - // profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - // current supported profile ids. - repeated string effects_profile_id = 6 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// The message returned to the client by the `SynthesizeSpeech` method. -message SynthesizeSpeechResponse { - // The audio data bytes encoded as specified in the request, including the - // header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - // For LINEAR16 audio, we include the WAV header. Note: as - // with all bytes fields, protobuffers use a pure binary representation, - // whereas JSON representations use base64. - bytes audio_content = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline deleted file mode 100644 index b061fbcd3f9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline +++ /dev/null @@ -1,103 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-texttospeech", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.texttospeech.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "texttospeech_v1_generated_TextToSpeech_ListVoices_async", - "title": "TextToSpeech listVoices Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of Voice supported for synthesis.", - "canonical": true, - "file": "text_to_speech.list_voices.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVoices", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.ListVoices", - "async": true, - "parameters": [ - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.texttospeech.v1.ListVoicesResponse", - "client": { - "shortName": "TextToSpeechClient", - "fullName": "google.cloud.texttospeech.v1.TextToSpeechClient" - }, - "method": { - "shortName": "ListVoices", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.ListVoices", - "service": { - "shortName": "TextToSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech" - } - } - } - }, - { - "regionTag": "texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async", - "title": "TextToSpeech synthesizeSpeech Sample", - "origin": "API_DEFINITION", - "description": " Synthesizes speech synchronously: receive results after all text input has been processed.", - "canonical": true, - "file": "text_to_speech.synthesize_speech.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SynthesizeSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.SynthesizeSpeech", - "async": true, - "parameters": [ - { - "name": "input", - "type": ".google.cloud.texttospeech.v1.SynthesisInput" - }, - { - "name": "voice", - "type": ".google.cloud.texttospeech.v1.VoiceSelectionParams" - }, - { - "name": "audio_config", - "type": ".google.cloud.texttospeech.v1.AudioConfig" - } - ], - "resultType": ".google.cloud.texttospeech.v1.SynthesizeSpeechResponse", - "client": { - "shortName": "TextToSpeechClient", - "fullName": "google.cloud.texttospeech.v1.TextToSpeechClient" - }, - "method": { - "shortName": "SynthesizeSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.SynthesizeSpeech", - "service": { - "shortName": "TextToSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.list_voices.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.list_voices.js.baseline deleted file mode 100644 index 4a53ded0c3fb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.list_voices.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START texttospeech_v1_generated_TextToSpeech_ListVoices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Recommended. - * BCP-47 (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - * specified, the ListVoices call will only return voices that can be used to - * synthesize this language_code. E.g. when specifying "en-NZ", you will get - * supported "en-*" voices; when specifying "no", you will get supported - * "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - * will also get supported "cmn-*" voices; specifying "zh-hk" will also get - * supported "yue-*" voices. - */ - // const languageCode = 'abc123' - - // Imports the Texttospeech library - const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1; - - // Instantiates a client - const texttospeechClient = new TextToSpeechClient(); - - async function callListVoices() { - // Construct request - const request = { - }; - - // Run request - const response = await texttospeechClient.listVoices(request); - console.log(response); - } - - callListVoices(); - // [END texttospeech_v1_generated_TextToSpeech_ListVoices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline deleted file mode 100644 index d2b35dd76526..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(input, voice, audioConfig) { - // [START texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Synthesizer requires either plain text or SSML as input. - */ - // const input = {} - /** - * Required. The desired voice of the synthesized audio. - */ - // const voice = {} - /** - * Required. The configuration of the synthesized audio. - */ - // const audioConfig = {} - - // Imports the Texttospeech library - const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1; - - // Instantiates a client - const texttospeechClient = new TextToSpeechClient(); - - async function callSynthesizeSpeech() { - // Construct request - const request = { - input, - voice, - audioConfig, - }; - - // Run request - const response = await texttospeechClient.synthesizeSpeech(request); - console.log(response); - } - - callSynthesizeSpeech(); - // [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/webpack.config.cjs.baseline deleted file mode 100644 index 25f059a09792..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TextToSpeech', - filename: './text-to-speech.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.OwlBot.yaml.baseline deleted file mode 100644 index d90268c62f2a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/texttospeech/google-cloud-texttospeech-nodejs - dest: /owl-bot-staging/google-cloud-texttospeech - -api-name: texttospeech \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.jsdoc.js.baseline deleted file mode 100644 index 1ec3c14d8495..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/text-to-speech', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/README.md.baseline deleted file mode 100644 index dab4135a4968..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Texttospeech: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/@google-cloud/text-to-speech.svg)](https://www.npmjs.org/package/@google-cloud/text-to-speech) - -Texttospeech client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Texttospeech Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/texttospeech/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Texttospeech API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/text-to-speech -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/text-to-speech@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-texttospeech diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json b/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json deleted file mode 100644 index 07f6bb0a393b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "@google-cloud/text-to-speech", - "version": "0.1.0", - "description": "Texttospeech client for Node.js", - "repository": "googleapis/nodejs-texttospeech", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google texttospeech", - "texttospeech", - "text to speech" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline deleted file mode 100644 index 25b0065dde01..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/protos/google/cloud/texttospeech/v1/cloud_tts.proto.baseline +++ /dev/null @@ -1,253 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.texttospeech.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.TextToSpeech.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1;texttospeech"; -option java_multiple_files = true; -option java_outer_classname = "TextToSpeechProto"; -option java_package = "com.google.cloud.texttospeech.v1"; -option php_namespace = "Google\\Cloud\\TextToSpeech\\V1"; - -// Service that implements Google Cloud Text-to-Speech API. -service TextToSpeech { - option (google.api.default_host) = "texttospeech.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Returns a list of Voice supported for synthesis. - rpc ListVoices(ListVoicesRequest) returns (ListVoicesResponse) { - option (google.api.http) = { - get: "/v1/voices" - }; - option (google.api.method_signature) = "language_code"; - } - - // Synthesizes speech synchronously: receive results after all text input - // has been processed. - rpc SynthesizeSpeech(SynthesizeSpeechRequest) returns (SynthesizeSpeechResponse) { - option (google.api.http) = { - post: "/v1/text:synthesize" - body: "*" - }; - option (google.api.method_signature) = "input,voice,audio_config"; - } -} - -// The top-level message sent by the client for the `ListVoices` method. -message ListVoicesRequest { - // Optional. Recommended. - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - // specified, the ListVoices call will only return voices that can be used to - // synthesize this language_code. E.g. when specifying "en-NZ", you will get - // supported "en-*" voices; when specifying "no", you will get supported - // "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - // will also get supported "cmn-*" voices; specifying "zh-hk" will also get - // supported "yue-*" voices. - string language_code = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// Gender of the voice as described in -// [SSML voice element](https://www.w3.org/TR/speech-synthesis11/#edef_voice). -enum SsmlVoiceGender { - // An unspecified gender. - // In VoiceSelectionParams, this means that the client doesn't care which - // gender the selected voice will have. In the Voice field of - // ListVoicesResponse, this may mean that the voice doesn't fit any of the - // other categories in this enum, or that the gender of the voice isn't known. - SSML_VOICE_GENDER_UNSPECIFIED = 0; - - // A male voice. - MALE = 1; - - // A female voice. - FEMALE = 2; - - // A gender-neutral voice. - NEUTRAL = 3; -} - -// Configuration to set up audio encoder. The encoding determines the output -// audio format that we'd like. -enum AudioEncoding { - // Not specified. Will return result [google.rpc.Code.INVALID_ARGUMENT][]. - AUDIO_ENCODING_UNSPECIFIED = 0; - - // Uncompressed 16-bit signed little-endian samples (Linear PCM). - // Audio content returned as LINEAR16 also contains a WAV header. - LINEAR16 = 1; - - // MP3 audio at 32kbps. - MP3 = 2; - - // Opus encoded audio wrapped in an ogg container. The result will be a - // file which can be played natively on Android, and in browsers (at least - // Chrome and Firefox). The quality of the encoding is considerably higher - // than MP3 while using approximately the same bitrate. - OGG_OPUS = 3; -} - -// The message returned to the client by the `ListVoices` method. -message ListVoicesResponse { - // The list of voices. - repeated Voice voices = 1; -} - -// Description of a voice supported by the TTS service. -message Voice { - // The languages that this voice supports, expressed as - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. - // "en-US", "es-419", "cmn-tw"). - repeated string language_codes = 1; - - // The name of this voice. Each distinct voice has a unique name. - string name = 2; - - // The gender of this voice. - SsmlVoiceGender ssml_gender = 3; - - // The natural sample rate (in hertz) for this voice. - int32 natural_sample_rate_hertz = 4; -} - -// The top-level message sent by the client for the `SynthesizeSpeech` method. -message SynthesizeSpeechRequest { - // Required. The Synthesizer requires either plain text or SSML as input. - SynthesisInput input = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The desired voice of the synthesized audio. - VoiceSelectionParams voice = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The configuration of the synthesized audio. - AudioConfig audio_config = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Contains text input to be synthesized. Either `text` or `ssml` must be -// supplied. Supplying both or neither returns -// [google.rpc.Code.INVALID_ARGUMENT][]. The input size is limited to 5000 -// characters. -message SynthesisInput { - // The input source, which is either plain text or SSML. - oneof input_source { - // The raw text to be synthesized. - string text = 1; - - // The SSML document to be synthesized. The SSML document must be valid - // and well-formed. Otherwise the RPC will fail and return - // [google.rpc.Code.INVALID_ARGUMENT][]. For more information, see - // [SSML](/speech/text-to-speech/docs/ssml). - string ssml = 2; - } -} - -// Description of which voice to use for a synthesis request. -message VoiceSelectionParams { - // Required. The language (and potentially also the region) of the voice expressed as a - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. - // "en-US". This should not include a script tag (e.g. use - // "cmn-cn" rather than "cmn-Hant-cn"), because the script will be inferred - // from the input provided in the SynthesisInput. The TTS service - // will use this parameter to help choose an appropriate voice. Note that - // the TTS service may choose a voice with a slightly different language code - // than the one selected; it may substitute a different region - // (e.g. using en-US rather than en-CA if there isn't a Canadian voice - // available), or even a different language, e.g. using "nb" (Norwegian - // Bokmal) instead of "no" (Norwegian)". - string language_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // The name of the voice. If not set, the service will choose a - // voice based on the other parameters such as language_code and gender. - string name = 2; - - // The preferred gender of the voice. If not set, the service will - // choose a voice based on the other parameters such as language_code and - // name. Note that this is only a preference, not requirement; if a - // voice of the appropriate gender is not available, the synthesizer should - // substitute a voice with a different gender rather than failing the request. - SsmlVoiceGender ssml_gender = 3; -} - -// Description of audio data to be synthesized. -message AudioConfig { - // Required. The format of the audio byte stream. - AudioEncoding audio_encoding = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Input only. Speaking rate/speed, in the range [0.25, 4.0]. 1.0 is - // the normal native speed supported by the specific voice. 2.0 is twice as - // fast, and 0.5 is half as fast. If unset(0.0), defaults to the native 1.0 - // speed. Any other values < 0.25 or > 4.0 will return an error. - double speaking_rate = 2 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20 means - // increase 20 semitones from the original pitch. -20 means decrease 20 - // semitones from the original pitch. - double pitch = 3 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. Input only. Volume gain (in dB) of the normal native volume - // supported by the specific voice, in the range [-96.0, 16.0]. If unset, or - // set to a value of 0.0 (dB), will play at normal native signal amplitude. A - // value of -6.0 (dB) will play at approximately half the amplitude of the - // normal native signal amplitude. A value of +6.0 (dB) will play at - // approximately twice the amplitude of the normal native signal amplitude. - // Strongly recommend not to exceed +10 (dB) as there's usually no effective - // increase in loudness for any value greater than that. - double volume_gain_db = 4 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. The synthesis sample rate (in hertz) for this audio. When this is - // specified in SynthesizeSpeechRequest, if this is different from the voice's - // natural sample rate, then the synthesizer will honor this request by - // converting to the desired sample rate (which might result in worse audio - // quality), unless the specified sample rate is not supported for the - // encoding chosen, in which case it will fail the request and return - // [google.rpc.Code.INVALID_ARGUMENT][]. - int32 sample_rate_hertz = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Input only. An identifier which selects 'audio effects' profiles - // that are applied on (post synthesized) text to speech. Effects are applied - // on top of each other in the order they are given. See - // [audio - // profiles](https://cloud.google.com/text-to-speech/docs/audio-profiles) for - // current supported profile ids. - repeated string effects_profile_id = 6 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// The message returned to the client by the `SynthesizeSpeech` method. -message SynthesizeSpeechResponse { - // The audio data bytes encoded as specified in the request, including the - // header for encodings that are wrapped in containers (e.g. MP3, OGG_OPUS). - // For LINEAR16 audio, we include the WAV header. Note: as - // with all bytes fields, protobuffers use a pure binary representation, - // whereas JSON representations use base64. - bytes audio_content = 1; -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline deleted file mode 100644 index b061fbcd3f9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/snippet_metadata_google.cloud.texttospeech.v1.json.baseline +++ /dev/null @@ -1,103 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-texttospeech", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.texttospeech.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "texttospeech_v1_generated_TextToSpeech_ListVoices_async", - "title": "TextToSpeech listVoices Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of Voice supported for synthesis.", - "canonical": true, - "file": "text_to_speech.list_voices.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListVoices", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.ListVoices", - "async": true, - "parameters": [ - { - "name": "language_code", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.texttospeech.v1.ListVoicesResponse", - "client": { - "shortName": "TextToSpeechClient", - "fullName": "google.cloud.texttospeech.v1.TextToSpeechClient" - }, - "method": { - "shortName": "ListVoices", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.ListVoices", - "service": { - "shortName": "TextToSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech" - } - } - } - }, - { - "regionTag": "texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async", - "title": "TextToSpeech synthesizeSpeech Sample", - "origin": "API_DEFINITION", - "description": " Synthesizes speech synchronously: receive results after all text input has been processed.", - "canonical": true, - "file": "text_to_speech.synthesize_speech.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SynthesizeSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.SynthesizeSpeech", - "async": true, - "parameters": [ - { - "name": "input", - "type": ".google.cloud.texttospeech.v1.SynthesisInput" - }, - { - "name": "voice", - "type": ".google.cloud.texttospeech.v1.VoiceSelectionParams" - }, - { - "name": "audio_config", - "type": ".google.cloud.texttospeech.v1.AudioConfig" - } - ], - "resultType": ".google.cloud.texttospeech.v1.SynthesizeSpeechResponse", - "client": { - "shortName": "TextToSpeechClient", - "fullName": "google.cloud.texttospeech.v1.TextToSpeechClient" - }, - "method": { - "shortName": "SynthesizeSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech.SynthesizeSpeech", - "service": { - "shortName": "TextToSpeech", - "fullName": "google.cloud.texttospeech.v1.TextToSpeech" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.list_voices.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.list_voices.js.baseline deleted file mode 100644 index 4a53ded0c3fb..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.list_voices.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main() { - // [START texttospeech_v1_generated_TextToSpeech_ListVoices_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Recommended. - * BCP-47 (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - * specified, the ListVoices call will only return voices that can be used to - * synthesize this language_code. E.g. when specifying "en-NZ", you will get - * supported "en-*" voices; when specifying "no", you will get supported - * "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - * will also get supported "cmn-*" voices; specifying "zh-hk" will also get - * supported "yue-*" voices. - */ - // const languageCode = 'abc123' - - // Imports the Texttospeech library - const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1; - - // Instantiates a client - const texttospeechClient = new TextToSpeechClient(); - - async function callListVoices() { - // Construct request - const request = { - }; - - // Run request - const response = await texttospeechClient.listVoices(request); - console.log(response); - } - - callListVoices(); - // [END texttospeech_v1_generated_TextToSpeech_ListVoices_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline deleted file mode 100644 index d2b35dd76526..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/samples/generated/v1/text_to_speech.synthesize_speech.js.baseline +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(input, voice, audioConfig) { - // [START texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Synthesizer requires either plain text or SSML as input. - */ - // const input = {} - /** - * Required. The desired voice of the synthesized audio. - */ - // const voice = {} - /** - * Required. The configuration of the synthesized audio. - */ - // const audioConfig = {} - - // Imports the Texttospeech library - const {TextToSpeechClient} = require('@google-cloud/text-to-speech').v1; - - // Instantiates a client - const texttospeechClient = new TextToSpeechClient(); - - async function callSynthesizeSpeech() { - // Construct request - const request = { - input, - voice, - audioConfig, - }; - - // Run request - const response = await texttospeechClient.synthesizeSpeech(request); - console.log(response); - } - - callSynthesizeSpeech(); - // [END texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/src/index.ts.baseline deleted file mode 100644 index c0ef6854fae4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const TextToSpeechClient = v1.TextToSpeechClient; -type TextToSpeechClient = v1.TextToSpeechClient; -export {v1, TextToSpeechClient}; -export default {v1, TextToSpeechClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/index.ts.baseline deleted file mode 100644 index 2a0636a80ace..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TextToSpeechClient} from './text_to_speech_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client.ts.baseline deleted file mode 100644 index f9c2e438f4f8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client.ts.baseline +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/text_to_speech_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './text_to_speech_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service that implements Google Cloud Text-to-Speech API. - * @class - * @memberof v1 - */ -export class TextToSpeechClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('text-to-speech'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - textToSpeechStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TextToSpeechClient. - * - * @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://cloud.google.com/docs/authentication/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 TextToSpeechClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TextToSpeechClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'texttospeech.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.texttospeech.v1.TextToSpeech', gapicConfig as gax.ClientConfig, - 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.textToSpeechStub) { - return this.textToSpeechStub; - } - - // Put together the "service stub" for - // google.cloud.texttospeech.v1.TextToSpeech. - this.textToSpeechStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.texttospeech.v1.TextToSpeech') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.texttospeech.v1.TextToSpeech, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const textToSpeechStubMethods = - ['listVoices', 'synthesizeSpeech']; - for (const methodName of textToSpeechStubMethods) { - const callPromise = this.textToSpeechStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.textToSpeechStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'texttospeech.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'texttospeech.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Returns a list of Voice supported for synthesis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.languageCode] - * Optional. Recommended. - * [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If - * specified, the ListVoices call will only return voices that can be used to - * synthesize this language_code. E.g. when specifying "en-NZ", you will get - * supported "en-*" voices; when specifying "no", you will get supported - * "no-*" (Norwegian) and "nb-*" (Norwegian Bokmal) voices; specifying "zh" - * will also get supported "cmn-*" voices; specifying "zh-hk" will also get - * supported "yue-*" voices. - * @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 {@link protos.google.cloud.texttospeech.v1.ListVoicesResponse|ListVoicesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/text_to_speech.list_voices.js - * region_tag:texttospeech_v1_generated_TextToSpeech_ListVoices_async - */ - listVoices( - request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, {}|undefined - ]>; - listVoices( - request: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): void; - listVoices( - request: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - callback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): void; - listVoices( - request?: protos.google.cloud.texttospeech.v1.IListVoicesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('listVoices request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listVoices response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.listVoices(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.texttospeech.v1.IListVoicesResponse, - protos.google.cloud.texttospeech.v1.IListVoicesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listVoices response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Synthesizes speech synchronously: receive results after all text input - * has been processed. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.texttospeech.v1.SynthesisInput} request.input - * Required. The Synthesizer requires either plain text or SSML as input. - * @param {google.cloud.texttospeech.v1.VoiceSelectionParams} request.voice - * Required. The desired voice of the synthesized audio. - * @param {google.cloud.texttospeech.v1.AudioConfig} request.audioConfig - * Required. The configuration of the synthesized audio. - * @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 {@link protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse|SynthesizeSpeechResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/text_to_speech.synthesize_speech.js - * region_tag:texttospeech_v1_generated_TextToSpeech_SynthesizeSpeech_async - */ - synthesizeSpeech( - request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, {}|undefined - ]>; - synthesizeSpeech( - request: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): void; - synthesizeSpeech( - request: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - callback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): void; - synthesizeSpeech( - request?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - this._log.info('synthesizeSpeech request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('synthesizeSpeech response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.synthesizeSpeech(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse, - protos.google.cloud.texttospeech.v1.ISynthesizeSpeechRequest|undefined, - {}|undefined - ]) => { - this._log.info('synthesizeSpeech response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.textToSpeechStub && !this._terminated) { - return this.textToSpeechStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client_config.json.baseline deleted file mode 100644 index e460d95484ac..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_client_config.json.baseline +++ /dev/null @@ -1,36 +0,0 @@ -{ - "interfaces": { - "google.cloud.texttospeech.v1.TextToSpeech": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListVoices": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - }, - "SynthesizeSpeech": { - "timeout_millis": 600000, - "retry_codes_name": "idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_proto_list.json.baseline deleted file mode 100644 index a2b3f234f3fe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/src/v1/text_to_speech_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/texttospeech/v1/cloud_tts.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 2292e3b2911f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const texttospeech = require('@google-cloud/text-to-speech'); - -function main() { - const textToSpeechClient = new texttospeech.TextToSpeechClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 71b0bcb6738b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {TextToSpeechClient} from '@google-cloud/text-to-speech'; - -// check that the client class type name can be used -function doStuffWithTextToSpeechClient(client: TextToSpeechClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const textToSpeechClient = new TextToSpeechClient(); - doStuffWithTextToSpeechClient(textToSpeechClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/test/gapic_text_to_speech_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/test/gapic_text_to_speech_v1.ts.baseline deleted file mode 100644 index e9a7f7455ce7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/test/gapic_text_to_speech_v1.ts.baseline +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as texttospeechModule from '../src'; - -import {protobuf} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -describe('v1.TextToSpeechClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'texttospeech.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = texttospeechModule.v1.TextToSpeechClient.servicePath; - assert.strictEqual(servicePath, 'texttospeech.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = texttospeechModule.v1.TextToSpeechClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'texttospeech.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new texttospeechModule.v1.TextToSpeechClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new texttospeechModule.v1.TextToSpeechClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'texttospeech.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new texttospeechModule.v1.TextToSpeechClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = texttospeechModule.v1.TextToSpeechClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new texttospeechModule.v1.TextToSpeechClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.textToSpeechStub, undefined); - await client.initialize(); - assert(client.textToSpeechStub); - }); - - it('has close method for the initialized client', done => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.textToSpeechStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.textToSpeechStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('listVoices', () => { - it('invokes listVoices without error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesResponse() - ); - client.innerApiCalls.listVoices = stubSimpleCall(expectedResponse); - const [response] = await client.listVoices(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listVoices without error using callback', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesResponse() - ); - client.innerApiCalls.listVoices = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listVoices( - request, - (err?: Error|null, result?: protos.google.cloud.texttospeech.v1.IListVoicesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes listVoices with error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.listVoices = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listVoices(request), expectedError); - }); - - it('invokes listVoices with closed client', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.ListVoicesRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listVoices(request), expectedError); - }); - }); - - describe('synthesizeSpeech', () => { - it('invokes synthesizeSpeech without error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse() - ); - client.innerApiCalls.synthesizeSpeech = stubSimpleCall(expectedResponse); - const [response] = await client.synthesizeSpeech(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes synthesizeSpeech without error using callback', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechResponse() - ); - client.innerApiCalls.synthesizeSpeech = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.synthesizeSpeech( - request, - (err?: Error|null, result?: protos.google.cloud.texttospeech.v1.ISynthesizeSpeechResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes synthesizeSpeech with error', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.synthesizeSpeech = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.synthesizeSpeech(request), expectedError); - }); - - it('invokes synthesizeSpeech with closed client', async () => { - const client = new texttospeechModule.v1.TextToSpeechClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.texttospeech.v1.SynthesizeSpeechRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.synthesizeSpeech(request), expectedError); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/texttospeech/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/texttospeech/webpack.config.js.baseline deleted file mode 100644 index 25f059a09792..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/texttospeech/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TextToSpeech', - filename: './text-to-speech.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.OwlBot.yaml.baseline deleted file mode 100644 index 6d5a02b84a4c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/translation/google-cloud-translation-nodejs - dest: /owl-bot-staging/google-cloud-translation - -api-name: translation \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 556769166891..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'translation', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/README.md.baseline deleted file mode 100644 index 0410ab09ba8c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Translation: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/translation.svg)](https://www.npmjs.org/package/translation) - -Translation client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Translation Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/translation/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Translation API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install translation -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install translation@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=translate.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/index.ts.baseline deleted file mode 100644 index 77370f456aea..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v3beta1 from './v3beta1/index.js'; -const TranslationServiceClient = v3beta1.TranslationServiceClient; -type TranslationServiceClient = v3beta1.TranslationServiceClient; -export {v3beta1, TranslationServiceClient}; -export default {v3beta1, TranslationServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/index.ts.baseline deleted file mode 100644 index 9c6ee9adfc70..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TranslationServiceClient} from './translation_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client.ts.baseline deleted file mode 100644 index 4227393e72a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client.ts.baseline +++ /dev/null @@ -1,1606 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as translation_service_client_config from './translation_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v3beta1/translation_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'translation_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Provides natural language translation operations. - * @class - * @memberof v3beta1 - */ -export class TranslationServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('translation'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - translationServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TranslationServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 TranslationServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TranslationServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'translate.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - glossaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/glossaries/{glossary}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // 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 = { - listGlossaries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'glossaries') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const batchTranslateTextResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.BatchTranslateResponse') as gax.protobuf.Type; - const batchTranslateTextMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.BatchTranslateMetadata') as gax.protobuf.Type; - const createGlossaryResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.Glossary') as gax.protobuf.Type; - const createGlossaryMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.CreateGlossaryMetadata') as gax.protobuf.Type; - const deleteGlossaryResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.DeleteGlossaryResponse') as gax.protobuf.Type; - const deleteGlossaryMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.DeleteGlossaryMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchTranslateText: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchTranslateTextResponse.decode.bind(batchTranslateTextResponse), - batchTranslateTextMetadata.decode.bind(batchTranslateTextMetadata)), - createGlossary: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGlossaryResponse.decode.bind(createGlossaryResponse), - createGlossaryMetadata.decode.bind(createGlossaryMetadata)), - deleteGlossary: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGlossaryResponse.decode.bind(deleteGlossaryResponse), - deleteGlossaryMetadata.decode.bind(deleteGlossaryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.translation.v3beta1.TranslationService', gapicConfig as gax.ClientConfig, - 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.translationServiceStub) { - return this.translationServiceStub; - } - - // Put together the "service stub" for - // google.cloud.translation.v3beta1.TranslationService. - this.translationServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.translation.v3beta1.TranslationService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.translation.v3beta1.TranslationService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const translationServiceStubMethods = - ['translateText', 'detectLanguage', 'getSupportedLanguages', 'batchTranslateText', 'createGlossary', 'listGlossaries', 'getGlossary', 'deleteGlossary']; - for (const methodName of translationServiceStubMethods) { - const callPromise = this.translationServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.translationServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'translate.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'translate.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-translation' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Translates input text and returns translated text. - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.contents - * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. - * Use BatchTranslateText for larger text. - * @param {string} [request.mimeType] - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @param {string} [request.sourceLanguageCode] - * Optional. The BCP-47 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * @param {string} request.targetLanguageCode - * Required. The BCP-47 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.model] - * Optional. The `model` type requested for this translation. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-id}/locations/global/models/general/nmt`. - * - * If missing, the system decides which google base model to use. - * @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} [request.glossaryConfig] - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * @param {number[]} [request.labels] - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 {@link protos.google.cloud.translation.v3beta1.TranslateTextResponse|TranslateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_TranslateText_async - */ - translateText( - request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, {}|undefined - ]>; - translateText( - request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): void; - translateText( - request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): void; - translateText( - request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('translateText request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('translateText response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.translateText(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, {}|undefined - ]) => { - this._log.info('translateText response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Detects the language of text within a request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}/locations/{location-id}` or - * `projects/{project-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.model] - * Optional. The language detection model to be used. - * - * Format: - * `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - * - * Only one language detection model is currently supported: - * `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - * - * If not specified, the default model is used. - * @param {string} request.content - * The content of the input stored as a string. - * @param {string} [request.mimeType] - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @param {number[]} request.labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 {@link protos.google.cloud.translation.v3beta1.DetectLanguageResponse|DetectLanguageResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.detect_language.js - * region_tag:translate_v3beta1_generated_TranslationService_DetectLanguage_async - */ - detectLanguage( - request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, {}|undefined - ]>; - detectLanguage( - request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): void; - detectLanguage( - request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): void; - detectLanguage( - request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('detectLanguage request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('detectLanguage response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.detectLanguage(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, {}|undefined - ]) => { - this._log.info('detectLanguage response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns a list of supported languages for translation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Non-global location is required for AutoML models. - * - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.displayLanguageCode] - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * @param {string} [request.model] - * Optional. Get supported languages of this model. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general base (PBMT) model. - * @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 {@link protos.google.cloud.translation.v3beta1.SupportedLanguages|SupportedLanguages}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.get_supported_languages.js - * region_tag:translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async - */ - getSupportedLanguages( - request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, {}|undefined - ]>; - getSupportedLanguages( - request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): void; - getSupportedLanguages( - request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): void; - getSupportedLanguages( - request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSupportedLanguages request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSupportedLanguages response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getSupportedLanguages(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, {}|undefined - ]) => { - this._log.info('getSupportedLanguages response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - * exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the glossary to retrieve. - * @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 {@link protos.google.cloud.translation.v3beta1.Glossary|Glossary}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.get_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_GetGlossary_async - */ - getGlossary( - request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, {}|undefined - ]>; - getGlossary( - request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): void; - getGlossary( - request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): void; - getGlossary( - request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGlossary request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGlossary response %j', response); - callback!(error, response, options, rawResponse); - } - : undefined; - return this.innerApiCalls.getGlossary(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, {}|undefined - ]) => { - this._log.info('getGlossary response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Translates a large volume of text in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can - * use google.longrunning.Operation.name to poll the status of the call. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Location to make a call. Must refer to a caller's project. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * The `global` location is not supported for batch translation. - * - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @param {string} request.sourceLanguageCode - * Required. Source language code. - * @param {string[]} request.targetLanguageCodes - * Required. Specify up to 10 language codes here. - * @param {number[]} [request.models] - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * - * The value format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @param {number[]} request.inputConfigs - * Required. Input configurations. - * The total number of files matched should be <= 1000. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @param {google.cloud.translation.v3beta1.OutputConfig} request.outputConfig - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @param {number[]} [request.glossaries] - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * @param {number[]} [request.labels] - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.batch_translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async - */ - batchTranslateText( - request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchTranslateText( - request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchTranslateText( - request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchTranslateText( - request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('batchTranslateText response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('batchTranslateText request %j', request); - return this.innerApiCalls.batchTranslateText(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('batchTranslateText response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `batchTranslateText()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.batch_translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async - */ - async checkBatchTranslateTextProgress(name: string): Promise>{ - this._log.info('batchTranslateText long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchTranslateText, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a glossary and returns the long-running operation. Returns - * NOT_FOUND, if the project doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project name. - * @param {google.cloud.translation.v3beta1.Glossary} request.glossary - * Required. The glossary 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.create_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async - */ - createGlossary( - request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createGlossary( - request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGlossary( - request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGlossary( - request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createGlossary response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('createGlossary request %j', request); - return this.innerApiCalls.createGlossary(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGlossary response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createGlossary()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.create_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async - */ - async checkCreateGlossaryProgress(name: string): Promise>{ - this._log.info('createGlossary long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGlossary, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a glossary, or cancels glossary construction - * if the glossary isn't created yet. - * Returns NOT_FOUND, if the glossary doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the glossary to delete. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.delete_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async - */ - deleteGlossary( - request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteGlossary( - request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGlossary( - request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGlossary( - request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('deleteGlossary response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('deleteGlossary request %j', request); - return this.innerApiCalls.deleteGlossary(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGlossary response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `deleteGlossary()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.delete_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async - */ - async checkDeleteGlossaryProgress(name: string): Promise>{ - this._log.info('deleteGlossary long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGlossary, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - * exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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 Array of {@link protos.google.cloud.translation.v3beta1.Glossary|Glossary}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGlossariesAsync()` - * 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. - */ - listGlossaries( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]>; - listGlossaries( - request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): void; - listGlossaries( - request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - callback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): void; - listGlossaries( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>, - callback?: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGlossaries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); - } - : undefined; - this._log.info('listGlossaries request %j', request); - return this.innerApiCalls - .listGlossaries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]) => { - this._log.info('listGlossaries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGlossaries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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.cloud.translation.v3beta1.Glossary|Glossary} 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 `listGlossariesAsync()` - * 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. - */ - listGlossariesStream( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGlossaries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGlossaries stream %j', request); - return this.descriptors.page.listGlossaries.createStream( - this.innerApiCalls.listGlossaries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGlossaries`, 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. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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.cloud.translation.v3beta1.Glossary|Glossary}. 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 include:samples/generated/v3beta1/translation_service.list_glossaries.js - * region_tag:translate_v3beta1_generated_TranslationService_ListGlossaries_async - */ - listGlossariesAsync( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGlossaries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGlossaries iterate %j', request); - return this.descriptors.page.listGlossaries.asyncIterate( - this.innerApiCalls['listGlossaries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified glossary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} glossary - * @returns {string} Resource name string. - */ - glossaryPath(project:string,location:string,glossary:string) { - return this.pathTemplates.glossaryPathTemplate.render({ - project: project, - location: location, - glossary: glossary, - }); - } - - /** - * Parse the project from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).project; - } - - /** - * Parse the location from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).location; - } - - /** - * Parse the glossary from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the glossary. - */ - matchGlossaryFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).glossary; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.translationServiceStub && !this._terminated) { - return this.translationServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client_config.json.baseline deleted file mode 100644 index c0be7abb1086..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.translation.v3beta1.TranslationService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "TranslateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetectLanguage": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSupportedLanguages": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchTranslateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGlossaries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_proto_list.json.baseline deleted file mode 100644 index a50dcfc7d4fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/src/v3beta1/translation_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/translate/v3beta1/translation_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index d33945fc8831..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const translation = require('translation'); - -function main() { - const translationServiceClient = new translation.TranslationServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 73b7d3434b75..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as translation from 'translation'; - -function main() { - const translationServiceClient = new translation.TranslationServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 15bd45a8eca7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {TranslationServiceClient} from 'translation'; - -// check that the client class type name can be used -function doStuffWithTranslationServiceClient(client: TranslationServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const translationServiceClient = new TranslationServiceClient(); - doStuffWithTranslationServiceClient(translationServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/test/gapic_translation_service_v3beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/test/gapic_translation_service_v3beta1.ts.baseline deleted file mode 100644 index 629006c0a48b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/esm/test/gapic_translation_service_v3beta1.ts.baseline +++ /dev/null @@ -1,1512 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as translationserviceModule from '../src/index.js'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3beta1.TranslationServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'translate.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = translationserviceModule.v3beta1.TranslationServiceClient.servicePath; - assert.strictEqual(servicePath, 'translate.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = translationserviceModule.v3beta1.TranslationServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'translate.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new translationserviceModule.v3beta1.TranslationServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = translationserviceModule.v3beta1.TranslationServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.translationServiceStub, undefined); - await client.initialize(); - assert(client.translationServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.translationServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.translationServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('translateText', () => { - it('invokes translateText without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextResponse() - ); - client.innerApiCalls.translateText = stubSimpleCall(expectedResponse); - const [response] = await client.translateText(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextResponse() - ); - client.innerApiCalls.translateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.translateText( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.ITranslateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.translateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.translateText(request), expectedError); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.translateText(request), expectedError); - }); - }); - - describe('detectLanguage', () => { - it('invokes detectLanguage without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() - ); - client.innerApiCalls.detectLanguage = stubSimpleCall(expectedResponse); - const [response] = await client.detectLanguage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() - ); - client.innerApiCalls.detectLanguage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detectLanguage( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IDetectLanguageResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.detectLanguage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectLanguage(request), expectedError); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.detectLanguage(request), expectedError); - }); - }); - - describe('getSupportedLanguages', () => { - it('invokes getSupportedLanguages without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.SupportedLanguages() - ); - client.innerApiCalls.getSupportedLanguages = stubSimpleCall(expectedResponse); - const [response] = await client.getSupportedLanguages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.SupportedLanguages() - ); - client.innerApiCalls.getSupportedLanguages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSupportedLanguages( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.ISupportedLanguages|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSupportedLanguages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSupportedLanguages(request), expectedError); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSupportedLanguages(request), expectedError); - }); - }); - - describe('getGlossary', () => { - it('invokes getGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.Glossary() - ); - client.innerApiCalls.getGlossary = stubSimpleCall(expectedResponse); - const [response] = await client.getGlossary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.Glossary() - ); - client.innerApiCalls.getGlossary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGlossary( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IGlossary|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGlossary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGlossary(request), expectedError); - }); - }); - - describe('batchTranslateText', () => { - it('invokes batchTranslateText without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchTranslateText(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchTranslateText = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchTranslateText( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchTranslateText(request), expectedError); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchTranslateText(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBatchTranslateTextProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchTranslateTextProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchTranslateTextProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchTranslateTextProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createGlossary', () => { - it('invokes createGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGlossary = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGlossary(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGlossary = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGlossary( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGlossary = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGlossary = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGlossary(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGlossaryProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateGlossaryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGlossaryProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGlossaryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteGlossary', () => { - it('invokes deleteGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGlossary(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGlossary = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGlossary( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGlossary(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteGlossaryProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteGlossaryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteGlossaryProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGlossaryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listGlossaries', () => { - it('invokes listGlossaries without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.innerApiCalls.listGlossaries = stubSimpleCall(expectedResponse); - const [response] = await client.listGlossaries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossaries without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.innerApiCalls.listGlossaries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGlossaries( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IGlossary[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossaries with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGlossaries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGlossaries(request), expectedError); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossariesStream without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.descriptors.page.listGlossaries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGlossariesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.translation.v3beta1.Glossary[] = []; - stream.on('data', (response: protos.google.cloud.translation.v3beta1.Glossary) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGlossaries, request)); - assert( - (client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGlossariesStream with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGlossaries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGlossariesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.translation.v3beta1.Glossary[] = []; - stream.on('data', (response: protos.google.cloud.translation.v3beta1.Glossary) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGlossaries, request)); - assert( - (client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGlossaries without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.descriptors.page.listGlossaries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; - const iterable = client.listGlossariesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGlossaries with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGlossaries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGlossariesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('glossary', () => { - const fakePath = "/rendered/path/glossary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - glossary: "glossaryValue", - }; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.glossaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.glossaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('glossaryPath', () => { - const result = client.glossaryPath("projectValue", "locationValue", "glossaryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.glossaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGlossaryName', () => { - const result = client.matchProjectFromGlossaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGlossaryName', () => { - const result = client.matchLocationFromGlossaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGlossaryFromGlossaryName', () => { - const result = client.matchGlossaryFromGlossaryName(fakePath); - assert.strictEqual(result, "glossaryValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json b/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json deleted file mode 100644 index 5df9b5f36163..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "translation", - "version": "0.1.0", - "description": "Translation client for Node.js", - "repository": "googleapis/nodejs-translation", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google translation", - "translation", - "translation service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline deleted file mode 100644 index 261671c6fd9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline +++ /dev/null @@ -1,902 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.translation.v3beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Translate.V3Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate"; -option java_multiple_files = true; -option java_outer_classname = "TranslationServiceProto"; -option java_package = "com.google.cloud.translate.v3beta1"; -option php_namespace = "Google\\Cloud\\Translate\\V3beta1"; -option ruby_package = "Google::Cloud::Translate::V3beta1"; - -// Proto file for the Cloud Translation API (v3beta1). - -// Provides natural language translation operations. -service TranslationService { - option (google.api.default_host) = "translate.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-translation"; - - // Translates input text and returns translated text. - rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:translateText" - body: "*" - additional_bindings { - post: "/v3beta1/{parent=projects/*}:translateText" - body: "*" - } - }; - } - - // Detects the language of text within a request. - rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:detectLanguage" - body: "*" - additional_bindings { - post: "/v3beta1/{parent=projects/*}:detectLanguage" - body: "*" - } - }; - option (google.api.method_signature) = "parent,model,mime_type"; - } - - // Returns a list of supported languages for translation. - rpc GetSupportedLanguages(GetSupportedLanguagesRequest) returns (SupportedLanguages) { - option (google.api.http) = { - get: "/v3beta1/{parent=projects/*/locations/*}/supportedLanguages" - additional_bindings { - get: "/v3beta1/{parent=projects/*}/supportedLanguages" - } - }; - option (google.api.method_signature) = "parent,display_language_code,model"; - } - - // Translates a large volume of text in asynchronous batch mode. - // This function provides real-time output as the inputs are being processed. - // If caller cancels a request, the partial results (for an input file, it's - // all or nothing) may still be available on the specified output location. - // - // This call returns immediately and you can - // use google.longrunning.Operation.name to poll the status of the call. - rpc BatchTranslateText(BatchTranslateTextRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "BatchTranslateResponse" - metadata_type: "BatchTranslateMetadata" - }; - } - - // Creates a glossary and returns the long-running operation. Returns - // NOT_FOUND, if the project doesn't exist. - rpc CreateGlossary(CreateGlossaryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}/glossaries" - body: "glossary" - }; - option (google.api.method_signature) = "parent,glossary"; - option (google.longrunning.operation_info) = { - response_type: "Glossary" - metadata_type: "CreateGlossaryMetadata" - }; - } - - // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - // exist. - rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { - option (google.api.http) = { - get: "/v3beta1/{parent=projects/*/locations/*}/glossaries" - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,filter"; - } - - // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - // exist. - rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { - option (google.api.http) = { - get: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a glossary, or cancels glossary construction - // if the glossary isn't created yet. - // Returns NOT_FOUND, if the glossary doesn't exist. - rpc DeleteGlossary(DeleteGlossaryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "DeleteGlossaryResponse" - metadata_type: "DeleteGlossaryMetadata" - }; - } -} - -// Configures which glossary should be used for a specific target language, -// and defines options for applying that glossary. -message TranslateTextGlossaryConfig { - // Required. Specifies the glossary used for this translation. Use - // this format: projects/*/locations/*/glossaries/* - string glossary = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates match is case-insensitive. - // Default value is false if missing. - bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for synchronous translation. -message TranslateTextRequest { - // Required. The content of the input in string format. - // We recommend the total content be less than 30k codepoints. - // Use BatchTranslateText for larger text. - repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The format of the source text, for example, "text/html", - // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code of the input text if - // known, for example, "en-US" or "sr-Latn". Supported language codes are - // listed in Language Support. If the source language isn't specified, the API - // attempts to identify the source language automatically and returns the - // source language within the response. - string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The BCP-47 language code to use for translation of the input - // text, set to one of the language codes listed in Language Support. - string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}` or - // `projects/{project-id}/locations/{location-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Non-global location is required for requests using AutoML models or - // custom glossaries. - // - // Models and glossaries must be within the same region (have same - // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The `model` type requested for this translation. - // - // The format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // For global (non-regionalized) requests, use `location-id` `global`. - // For example, - // `projects/{project-id}/locations/global/models/general/nmt`. - // - // If missing, the system decides which google base model to use. - string model = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Glossary to be applied. The glossary must be - // within the same region (have the same location-id) as the model, otherwise - // an INVALID_ARGUMENT (400) error is returned. - TranslateTextGlossaryConfig glossary_config = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -message TranslateTextResponse { - // Text translation responses with no glossary applied. - // This field has the same length as - // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. - repeated Translation translations = 1; - - // Text translation responses if a glossary is provided in the request. - // This can be the same as - // [`translations`][google.cloud.translation.v3beta1.TranslateTextResponse.translations] if no terms apply. - // This field has the same length as - // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. - repeated Translation glossary_translations = 3; -} - -// A single translation response. -message Translation { - // Text translated into the target language. - string translated_text = 1; - - // Only present when `model` is present in the request. - // This is same as `model` provided in the request. - string model = 2; - - // The BCP-47 language code of source text in the initial request, detected - // automatically, if no source language was passed within the initial - // request. If the source language was passed, auto-detection of the language - // does not occur and this field is empty. - string detected_language_code = 4; - - // The `glossary_config` used for this translation. - TranslateTextGlossaryConfig glossary_config = 3; -} - -// The request message for language detection. -message DetectLanguageRequest { - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}/locations/{location-id}` or - // `projects/{project-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Only models within the same region (has same location-id) can be used. - // Otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The language detection model to be used. - // - // Format: - // `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - // - // Only one language detection model is currently supported: - // `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - // - // If not specified, the default model is used. - string model = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The source of the document from which to detect the language. - oneof source { - // The content of the input stored as a string. - string content = 1; - } - - // Optional. The format of the source text, for example, "text/html", - // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 6; -} - -// The response message for language detection. -message DetectedLanguage { - // The BCP-47 language code of source content in the request, detected - // automatically. - string language_code = 1; - - // The confidence of the detection result for this language. - float confidence = 2; -} - -// The response message for language detection. -message DetectLanguageResponse { - // A list of detected languages sorted by detection confidence in descending - // order. The most probable language first. - repeated DetectedLanguage languages = 1; -} - -// The request message for discovering supported languages. -message GetSupportedLanguagesRequest { - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}` or - // `projects/{project-id}/locations/{location-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Non-global location is required for AutoML models. - // - // Only models within the same region (have same location-id) can be used, - // otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The language to use to return localized, human readable names - // of supported languages. If missing, then display names are not returned - // in a response. - string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Get supported languages of this model. - // - // The format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // Returns languages supported by the specified model. - // If missing, we get supported languages of Google general base (PBMT) model. - string model = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for discovering supported languages. -message SupportedLanguages { - // A list of supported language responses. This list contains an entry - // for each language the Translation API supports. - repeated SupportedLanguage languages = 1; -} - -// A single supported language response corresponds to information related -// to one supported language. -message SupportedLanguage { - // Supported language code, generally consisting of its ISO 639-1 - // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes - // including language and region identifiers are returned (for example, - // 'zh-TW' and 'zh-CN') - string language_code = 1; - - // Human readable name of the language localized in the display language - // specified in the request. - string display_name = 2; - - // Can be used as source language. - bool support_source = 3; - - // Can be used as target language. - bool support_target = 4; -} - -// The Google Cloud Storage location for the input content. -message GcsSource { - // Required. Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Input configuration for BatchTranslateText request. -message InputConfig { - // Optional. Can be "text/plain" or "text/html". - // For `.tsv`, "text/html" is used if mime_type is missing. - // For `.html`, this field must be "text/html" or empty. - // For `.txt`, this field must be "text/plain" or empty. - string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Specify the input. - oneof source { - // Required. Google Cloud Storage location for the source input. - // This can be a single file (for example, - // `gs://translation-test/input.tsv`) or a wildcard (for example, - // `gs://translation-test/*`). If a file extension is `.tsv`, it can - // contain either one or two columns. The first column (optional) is the id - // of the text request. If the first column is missing, we use the row - // number (0-based) from the input file as the ID in the output file. The - // second column is the actual text to be - // translated. We recommend each row be <= 10K Unicode codepoints, - // otherwise an error might be returned. - // Note that the input tsv must be RFC 4180 compliant. - // - // You could use https://github.com/Clever/csvlint to check potential - // formatting errors in your tsv file. - // csvlint --delimiter='\t' your_input_file.tsv - // - // The other supported file extensions are `.txt` or `.html`, which is - // treated as a single large chunk of text. - GcsSource gcs_source = 2; - } -} - -// The Google Cloud Storage location for the output content. -message GcsDestination { - // Required. There must be no files under 'output_uri_prefix'. - // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an - // INVALID_ARGUMENT (400) error is returned. - string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Output configuration for BatchTranslateText request. -message OutputConfig { - // Required. The destination of output. - oneof destination { - // Google Cloud Storage destination for output content. - // For every single input file (for example, gs://a/b/c.[extension]), we - // generate at most 2 * n output files. (n is the # of target_language_codes - // in the BatchTranslateTextRequest). - // - // Output files (tsv) generated are compliant with RFC 4180 except that - // record delimiters are '\n' instead of '\r\n'. We don't provide any way to - // change record delimiters. - // - // While the input files are being processed, we write/update an index file - // 'index.csv' under 'output_uri_prefix' (for example, - // gs://translation-test/index.csv) The index file is generated/updated as - // new files are being translated. The format is: - // - // input_file,target_language_code,translations_file,errors_file, - // glossary_translations_file,glossary_errors_file - // - // input_file is one file we matched using gcs_source.input_uri. - // target_language_code is provided in the request. - // translations_file contains the translations. (details provided below) - // errors_file contains the errors during processing of the file. (details - // below). Both translations_file and errors_file could be empty - // strings if we have no content to output. - // glossary_translations_file and glossary_errors_file are always empty - // strings if the input_file is tsv. They could also be empty if we have no - // content to output. - // - // Once a row is present in index.csv, the input/output matching never - // changes. Callers should also expect all the content in input_file are - // processed and ready to be consumed (that is, no partial output file is - // written). - // - // The format of translations_file (for target language code 'trg') is: - // gs://translation_test/a_b_c_'trg'_translations.[extension] - // - // If the input file extension is tsv, the output has the following - // columns: - // Column 1: ID of the request provided in the input, if it's not - // provided in the input, then the input row number is used (0-based). - // Column 2: source sentence. - // Column 3: translation without applying a glossary. Empty string if there - // is an error. - // Column 4 (only present if a glossary is provided in the request): - // translation after applying the glossary. Empty string if there is an - // error applying the glossary. Could be same string as column 3 if there is - // no glossary applied. - // - // If input file extension is a txt or html, the translation is directly - // written to the output file. If glossary is requested, a separate - // glossary_translations_file has format of - // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] - // - // The format of errors file (for target language code 'trg') is: - // gs://translation_test/a_b_c_'trg'_errors.[extension] - // - // If the input file extension is tsv, errors_file contains the following: - // Column 1: ID of the request provided in the input, if it's not - // provided in the input, then the input row number is used (0-based). - // Column 2: source sentence. - // Column 3: Error detail for the translation. Could be empty. - // Column 4 (only present if a glossary is provided in the request): - // Error when applying the glossary. - // - // If the input file extension is txt or html, glossary_error_file will be - // generated that contains error details. glossary_error_file has format of - // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] - GcsDestination gcs_destination = 1; - } -} - -// The batch translation request. -message BatchTranslateTextRequest { - // Required. Location to make a call. Must refer to a caller's project. - // - // Format: `projects/{project-id}/locations/{location-id}`. - // - // The `global` location is not supported for batch translation. - // - // Only AutoML Translation models or glossaries within the same region (have - // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - // error is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Source language code. - string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify up to 10 language codes here. - repeated string target_language_codes = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The models to use for translation. Map's key is target language - // code. Map's value is model name. Value can be a built-in general model, - // or an AutoML Translation model. - // - // The value format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // If the map is empty or a specific model is - // not requested for a language pair, then default google model (nmt) is used. - map models = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Input configurations. - // The total number of files matched should be <= 1000. - // The total content size should be <= 100M Unicode codepoints. - // The files must use UTF-8 encoding. - repeated InputConfig input_configs = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Output configuration. - // If 2 input configs match to the same file (that is, same input path), - // we don't generate output for duplicate inputs. - OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Glossaries to be applied for translation. - // It's keyed by target language code. - map glossaries = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// State metadata for the batch translation operation. -message BatchTranslateMetadata { - // State of the job. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The batch is processed, and at least one item was successfully - // processed. - SUCCEEDED = 2; - - // The batch is done and no item was successfully processed. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The batch is done after the user has called the - // longrunning.Operations.CancelOperation. Any records processed before the - // cancel command are output as specified in the request. - CANCELLED = 5; - } - - // The state of the operation. - State state = 1; - - // Number of successfully translated characters so far (Unicode codepoints). - int64 translated_characters = 2; - - // Number of characters that have failed to process so far (Unicode - // codepoints). - int64 failed_characters = 3; - - // Total number of characters (Unicode codepoints). - // This is the total number of codepoints from input files times the number of - // target languages and appears here shortly after the call is submitted. - int64 total_characters = 4; - - // Time when the operation was submitted. - google.protobuf.Timestamp submit_time = 5; -} - -// Stored in the [google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by -// BatchTranslateText if at least one sentence is translated successfully. -message BatchTranslateResponse { - // Total number of characters (Unicode codepoints). - int64 total_characters = 1; - - // Number of successfully translated characters (Unicode codepoints). - int64 translated_characters = 2; - - // Number of characters that have failed to process (Unicode codepoints). - int64 failed_characters = 3; - - // Time when the operation was submitted. - google.protobuf.Timestamp submit_time = 4; - - // The time when the operation is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. - google.protobuf.Timestamp end_time = 5; -} - -// Input configuration for glossaries. -message GlossaryInputConfig { - // Required. Specify the input. - oneof source { - // Required. Google Cloud Storage location of glossary data. - // File format is determined based on the filename extension. API returns - // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - // formats. Wildcards are not allowed. This must be a single file in one of - // the following formats: - // - // For unidirectional glossaries: - // - // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. - // The first column is source text. The second column is target text. - // The file must not contain headers. That is, the first row is data, not - // column names. - // - // - TMX (`.tmx`): TMX file with parallel data defining source/target term - // pairs. - // - // For equivalent term sets glossaries: - // - // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - // in multiple languages. The format is defined for Google Translation - // Toolkit and documented in [Use a - // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). - GcsSource gcs_source = 1; - } -} - -// Represents a glossary built from user provided data. -message Glossary { - option (google.api.resource) = { - type: "translate.googleapis.com/Glossary" - pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" - }; - - // Used with unidirectional glossaries. - message LanguageCodePair { - // Required. The BCP-47 language code of the input text, for example, - // "en-US". Expected to be an exact match for GlossaryTerm.language_code. - string source_language_code = 1; - - // Required. The BCP-47 language code for translation output, for example, - // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - string target_language_code = 2; - } - - // Used with equivalent term set glossaries. - message LanguageCodesSet { - // The BCP-47 language code(s) for terms defined in the glossary. - // All entries are unique. The list contains at least two entries. - // Expected to be an exact match for GlossaryTerm.language_code. - repeated string language_codes = 1; - } - - // Required. The resource name of the glossary. Glossary names have the form - // `projects/{project-id}/locations/{location-id}/glossaries/{glossary-id}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Languages supported by the glossary. - oneof languages { - // Used with unidirectional glossaries. - LanguageCodePair language_pair = 3; - - // Used with equivalent term set glossaries. - LanguageCodesSet language_codes_set = 4; - } - - // Required. Provides examples to build the glossary from. - // Total glossary must not exceed 10M Unicode codepoints. - GlossaryInputConfig input_config = 5; - - // Output only. The number of entries defined in the glossary. - int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When CreateGlossary was called. - google.protobuf.Timestamp submit_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the glossary creation was finished. - google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for CreateGlossary. -message CreateGlossaryRequest { - // Required. The project name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The glossary to create. - Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for GetGlossary. -message GetGlossaryRequest { - // Required. The name of the glossary to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "translate.googleapis.com/Glossary" - } - ]; -} - -// Request message for DeleteGlossary. -message DeleteGlossaryRequest { - // Required. The name of the glossary to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "translate.googleapis.com/Glossary" - } - ]; -} - -// Request message for ListGlossaries. -message ListGlossariesRequest { - // Required. The name of the project from which to list all of the glossaries. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Requested page size. The server may return fewer glossaries than - // requested. If unspecified, the server picks an appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token identifying a page of results the server should return. - // Typically, this is the value of [ListGlossariesResponse.next_page_token] - // returned from the previous call to `ListGlossaries` method. - // The first page is returned if `page_token`is empty or missing. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter specifying constraints of a list operation. - // Filtering is not supported yet, and the parameter currently has no effect. - // If missing, no filtering is performed. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListGlossaries. -message ListGlossariesResponse { - // The list of glossaries for a project. - repeated Glossary glossaries = 1; - - // A token to retrieve a page of results. Pass this value in the - // [ListGlossariesRequest.page_token] field in the subsequent call to - // `ListGlossaries` method to retrieve the next page of results. - string next_page_token = 2; -} - -// Stored in the [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] field returned by -// CreateGlossary. -message CreateGlossaryMetadata { - // Enumerates the possible states that the creation request can be in. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The glossary was successfully created. - SUCCEEDED = 2; - - // Failed to create the glossary. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The glossary creation request was successfully canceled. - CANCELLED = 5; - } - - // The name of the glossary that is being created. - string name = 1; - - // The current state of the glossary creation operation. - State state = 2; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 3; -} - -// Stored in the [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] field returned by -// DeleteGlossary. -message DeleteGlossaryMetadata { - // Enumerates the possible states that the creation request can be in. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The glossary was successfully deleted. - SUCCEEDED = 2; - - // Failed to delete the glossary. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The glossary deletion request was successfully canceled. - CANCELLED = 5; - } - - // The name of the glossary that is being deleted. - string name = 1; - - // The current state of the glossary deletion operation. - State state = 2; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 3; -} - -// Stored in the [google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by -// DeleteGlossary. -message DeleteGlossaryResponse { - // The name of the deleted glossary. - string name = 1; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 2; - - // The time when the glossary deletion is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. - google.protobuf.Timestamp end_time = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline deleted file mode 100644 index 9cf4dc5b7323..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline +++ /dev/null @@ -1,431 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-translation", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.translation.v3beta1", - "version": "v3beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "translate_v3beta1_generated_TranslationService_TranslateText_async", - "title": "TranslationService translateText Sample", - "origin": "API_DEFINITION", - "description": " Translates input text and returns translated text.", - "canonical": true, - "file": "translation_service.translate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 117, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", - "async": true, - "parameters": [ - { - "name": "contents", - "type": "TYPE_STRING[]" - }, - { - "name": "mime_type", - "type": "TYPE_STRING" - }, - { - "name": "source_language_code", - "type": "TYPE_STRING" - }, - { - "name": "target_language_code", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - }, - { - "name": "glossary_config", - "type": ".google.cloud.translation.v3beta1.TranslateTextGlossaryConfig" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.translation.v3beta1.TranslateTextResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "TranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_DetectLanguage_async", - "title": "TranslationService detectLanguage Sample", - "origin": "API_DEFINITION", - "description": " Detects the language of text within a request.", - "canonical": true, - "file": "translation_service.detect_language.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetectLanguage", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - }, - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "mime_type", - "type": "TYPE_STRING" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.translation.v3beta1.DetectLanguageResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "DetectLanguage", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async", - "title": "TranslationService getSupportedLanguages Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of supported languages for translation.", - "canonical": true, - "file": "translation_service.get_supported_languages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSupportedLanguages", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "display_language_code", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.SupportedLanguages", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "GetSupportedLanguages", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateText_async", - "title": "TranslationService batchTranslateText Sample", - "origin": "API_DEFINITION", - "description": " Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", - "canonical": true, - "file": "translation_service.batch_translate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 112, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchTranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source_language_code", - "type": "TYPE_STRING" - }, - { - "name": "target_language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "models", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "input_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "output_config", - "type": ".google.cloud.translation.v3beta1.OutputConfig" - }, - { - "name": "glossaries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "BatchTranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_CreateGlossary_async", - "title": "TranslationService createGlossary Sample", - "origin": "API_DEFINITION", - "description": " Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.", - "canonical": true, - "file": "translation_service.create_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "glossary", - "type": ".google.cloud.translation.v3beta1.Glossary" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "CreateGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_ListGlossaries_async", - "title": "TranslationService listGlossaries Sample", - "origin": "API_DEFINITION", - "description": " Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.", - "canonical": true, - "file": "translation_service.list_glossaries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGlossaries", - "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.ListGlossariesResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "ListGlossaries", - "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_GetGlossary_async", - "title": "TranslationService getGlossary Sample", - "origin": "API_DEFINITION", - "description": " Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.", - "canonical": true, - "file": "translation_service.get_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.Glossary", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "GetGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_DeleteGlossary_async", - "title": "TranslationService deleteGlossary Sample", - "origin": "API_DEFINITION", - "description": " Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.", - "canonical": true, - "file": "translation_service.delete_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "DeleteGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline deleted file mode 100644 index f01ba73e9878..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { - // [START translate_v3beta1_generated_TranslationService_BatchTranslateText_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - */ - // const parent = 'abc123' - /** - * Required. Source language code. - */ - // const sourceLanguageCode = 'abc123' - /** - * Required. Specify up to 10 language codes here. - */ - // const targetLanguageCodes = ['abc','def'] - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - */ - // const models = [1,2,3,4] - /** - * Required. Input configurations. - * The total number of files matched should be <= 1000. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - */ - // const inputConfigs = [1,2,3,4] - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - */ - // const outputConfig = {} - /** - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - */ - // const glossaries = [1,2,3,4] - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callBatchTranslateText() { - // Construct request - const request = { - parent, - sourceLanguageCode, - targetLanguageCodes, - inputConfigs, - outputConfig, - }; - - // Run request - const [operation] = await translationClient.batchTranslateText(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchTranslateText(); - // [END translate_v3beta1_generated_TranslationService_BatchTranslateText_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.create_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.create_glossary.js.baseline deleted file mode 100644 index 0ecb9344326d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.create_glossary.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, glossary) { - // [START translate_v3beta1_generated_TranslationService_CreateGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project name. - */ - // const parent = 'abc123' - /** - * Required. The glossary to create. - */ - // const glossary = {} - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callCreateGlossary() { - // Construct request - const request = { - parent, - glossary, - }; - - // Run request - const [operation] = await translationClient.createGlossary(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateGlossary(); - // [END translate_v3beta1_generated_TranslationService_CreateGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline deleted file mode 100644 index e2bc4aaba52b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START translate_v3beta1_generated_TranslationService_DeleteGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the glossary to delete. - */ - // const name = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callDeleteGlossary() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await translationClient.deleteGlossary(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteGlossary(); - // [END translate_v3beta1_generated_TranslationService_DeleteGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.detect_language.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.detect_language.js.baseline deleted file mode 100644 index a65cca62d522..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.detect_language.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_DetectLanguage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}/locations/{location-id}` or - * `projects/{project-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The language detection model to be used. - * Format: - * `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - */ - // const model = 'abc123' - /** - * The content of the input stored as a string. - */ - // const content = 'abc123' - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - */ - // const mimeType = 'abc123' - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callDetectLanguage() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await translationClient.detectLanguage(request); - console.log(response); - } - - callDetectLanguage(); - // [END translate_v3beta1_generated_TranslationService_DetectLanguage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_glossary.js.baseline deleted file mode 100644 index a67a39816e51..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_glossary.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START translate_v3beta1_generated_TranslationService_GetGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the glossary to retrieve. - */ - // const name = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callGetGlossary() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await translationClient.getGlossary(request); - console.log(response); - } - - callGetGlossary(); - // [END translate_v3beta1_generated_TranslationService_GetGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline deleted file mode 100644 index 9f4f6eae598c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - */ - // const displayLanguageCode = 'abc123' - /** - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general base (PBMT) model. - */ - // const model = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callGetSupportedLanguages() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await translationClient.getSupportedLanguages(request); - console.log(response); - } - - callGetSupportedLanguages(); - // [END translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline deleted file mode 100644 index 1a2d0b5695c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_ListGlossaries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project from which to list all of the glossaries. - */ - // const parent = 'abc123' - /** - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of ListGlossariesResponse.next_page_token - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - */ - // const pageToken = 'abc123' - /** - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - */ - // const filter = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callListGlossaries() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = translationClient.listGlossariesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGlossaries(); - // [END translate_v3beta1_generated_TranslationService_ListGlossaries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.translate_text.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.translate_text.js.baseline deleted file mode 100644 index f58fdf14caf7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/samples/generated/v3beta1/translation_service.translate_text.js.baseline +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(contents, targetLanguageCode, parent) { - // [START translate_v3beta1_generated_TranslationService_TranslateText_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. - * Use BatchTranslateText for larger text. - */ - // const contents = ['abc','def'] - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - */ - // const mimeType = 'abc123' - /** - * Optional. The BCP-47 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - */ - // const sourceLanguageCode = 'abc123' - /** - * Required. The BCP-47 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - */ - // const targetLanguageCode = 'abc123' - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-id}/locations/global/models/general/nmt`. - * If missing, the system decides which google base model to use. - */ - // const model = 'abc123' - /** - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - */ - // const glossaryConfig = {} - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callTranslateText() { - // Construct request - const request = { - contents, - targetLanguageCode, - parent, - }; - - // Run request - const response = await translationClient.translateText(request); - console.log(response); - } - - callTranslateText(); - // [END translate_v3beta1_generated_TranslationService_TranslateText_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/translate-esm/webpack.config.cjs.baseline deleted file mode 100644 index 3504dead08d9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TranslationService', - filename: './translation-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.OwlBot.yaml.baseline deleted file mode 100644 index 6d5a02b84a4c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/translation/google-cloud-translation-nodejs - dest: /owl-bot-staging/google-cloud-translation - -api-name: translation \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.jsdoc.js.baseline deleted file mode 100644 index 3867009c9fbe..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'translation', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/translate/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/translate/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/translate/README.md.baseline deleted file mode 100644 index 0410ab09ba8c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Translation: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/translation.svg)](https://www.npmjs.org/package/translation) - -Translation client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Translation Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/translation/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Translation API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install translation -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install translation@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=translate.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-translation diff --git a/core/generator/gapic-generator-typescript/baselines/translate/package.json b/core/generator/gapic-generator-typescript/baselines/translate/package.json deleted file mode 100644 index e04f1dc2d7bd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "translation", - "version": "0.1.0", - "description": "Translation client for Node.js", - "repository": "googleapis/nodejs-translation", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google translation", - "translation", - "translation service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline b/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline deleted file mode 100644 index 261671c6fd9f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/protos/google/cloud/translate/v3beta1/translation_service.proto.baseline +++ /dev/null @@ -1,902 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -syntax = "proto3"; - -package google.cloud.translation.v3beta1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.Translate.V3Beta1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1;translate"; -option java_multiple_files = true; -option java_outer_classname = "TranslationServiceProto"; -option java_package = "com.google.cloud.translate.v3beta1"; -option php_namespace = "Google\\Cloud\\Translate\\V3beta1"; -option ruby_package = "Google::Cloud::Translate::V3beta1"; - -// Proto file for the Cloud Translation API (v3beta1). - -// Provides natural language translation operations. -service TranslationService { - option (google.api.default_host) = "translate.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloud-translation"; - - // Translates input text and returns translated text. - rpc TranslateText(TranslateTextRequest) returns (TranslateTextResponse) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:translateText" - body: "*" - additional_bindings { - post: "/v3beta1/{parent=projects/*}:translateText" - body: "*" - } - }; - } - - // Detects the language of text within a request. - rpc DetectLanguage(DetectLanguageRequest) returns (DetectLanguageResponse) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:detectLanguage" - body: "*" - additional_bindings { - post: "/v3beta1/{parent=projects/*}:detectLanguage" - body: "*" - } - }; - option (google.api.method_signature) = "parent,model,mime_type"; - } - - // Returns a list of supported languages for translation. - rpc GetSupportedLanguages(GetSupportedLanguagesRequest) returns (SupportedLanguages) { - option (google.api.http) = { - get: "/v3beta1/{parent=projects/*/locations/*}/supportedLanguages" - additional_bindings { - get: "/v3beta1/{parent=projects/*}/supportedLanguages" - } - }; - option (google.api.method_signature) = "parent,display_language_code,model"; - } - - // Translates a large volume of text in asynchronous batch mode. - // This function provides real-time output as the inputs are being processed. - // If caller cancels a request, the partial results (for an input file, it's - // all or nothing) may still be available on the specified output location. - // - // This call returns immediately and you can - // use google.longrunning.Operation.name to poll the status of the call. - rpc BatchTranslateText(BatchTranslateTextRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}:batchTranslateText" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "BatchTranslateResponse" - metadata_type: "BatchTranslateMetadata" - }; - } - - // Creates a glossary and returns the long-running operation. Returns - // NOT_FOUND, if the project doesn't exist. - rpc CreateGlossary(CreateGlossaryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v3beta1/{parent=projects/*/locations/*}/glossaries" - body: "glossary" - }; - option (google.api.method_signature) = "parent,glossary"; - option (google.longrunning.operation_info) = { - response_type: "Glossary" - metadata_type: "CreateGlossaryMetadata" - }; - } - - // Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - // exist. - rpc ListGlossaries(ListGlossariesRequest) returns (ListGlossariesResponse) { - option (google.api.http) = { - get: "/v3beta1/{parent=projects/*/locations/*}/glossaries" - }; - option (google.api.method_signature) = "parent"; - option (google.api.method_signature) = "parent,filter"; - } - - // Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - // exist. - rpc GetGlossary(GetGlossaryRequest) returns (Glossary) { - option (google.api.http) = { - get: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Deletes a glossary, or cancels glossary construction - // if the glossary isn't created yet. - // Returns NOT_FOUND, if the glossary doesn't exist. - rpc DeleteGlossary(DeleteGlossaryRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v3beta1/{name=projects/*/locations/*/glossaries/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "DeleteGlossaryResponse" - metadata_type: "DeleteGlossaryMetadata" - }; - } -} - -// Configures which glossary should be used for a specific target language, -// and defines options for applying that glossary. -message TranslateTextGlossaryConfig { - // Required. Specifies the glossary used for this translation. Use - // this format: projects/*/locations/*/glossaries/* - string glossary = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Indicates match is case-insensitive. - // Default value is false if missing. - bool ignore_case = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The request message for synchronous translation. -message TranslateTextRequest { - // Required. The content of the input in string format. - // We recommend the total content be less than 30k codepoints. - // Use BatchTranslateText for larger text. - repeated string contents = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The format of the source text, for example, "text/html", - // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The BCP-47 language code of the input text if - // known, for example, "en-US" or "sr-Latn". Supported language codes are - // listed in Language Support. If the source language isn't specified, the API - // attempts to identify the source language automatically and returns the - // source language within the response. - string source_language_code = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The BCP-47 language code to use for translation of the input - // text, set to one of the language codes listed in Language Support. - string target_language_code = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}` or - // `projects/{project-id}/locations/{location-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Non-global location is required for requests using AutoML models or - // custom glossaries. - // - // Models and glossaries must be within the same region (have same - // location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 8 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The `model` type requested for this translation. - // - // The format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // For global (non-regionalized) requests, use `location-id` `global`. - // For example, - // `projects/{project-id}/locations/global/models/general/nmt`. - // - // If missing, the system decides which google base model to use. - string model = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Glossary to be applied. The glossary must be - // within the same region (have the same location-id) as the model, otherwise - // an INVALID_ARGUMENT (400) error is returned. - TranslateTextGlossaryConfig glossary_config = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 10 [(google.api.field_behavior) = OPTIONAL]; -} - -message TranslateTextResponse { - // Text translation responses with no glossary applied. - // This field has the same length as - // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. - repeated Translation translations = 1; - - // Text translation responses if a glossary is provided in the request. - // This can be the same as - // [`translations`][google.cloud.translation.v3beta1.TranslateTextResponse.translations] if no terms apply. - // This field has the same length as - // [`contents`][google.cloud.translation.v3beta1.TranslateTextRequest.contents]. - repeated Translation glossary_translations = 3; -} - -// A single translation response. -message Translation { - // Text translated into the target language. - string translated_text = 1; - - // Only present when `model` is present in the request. - // This is same as `model` provided in the request. - string model = 2; - - // The BCP-47 language code of source text in the initial request, detected - // automatically, if no source language was passed within the initial - // request. If the source language was passed, auto-detection of the language - // does not occur and this field is empty. - string detected_language_code = 4; - - // The `glossary_config` used for this translation. - TranslateTextGlossaryConfig glossary_config = 3; -} - -// The request message for language detection. -message DetectLanguageRequest { - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}/locations/{location-id}` or - // `projects/{project-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Only models within the same region (has same location-id) can be used. - // Otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 5 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The language detection model to be used. - // - // Format: - // `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - // - // Only one language detection model is currently supported: - // `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - // - // If not specified, the default model is used. - string model = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The source of the document from which to detect the language. - oneof source { - // The content of the input stored as a string. - string content = 1; - } - - // Optional. The format of the source text, for example, "text/html", - // "text/plain". If left blank, the MIME type defaults to "text/html". - string mime_type = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 6; -} - -// The response message for language detection. -message DetectedLanguage { - // The BCP-47 language code of source content in the request, detected - // automatically. - string language_code = 1; - - // The confidence of the detection result for this language. - float confidence = 2; -} - -// The response message for language detection. -message DetectLanguageResponse { - // A list of detected languages sorted by detection confidence in descending - // order. The most probable language first. - repeated DetectedLanguage languages = 1; -} - -// The request message for discovering supported languages. -message GetSupportedLanguagesRequest { - // Required. Project or location to make a call. Must refer to a caller's - // project. - // - // Format: `projects/{project-id}` or - // `projects/{project-id}/locations/{location-id}`. - // - // For global calls, use `projects/{project-id}/locations/global` or - // `projects/{project-id}`. - // - // Non-global location is required for AutoML models. - // - // Only models within the same region (have same location-id) can be used, - // otherwise an INVALID_ARGUMENT (400) error is returned. - string parent = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. The language to use to return localized, human readable names - // of supported languages. If missing, then display names are not returned - // in a response. - string display_language_code = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Get supported languages of this model. - // - // The format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // Returns languages supported by the specified model. - // If missing, we get supported languages of Google general base (PBMT) model. - string model = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// The response message for discovering supported languages. -message SupportedLanguages { - // A list of supported language responses. This list contains an entry - // for each language the Translation API supports. - repeated SupportedLanguage languages = 1; -} - -// A single supported language response corresponds to information related -// to one supported language. -message SupportedLanguage { - // Supported language code, generally consisting of its ISO 639-1 - // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes - // including language and region identifiers are returned (for example, - // 'zh-TW' and 'zh-CN') - string language_code = 1; - - // Human readable name of the language localized in the display language - // specified in the request. - string display_name = 2; - - // Can be used as source language. - bool support_source = 3; - - // Can be used as target language. - bool support_target = 4; -} - -// The Google Cloud Storage location for the input content. -message GcsSource { - // Required. Source data URI. For example, `gs://my_bucket/my_object`. - string input_uri = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Input configuration for BatchTranslateText request. -message InputConfig { - // Optional. Can be "text/plain" or "text/html". - // For `.tsv`, "text/html" is used if mime_type is missing. - // For `.html`, this field must be "text/html" or empty. - // For `.txt`, this field must be "text/plain" or empty. - string mime_type = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Specify the input. - oneof source { - // Required. Google Cloud Storage location for the source input. - // This can be a single file (for example, - // `gs://translation-test/input.tsv`) or a wildcard (for example, - // `gs://translation-test/*`). If a file extension is `.tsv`, it can - // contain either one or two columns. The first column (optional) is the id - // of the text request. If the first column is missing, we use the row - // number (0-based) from the input file as the ID in the output file. The - // second column is the actual text to be - // translated. We recommend each row be <= 10K Unicode codepoints, - // otherwise an error might be returned. - // Note that the input tsv must be RFC 4180 compliant. - // - // You could use https://github.com/Clever/csvlint to check potential - // formatting errors in your tsv file. - // csvlint --delimiter='\t' your_input_file.tsv - // - // The other supported file extensions are `.txt` or `.html`, which is - // treated as a single large chunk of text. - GcsSource gcs_source = 2; - } -} - -// The Google Cloud Storage location for the output content. -message GcsDestination { - // Required. There must be no files under 'output_uri_prefix'. - // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an - // INVALID_ARGUMENT (400) error is returned. - string output_uri_prefix = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Output configuration for BatchTranslateText request. -message OutputConfig { - // Required. The destination of output. - oneof destination { - // Google Cloud Storage destination for output content. - // For every single input file (for example, gs://a/b/c.[extension]), we - // generate at most 2 * n output files. (n is the # of target_language_codes - // in the BatchTranslateTextRequest). - // - // Output files (tsv) generated are compliant with RFC 4180 except that - // record delimiters are '\n' instead of '\r\n'. We don't provide any way to - // change record delimiters. - // - // While the input files are being processed, we write/update an index file - // 'index.csv' under 'output_uri_prefix' (for example, - // gs://translation-test/index.csv) The index file is generated/updated as - // new files are being translated. The format is: - // - // input_file,target_language_code,translations_file,errors_file, - // glossary_translations_file,glossary_errors_file - // - // input_file is one file we matched using gcs_source.input_uri. - // target_language_code is provided in the request. - // translations_file contains the translations. (details provided below) - // errors_file contains the errors during processing of the file. (details - // below). Both translations_file and errors_file could be empty - // strings if we have no content to output. - // glossary_translations_file and glossary_errors_file are always empty - // strings if the input_file is tsv. They could also be empty if we have no - // content to output. - // - // Once a row is present in index.csv, the input/output matching never - // changes. Callers should also expect all the content in input_file are - // processed and ready to be consumed (that is, no partial output file is - // written). - // - // The format of translations_file (for target language code 'trg') is: - // gs://translation_test/a_b_c_'trg'_translations.[extension] - // - // If the input file extension is tsv, the output has the following - // columns: - // Column 1: ID of the request provided in the input, if it's not - // provided in the input, then the input row number is used (0-based). - // Column 2: source sentence. - // Column 3: translation without applying a glossary. Empty string if there - // is an error. - // Column 4 (only present if a glossary is provided in the request): - // translation after applying the glossary. Empty string if there is an - // error applying the glossary. Could be same string as column 3 if there is - // no glossary applied. - // - // If input file extension is a txt or html, the translation is directly - // written to the output file. If glossary is requested, a separate - // glossary_translations_file has format of - // gs://translation_test/a_b_c_'trg'_glossary_translations.[extension] - // - // The format of errors file (for target language code 'trg') is: - // gs://translation_test/a_b_c_'trg'_errors.[extension] - // - // If the input file extension is tsv, errors_file contains the following: - // Column 1: ID of the request provided in the input, if it's not - // provided in the input, then the input row number is used (0-based). - // Column 2: source sentence. - // Column 3: Error detail for the translation. Could be empty. - // Column 4 (only present if a glossary is provided in the request): - // Error when applying the glossary. - // - // If the input file extension is txt or html, glossary_error_file will be - // generated that contains error details. glossary_error_file has format of - // gs://translation_test/a_b_c_'trg'_glossary_errors.[extension] - GcsDestination gcs_destination = 1; - } -} - -// The batch translation request. -message BatchTranslateTextRequest { - // Required. Location to make a call. Must refer to a caller's project. - // - // Format: `projects/{project-id}/locations/{location-id}`. - // - // The `global` location is not supported for batch translation. - // - // Only AutoML Translation models or glossaries within the same region (have - // the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - // error is returned. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Source language code. - string source_language_code = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specify up to 10 language codes here. - repeated string target_language_codes = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. The models to use for translation. Map's key is target language - // code. Map's value is model name. Value can be a built-in general model, - // or an AutoML Translation model. - // - // The value format depends on model type: - // - // - AutoML Translation models: - // `projects/{project-id}/locations/{location-id}/models/{model-id}` - // - // - General (built-in) models: - // `projects/{project-id}/locations/{location-id}/models/general/nmt`, - // `projects/{project-id}/locations/{location-id}/models/general/base` - // - // - // If the map is empty or a specific model is - // not requested for a language pair, then default google model (nmt) is used. - map models = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Input configurations. - // The total number of files matched should be <= 1000. - // The total content size should be <= 100M Unicode codepoints. - // The files must use UTF-8 encoding. - repeated InputConfig input_configs = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Output configuration. - // If 2 input configs match to the same file (that is, same input path), - // we don't generate output for duplicate inputs. - OutputConfig output_config = 6 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Glossaries to be applied for translation. - // It's keyed by target language code. - map glossaries = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The labels with user-defined metadata for the request. - // - // Label keys and values can be no longer than 63 characters - // (Unicode codepoints), can only contain lowercase letters, numeric - // characters, underscores and dashes. International characters are allowed. - // Label values are optional. Label keys must start with a letter. - // - // See https://cloud.google.com/translate/docs/labels for more information. - map labels = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// State metadata for the batch translation operation. -message BatchTranslateMetadata { - // State of the job. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The batch is processed, and at least one item was successfully - // processed. - SUCCEEDED = 2; - - // The batch is done and no item was successfully processed. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The batch is done after the user has called the - // longrunning.Operations.CancelOperation. Any records processed before the - // cancel command are output as specified in the request. - CANCELLED = 5; - } - - // The state of the operation. - State state = 1; - - // Number of successfully translated characters so far (Unicode codepoints). - int64 translated_characters = 2; - - // Number of characters that have failed to process so far (Unicode - // codepoints). - int64 failed_characters = 3; - - // Total number of characters (Unicode codepoints). - // This is the total number of codepoints from input files times the number of - // target languages and appears here shortly after the call is submitted. - int64 total_characters = 4; - - // Time when the operation was submitted. - google.protobuf.Timestamp submit_time = 5; -} - -// Stored in the [google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by -// BatchTranslateText if at least one sentence is translated successfully. -message BatchTranslateResponse { - // Total number of characters (Unicode codepoints). - int64 total_characters = 1; - - // Number of successfully translated characters (Unicode codepoints). - int64 translated_characters = 2; - - // Number of characters that have failed to process (Unicode codepoints). - int64 failed_characters = 3; - - // Time when the operation was submitted. - google.protobuf.Timestamp submit_time = 4; - - // The time when the operation is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. - google.protobuf.Timestamp end_time = 5; -} - -// Input configuration for glossaries. -message GlossaryInputConfig { - // Required. Specify the input. - oneof source { - // Required. Google Cloud Storage location of glossary data. - // File format is determined based on the filename extension. API returns - // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file - // formats. Wildcards are not allowed. This must be a single file in one of - // the following formats: - // - // For unidirectional glossaries: - // - // - TSV/CSV (`.tsv`/`.csv`): 2 column file, tab- or comma-separated. - // The first column is source text. The second column is target text. - // The file must not contain headers. That is, the first row is data, not - // column names. - // - // - TMX (`.tmx`): TMX file with parallel data defining source/target term - // pairs. - // - // For equivalent term sets glossaries: - // - // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms - // in multiple languages. The format is defined for Google Translation - // Toolkit and documented in [Use a - // glossary](https://support.google.com/translatortoolkit/answer/6306379?hl=en). - GcsSource gcs_source = 1; - } -} - -// Represents a glossary built from user provided data. -message Glossary { - option (google.api.resource) = { - type: "translate.googleapis.com/Glossary" - pattern: "projects/{project}/locations/{location}/glossaries/{glossary}" - }; - - // Used with unidirectional glossaries. - message LanguageCodePair { - // Required. The BCP-47 language code of the input text, for example, - // "en-US". Expected to be an exact match for GlossaryTerm.language_code. - string source_language_code = 1; - - // Required. The BCP-47 language code for translation output, for example, - // "zh-CN". Expected to be an exact match for GlossaryTerm.language_code. - string target_language_code = 2; - } - - // Used with equivalent term set glossaries. - message LanguageCodesSet { - // The BCP-47 language code(s) for terms defined in the glossary. - // All entries are unique. The list contains at least two entries. - // Expected to be an exact match for GlossaryTerm.language_code. - repeated string language_codes = 1; - } - - // Required. The resource name of the glossary. Glossary names have the form - // `projects/{project-id}/locations/{location-id}/glossaries/{glossary-id}`. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Languages supported by the glossary. - oneof languages { - // Used with unidirectional glossaries. - LanguageCodePair language_pair = 3; - - // Used with equivalent term set glossaries. - LanguageCodesSet language_codes_set = 4; - } - - // Required. Provides examples to build the glossary from. - // Total glossary must not exceed 10M Unicode codepoints. - GlossaryInputConfig input_config = 5; - - // Output only. The number of entries defined in the glossary. - int32 entry_count = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When CreateGlossary was called. - google.protobuf.Timestamp submit_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. When the glossary creation was finished. - google.protobuf.Timestamp end_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request message for CreateGlossary. -message CreateGlossaryRequest { - // Required. The project name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The glossary to create. - Glossary glossary = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for GetGlossary. -message GetGlossaryRequest { - // Required. The name of the glossary to retrieve. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "translate.googleapis.com/Glossary" - } - ]; -} - -// Request message for DeleteGlossary. -message DeleteGlossaryRequest { - // Required. The name of the glossary to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "translate.googleapis.com/Glossary" - } - ]; -} - -// Request message for ListGlossaries. -message ListGlossariesRequest { - // Required. The name of the project from which to list all of the glossaries. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Requested page size. The server may return fewer glossaries than - // requested. If unspecified, the server picks an appropriate default. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A token identifying a page of results the server should return. - // Typically, this is the value of [ListGlossariesResponse.next_page_token] - // returned from the previous call to `ListGlossaries` method. - // The first page is returned if `page_token`is empty or missing. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter specifying constraints of a list operation. - // Filtering is not supported yet, and the parameter currently has no effect. - // If missing, no filtering is performed. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for ListGlossaries. -message ListGlossariesResponse { - // The list of glossaries for a project. - repeated Glossary glossaries = 1; - - // A token to retrieve a page of results. Pass this value in the - // [ListGlossariesRequest.page_token] field in the subsequent call to - // `ListGlossaries` method to retrieve the next page of results. - string next_page_token = 2; -} - -// Stored in the [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] field returned by -// CreateGlossary. -message CreateGlossaryMetadata { - // Enumerates the possible states that the creation request can be in. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The glossary was successfully created. - SUCCEEDED = 2; - - // Failed to create the glossary. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The glossary creation request was successfully canceled. - CANCELLED = 5; - } - - // The name of the glossary that is being created. - string name = 1; - - // The current state of the glossary creation operation. - State state = 2; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 3; -} - -// Stored in the [google.longrunning.Operation.metadata][google.longrunning.Operation.metadata] field returned by -// DeleteGlossary. -message DeleteGlossaryMetadata { - // Enumerates the possible states that the creation request can be in. - enum State { - // Invalid. - STATE_UNSPECIFIED = 0; - - // Request is being processed. - RUNNING = 1; - - // The glossary was successfully deleted. - SUCCEEDED = 2; - - // Failed to delete the glossary. - FAILED = 3; - - // Request is in the process of being canceled after caller invoked - // longrunning.Operations.CancelOperation on the request id. - CANCELLING = 4; - - // The glossary deletion request was successfully canceled. - CANCELLED = 5; - } - - // The name of the glossary that is being deleted. - string name = 1; - - // The current state of the glossary deletion operation. - State state = 2; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 3; -} - -// Stored in the [google.longrunning.Operation.response][google.longrunning.Operation.response] field returned by -// DeleteGlossary. -message DeleteGlossaryResponse { - // The name of the deleted glossary. - string name = 1; - - // The time when the operation was submitted to the server. - google.protobuf.Timestamp submit_time = 2; - - // The time when the glossary deletion is finished and - // [google.longrunning.Operation.done][google.longrunning.Operation.done] is set to true. - google.protobuf.Timestamp end_time = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline deleted file mode 100644 index 9cf4dc5b7323..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/snippet_metadata_google.cloud.translation.v3beta1.json.baseline +++ /dev/null @@ -1,431 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-translation", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.translation.v3beta1", - "version": "v3beta1" - } - ] - }, - "snippets": [ - { - "regionTag": "translate_v3beta1_generated_TranslationService_TranslateText_async", - "title": "TranslationService translateText Sample", - "origin": "API_DEFINITION", - "description": " Translates input text and returns translated text.", - "canonical": true, - "file": "translation_service.translate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 117, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", - "async": true, - "parameters": [ - { - "name": "contents", - "type": "TYPE_STRING[]" - }, - { - "name": "mime_type", - "type": "TYPE_STRING" - }, - { - "name": "source_language_code", - "type": "TYPE_STRING" - }, - { - "name": "target_language_code", - "type": "TYPE_STRING" - }, - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - }, - { - "name": "glossary_config", - "type": ".google.cloud.translation.v3beta1.TranslateTextGlossaryConfig" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.translation.v3beta1.TranslateTextResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "TranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.TranslateText", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_DetectLanguage_async", - "title": "TranslationService detectLanguage Sample", - "origin": "API_DEFINITION", - "description": " Detects the language of text within a request.", - "canonical": true, - "file": "translation_service.detect_language.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DetectLanguage", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - }, - { - "name": "content", - "type": "TYPE_STRING" - }, - { - "name": "mime_type", - "type": "TYPE_STRING" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.translation.v3beta1.DetectLanguageResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "DetectLanguage", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DetectLanguage", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async", - "title": "TranslationService getSupportedLanguages Sample", - "origin": "API_DEFINITION", - "description": " Returns a list of supported languages for translation.", - "canonical": true, - "file": "translation_service.get_supported_languages.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSupportedLanguages", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "display_language_code", - "type": "TYPE_STRING" - }, - { - "name": "model", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.SupportedLanguages", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "GetSupportedLanguages", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetSupportedLanguages", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_BatchTranslateText_async", - "title": "TranslationService batchTranslateText Sample", - "origin": "API_DEFINITION", - "description": " Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.", - "canonical": true, - "file": "translation_service.batch_translate_text.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 112, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "BatchTranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source_language_code", - "type": "TYPE_STRING" - }, - { - "name": "target_language_codes", - "type": "TYPE_STRING[]" - }, - { - "name": "models", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "input_configs", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "output_config", - "type": ".google.cloud.translation.v3beta1.OutputConfig" - }, - { - "name": "glossaries", - "type": "TYPE_MESSAGE[]" - }, - { - "name": "labels", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "BatchTranslateText", - "fullName": "google.cloud.translation.v3beta1.TranslationService.BatchTranslateText", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_CreateGlossary_async", - "title": "TranslationService createGlossary Sample", - "origin": "API_DEFINITION", - "description": " Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.", - "canonical": true, - "file": "translation_service.create_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "glossary", - "type": ".google.cloud.translation.v3beta1.Glossary" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "CreateGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.CreateGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_ListGlossaries_async", - "title": "TranslationService listGlossaries Sample", - "origin": "API_DEFINITION", - "description": " Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.", - "canonical": true, - "file": "translation_service.list_glossaries.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListGlossaries", - "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.ListGlossariesResponse", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "ListGlossaries", - "fullName": "google.cloud.translation.v3beta1.TranslationService.ListGlossaries", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_GetGlossary_async", - "title": "TranslationService getGlossary Sample", - "origin": "API_DEFINITION", - "description": " Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.", - "canonical": true, - "file": "translation_service.get_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.translation.v3beta1.Glossary", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "GetGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.GetGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - }, - { - "regionTag": "translate_v3beta1_generated_TranslationService_DeleteGlossary_async", - "title": "TranslationService deleteGlossary Sample", - "origin": "API_DEFINITION", - "description": " Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.", - "canonical": true, - "file": "translation_service.delete_glossary.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "TranslationServiceClient", - "fullName": "google.cloud.translation.v3beta1.TranslationServiceClient" - }, - "method": { - "shortName": "DeleteGlossary", - "fullName": "google.cloud.translation.v3beta1.TranslationService.DeleteGlossary", - "service": { - "shortName": "TranslationService", - "fullName": "google.cloud.translation.v3beta1.TranslationService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline deleted file mode 100644 index f01ba73e9878..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.batch_translate_text.js.baseline +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, sourceLanguageCode, targetLanguageCodes, inputConfigs, outputConfig) { - // [START translate_v3beta1_generated_TranslationService_BatchTranslateText_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Location to make a call. Must refer to a caller's project. - * Format: `projects/{project-id}/locations/{location-id}`. - * The `global` location is not supported for batch translation. - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - */ - // const parent = 'abc123' - /** - * Required. Source language code. - */ - // const sourceLanguageCode = 'abc123' - /** - * Required. Specify up to 10 language codes here. - */ - // const targetLanguageCodes = ['abc','def'] - /** - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * The value format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - */ - // const models = [1,2,3,4] - /** - * Required. Input configurations. - * The total number of files matched should be <= 1000. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - */ - // const inputConfigs = [1,2,3,4] - /** - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - */ - // const outputConfig = {} - /** - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - */ - // const glossaries = [1,2,3,4] - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callBatchTranslateText() { - // Construct request - const request = { - parent, - sourceLanguageCode, - targetLanguageCodes, - inputConfigs, - outputConfig, - }; - - // Run request - const [operation] = await translationClient.batchTranslateText(request); - const [response] = await operation.promise(); - console.log(response); - } - - callBatchTranslateText(); - // [END translate_v3beta1_generated_TranslationService_BatchTranslateText_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.create_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.create_glossary.js.baseline deleted file mode 100644 index 0ecb9344326d..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.create_glossary.js.baseline +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent, glossary) { - // [START translate_v3beta1_generated_TranslationService_CreateGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The project name. - */ - // const parent = 'abc123' - /** - * Required. The glossary to create. - */ - // const glossary = {} - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callCreateGlossary() { - // Construct request - const request = { - parent, - glossary, - }; - - // Run request - const [operation] = await translationClient.createGlossary(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateGlossary(); - // [END translate_v3beta1_generated_TranslationService_CreateGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline deleted file mode 100644 index e2bc4aaba52b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.delete_glossary.js.baseline +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START translate_v3beta1_generated_TranslationService_DeleteGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the glossary to delete. - */ - // const name = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callDeleteGlossary() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await translationClient.deleteGlossary(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteGlossary(); - // [END translate_v3beta1_generated_TranslationService_DeleteGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.detect_language.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.detect_language.js.baseline deleted file mode 100644 index a65cca62d522..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.detect_language.js.baseline +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_DetectLanguage_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}/locations/{location-id}` or - * `projects/{project-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The language detection model to be used. - * Format: - * `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - * Only one language detection model is currently supported: - * `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - * If not specified, the default model is used. - */ - // const model = 'abc123' - /** - * The content of the input stored as a string. - */ - // const content = 'abc123' - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - */ - // const mimeType = 'abc123' - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callDetectLanguage() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await translationClient.detectLanguage(request); - console.log(response); - } - - callDetectLanguage(); - // [END translate_v3beta1_generated_TranslationService_DetectLanguage_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_glossary.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_glossary.js.baseline deleted file mode 100644 index a67a39816e51..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_glossary.js.baseline +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(name) { - // [START translate_v3beta1_generated_TranslationService_GetGlossary_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the glossary to retrieve. - */ - // const name = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callGetGlossary() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await translationClient.getGlossary(request); - console.log(response); - } - - callGetGlossary(); - // [END translate_v3beta1_generated_TranslationService_GetGlossary_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline deleted file mode 100644 index 9f4f6eae598c..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.get_supported_languages.js.baseline +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Non-global location is required for AutoML models. - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - */ - // const displayLanguageCode = 'abc123' - /** - * Optional. Get supported languages of this model. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general base (PBMT) model. - */ - // const model = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callGetSupportedLanguages() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await translationClient.getSupportedLanguages(request); - console.log(response); - } - - callGetSupportedLanguages(); - // [END translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline deleted file mode 100644 index 1a2d0b5695c0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.list_glossaries.js.baseline +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(parent) { - // [START translate_v3beta1_generated_TranslationService_ListGlossaries_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the project from which to list all of the glossaries. - */ - // const parent = 'abc123' - /** - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - */ - // const pageSize = 1234 - /** - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of ListGlossariesResponse.next_page_token - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - */ - // const pageToken = 'abc123' - /** - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - */ - // const filter = 'abc123' - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callListGlossaries() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = translationClient.listGlossariesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListGlossaries(); - // [END translate_v3beta1_generated_TranslationService_ListGlossaries_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.translate_text.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.translate_text.js.baseline deleted file mode 100644 index f58fdf14caf7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/samples/generated/v3beta1/translation_service.translate_text.js.baseline +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(contents, targetLanguageCode, parent) { - // [START translate_v3beta1_generated_TranslationService_TranslateText_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. - * Use BatchTranslateText for larger text. - */ - // const contents = ['abc','def'] - /** - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - */ - // const mimeType = 'abc123' - /** - * Optional. The BCP-47 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - */ - // const sourceLanguageCode = 'abc123' - /** - * Required. The BCP-47 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - */ - // const targetLanguageCode = 'abc123' - /** - * Required. Project or location to make a call. Must refer to a caller's - * project. - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - */ - // const parent = 'abc123' - /** - * Optional. The `model` type requested for this translation. - * The format depends on model type: - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-id}/locations/global/models/general/nmt`. - * If missing, the system decides which google base model to use. - */ - // const model = 'abc123' - /** - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - */ - // const glossaryConfig = {} - /** - * Optional. The labels with user-defined metadata for the request. - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * See https://cloud.google.com/translate/docs/labels for more information. - */ - // const labels = [1,2,3,4] - - // Imports the Translation library - const {TranslationServiceClient} = require('translation').v3beta1; - - // Instantiates a client - const translationClient = new TranslationServiceClient(); - - async function callTranslateText() { - // Construct request - const request = { - contents, - targetLanguageCode, - parent, - }; - - // Run request - const response = await translationClient.translateText(request); - console.log(response); - } - - callTranslateText(); - // [END translate_v3beta1_generated_TranslationService_TranslateText_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/src/index.ts.baseline deleted file mode 100644 index 85f2bdbd874b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v3beta1 from './v3beta1'; -const TranslationServiceClient = v3beta1.TranslationServiceClient; -type TranslationServiceClient = v3beta1.TranslationServiceClient; -export {v3beta1, TranslationServiceClient}; -export default {v3beta1, TranslationServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/index.ts.baseline deleted file mode 100644 index f4c9d9326e98..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {TranslationServiceClient} from './translation_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client.ts.baseline deleted file mode 100644 index e8f0779587f1..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client.ts.baseline +++ /dev/null @@ -1,1590 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v3beta1/translation_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './translation_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Provides natural language translation operations. - * @class - * @memberof v3beta1 - */ -export class TranslationServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('translation'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - translationServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of TranslationServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 TranslationServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof TranslationServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'translate.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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 = { - glossaryPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/glossaries/{glossary}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - }; - - // 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 = { - listGlossaries: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'glossaries') - }; - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const batchTranslateTextResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.BatchTranslateResponse') as gax.protobuf.Type; - const batchTranslateTextMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.BatchTranslateMetadata') as gax.protobuf.Type; - const createGlossaryResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.Glossary') as gax.protobuf.Type; - const createGlossaryMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.CreateGlossaryMetadata') as gax.protobuf.Type; - const deleteGlossaryResponse = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.DeleteGlossaryResponse') as gax.protobuf.Type; - const deleteGlossaryMetadata = protoFilesRoot.lookup( - '.google.cloud.translation.v3beta1.DeleteGlossaryMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - batchTranslateText: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - batchTranslateTextResponse.decode.bind(batchTranslateTextResponse), - batchTranslateTextMetadata.decode.bind(batchTranslateTextMetadata)), - createGlossary: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createGlossaryResponse.decode.bind(createGlossaryResponse), - createGlossaryMetadata.decode.bind(createGlossaryMetadata)), - deleteGlossary: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteGlossaryResponse.decode.bind(deleteGlossaryResponse), - deleteGlossaryMetadata.decode.bind(deleteGlossaryMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.translation.v3beta1.TranslationService', gapicConfig as gax.ClientConfig, - 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.translationServiceStub) { - return this.translationServiceStub; - } - - // Put together the "service stub" for - // google.cloud.translation.v3beta1.TranslationService. - this.translationServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.translation.v3beta1.TranslationService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.translation.v3beta1.TranslationService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const translationServiceStubMethods = - ['translateText', 'detectLanguage', 'getSupportedLanguages', 'batchTranslateText', 'createGlossary', 'listGlossaries', 'getGlossary', 'deleteGlossary']; - for (const methodName of translationServiceStubMethods) { - const callPromise = this.translationServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.translationServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'translate.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'translate.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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', - 'https://www.googleapis.com/auth/cloud-translation' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Translates input text and returns translated text. - * - * @param {Object} request - * The request object that will be sent. - * @param {string[]} request.contents - * Required. The content of the input in string format. - * We recommend the total content be less than 30k codepoints. - * Use BatchTranslateText for larger text. - * @param {string} [request.mimeType] - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @param {string} [request.sourceLanguageCode] - * Optional. The BCP-47 language code of the input text if - * known, for example, "en-US" or "sr-Latn". Supported language codes are - * listed in Language Support. If the source language isn't specified, the API - * attempts to identify the source language automatically and returns the - * source language within the response. - * @param {string} request.targetLanguageCode - * Required. The BCP-47 language code to use for translation of the input - * text, set to one of the language codes listed in Language Support. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Non-global location is required for requests using AutoML models or - * custom glossaries. - * - * Models and glossaries must be within the same region (have same - * location-id), otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.model] - * Optional. The `model` type requested for this translation. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * For global (non-regionalized) requests, use `location-id` `global`. - * For example, - * `projects/{project-id}/locations/global/models/general/nmt`. - * - * If missing, the system decides which google base model to use. - * @param {google.cloud.translation.v3beta1.TranslateTextGlossaryConfig} [request.glossaryConfig] - * Optional. Glossary to be applied. The glossary must be - * within the same region (have the same location-id) as the model, otherwise - * an INVALID_ARGUMENT (400) error is returned. - * @param {number[]} [request.labels] - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 {@link protos.google.cloud.translation.v3beta1.TranslateTextResponse|TranslateTextResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_TranslateText_async - */ - translateText( - request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, {}|undefined - ]>; - translateText( - request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): void; - translateText( - request: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): void; - translateText( - request?: protos.google.cloud.translation.v3beta1.ITranslateTextRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('translateText request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('translateText response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.translateText(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.ITranslateTextResponse, - protos.google.cloud.translation.v3beta1.ITranslateTextRequest|undefined, - {}|undefined - ]) => { - this._log.info('translateText response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Detects the language of text within a request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}/locations/{location-id}` or - * `projects/{project-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Only models within the same region (has same location-id) can be used. - * Otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.model] - * Optional. The language detection model to be used. - * - * Format: - * `projects/{project-id}/locations/{location-id}/models/language-detection/{model-id}` - * - * Only one language detection model is currently supported: - * `projects/{project-id}/locations/{location-id}/models/language-detection/default`. - * - * If not specified, the default model is used. - * @param {string} request.content - * The content of the input stored as a string. - * @param {string} [request.mimeType] - * Optional. The format of the source text, for example, "text/html", - * "text/plain". If left blank, the MIME type defaults to "text/html". - * @param {number[]} request.labels - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 {@link protos.google.cloud.translation.v3beta1.DetectLanguageResponse|DetectLanguageResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.detect_language.js - * region_tag:translate_v3beta1_generated_TranslationService_DetectLanguage_async - */ - detectLanguage( - request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, {}|undefined - ]>; - detectLanguage( - request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): void; - detectLanguage( - request: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): void; - detectLanguage( - request?: protos.google.cloud.translation.v3beta1.IDetectLanguageRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('detectLanguage request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('detectLanguage response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.detectLanguage(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.IDetectLanguageResponse, - protos.google.cloud.translation.v3beta1.IDetectLanguageRequest|undefined, - {}|undefined - ]) => { - this._log.info('detectLanguage response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Returns a list of supported languages for translation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Project or location to make a call. Must refer to a caller's - * project. - * - * Format: `projects/{project-id}` or - * `projects/{project-id}/locations/{location-id}`. - * - * For global calls, use `projects/{project-id}/locations/global` or - * `projects/{project-id}`. - * - * Non-global location is required for AutoML models. - * - * Only models within the same region (have same location-id) can be used, - * otherwise an INVALID_ARGUMENT (400) error is returned. - * @param {string} [request.displayLanguageCode] - * Optional. The language to use to return localized, human readable names - * of supported languages. If missing, then display names are not returned - * in a response. - * @param {string} [request.model] - * Optional. Get supported languages of this model. - * - * The format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * Returns languages supported by the specified model. - * If missing, we get supported languages of Google general base (PBMT) model. - * @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 {@link protos.google.cloud.translation.v3beta1.SupportedLanguages|SupportedLanguages}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.get_supported_languages.js - * region_tag:translate_v3beta1_generated_TranslationService_GetSupportedLanguages_async - */ - getSupportedLanguages( - request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, {}|undefined - ]>; - getSupportedLanguages( - request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): void; - getSupportedLanguages( - request: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): void; - getSupportedLanguages( - request?: protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getSupportedLanguages request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getSupportedLanguages response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getSupportedLanguages(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.ISupportedLanguages, - protos.google.cloud.translation.v3beta1.IGetSupportedLanguagesRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSupportedLanguages response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } -/** - * Gets a glossary. Returns NOT_FOUND, if the glossary doesn't - * exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the glossary to retrieve. - * @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 {@link protos.google.cloud.translation.v3beta1.Glossary|Glossary}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.get_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_GetGlossary_async - */ - getGlossary( - request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, {}|undefined - ]>; - getGlossary( - request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): void; - getGlossary( - request: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - callback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): void; - getGlossary( - request?: protos.google.cloud.translation.v3beta1.IGetGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - this._log.info('getGlossary request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getGlossary response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls.getGlossary(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.translation.v3beta1.IGlossary, - protos.google.cloud.translation.v3beta1.IGetGlossaryRequest|undefined, - {}|undefined - ]) => { - this._log.info('getGlossary response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); - } - throw error; - }); - } - -/** - * Translates a large volume of text in asynchronous batch mode. - * This function provides real-time output as the inputs are being processed. - * If caller cancels a request, the partial results (for an input file, it's - * all or nothing) may still be available on the specified output location. - * - * This call returns immediately and you can - * use google.longrunning.Operation.name to poll the status of the call. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. Location to make a call. Must refer to a caller's project. - * - * Format: `projects/{project-id}/locations/{location-id}`. - * - * The `global` location is not supported for batch translation. - * - * Only AutoML Translation models or glossaries within the same region (have - * the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) - * error is returned. - * @param {string} request.sourceLanguageCode - * Required. Source language code. - * @param {string[]} request.targetLanguageCodes - * Required. Specify up to 10 language codes here. - * @param {number[]} [request.models] - * Optional. The models to use for translation. Map's key is target language - * code. Map's value is model name. Value can be a built-in general model, - * or an AutoML Translation model. - * - * The value format depends on model type: - * - * - AutoML Translation models: - * `projects/{project-id}/locations/{location-id}/models/{model-id}` - * - * - General (built-in) models: - * `projects/{project-id}/locations/{location-id}/models/general/nmt`, - * `projects/{project-id}/locations/{location-id}/models/general/base` - * - * - * If the map is empty or a specific model is - * not requested for a language pair, then default google model (nmt) is used. - * @param {number[]} request.inputConfigs - * Required. Input configurations. - * The total number of files matched should be <= 1000. - * The total content size should be <= 100M Unicode codepoints. - * The files must use UTF-8 encoding. - * @param {google.cloud.translation.v3beta1.OutputConfig} request.outputConfig - * Required. Output configuration. - * If 2 input configs match to the same file (that is, same input path), - * we don't generate output for duplicate inputs. - * @param {number[]} [request.glossaries] - * Optional. Glossaries to be applied for translation. - * It's keyed by target language code. - * @param {number[]} [request.labels] - * Optional. The labels with user-defined metadata for the request. - * - * Label keys and values can be no longer than 63 characters - * (Unicode codepoints), can only contain lowercase letters, numeric - * characters, underscores and dashes. International characters are allowed. - * Label values are optional. Label keys must start with a letter. - * - * See https://cloud.google.com/translate/docs/labels for more information. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.batch_translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async - */ - batchTranslateText( - request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - batchTranslateText( - request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchTranslateText( - request: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - batchTranslateText( - request?: protos.google.cloud.translation.v3beta1.IBatchTranslateTextRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('batchTranslateText response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('batchTranslateText request %j', request); - return this.innerApiCalls.batchTranslateText(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('batchTranslateText response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `batchTranslateText()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.batch_translate_text.js - * region_tag:translate_v3beta1_generated_TranslationService_BatchTranslateText_async - */ - async checkBatchTranslateTextProgress(name: string): Promise>{ - this._log.info('batchTranslateText long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchTranslateText, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a glossary and returns the long-running operation. Returns - * NOT_FOUND, if the project doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The project name. - * @param {google.cloud.translation.v3beta1.Glossary} request.glossary - * Required. The glossary 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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.create_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async - */ - createGlossary( - request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createGlossary( - request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGlossary( - request: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createGlossary( - request?: protos.google.cloud.translation.v3beta1.ICreateGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('createGlossary response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('createGlossary request %j', request); - return this.innerApiCalls.createGlossary(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createGlossary response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `createGlossary()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.create_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_CreateGlossary_async - */ - async checkCreateGlossaryProgress(name: string): Promise>{ - this._log.info('createGlossary long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createGlossary, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a glossary, or cancels glossary construction - * if the glossary isn't created yet. - * Returns NOT_FOUND, if the glossary doesn't exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the glossary to delete. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.delete_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async - */ - deleteGlossary( - request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteGlossary( - request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGlossary( - request: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteGlossary( - request?: protos.google.cloud.translation.v3beta1.IDeleteGlossaryRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('deleteGlossary response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('deleteGlossary request %j', request); - return this.innerApiCalls.deleteGlossary(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('deleteGlossary response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `deleteGlossary()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v3beta1/translation_service.delete_glossary.js - * region_tag:translate_v3beta1_generated_TranslationService_DeleteGlossary_async - */ - async checkDeleteGlossaryProgress(name: string): Promise>{ - this._log.info('deleteGlossary long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteGlossary, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't - * exist. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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 Array of {@link protos.google.cloud.translation.v3beta1.Glossary|Glossary}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listGlossariesAsync()` - * 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. - */ - listGlossaries( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]>; - listGlossaries( - request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): void; - listGlossaries( - request: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - callback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): void; - listGlossaries( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>, - callback?: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>): - Promise<[ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse|null|undefined, - protos.google.cloud.translation.v3beta1.IGlossary>|undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listGlossaries values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listGlossaries request %j', request); - return this.innerApiCalls - .listGlossaries(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.translation.v3beta1.IGlossary[], - protos.google.cloud.translation.v3beta1.IListGlossariesRequest|null, - protos.google.cloud.translation.v3beta1.IListGlossariesResponse - ]) => { - this._log.info('listGlossaries values %j', response); - return [response, input, output]; - }); - } - -/** - * Equivalent to `listGlossaries`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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.cloud.translation.v3beta1.Glossary|Glossary} 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 `listGlossariesAsync()` - * 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. - */ - listGlossariesStream( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - Transform{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGlossaries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGlossaries stream %j', request); - return this.descriptors.page.listGlossaries.createStream( - this.innerApiCalls.listGlossaries as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listGlossaries`, 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. The name of the project from which to list all of the glossaries. - * @param {number} [request.pageSize] - * Optional. Requested page size. The server may return fewer glossaries than - * requested. If unspecified, the server picks an appropriate default. - * @param {string} [request.pageToken] - * Optional. A token identifying a page of results the server should return. - * Typically, this is the value of [ListGlossariesResponse.next_page_token] - * returned from the previous call to `ListGlossaries` method. - * The first page is returned if `page_token`is empty or missing. - * @param {string} [request.filter] - * Optional. Filter specifying constraints of a list operation. - * Filtering is not supported yet, and the parameter currently has no effect. - * If missing, no filtering is performed. - * @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.cloud.translation.v3beta1.Glossary|Glossary}. 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 include:samples/generated/v3beta1/translation_service.list_glossaries.js - * region_tag:translate_v3beta1_generated_TranslationService_ListGlossaries_async - */ - listGlossariesAsync( - request?: protos.google.cloud.translation.v3beta1.IListGlossariesRequest, - options?: CallOptions): - AsyncIterable{ - 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': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listGlossaries']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); - this._log.info('listGlossaries iterate %j', request); - return this.descriptors.page.listGlossaries.asyncIterate( - this.innerApiCalls['listGlossaries'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified glossary resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} glossary - * @returns {string} Resource name string. - */ - glossaryPath(project:string,location:string,glossary:string) { - return this.pathTemplates.glossaryPathTemplate.render({ - project: project, - location: location, - glossary: glossary, - }); - } - - /** - * Parse the project from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the project. - */ - matchProjectFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).project; - } - - /** - * Parse the location from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the location. - */ - matchLocationFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).location; - } - - /** - * Parse the glossary from Glossary resource. - * - * @param {string} glossaryName - * A fully-qualified path representing Glossary resource. - * @returns {string} A string representing the glossary. - */ - matchGlossaryFromGlossaryName(glossaryName: string) { - return this.pathTemplates.glossaryPathTemplate.match(glossaryName).glossary; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.translationServiceStub && !this._terminated) { - return this.translationServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client_config.json.baseline deleted file mode 100644 index c0be7abb1086..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_client_config.json.baseline +++ /dev/null @@ -1,58 +0,0 @@ -{ - "interfaces": { - "google.cloud.translation.v3beta1.TranslationService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "TranslateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DetectLanguage": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSupportedLanguages": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "BatchTranslateText": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListGlossaries": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteGlossary": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_proto_list.json.baseline deleted file mode 100644 index a50dcfc7d4fd..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/src/v3beta1/translation_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/translate/v3beta1/translation_service.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 6c68622980f6..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const translation = require('translation'); - -function main() { - const translationServiceClient = new translation.TranslationServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 06dcee3e6811..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {TranslationServiceClient} from 'translation'; - -// check that the client class type name can be used -function doStuffWithTranslationServiceClient(client: TranslationServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const translationServiceClient = new TranslationServiceClient(); - doStuffWithTranslationServiceClient(translationServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/test/gapic_translation_service_v3beta1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/translate/test/gapic_translation_service_v3beta1.ts.baseline deleted file mode 100644 index de19cb3fb570..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/test/gapic_translation_service_v3beta1.ts.baseline +++ /dev/null @@ -1,1503 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as translationserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v3beta1.TranslationServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'translate.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = translationserviceModule.v3beta1.TranslationServiceClient.servicePath; - assert.strictEqual(servicePath, 'translate.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = translationserviceModule.v3beta1.TranslationServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'translate.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'translate.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new translationserviceModule.v3beta1.TranslationServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = translationserviceModule.v3beta1.TranslationServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.translationServiceStub, undefined); - await client.initialize(); - assert(client.translationServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.translationServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.translationServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('translateText', () => { - it('invokes translateText without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextResponse() - ); - client.innerApiCalls.translateText = stubSimpleCall(expectedResponse); - const [response] = await client.translateText(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextResponse() - ); - client.innerApiCalls.translateText = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.translateText( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.ITranslateTextResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.translateText = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.translateText(request), expectedError); - const actualRequest = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.translateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes translateText with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.TranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.TranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.translateText(request), expectedError); - }); - }); - - describe('detectLanguage', () => { - it('invokes detectLanguage without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() - ); - client.innerApiCalls.detectLanguage = stubSimpleCall(expectedResponse); - const [response] = await client.detectLanguage(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageResponse() - ); - client.innerApiCalls.detectLanguage = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.detectLanguage( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IDetectLanguageResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.detectLanguage = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.detectLanguage(request), expectedError); - const actualRequest = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.detectLanguage as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes detectLanguage with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DetectLanguageRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DetectLanguageRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.detectLanguage(request), expectedError); - }); - }); - - describe('getSupportedLanguages', () => { - it('invokes getSupportedLanguages without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.SupportedLanguages() - ); - client.innerApiCalls.getSupportedLanguages = stubSimpleCall(expectedResponse); - const [response] = await client.getSupportedLanguages(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.SupportedLanguages() - ); - client.innerApiCalls.getSupportedLanguages = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSupportedLanguages( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.ISupportedLanguages|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSupportedLanguages = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSupportedLanguages(request), expectedError); - const actualRequest = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSupportedLanguages as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSupportedLanguages with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetSupportedLanguagesRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSupportedLanguages(request), expectedError); - }); - }); - - describe('getGlossary', () => { - it('invokes getGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.Glossary() - ); - client.innerApiCalls.getGlossary = stubSimpleCall(expectedResponse); - const [response] = await client.getGlossary(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.Glossary() - ); - client.innerApiCalls.getGlossary = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getGlossary( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IGlossary|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getGlossary = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getGlossary with closed client', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.GetGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.GetGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getGlossary(request), expectedError); - }); - }); - - describe('batchTranslateText', () => { - it('invokes batchTranslateText without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchTranslateText(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchTranslateText = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchTranslateText( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchTranslateText(request), expectedError); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes batchTranslateText with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.BatchTranslateTextRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.BatchTranslateTextRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchTranslateText = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchTranslateText(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchTranslateText as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkBatchTranslateTextProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchTranslateTextProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkBatchTranslateTextProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchTranslateTextProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createGlossary', () => { - it('invokes createGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGlossary = stubLongRunningCall(expectedResponse); - const [operation] = await client.createGlossary(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createGlossary = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createGlossary( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGlossary = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createGlossary with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.CreateGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.CreateGlossaryRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createGlossary = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createGlossary(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateGlossaryProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateGlossaryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateGlossaryProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateGlossaryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteGlossary', () => { - it('invokes deleteGlossary without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteGlossary(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteGlossary = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteGlossary( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary with call error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteGlossary(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteGlossary with LRO error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.DeleteGlossaryRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.DeleteGlossaryRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteGlossary = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteGlossary(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteGlossary as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteGlossaryProgress without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkDeleteGlossaryProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteGlossaryProgress with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkDeleteGlossaryProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listGlossaries', () => { - it('invokes listGlossaries without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.innerApiCalls.listGlossaries = stubSimpleCall(expectedResponse); - const [response] = await client.listGlossaries(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossaries without error using callback', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.innerApiCalls.listGlossaries = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listGlossaries( - request, - (err?: Error|null, result?: protos.google.cloud.translation.v3beta1.IGlossary[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossaries with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listGlossaries = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listGlossaries(request), expectedError); - const actualRequest = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listGlossaries as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listGlossariesStream without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.descriptors.page.listGlossaries.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listGlossariesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.translation.v3beta1.Glossary[] = []; - stream.on('data', (response: protos.google.cloud.translation.v3beta1.Glossary) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGlossaries, request)); - assert( - (client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listGlossariesStream with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGlossaries.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listGlossariesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.translation.v3beta1.Glossary[] = []; - stream.on('data', (response: protos.google.cloud.translation.v3beta1.Glossary) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listGlossaries, request)); - assert( - (client.descriptors.page.listGlossaries.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGlossaries without error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - generateSampleMessage(new protos.google.cloud.translation.v3beta1.Glossary()), - ]; - client.descriptors.page.listGlossaries.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; - const iterable = client.listGlossariesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listGlossaries with error', async () => { - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.translation.v3beta1.ListGlossariesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.translation.v3beta1.ListGlossariesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listGlossaries.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listGlossariesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.translation.v3beta1.IGlossary[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listGlossaries.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('glossary', async () => { - const fakePath = "/rendered/path/glossary"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - glossary: "glossaryValue", - }; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.glossaryPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.glossaryPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('glossaryPath', () => { - const result = client.glossaryPath("projectValue", "locationValue", "glossaryValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.glossaryPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromGlossaryName', () => { - const result = client.matchProjectFromGlossaryName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromGlossaryName', () => { - const result = client.matchLocationFromGlossaryName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchGlossaryFromGlossaryName', () => { - const result = client.matchGlossaryFromGlossaryName(fakePath); - assert.strictEqual(result, "glossaryValue"); - assert((client.pathTemplates.glossaryPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', async () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new translationserviceModule.v3beta1.TranslationServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/translate/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/translate/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/translate/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/translate/webpack.config.js.baseline deleted file mode 100644 index 3504dead08d9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/translate/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'TranslationService', - filename: './translation-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.OwlBot.yaml.baseline deleted file mode 100644 index d5edf2d0e5ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/videointelligence/google-cloud-videointelligence-nodejs - dest: /owl-bot-staging/google-cloud-videointelligence - -api-name: videointelligence \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.babelrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.babelrc.json.baseline deleted file mode 100644 index 940d91b0a07b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.babelrc.json.baseline +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - "@babel/preset-typescript", - "@babel/env" - ], - "plugins": [ - [ - "replace-import-extension", - { - "extMapping": { - ".js": ".cjs" - } - } - ], - "./node_modules/gapic-tools/build/src/replaceESMMockingLib.js", - "./node_modules/gapic-tools/build/src/replaceImportMetaUrl.js", - "./node_modules/gapic-tools/build/src/toggleESMFlagVariable.js" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintignore.baseline deleted file mode 100644 index a73044f809ca..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintignore.baseline +++ /dev/null @@ -1,11 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/ -esm/src/**/*.d.ts -esm/test/**/*.d.ts -esm/system-test/**/*.d.ts -esm/system-test/fixtures/sample/src/*.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.gitignore.baseline deleted file mode 100644 index b391f5f9cd1a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.gitignore.baseline +++ /dev/null @@ -1,15 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ -esm/**/*.d.ts \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.jsdoc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.jsdoc.cjs.baseline deleted file mode 100644 index 115bfc8e98ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.jsdoc.cjs.baseline +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2026 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. ** - - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'videointelligence', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.mocharc.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.mocharc.cjs.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.mocharc.cjs.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/README.md.baseline deleted file mode 100644 index f1b2543bb6a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Videointelligence: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/videointelligence.svg)](https://www.npmjs.org/package/videointelligence) - -Videointelligence client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Videointelligence Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/videointelligence/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Videointelligence API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install videointelligence -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install videointelligence@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=videointelligence.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/index.ts.baseline deleted file mode 100644 index 94bfb1455d5a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/index.ts.baseline +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1/index.js'; -const VideoIntelligenceServiceClient = v1.VideoIntelligenceServiceClient; -type VideoIntelligenceServiceClient = v1.VideoIntelligenceServiceClient; -export {v1, VideoIntelligenceServiceClient}; -export default {v1, VideoIntelligenceServiceClient}; -// @ts-ignore -import * as protos from '../../protos/protos.js'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/json-helper.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/json-helper.cjs.baseline deleted file mode 100644 index 3c1fc730201e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/json-helper.cjs.baseline +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2024 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -/* eslint-disable node/no-missing-require */ -function getJSON(path) { - return require(path); -} - -exports.getJSON = getJSON; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/index.ts.baseline deleted file mode 100644 index 3c3a4b4f051b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {VideoIntelligenceServiceClient} from './video_intelligence_service_client.js'; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client.ts.baseline deleted file mode 100644 index 914ef9875f89..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client.ts.baseline +++ /dev/null @@ -1,516 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -// @ts-ignore -import type * as protos from '../../../protos/protos.js'; -import * as video_intelligence_service_client_config from './video_intelligence_service_client_config.json'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; -import {getJSON} from '../json-helper.cjs'; -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); - -/** - * Client JSON configuration object, loaded from - * `src/v1/video_intelligence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -const gapicConfig = getJSON( - path.join(dirname, 'video_intelligence_service_client_config.json') -); - -const jsonProtos = getJSON( - path.join(dirname, '..', '..', '..', 'protos/protos.json') -); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; -const version = getJSON( - path.join(dirname, '..', '..', '..', '..', 'package.json') -).version; - -/** - * Service that implements Google Cloud Video Intelligence API. - * @class - * @memberof v1 - */ -export class VideoIntelligenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('videointelligence'); - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - operationsClient: gax.OperationsClient; - videoIntelligenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VideoIntelligenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * 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 VideoIntelligenceServiceClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof VideoIntelligenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'videointelligence.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = gax as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Add ESM headers - const isEsm = true; - const isEsmString = isEsm ? '-esm' : '-cjs'; - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/{process.versions.node}${isEsmString}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - 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 as gax.protobuf.INamespace); - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const annotateVideoResponse = protoFilesRoot.lookup( - '.google.cloud.videointelligence.v1.AnnotateVideoResponse') as gax.protobuf.Type; - const annotateVideoMetadata = protoFilesRoot.lookup( - '.google.cloud.videointelligence.v1.AnnotateVideoProgress') as gax.protobuf.Type; - - this.descriptors.longrunning = { - annotateVideo: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - annotateVideoResponse.decode.bind(annotateVideoResponse), - annotateVideoMetadata.decode.bind(annotateVideoMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.videointelligence.v1.VideoIntelligenceService', gapicConfig as gax.ClientConfig, - 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.videoIntelligenceServiceStub) { - return this.videoIntelligenceServiceStub; - } - - // Put together the "service stub" for - // google.cloud.videointelligence.v1.VideoIntelligenceService. - this.videoIntelligenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.videointelligence.v1.VideoIntelligenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.videointelligence.v1.VideoIntelligenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const videoIntelligenceServiceStubMethods = - ['annotateVideo']; - for (const methodName of videoIntelligenceServiceStubMethods) { - const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.videoIntelligenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'videointelligence.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath, - * exists for compatibility reasons. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'videointelligence.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Performs asynchronous video annotation. Progress and results can be - * retrieved through the `google.longrunning.Operations` interface. - * `Operation.metadata` contains `AnnotateVideoProgress` (progress). - * `Operation.response` contains `AnnotateVideoResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.inputUri - * Input video location. Currently, only - * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * {@link protos.google.rpc.Code.INVALID_ARGUMENT|google.rpc.Code.INVALID_ARGUMENT}). For more information, see - * [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - * A video URI may include wildcards in `object-id`, and thus identify - * multiple videos. Supported wildcards: '*' to match 0 or more characters; - * '?' to match 1 character. If unset, the input video should be embedded - * in the request as `input_content`. If set, `input_content` should be unset. - * @param {Buffer} request.inputContent - * The video data bytes. - * If unset, the input video(s) should be specified via `input_uri`. - * If set, `input_uri` should be unset. - * @param {number[]} request.features - * Required. Requested video annotation features. - * @param {google.cloud.videointelligence.v1.VideoContext} request.videoContext - * Additional video context and/or feature-specific parameters. - * @param {string} [request.outputUri] - * Optional. Location where the output (in JSON format) should be stored. - * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) - * URIs are supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * {@link protos.google.rpc.Code.INVALID_ARGUMENT|google.rpc.Code.INVALID_ARGUMENT}). For more information, see - * [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - * @param {string} [request.locationId] - * Optional. Cloud region where annotation should take place. Supported cloud - * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - * is specified, a region will be determined based on video file location. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/video_intelligence_service.annotate_video.js - * region_tag:videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async - */ - annotateVideo( - request?: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - annotateVideo( - request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - annotateVideo( - request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - annotateVideo( - request?: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('annotateVideo response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified `callback` above. - } - : undefined; - this._log.info('annotateVideo request %j', request); - return this.innerApiCalls.annotateVideo(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('annotateVideo response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `annotateVideo()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/video_intelligence_service.annotate_video.js - * region_tag:videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async - */ - async checkAnnotateVideoProgress(name: string): Promise>{ - this._log.info('annotateVideo long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.annotateVideo, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.videoIntelligenceServiceStub && !this._terminated) { - return this.videoIntelligenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client_config.json.baseline deleted file mode 100644 index e99ce74a90cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.videointelligence.v1.VideoIntelligenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AnnotateVideo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_proto_list.json.baseline deleted file mode 100644 index e28d401f1a27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/src/v1/video_intelligence_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/videointelligence/v1/video_intelligence.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline deleted file mode 100644 index 9211b853189a..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.cjs.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -const videointelligence = require('videointelligence'); - -function main() { - const videoIntelligenceServiceClient = new videointelligence.VideoIntelligenceServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 398644a543cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -import * as videointelligence from 'videointelligence'; - -function main() { - const videoIntelligenceServiceClient = new videointelligence.VideoIntelligenceServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 407f139c34e0..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable node/no-missing-require, no-unused-vars, no-undef */ -// Copyright 2026 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. ** - -import {VideoIntelligenceServiceClient} from 'videointelligence'; - -// check that the client class type name can be used -function doStuffWithVideoIntelligenceServiceClient(client: VideoIntelligenceServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - doStuffWithVideoIntelligenceServiceClient(videoIntelligenceServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/install.ts.baseline deleted file mode 100644 index e079c4fa1101..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/system-test/install.ts.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript', async function() { - this.timeout(300000); - await packNTest({ - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./esm/system-test/fixtures/sample/src/index.ts').toString() - } - }); - }); - - it('ESM module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using ESM', - esm: readFileSync('./esm/system-test/fixtures/sample/src/index.js').toString(), - }, - }); - }); - - it('CJS module', async function() { - this.timeout(300000); - await packNTest({ - sample: { - description: 'Should be able to import using CJS', - cjs: readFileSync('./esm/system-test/fixtures/sample/src/index.cjs').toString(), - }, - }); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/test/gapic_video_intelligence_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/test/gapic_video_intelligence_service_v1.ts.baseline deleted file mode 100644 index 3c1ab593ac37..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/esm/test/gapic_video_intelligence_service_v1.ts.baseline +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright 2026 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. ** - -// @ts-ignore -import * as protos from '../../protos/protos.js'; -import assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as videointelligenceserviceModule from '../src/index.js'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; -import fs from 'fs'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -// @ts-ignore -const dirname = path.dirname(fileURLToPath(import.meta.url)); -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - JSON.parse( - fs.readFileSync(path.join(dirname, '..', '..', 'protos/protos.json'), 'utf8') - )) - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type?.fields[field]?.resolvedType as protobuf.Type; - } - return type?.fields[fields[fields.length - 1]]?.defaultValue ?? null; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1.VideoIntelligenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'videointelligence.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'videointelligence.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'videointelligence.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.videoIntelligenceServiceStub, undefined); - await client.initialize(); - assert(client.videoIntelligenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.videoIntelligenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.videoIntelligenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('annotateVideo', () => { - it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.annotateVideo = stubLongRunningCall(expectedResponse); - const [operation] = await client.annotateVideo(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.annotateVideo( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateVideo = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.annotateVideo(request), expectedError); - }); - - it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateVideo = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.annotateVideo(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnnotateVideoProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAnnotateVideoProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json deleted file mode 100644 index c897e60b4a5e..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "videointelligence", - "version": "0.1.0", - "description": "Videointelligence client for Node.js", - "repository": "googleapis/nodejs-videointelligence", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "./build/cjs/src/index.cjs", - "types": "./build/cjs/src/index.d.ts", - "type": "module", - "exports": { - ".": { - "import": { - "types": "./build/esm/src/index.d.ts", - "default": "./build/esm/src/index.js" - }, - "require": { - "types": "./build/cjs/src/index.d.ts", - "default": "./build/cjs/src/index.cjs" - } - }, - "./build/protos/protos": { - "import": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.js" - }, - "require": { - "types": "./build/protos/protos/protos.d.ts", - "default": "./build/protos/protos/protos.cjs" - } - } - }, - "files": [ - "build/esm", - "build/cjs", - "build/protos", - "!build/esm/**/*.map", - "!build/cjs/**/*.map" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google videointelligence", - "videointelligence", - "video intelligence service" - ], - "scripts": { - "clean": "gts clean", - "compile-protos": "compileProtos esm/src --esm ", - "docs": "jsdoc -c .jsdoc.cjs", - "postpack": "minifyProtoJson build/cjs && minifyProtoJson build/esm", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test:cjs": "c8 mocha build/cjs/system-test", - "system-test:esm": "c8 mocha build/esm/system-test", - "system-test": "npm run system-test:esm && npm run system-test:cjs", - "test:cjs": "c8 mocha build/cjs/test", - "test:esm": "c8 mocha build/esm/test", - "test": "npm run test:cjs && npm run test:esm", - "compile:esm": "tsc -p ./tsconfig.esm.json && cp -r esm/src/json-helper.cjs build/esm/src/json-helper.cjs", - "babel": "babel esm --out-dir build/cjs --ignore \"esm/**/*.d.ts\" --extensions \".ts\" --out-file-extension .cjs --copy-files", - "compile:cjs": "tsc -p ./tsconfig.json && npm run babel", - "compile": "npm run compile:esm && rm -rf esm/src/json-helper.d.cts && npm run compile:cjs && rm -rf build/protos && cp -r protos build/protos", - "samples-test": "cd samples/ && npm link ../ && npm i && npm test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@babel/cli": "^7.28.3", - "@babel/core": "^7.28.5", - "@babel/preset-env": "^7.28.5", - "@babel/preset-typescript": "^7.28.5", - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "babel-plugin-replace-import-extension": "^1.1.5", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-region-tag": "^4.0.1", - "jsdoc-fresh": "^5.0.2", - "long": "^5.3.2", - "mocha": "^11.7.4", - "typescript": "5.8.3", - "pack-n-play": "^4.2.1", - "sinon": "^20.0.0", - "ts-loader": "^8.4.0", - "webpack": "^5.102.1", - "webpack-cli": "^6.0.1" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline deleted file mode 100644 index 9dcfda55edd5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline +++ /dev/null @@ -1,826 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.videointelligence.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.VideoIntelligence.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1;videointelligence"; -option java_multiple_files = true; -option java_outer_classname = "VideoIntelligenceServiceProto"; -option java_package = "com.google.cloud.videointelligence.v1"; -option php_namespace = "Google\\Cloud\\VideoIntelligence\\V1"; -option ruby_package = "Google::Cloud::VideoIntelligence::V1"; - -// Service that implements Google Cloud Video Intelligence API. -service VideoIntelligenceService { - option (google.api.default_host) = "videointelligence.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Performs asynchronous video annotation. Progress and results can be - // retrieved through the `google.longrunning.Operations` interface. - // `Operation.metadata` contains `AnnotateVideoProgress` (progress). - // `Operation.response` contains `AnnotateVideoResponse` (results). - rpc AnnotateVideo(AnnotateVideoRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/videos:annotate" - body: "*" - }; - option (google.api.method_signature) = "input_uri,features"; - option (google.longrunning.operation_info) = { - response_type: "AnnotateVideoResponse" - metadata_type: "AnnotateVideoProgress" - }; - } -} - -// Video annotation request. -message AnnotateVideoRequest { - // Input video location. Currently, only - // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - // supported, which must be specified in the following format: - // `gs://bucket-id/object-id` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - // A video URI may include wildcards in `object-id`, and thus identify - // multiple videos. Supported wildcards: '*' to match 0 or more characters; - // '?' to match 1 character. If unset, the input video should be embedded - // in the request as `input_content`. If set, `input_content` should be unset. - string input_uri = 1; - - // The video data bytes. - // If unset, the input video(s) should be specified via `input_uri`. - // If set, `input_uri` should be unset. - bytes input_content = 6; - - // Required. Requested video annotation features. - repeated Feature features = 2 [(google.api.field_behavior) = REQUIRED]; - - // Additional video context and/or feature-specific parameters. - VideoContext video_context = 3; - - // Optional. Location where the output (in JSON format) should be stored. - // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) - // URIs are supported, which must be specified in the following format: - // `gs://bucket-id/object-id` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - string output_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Cloud region where annotation should take place. Supported cloud - // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - // is specified, a region will be determined based on video file location. - string location_id = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Video context and/or feature-specific parameters. -message VideoContext { - // Video segments to annotate. The segments may overlap and are not required - // to be contiguous or span the whole video. If unspecified, each video is - // treated as a single segment. - repeated VideoSegment segments = 1; - - // Config for LABEL_DETECTION. - LabelDetectionConfig label_detection_config = 2; - - // Config for SHOT_CHANGE_DETECTION. - ShotChangeDetectionConfig shot_change_detection_config = 3; - - // Config for EXPLICIT_CONTENT_DETECTION. - ExplicitContentDetectionConfig explicit_content_detection_config = 4; - - // Config for FACE_DETECTION. - FaceDetectionConfig face_detection_config = 5; - - // Config for SPEECH_TRANSCRIPTION. - SpeechTranscriptionConfig speech_transcription_config = 6; - - // Config for TEXT_DETECTION. - TextDetectionConfig text_detection_config = 8; - - // Config for OBJECT_TRACKING. - ObjectTrackingConfig object_tracking_config = 13; -} - -// Video annotation feature. -enum Feature { - // Unspecified. - FEATURE_UNSPECIFIED = 0; - - // Label detection. Detect objects, such as dog or flower. - LABEL_DETECTION = 1; - - // Shot change detection. - SHOT_CHANGE_DETECTION = 2; - - // Explicit content detection. - EXPLICIT_CONTENT_DETECTION = 3; - - // Human face detection and tracking. - FACE_DETECTION = 4; - - // Speech transcription. - SPEECH_TRANSCRIPTION = 6; - - // OCR text detection and tracking. - TEXT_DETECTION = 7; - - // Object detection and tracking. - OBJECT_TRACKING = 9; - - // Logo detection, tracking, and recognition. - LOGO_RECOGNITION = 12; -} - -// Label detection mode. -enum LabelDetectionMode { - // Unspecified. - LABEL_DETECTION_MODE_UNSPECIFIED = 0; - - // Detect shot-level labels. - SHOT_MODE = 1; - - // Detect frame-level labels. - FRAME_MODE = 2; - - // Detect both shot-level and frame-level labels. - SHOT_AND_FRAME_MODE = 3; -} - -// Bucketized representation of likelihood. -enum Likelihood { - // Unspecified likelihood. - LIKELIHOOD_UNSPECIFIED = 0; - - // Very unlikely. - VERY_UNLIKELY = 1; - - // Unlikely. - UNLIKELY = 2; - - // Possible. - POSSIBLE = 3; - - // Likely. - LIKELY = 4; - - // Very likely. - VERY_LIKELY = 5; -} - -// Config for LABEL_DETECTION. -message LabelDetectionConfig { - // What labels should be detected with LABEL_DETECTION, in addition to - // video-level labels or segment-level labels. - // If unspecified, defaults to `SHOT_MODE`. - LabelDetectionMode label_detection_mode = 1; - - // Whether the video has been shot from a stationary (i.e. non-moving) camera. - // When set to true, might improve detection accuracy for moving objects. - // Should be used with `SHOT_AND_FRAME_MODE` enabled. - bool stationary_camera = 2; - - // Model to use for label detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 3; - - // The confidence threshold we perform filtering on the labels from - // frame-level detection. If not set, it is set to 0.4 by default. The valid - // range for this threshold is [0.1, 0.9]. Any value set outside of this - // range will be clipped. - // Note: for best results please follow the default threshold. We will update - // the default threshold everytime when we release a new model. - float frame_confidence_threshold = 4; - - // The confidence threshold we perform filtering on the labels from - // video-level and shot-level detections. If not set, it is set to 0.3 by - // default. The valid range for this threshold is [0.1, 0.9]. Any value set - // outside of this range will be clipped. - // Note: for best results please follow the default threshold. We will update - // the default threshold everytime when we release a new model. - float video_confidence_threshold = 5; -} - -// Config for SHOT_CHANGE_DETECTION. -message ShotChangeDetectionConfig { - // Model to use for shot change detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for OBJECT_TRACKING. -message ObjectTrackingConfig { - // Model to use for object tracking. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for FACE_DETECTION. -message FaceDetectionConfig { - // Model to use for face detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; - - // Whether bounding boxes be included in the face annotation output. - bool include_bounding_boxes = 2; -} - -// Config for EXPLICIT_CONTENT_DETECTION. -message ExplicitContentDetectionConfig { - // Model to use for explicit content detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for TEXT_DETECTION. -message TextDetectionConfig { - // Language hint can be specified if the language to be detected is known a - // priori. It can increase the accuracy of the detection. Language hint must - // be language code in BCP-47 format. - // - // Automatic language detection is performed if no hint is provided. - repeated string language_hints = 1; - - // Model to use for text detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 2; -} - -// Video segment. -message VideoSegment { - // Time-offset, relative to the beginning of the video, - // corresponding to the start of the segment (inclusive). - google.protobuf.Duration start_time_offset = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the end of the segment (inclusive). - google.protobuf.Duration end_time_offset = 2; -} - -// Video segment level annotation results for label detection. -message LabelSegment { - // Video segment where a label was detected. - VideoSegment segment = 1; - - // Confidence that the label is accurate. Range: [0, 1]. - float confidence = 2; -} - -// Video frame level annotation results for label detection. -message LabelFrame { - // Time-offset, relative to the beginning of the video, corresponding to the - // video frame for this location. - google.protobuf.Duration time_offset = 1; - - // Confidence that the label is accurate. Range: [0, 1]. - float confidence = 2; -} - -// Detected entity from video analysis. -message Entity { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string entity_id = 1; - - // Textual description, e.g. `Fixed-gear bicycle`. - string description = 2; - - // Language code for `description` in BCP-47 format. - string language_code = 3; -} - -// Label annotation. -message LabelAnnotation { - // Detected entity. - Entity entity = 1; - - // Common categories for the detected entity. - // E.g. when the label is `Terrier` the category is likely `dog`. And in some - // cases there might be more than one categories e.g. `Terrier` could also be - // a `pet`. - repeated Entity category_entities = 2; - - // All video segments where a label was detected. - repeated LabelSegment segments = 3; - - // All video frames where a label was detected. - repeated LabelFrame frames = 4; -} - -// Video frame level annotation results for explicit content. -message ExplicitContentFrame { - // Time-offset, relative to the beginning of the video, corresponding to the - // video frame for this location. - google.protobuf.Duration time_offset = 1; - - // Likelihood of the pornography content.. - Likelihood pornography_likelihood = 2; -} - -// Explicit content annotation (based on per-frame visual signals only). -// If no explicit content has been detected in a frame, no annotations are -// present for that frame. -message ExplicitContentAnnotation { - // All video frames where explicit content was detected. - repeated ExplicitContentFrame frames = 1; -} - -// Normalized bounding box. -// The normalized vertex coordinates are relative to the original image. -// Range: [0, 1]. -message NormalizedBoundingBox { - // Left X coordinate. - float left = 1; - - // Top Y coordinate. - float top = 2; - - // Right X coordinate. - float right = 3; - - // Bottom Y coordinate. - float bottom = 4; -} - -// Video segment level annotation results for face detection. -message FaceSegment { - // Video segment where a face was detected. - VideoSegment segment = 1; -} - -// Video frame level annotation results for face detection. -message FaceFrame { - // Normalized Bounding boxes in a frame. - // There can be more than one boxes if the same face is detected in multiple - // locations within the current frame. - repeated NormalizedBoundingBox normalized_bounding_boxes = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the video frame for this location. - google.protobuf.Duration time_offset = 2; -} - -// Face annotation. -message FaceAnnotation { - // Thumbnail of a representative face view (in JPEG format). - bytes thumbnail = 1; - - // All video segments where a face was detected. - repeated FaceSegment segments = 2; - - // All video frames where a face was detected. - repeated FaceFrame frames = 3; -} - -// For tracking related features. -// An object at time_offset with attributes, and located with -// normalized_bounding_box. -message TimestampedObject { - // Normalized Bounding box in a frame, where the object is located. - NormalizedBoundingBox normalized_bounding_box = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the video frame for this object. - google.protobuf.Duration time_offset = 2; - - // Optional. The attributes of the object in the bounding box. - repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The detected landmarks. - repeated DetectedLandmark landmarks = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A track of an object instance. -message Track { - // Video segment of a track. - VideoSegment segment = 1; - - // The object with timestamp and attributes per frame in the track. - repeated TimestampedObject timestamped_objects = 2; - - // Optional. Attributes in the track level. - repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The confidence score of the tracked object. - float confidence = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A generic detected attribute represented by name in string format. -message DetectedAttribute { - // The name of the attribute, i.e. glasses, dark_glasses, mouth_open etc. - // A full list of supported type names will be provided in the document. - string name = 1; - - // Detected attribute confidence. Range [0, 1]. - float confidence = 2; - - // Text value of the detection result. For example, the value for "HairColor" - // can be "black", "blonde", etc. - string value = 3; -} - -// A generic detected landmark represented by name in string format and a 2D -// location. -message DetectedLandmark { - // The name of this landmark, i.e. left_hand, right_shoulder. - string name = 1; - - // The 2D point of the detected landmark using the normalized image - // coordindate system. The normalized coordinates have the range from 0 to 1. - NormalizedVertex point = 2; - - // The confidence score of the detected landmark. Range [0, 1]. - float confidence = 3; -} - -// Annotation results for a single video. -message VideoAnnotationResults { - // Video file location in - // [Google Cloud Storage](https://cloud.google.com/storage/). - string input_uri = 1; - - // Video segment on which the annotation is run. - VideoSegment segment = 10; - - // Topical label annotations on video level or user specified segment level. - // There is exactly one element for each unique label. - repeated LabelAnnotation segment_label_annotations = 2; - - // Presence label annotations on video level or user specified segment level. - // There is exactly one element for each unique label. Compared to the - // existing topical `segment_label_annotations`, this field presents more - // fine-grained, segment-level labels detected in video content and is made - // available only when the client sets `LabelDetectionConfig.model` to - // "builtin/latest" in the request. - repeated LabelAnnotation segment_presence_label_annotations = 23; - - // Topical label annotations on shot level. - // There is exactly one element for each unique label. - repeated LabelAnnotation shot_label_annotations = 3; - - // Presence label annotations on shot level. There is exactly one element for - // each unique label. Compared to the existing topical - // `shot_label_annotations`, this field presents more fine-grained, shot-level - // labels detected in video content and is made available only when the client - // sets `LabelDetectionConfig.model` to "builtin/latest" in the request. - repeated LabelAnnotation shot_presence_label_annotations = 24; - - // Label annotations on frame level. - // There is exactly one element for each unique label. - repeated LabelAnnotation frame_label_annotations = 4; - - // Face annotations. There is exactly one element for each unique face. - repeated FaceAnnotation face_annotations = 5; - - // Shot annotations. Each shot is represented as a video segment. - repeated VideoSegment shot_annotations = 6; - - // Explicit content annotation. - ExplicitContentAnnotation explicit_annotation = 7; - - // Speech transcription. - repeated SpeechTranscription speech_transcriptions = 11; - - // OCR text detection and tracking. - // Annotations for list of detected text snippets. Each will have list of - // frame information associated with it. - repeated TextAnnotation text_annotations = 12; - - // Annotations for list of objects detected and tracked in video. - repeated ObjectTrackingAnnotation object_annotations = 14; - - // Annotations for list of logos detected, tracked and recognized in video. - repeated LogoRecognitionAnnotation logo_recognition_annotations = 19; - - // If set, indicates an error. Note that for a single `AnnotateVideoRequest` - // some videos may succeed and some may fail. - google.rpc.Status error = 9; -} - -// Video annotation response. Included in the `response` -// field of the `Operation` returned by the `GetOperation` -// call of the `google::longrunning::Operations` service. -message AnnotateVideoResponse { - // Annotation results for all videos specified in `AnnotateVideoRequest`. - repeated VideoAnnotationResults annotation_results = 1; -} - -// Annotation progress for a single video. -message VideoAnnotationProgress { - // Video file location in - // [Google Cloud Storage](https://cloud.google.com/storage/). - string input_uri = 1; - - // Approximate percentage processed thus far. Guaranteed to be - // 100 when fully processed. - int32 progress_percent = 2; - - // Time when the request was received. - google.protobuf.Timestamp start_time = 3; - - // Time of the most recent update. - google.protobuf.Timestamp update_time = 4; - - // Specifies which feature is being tracked if the request contains more than - // one features. - Feature feature = 5; - - // Specifies which segment is being tracked if the request contains more than - // one segments. - VideoSegment segment = 6; -} - -// Video annotation progress. Included in the `metadata` -// field of the `Operation` returned by the `GetOperation` -// call of the `google::longrunning::Operations` service. -message AnnotateVideoProgress { - // Progress metadata for all videos specified in `AnnotateVideoRequest`. - repeated VideoAnnotationProgress annotation_progress = 1; -} - -// Config for SPEECH_TRANSCRIPTION. -message SpeechTranscriptionConfig { - // Required. *Required* The language of the supplied audio as a - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - // Example: "en-US". - // See [Language Support](https://cloud.google.com/speech/docs/languages) - // for a list of the currently supported language codes. - string language_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Maximum number of recognition hypotheses to be returned. - // Specifically, the maximum number of `SpeechRecognitionAlternative` messages - // within each `SpeechTranscription`. The server may return fewer than - // `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will - // return a maximum of one. If omitted, will return a maximum of one. - int32 max_alternatives = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `true`, the server will attempt to filter out - // profanities, replacing all but the initial character in each filtered word - // with asterisks, e.g. "f***". If set to `false` or omitted, profanities - // won't be filtered out. - bool filter_profanity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A means to provide context to assist the speech recognition. - repeated SpeechContext speech_contexts = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If 'true', adds punctuation to recognition result hypotheses. - // This feature is only available in select languages. Setting this for - // requests in other languages has no effect at all. The default 'false' value - // does not add punctuation to result hypotheses. NOTE: "This is currently - // offered as an experimental service, complimentary to all users. In the - // future this may be exclusively available as a premium feature." - bool enable_automatic_punctuation = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. For file formats, such as MXF or MKV, supporting multiple audio - // tracks, specify up to two tracks. Default: track 0. - repeated int32 audio_tracks = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If 'true', enables speaker detection for each recognized word in - // the top alternative of the recognition result using a speaker_tag provided - // in the WordInfo. - // Note: When this is true, we send all the words from the beginning of the - // audio for the top alternative in every consecutive responses. - // This is done in order to improve our speaker tags as our models learn to - // identify the speakers in the conversation over time. - bool enable_speaker_diarization = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, specifies the estimated number of speakers in the conversation. - // If not set, defaults to '2'. - // Ignored unless enable_speaker_diarization is set to true. - int32 diarization_speaker_count = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If `true`, the top result includes a list of words and the - // confidence for those words. If `false`, no word-level confidence - // information is returned. The default is `false`. - bool enable_word_confidence = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// Provides "hints" to the speech recognizer to favor specific words and phrases -// in the results. -message SpeechContext { - // Optional. A list of strings containing words and phrases "hints" so that - // the speech recognition is more likely to recognize them. This can be used - // to improve the accuracy for specific words and phrases, for example, if - // specific commands are typically spoken by the user. This can also be used - // to add additional words to the vocabulary of the recognizer. See - // [usage limits](https://cloud.google.com/speech/limits#content). - repeated string phrases = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// A speech recognition result corresponding to a portion of the audio. -message SpeechTranscription { - // May contain one or more recognition hypotheses (up to the maximum specified - // in `max_alternatives`). These alternatives are ordered in terms of - // accuracy, with the top (first) alternative being the most probable, as - // ranked by the recognizer. - repeated SpeechRecognitionAlternative alternatives = 1; - - // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of - // the language in this result. This language code was detected to have the - // most likelihood of being spoken in the audio. - string language_code = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Alternative hypotheses (a.k.a. n-best list). -message SpeechRecognitionAlternative { - // Transcript text representing the words that the user spoke. - string transcript = 1; - - // Output only. The confidence estimate between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. This field is set only for the top alternative. - // This field is not guaranteed to be accurate and users should not rely on it - // to be always provided. - // The default of 0.0 is a sentinel value indicating `confidence` was not set. - float confidence = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A list of word-specific information for each recognized word. - // Note: When `enable_speaker_diarization` is true, you will see all the words - // from the beginning of the audio. - repeated WordInfo words = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Word-specific information for recognized words. Word information is only -// included in the response when certain request parameters are set, such -// as `enable_word_time_offsets`. -message WordInfo { - // Time offset relative to the beginning of the audio, and - // corresponding to the start of the spoken word. This field is only set if - // `enable_word_time_offsets=true` and only in the top hypothesis. This is an - // experimental feature and the accuracy of the time offset can vary. - google.protobuf.Duration start_time = 1; - - // Time offset relative to the beginning of the audio, and - // corresponding to the end of the spoken word. This field is only set if - // `enable_word_time_offsets=true` and only in the top hypothesis. This is an - // experimental feature and the accuracy of the time offset can vary. - google.protobuf.Duration end_time = 2; - - // The word corresponding to this set of information. - string word = 3; - - // Output only. The confidence estimate between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. This field is set only for the top alternative. - // This field is not guaranteed to be accurate and users should not rely on it - // to be always provided. - // The default of 0.0 is a sentinel value indicating `confidence` was not set. - float confidence = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A distinct integer value is assigned for every speaker within - // the audio. This field specifies which one of those speakers was detected to - // have spoken this word. Value ranges from 1 up to diarization_speaker_count, - // and is only set if speaker diarization is enabled. - int32 speaker_tag = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A vertex represents a 2D point in the image. -// NOTE: the normalized vertex coordinates are relative to the original image -// and range from 0 to 1. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// Normalized bounding polygon for text (that might not be aligned with axis). -// Contains list of the corner points in clockwise order starting from -// top-left corner. For example, for a rectangular bounding box: -// When the text is horizontal it might look like: -// 0----1 -// | | -// 3----2 -// -// When it's clockwise rotated 180 degrees around the top-left corner it -// becomes: -// 2----3 -// | | -// 1----0 -// -// and the vertex order will still be (0, 1, 2, 3). Note that values can be less -// than 0, or greater than 1 due to trignometric calculations for location of -// the box. -message NormalizedBoundingPoly { - // Normalized vertices of the bounding polygon. - repeated NormalizedVertex vertices = 1; -} - -// Video segment level annotation results for text detection. -message TextSegment { - // Video segment where a text snippet was detected. - VideoSegment segment = 1; - - // Confidence for the track of detected text. It is calculated as the highest - // over all frames where OCR detected text appears. - float confidence = 2; - - // Information related to the frames where OCR detected text appears. - repeated TextFrame frames = 3; -} - -// Video frame level annotation results for text annotation (OCR). -// Contains information regarding timestamp and bounding box locations for the -// frames containing detected OCR text snippets. -message TextFrame { - // Bounding polygon of the detected text for this frame. - NormalizedBoundingPoly rotated_bounding_box = 1; - - // Timestamp of this frame. - google.protobuf.Duration time_offset = 2; -} - -// Annotations related to one detected OCR text snippet. This will contain the -// corresponding text, confidence value, and frame level information for each -// detection. -message TextAnnotation { - // The detected text. - string text = 1; - - // All video segments where OCR detected text appears. - repeated TextSegment segments = 2; -} - -// Video frame level annotations for object detection and tracking. This field -// stores per frame location, time offset, and confidence. -message ObjectTrackingFrame { - // The normalized bounding box location of this object track for the frame. - NormalizedBoundingBox normalized_bounding_box = 1; - - // The timestamp of the frame in microseconds. - google.protobuf.Duration time_offset = 2; -} - -// Annotations corresponding to one tracked object. -message ObjectTrackingAnnotation { - // Different representation of tracking info in non-streaming batch - // and streaming modes. - oneof track_info { - // Non-streaming batch mode ONLY. - // Each object track corresponds to one video segment where it appears. - VideoSegment segment = 3; - - // Streaming mode ONLY. - // In streaming mode, we do not know the end time of a tracked object - // before it is completed. Hence, there is no VideoSegment info returned. - // Instead, we provide a unique identifiable integer track_id so that - // the customers can correlate the results of the ongoing - // ObjectTrackAnnotation of the same track_id over time. - int64 track_id = 5; - } - - // Entity to specify the object category that this track is labeled as. - Entity entity = 1; - - // Object category's labeling confidence of this track. - float confidence = 4; - - // Information corresponding to all frames where this object track appears. - // Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame - // messages in frames. - // Streaming mode: it can only be one ObjectTrackingFrame message in frames. - repeated ObjectTrackingFrame frames = 2; -} - -// Annotation corresponding to one detected, tracked and recognized logo class. -message LogoRecognitionAnnotation { - // Entity category information to specify the logo class that all the logo - // tracks within this LogoRecognitionAnnotation are recognized as. - Entity entity = 1; - - // All logo tracks where the recognized logo appears. Each track corresponds - // to one logo instance appearing in consecutive frames. - repeated Track tracks = 2; - - // All video segments where the recognized logo appears. There might be - // multiple instances of the same logo class appearing in one VideoSegment. - repeated VideoSegment segments = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline deleted file mode 100644 index bcd609e915a8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline +++ /dev/null @@ -1,75 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-videointelligence", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.videointelligence.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async", - "title": "VideoIntelligenceService annotateVideo Sample", - "origin": "API_DEFINITION", - "description": " Performs asynchronous video annotation. Progress and results can be retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` (results).", - "canonical": true, - "file": "video_intelligence_service.annotate_video.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnnotateVideo", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService.AnnotateVideo", - "async": true, - "parameters": [ - { - "name": "input_uri", - "type": "TYPE_STRING" - }, - { - "name": "input_content", - "type": "TYPE_BYTES" - }, - { - "name": "features", - "type": "TYPE_ENUM[]" - }, - { - "name": "video_context", - "type": ".google.cloud.videointelligence.v1.VideoContext" - }, - { - "name": "output_uri", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VideoIntelligenceServiceClient", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceServiceClient" - }, - "method": { - "shortName": "AnnotateVideo", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService.AnnotateVideo", - "service": { - "shortName": "VideoIntelligenceService", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline deleted file mode 100644 index dc2e51e64703..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(features) { - // [START videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Input video location. Currently, only - * Google Cloud Storage (https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * google.rpc.Code.INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT). For more information, see - * Request URIs (https://cloud.google.com/storage/docs/request-endpoints). - * A video URI may include wildcards in `object-id`, and thus identify - * multiple videos. Supported wildcards: '*' to match 0 or more characters; - * '?' to match 1 character. If unset, the input video should be embedded - * in the request as `input_content`. If set, `input_content` should be unset. - */ - // const inputUri = 'abc123' - /** - * The video data bytes. - * If unset, the input video(s) should be specified via `input_uri`. - * If set, `input_uri` should be unset. - */ - // const inputContent = Buffer.from('string') - /** - * Required. Requested video annotation features. - */ - // const features = [1,2,3,4] - /** - * Additional video context and/or feature-specific parameters. - */ - // const videoContext = {} - /** - * Optional. Location where the output (in JSON format) should be stored. - * Currently, only Google Cloud Storage (https://cloud.google.com/storage/) - * URIs are supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * google.rpc.Code.INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT). For more information, see - * Request URIs (https://cloud.google.com/storage/docs/request-endpoints). - */ - // const outputUri = 'abc123' - /** - * Optional. Cloud region where annotation should take place. Supported cloud - * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - * is specified, a region will be determined based on video file location. - */ - // const locationId = 'abc123' - - // Imports the Videointelligence library - const {VideoIntelligenceServiceClient} = require('videointelligence').v1; - - // Instantiates a client - const videointelligenceClient = new VideoIntelligenceServiceClient(); - - async function callAnnotateVideo() { - // Construct request - const request = { - features, - }; - - // Run request - const [operation] = await videointelligenceClient.annotateVideo(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAnnotateVideo(); - // [END videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.esm.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.esm.json.baseline deleted file mode 100644 index 9ea46f074fa2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.esm.json.baseline +++ /dev/null @@ -1,27 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "module": "es2020", - "moduleResolution": "node", - "esModuleInterop": true, - "sourceMap": false, - "allowJs": true, - "lib": [ - "es2020", - "DOM" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/system-test/*.ts", - "esm/src/**/*.json", - "protos/protos.json", - "esm/src/*.cjs" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.json.baseline deleted file mode 100644 index 110f6eccd41b..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/tsconfig.json.baseline +++ /dev/null @@ -1,32 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "resolveJsonModule": true, - "moduleResolution": "node", - "allowJs": true, - "esModuleInterop": true, - "sourceMap": false, - "target": "esnext", - "module": "CommonJS", - "declaration": true, - "strict": true, - "isolatedModules": false, - "emitDeclarationOnly": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "esm/src/*.ts", - "esm/src/**/*.ts", - "esm/test/*.ts", - "esm/test/**/*.ts", - "esm/src/**/*.json", - "esm/system-test/*.ts", - "esm/src/*.cjs", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/webpack.config.cjs.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/webpack.config.cjs.baseline deleted file mode 100644 index 3ee1fd719b83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence-esm/webpack.config.cjs.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'VideoIntelligenceService', - filename: './video-intelligence-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.OwlBot.yaml.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.OwlBot.yaml.baseline deleted file mode 100644 index d5edf2d0e5ef..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.OwlBot.yaml.baseline +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2025 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -deep-copy-regex: - - source: /google/cloud/videointelligence/google-cloud-videointelligence-nodejs - dest: /owl-bot-staging/google-cloud-videointelligence - -api-name: videointelligence \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintignore.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintignore.baseline deleted file mode 100644 index cfc348ec4d11..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintignore.baseline +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintrc.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintrc.json.baseline deleted file mode 100644 index 3e8d97ccb390..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.eslintrc.json.baseline +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "./node_modules/gts", - "root": true -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.gitignore.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.gitignore.baseline deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.gitignore.baseline +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.jsdoc.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.jsdoc.js.baseline deleted file mode 100644 index 039f47643555..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.jsdoc.js.baseline +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: 'videointelligence', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.mocharc.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.mocharc.js.baseline deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.mocharc.js.baseline +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/.nycrc.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/.nycrc.baseline deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/.nycrc.baseline +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/README.md.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/README.md.baseline deleted file mode 100644 index f1b2543bb6a9..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/README.md.baseline +++ /dev/null @@ -1,108 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Videointelligence: Nodejs Client][homepage] - -[//]: # "releaseLevel" - -[![npm version](https://img.shields.io/npm/v/videointelligence.svg)](https://www.npmjs.org/package/videointelligence) - -Videointelligence client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Videointelligence Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/videointelligence/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Videointelligence API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install videointelligence -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -[//]: # "samples" - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install videointelligence@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=videointelligence.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-videointelligence diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json b/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json deleted file mode 100644 index f80a1458ef48..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "videointelligence", - "version": "0.1.0", - "description": "Videointelligence client for Node.js", - "repository": "googleapis/nodejs-videointelligence", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google videointelligence", - "videointelligence", - "video intelligence service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^5.1.1-rc.1" - }, - "devDependencies": { - "@types/mocha": "^10.0.10", - "@types/node": "^22.18.12", - "@types/sinon": "^20.0.0", - "c8": "^10.1.3", - "gapic-tools": "^1.0.3", - "gts": "^6.0.2", - "jsdoc": "^4.0.5", - "jsdoc-fresh": "^5.0.2", - "jsdoc-region-tag": "^4.0.1", - "mocha": "^11.7.4", - "pack-n-play": "^4.2.1", - "typescript": "5.8.3", - "sinon": "^20.0.0" - }, - "engines": { - "node": ">=v18" - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json.baseline deleted file mode 120000 index 2ff8622f1722..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/package.json.baseline +++ /dev/null @@ -1 +0,0 @@ -package.json \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/common_resources.proto.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/common_resources.proto.baseline deleted file mode 100644 index a2f46cea3e1f..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/common_resources.proto.baseline +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2020 Google LLC. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This file contains stub messages for common resources in GCP. -// It is not intended to be directly generated, and is instead used by -// other tooling to be able to match common resource patterns. -syntax = "proto3"; - -package google.cloud; - -import "google/api/resource.proto"; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Project" - pattern: "projects/{project}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Organization" - pattern: "organizations/{organization}" -}; - - -option (google.api.resource_definition) = { - type: "cloudresourcemanager.googleapis.com/Folder" - pattern: "folders/{folder}" -}; - - -option (google.api.resource_definition) = { - type: "cloudbilling.googleapis.com/BillingAccount" - pattern: "billingAccounts/{billing_account}" -}; - -option (google.api.resource_definition) = { - type: "locations.googleapis.com/Location" - pattern: "projects/{project}/locations/{location}" -}; - diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline deleted file mode 100644 index 9dcfda55edd5..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/protos/google/cloud/videointelligence/v1/video_intelligence.proto.baseline +++ /dev/null @@ -1,826 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.videointelligence.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.VideoIntelligence.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1;videointelligence"; -option java_multiple_files = true; -option java_outer_classname = "VideoIntelligenceServiceProto"; -option java_package = "com.google.cloud.videointelligence.v1"; -option php_namespace = "Google\\Cloud\\VideoIntelligence\\V1"; -option ruby_package = "Google::Cloud::VideoIntelligence::V1"; - -// Service that implements Google Cloud Video Intelligence API. -service VideoIntelligenceService { - option (google.api.default_host) = "videointelligence.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Performs asynchronous video annotation. Progress and results can be - // retrieved through the `google.longrunning.Operations` interface. - // `Operation.metadata` contains `AnnotateVideoProgress` (progress). - // `Operation.response` contains `AnnotateVideoResponse` (results). - rpc AnnotateVideo(AnnotateVideoRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/videos:annotate" - body: "*" - }; - option (google.api.method_signature) = "input_uri,features"; - option (google.longrunning.operation_info) = { - response_type: "AnnotateVideoResponse" - metadata_type: "AnnotateVideoProgress" - }; - } -} - -// Video annotation request. -message AnnotateVideoRequest { - // Input video location. Currently, only - // [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - // supported, which must be specified in the following format: - // `gs://bucket-id/object-id` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - // A video URI may include wildcards in `object-id`, and thus identify - // multiple videos. Supported wildcards: '*' to match 0 or more characters; - // '?' to match 1 character. If unset, the input video should be embedded - // in the request as `input_content`. If set, `input_content` should be unset. - string input_uri = 1; - - // The video data bytes. - // If unset, the input video(s) should be specified via `input_uri`. - // If set, `input_uri` should be unset. - bytes input_content = 6; - - // Required. Requested video annotation features. - repeated Feature features = 2 [(google.api.field_behavior) = REQUIRED]; - - // Additional video context and/or feature-specific parameters. - VideoContext video_context = 3; - - // Optional. Location where the output (in JSON format) should be stored. - // Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) - // URIs are supported, which must be specified in the following format: - // `gs://bucket-id/object-id` (other URI formats return - // [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For more information, see - // [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - string output_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Cloud region where annotation should take place. Supported cloud - // regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - // is specified, a region will be determined based on video file location. - string location_id = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Video context and/or feature-specific parameters. -message VideoContext { - // Video segments to annotate. The segments may overlap and are not required - // to be contiguous or span the whole video. If unspecified, each video is - // treated as a single segment. - repeated VideoSegment segments = 1; - - // Config for LABEL_DETECTION. - LabelDetectionConfig label_detection_config = 2; - - // Config for SHOT_CHANGE_DETECTION. - ShotChangeDetectionConfig shot_change_detection_config = 3; - - // Config for EXPLICIT_CONTENT_DETECTION. - ExplicitContentDetectionConfig explicit_content_detection_config = 4; - - // Config for FACE_DETECTION. - FaceDetectionConfig face_detection_config = 5; - - // Config for SPEECH_TRANSCRIPTION. - SpeechTranscriptionConfig speech_transcription_config = 6; - - // Config for TEXT_DETECTION. - TextDetectionConfig text_detection_config = 8; - - // Config for OBJECT_TRACKING. - ObjectTrackingConfig object_tracking_config = 13; -} - -// Video annotation feature. -enum Feature { - // Unspecified. - FEATURE_UNSPECIFIED = 0; - - // Label detection. Detect objects, such as dog or flower. - LABEL_DETECTION = 1; - - // Shot change detection. - SHOT_CHANGE_DETECTION = 2; - - // Explicit content detection. - EXPLICIT_CONTENT_DETECTION = 3; - - // Human face detection and tracking. - FACE_DETECTION = 4; - - // Speech transcription. - SPEECH_TRANSCRIPTION = 6; - - // OCR text detection and tracking. - TEXT_DETECTION = 7; - - // Object detection and tracking. - OBJECT_TRACKING = 9; - - // Logo detection, tracking, and recognition. - LOGO_RECOGNITION = 12; -} - -// Label detection mode. -enum LabelDetectionMode { - // Unspecified. - LABEL_DETECTION_MODE_UNSPECIFIED = 0; - - // Detect shot-level labels. - SHOT_MODE = 1; - - // Detect frame-level labels. - FRAME_MODE = 2; - - // Detect both shot-level and frame-level labels. - SHOT_AND_FRAME_MODE = 3; -} - -// Bucketized representation of likelihood. -enum Likelihood { - // Unspecified likelihood. - LIKELIHOOD_UNSPECIFIED = 0; - - // Very unlikely. - VERY_UNLIKELY = 1; - - // Unlikely. - UNLIKELY = 2; - - // Possible. - POSSIBLE = 3; - - // Likely. - LIKELY = 4; - - // Very likely. - VERY_LIKELY = 5; -} - -// Config for LABEL_DETECTION. -message LabelDetectionConfig { - // What labels should be detected with LABEL_DETECTION, in addition to - // video-level labels or segment-level labels. - // If unspecified, defaults to `SHOT_MODE`. - LabelDetectionMode label_detection_mode = 1; - - // Whether the video has been shot from a stationary (i.e. non-moving) camera. - // When set to true, might improve detection accuracy for moving objects. - // Should be used with `SHOT_AND_FRAME_MODE` enabled. - bool stationary_camera = 2; - - // Model to use for label detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 3; - - // The confidence threshold we perform filtering on the labels from - // frame-level detection. If not set, it is set to 0.4 by default. The valid - // range for this threshold is [0.1, 0.9]. Any value set outside of this - // range will be clipped. - // Note: for best results please follow the default threshold. We will update - // the default threshold everytime when we release a new model. - float frame_confidence_threshold = 4; - - // The confidence threshold we perform filtering on the labels from - // video-level and shot-level detections. If not set, it is set to 0.3 by - // default. The valid range for this threshold is [0.1, 0.9]. Any value set - // outside of this range will be clipped. - // Note: for best results please follow the default threshold. We will update - // the default threshold everytime when we release a new model. - float video_confidence_threshold = 5; -} - -// Config for SHOT_CHANGE_DETECTION. -message ShotChangeDetectionConfig { - // Model to use for shot change detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for OBJECT_TRACKING. -message ObjectTrackingConfig { - // Model to use for object tracking. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for FACE_DETECTION. -message FaceDetectionConfig { - // Model to use for face detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; - - // Whether bounding boxes be included in the face annotation output. - bool include_bounding_boxes = 2; -} - -// Config for EXPLICIT_CONTENT_DETECTION. -message ExplicitContentDetectionConfig { - // Model to use for explicit content detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 1; -} - -// Config for TEXT_DETECTION. -message TextDetectionConfig { - // Language hint can be specified if the language to be detected is known a - // priori. It can increase the accuracy of the detection. Language hint must - // be language code in BCP-47 format. - // - // Automatic language detection is performed if no hint is provided. - repeated string language_hints = 1; - - // Model to use for text detection. - // Supported values: "builtin/stable" (the default if unset) and - // "builtin/latest". - string model = 2; -} - -// Video segment. -message VideoSegment { - // Time-offset, relative to the beginning of the video, - // corresponding to the start of the segment (inclusive). - google.protobuf.Duration start_time_offset = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the end of the segment (inclusive). - google.protobuf.Duration end_time_offset = 2; -} - -// Video segment level annotation results for label detection. -message LabelSegment { - // Video segment where a label was detected. - VideoSegment segment = 1; - - // Confidence that the label is accurate. Range: [0, 1]. - float confidence = 2; -} - -// Video frame level annotation results for label detection. -message LabelFrame { - // Time-offset, relative to the beginning of the video, corresponding to the - // video frame for this location. - google.protobuf.Duration time_offset = 1; - - // Confidence that the label is accurate. Range: [0, 1]. - float confidence = 2; -} - -// Detected entity from video analysis. -message Entity { - // Opaque entity ID. Some IDs may be available in - // [Google Knowledge Graph Search - // API](https://developers.google.com/knowledge-graph/). - string entity_id = 1; - - // Textual description, e.g. `Fixed-gear bicycle`. - string description = 2; - - // Language code for `description` in BCP-47 format. - string language_code = 3; -} - -// Label annotation. -message LabelAnnotation { - // Detected entity. - Entity entity = 1; - - // Common categories for the detected entity. - // E.g. when the label is `Terrier` the category is likely `dog`. And in some - // cases there might be more than one categories e.g. `Terrier` could also be - // a `pet`. - repeated Entity category_entities = 2; - - // All video segments where a label was detected. - repeated LabelSegment segments = 3; - - // All video frames where a label was detected. - repeated LabelFrame frames = 4; -} - -// Video frame level annotation results for explicit content. -message ExplicitContentFrame { - // Time-offset, relative to the beginning of the video, corresponding to the - // video frame for this location. - google.protobuf.Duration time_offset = 1; - - // Likelihood of the pornography content.. - Likelihood pornography_likelihood = 2; -} - -// Explicit content annotation (based on per-frame visual signals only). -// If no explicit content has been detected in a frame, no annotations are -// present for that frame. -message ExplicitContentAnnotation { - // All video frames where explicit content was detected. - repeated ExplicitContentFrame frames = 1; -} - -// Normalized bounding box. -// The normalized vertex coordinates are relative to the original image. -// Range: [0, 1]. -message NormalizedBoundingBox { - // Left X coordinate. - float left = 1; - - // Top Y coordinate. - float top = 2; - - // Right X coordinate. - float right = 3; - - // Bottom Y coordinate. - float bottom = 4; -} - -// Video segment level annotation results for face detection. -message FaceSegment { - // Video segment where a face was detected. - VideoSegment segment = 1; -} - -// Video frame level annotation results for face detection. -message FaceFrame { - // Normalized Bounding boxes in a frame. - // There can be more than one boxes if the same face is detected in multiple - // locations within the current frame. - repeated NormalizedBoundingBox normalized_bounding_boxes = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the video frame for this location. - google.protobuf.Duration time_offset = 2; -} - -// Face annotation. -message FaceAnnotation { - // Thumbnail of a representative face view (in JPEG format). - bytes thumbnail = 1; - - // All video segments where a face was detected. - repeated FaceSegment segments = 2; - - // All video frames where a face was detected. - repeated FaceFrame frames = 3; -} - -// For tracking related features. -// An object at time_offset with attributes, and located with -// normalized_bounding_box. -message TimestampedObject { - // Normalized Bounding box in a frame, where the object is located. - NormalizedBoundingBox normalized_bounding_box = 1; - - // Time-offset, relative to the beginning of the video, - // corresponding to the video frame for this object. - google.protobuf.Duration time_offset = 2; - - // Optional. The attributes of the object in the bounding box. - repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The detected landmarks. - repeated DetectedLandmark landmarks = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A track of an object instance. -message Track { - // Video segment of a track. - VideoSegment segment = 1; - - // The object with timestamp and attributes per frame in the track. - repeated TimestampedObject timestamped_objects = 2; - - // Optional. Attributes in the track level. - repeated DetectedAttribute attributes = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The confidence score of the tracked object. - float confidence = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// A generic detected attribute represented by name in string format. -message DetectedAttribute { - // The name of the attribute, i.e. glasses, dark_glasses, mouth_open etc. - // A full list of supported type names will be provided in the document. - string name = 1; - - // Detected attribute confidence. Range [0, 1]. - float confidence = 2; - - // Text value of the detection result. For example, the value for "HairColor" - // can be "black", "blonde", etc. - string value = 3; -} - -// A generic detected landmark represented by name in string format and a 2D -// location. -message DetectedLandmark { - // The name of this landmark, i.e. left_hand, right_shoulder. - string name = 1; - - // The 2D point of the detected landmark using the normalized image - // coordindate system. The normalized coordinates have the range from 0 to 1. - NormalizedVertex point = 2; - - // The confidence score of the detected landmark. Range [0, 1]. - float confidence = 3; -} - -// Annotation results for a single video. -message VideoAnnotationResults { - // Video file location in - // [Google Cloud Storage](https://cloud.google.com/storage/). - string input_uri = 1; - - // Video segment on which the annotation is run. - VideoSegment segment = 10; - - // Topical label annotations on video level or user specified segment level. - // There is exactly one element for each unique label. - repeated LabelAnnotation segment_label_annotations = 2; - - // Presence label annotations on video level or user specified segment level. - // There is exactly one element for each unique label. Compared to the - // existing topical `segment_label_annotations`, this field presents more - // fine-grained, segment-level labels detected in video content and is made - // available only when the client sets `LabelDetectionConfig.model` to - // "builtin/latest" in the request. - repeated LabelAnnotation segment_presence_label_annotations = 23; - - // Topical label annotations on shot level. - // There is exactly one element for each unique label. - repeated LabelAnnotation shot_label_annotations = 3; - - // Presence label annotations on shot level. There is exactly one element for - // each unique label. Compared to the existing topical - // `shot_label_annotations`, this field presents more fine-grained, shot-level - // labels detected in video content and is made available only when the client - // sets `LabelDetectionConfig.model` to "builtin/latest" in the request. - repeated LabelAnnotation shot_presence_label_annotations = 24; - - // Label annotations on frame level. - // There is exactly one element for each unique label. - repeated LabelAnnotation frame_label_annotations = 4; - - // Face annotations. There is exactly one element for each unique face. - repeated FaceAnnotation face_annotations = 5; - - // Shot annotations. Each shot is represented as a video segment. - repeated VideoSegment shot_annotations = 6; - - // Explicit content annotation. - ExplicitContentAnnotation explicit_annotation = 7; - - // Speech transcription. - repeated SpeechTranscription speech_transcriptions = 11; - - // OCR text detection and tracking. - // Annotations for list of detected text snippets. Each will have list of - // frame information associated with it. - repeated TextAnnotation text_annotations = 12; - - // Annotations for list of objects detected and tracked in video. - repeated ObjectTrackingAnnotation object_annotations = 14; - - // Annotations for list of logos detected, tracked and recognized in video. - repeated LogoRecognitionAnnotation logo_recognition_annotations = 19; - - // If set, indicates an error. Note that for a single `AnnotateVideoRequest` - // some videos may succeed and some may fail. - google.rpc.Status error = 9; -} - -// Video annotation response. Included in the `response` -// field of the `Operation` returned by the `GetOperation` -// call of the `google::longrunning::Operations` service. -message AnnotateVideoResponse { - // Annotation results for all videos specified in `AnnotateVideoRequest`. - repeated VideoAnnotationResults annotation_results = 1; -} - -// Annotation progress for a single video. -message VideoAnnotationProgress { - // Video file location in - // [Google Cloud Storage](https://cloud.google.com/storage/). - string input_uri = 1; - - // Approximate percentage processed thus far. Guaranteed to be - // 100 when fully processed. - int32 progress_percent = 2; - - // Time when the request was received. - google.protobuf.Timestamp start_time = 3; - - // Time of the most recent update. - google.protobuf.Timestamp update_time = 4; - - // Specifies which feature is being tracked if the request contains more than - // one features. - Feature feature = 5; - - // Specifies which segment is being tracked if the request contains more than - // one segments. - VideoSegment segment = 6; -} - -// Video annotation progress. Included in the `metadata` -// field of the `Operation` returned by the `GetOperation` -// call of the `google::longrunning::Operations` service. -message AnnotateVideoProgress { - // Progress metadata for all videos specified in `AnnotateVideoRequest`. - repeated VideoAnnotationProgress annotation_progress = 1; -} - -// Config for SPEECH_TRANSCRIPTION. -message SpeechTranscriptionConfig { - // Required. *Required* The language of the supplied audio as a - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - // Example: "en-US". - // See [Language Support](https://cloud.google.com/speech/docs/languages) - // for a list of the currently supported language codes. - string language_code = 1 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Maximum number of recognition hypotheses to be returned. - // Specifically, the maximum number of `SpeechRecognitionAlternative` messages - // within each `SpeechTranscription`. The server may return fewer than - // `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will - // return a maximum of one. If omitted, will return a maximum of one. - int32 max_alternatives = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to `true`, the server will attempt to filter out - // profanities, replacing all but the initial character in each filtered word - // with asterisks, e.g. "f***". If set to `false` or omitted, profanities - // won't be filtered out. - bool filter_profanity = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. A means to provide context to assist the speech recognition. - repeated SpeechContext speech_contexts = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If 'true', adds punctuation to recognition result hypotheses. - // This feature is only available in select languages. Setting this for - // requests in other languages has no effect at all. The default 'false' value - // does not add punctuation to result hypotheses. NOTE: "This is currently - // offered as an experimental service, complimentary to all users. In the - // future this may be exclusively available as a premium feature." - bool enable_automatic_punctuation = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. For file formats, such as MXF or MKV, supporting multiple audio - // tracks, specify up to two tracks. Default: track 0. - repeated int32 audio_tracks = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If 'true', enables speaker detection for each recognized word in - // the top alternative of the recognition result using a speaker_tag provided - // in the WordInfo. - // Note: When this is true, we send all the words from the beginning of the - // audio for the top alternative in every consecutive responses. - // This is done in order to improve our speaker tags as our models learn to - // identify the speakers in the conversation over time. - bool enable_speaker_diarization = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, specifies the estimated number of speakers in the conversation. - // If not set, defaults to '2'. - // Ignored unless enable_speaker_diarization is set to true. - int32 diarization_speaker_count = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If `true`, the top result includes a list of words and the - // confidence for those words. If `false`, no word-level confidence - // information is returned. The default is `false`. - bool enable_word_confidence = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// Provides "hints" to the speech recognizer to favor specific words and phrases -// in the results. -message SpeechContext { - // Optional. A list of strings containing words and phrases "hints" so that - // the speech recognition is more likely to recognize them. This can be used - // to improve the accuracy for specific words and phrases, for example, if - // specific commands are typically spoken by the user. This can also be used - // to add additional words to the vocabulary of the recognizer. See - // [usage limits](https://cloud.google.com/speech/limits#content). - repeated string phrases = 1 [(google.api.field_behavior) = OPTIONAL]; -} - -// A speech recognition result corresponding to a portion of the audio. -message SpeechTranscription { - // May contain one or more recognition hypotheses (up to the maximum specified - // in `max_alternatives`). These alternatives are ordered in terms of - // accuracy, with the top (first) alternative being the most probable, as - // ranked by the recognizer. - repeated SpeechRecognitionAlternative alternatives = 1; - - // Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag of - // the language in this result. This language code was detected to have the - // most likelihood of being spoken in the audio. - string language_code = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Alternative hypotheses (a.k.a. n-best list). -message SpeechRecognitionAlternative { - // Transcript text representing the words that the user spoke. - string transcript = 1; - - // Output only. The confidence estimate between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. This field is set only for the top alternative. - // This field is not guaranteed to be accurate and users should not rely on it - // to be always provided. - // The default of 0.0 is a sentinel value indicating `confidence` was not set. - float confidence = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A list of word-specific information for each recognized word. - // Note: When `enable_speaker_diarization` is true, you will see all the words - // from the beginning of the audio. - repeated WordInfo words = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Word-specific information for recognized words. Word information is only -// included in the response when certain request parameters are set, such -// as `enable_word_time_offsets`. -message WordInfo { - // Time offset relative to the beginning of the audio, and - // corresponding to the start of the spoken word. This field is only set if - // `enable_word_time_offsets=true` and only in the top hypothesis. This is an - // experimental feature and the accuracy of the time offset can vary. - google.protobuf.Duration start_time = 1; - - // Time offset relative to the beginning of the audio, and - // corresponding to the end of the spoken word. This field is only set if - // `enable_word_time_offsets=true` and only in the top hypothesis. This is an - // experimental feature and the accuracy of the time offset can vary. - google.protobuf.Duration end_time = 2; - - // The word corresponding to this set of information. - string word = 3; - - // Output only. The confidence estimate between 0.0 and 1.0. A higher number - // indicates an estimated greater likelihood that the recognized words are - // correct. This field is set only for the top alternative. - // This field is not guaranteed to be accurate and users should not rely on it - // to be always provided. - // The default of 0.0 is a sentinel value indicating `confidence` was not set. - float confidence = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. A distinct integer value is assigned for every speaker within - // the audio. This field specifies which one of those speakers was detected to - // have spoken this word. Value ranges from 1 up to diarization_speaker_count, - // and is only set if speaker diarization is enabled. - int32 speaker_tag = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A vertex represents a 2D point in the image. -// NOTE: the normalized vertex coordinates are relative to the original image -// and range from 0 to 1. -message NormalizedVertex { - // X coordinate. - float x = 1; - - // Y coordinate. - float y = 2; -} - -// Normalized bounding polygon for text (that might not be aligned with axis). -// Contains list of the corner points in clockwise order starting from -// top-left corner. For example, for a rectangular bounding box: -// When the text is horizontal it might look like: -// 0----1 -// | | -// 3----2 -// -// When it's clockwise rotated 180 degrees around the top-left corner it -// becomes: -// 2----3 -// | | -// 1----0 -// -// and the vertex order will still be (0, 1, 2, 3). Note that values can be less -// than 0, or greater than 1 due to trignometric calculations for location of -// the box. -message NormalizedBoundingPoly { - // Normalized vertices of the bounding polygon. - repeated NormalizedVertex vertices = 1; -} - -// Video segment level annotation results for text detection. -message TextSegment { - // Video segment where a text snippet was detected. - VideoSegment segment = 1; - - // Confidence for the track of detected text. It is calculated as the highest - // over all frames where OCR detected text appears. - float confidence = 2; - - // Information related to the frames where OCR detected text appears. - repeated TextFrame frames = 3; -} - -// Video frame level annotation results for text annotation (OCR). -// Contains information regarding timestamp and bounding box locations for the -// frames containing detected OCR text snippets. -message TextFrame { - // Bounding polygon of the detected text for this frame. - NormalizedBoundingPoly rotated_bounding_box = 1; - - // Timestamp of this frame. - google.protobuf.Duration time_offset = 2; -} - -// Annotations related to one detected OCR text snippet. This will contain the -// corresponding text, confidence value, and frame level information for each -// detection. -message TextAnnotation { - // The detected text. - string text = 1; - - // All video segments where OCR detected text appears. - repeated TextSegment segments = 2; -} - -// Video frame level annotations for object detection and tracking. This field -// stores per frame location, time offset, and confidence. -message ObjectTrackingFrame { - // The normalized bounding box location of this object track for the frame. - NormalizedBoundingBox normalized_bounding_box = 1; - - // The timestamp of the frame in microseconds. - google.protobuf.Duration time_offset = 2; -} - -// Annotations corresponding to one tracked object. -message ObjectTrackingAnnotation { - // Different representation of tracking info in non-streaming batch - // and streaming modes. - oneof track_info { - // Non-streaming batch mode ONLY. - // Each object track corresponds to one video segment where it appears. - VideoSegment segment = 3; - - // Streaming mode ONLY. - // In streaming mode, we do not know the end time of a tracked object - // before it is completed. Hence, there is no VideoSegment info returned. - // Instead, we provide a unique identifiable integer track_id so that - // the customers can correlate the results of the ongoing - // ObjectTrackAnnotation of the same track_id over time. - int64 track_id = 5; - } - - // Entity to specify the object category that this track is labeled as. - Entity entity = 1; - - // Object category's labeling confidence of this track. - float confidence = 4; - - // Information corresponding to all frames where this object track appears. - // Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame - // messages in frames. - // Streaming mode: it can only be one ObjectTrackingFrame message in frames. - repeated ObjectTrackingFrame frames = 2; -} - -// Annotation corresponding to one detected, tracked and recognized logo class. -message LogoRecognitionAnnotation { - // Entity category information to specify the logo class that all the logo - // tracks within this LogoRecognitionAnnotation are recognized as. - Entity entity = 1; - - // All logo tracks where the recognized logo appears. Each track corresponds - // to one logo instance appearing in consecutive frames. - repeated Track tracks = 2; - - // All video segments where the recognized logo appears. There might be - // multiple instances of the same logo class appearing in one VideoSegment. - repeated VideoSegment segments = 3; -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline deleted file mode 100644 index bcd609e915a8..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/snippet_metadata_google.cloud.videointelligence.v1.json.baseline +++ /dev/null @@ -1,75 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-videointelligence", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.videointelligence.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async", - "title": "VideoIntelligenceService annotateVideo Sample", - "origin": "API_DEFINITION", - "description": " Performs asynchronous video annotation. Progress and results can be retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains `AnnotateVideoProgress` (progress). `Operation.response` contains `AnnotateVideoResponse` (results).", - "canonical": true, - "file": "video_intelligence_service.annotate_video.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 92, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AnnotateVideo", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService.AnnotateVideo", - "async": true, - "parameters": [ - { - "name": "input_uri", - "type": "TYPE_STRING" - }, - { - "name": "input_content", - "type": "TYPE_BYTES" - }, - { - "name": "features", - "type": "TYPE_ENUM[]" - }, - { - "name": "video_context", - "type": ".google.cloud.videointelligence.v1.VideoContext" - }, - { - "name": "output_uri", - "type": "TYPE_STRING" - }, - { - "name": "location_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "VideoIntelligenceServiceClient", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceServiceClient" - }, - "method": { - "shortName": "AnnotateVideo", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService.AnnotateVideo", - "service": { - "shortName": "VideoIntelligenceService", - "fullName": "google.cloud.videointelligence.v1.VideoIntelligenceService" - } - } - } - } - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline deleted file mode 100644 index dc2e51e64703..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/samples/generated/v1/video_intelligence_service.annotate_video.js.baseline +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright 2026 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. ** - - - -'use strict'; - -function main(features) { - // [START videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Input video location. Currently, only - * Google Cloud Storage (https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * google.rpc.Code.INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT). For more information, see - * Request URIs (https://cloud.google.com/storage/docs/request-endpoints). - * A video URI may include wildcards in `object-id`, and thus identify - * multiple videos. Supported wildcards: '*' to match 0 or more characters; - * '?' to match 1 character. If unset, the input video should be embedded - * in the request as `input_content`. If set, `input_content` should be unset. - */ - // const inputUri = 'abc123' - /** - * The video data bytes. - * If unset, the input video(s) should be specified via `input_uri`. - * If set, `input_uri` should be unset. - */ - // const inputContent = Buffer.from('string') - /** - * Required. Requested video annotation features. - */ - // const features = [1,2,3,4] - /** - * Additional video context and/or feature-specific parameters. - */ - // const videoContext = {} - /** - * Optional. Location where the output (in JSON format) should be stored. - * Currently, only Google Cloud Storage (https://cloud.google.com/storage/) - * URIs are supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * google.rpc.Code.INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT). For more information, see - * Request URIs (https://cloud.google.com/storage/docs/request-endpoints). - */ - // const outputUri = 'abc123' - /** - * Optional. Cloud region where annotation should take place. Supported cloud - * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - * is specified, a region will be determined based on video file location. - */ - // const locationId = 'abc123' - - // Imports the Videointelligence library - const {VideoIntelligenceServiceClient} = require('videointelligence').v1; - - // Instantiates a client - const videointelligenceClient = new VideoIntelligenceServiceClient(); - - async function callAnnotateVideo() { - // Construct request - const request = { - features, - }; - - // Run request - const [operation] = await videointelligenceClient.annotateVideo(request); - const [response] = await operation.promise(); - console.log(response); - } - - callAnnotateVideo(); - // [END videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/src/index.ts.baseline deleted file mode 100644 index 94955370b3b4..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/index.ts.baseline +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2026 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. ** - -import * as v1 from './v1'; -const VideoIntelligenceServiceClient = v1.VideoIntelligenceServiceClient; -type VideoIntelligenceServiceClient = v1.VideoIntelligenceServiceClient; -export {v1, VideoIntelligenceServiceClient}; -export default {v1, VideoIntelligenceServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/index.ts.baseline deleted file mode 100644 index 063b4957f588..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/index.ts.baseline +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2026 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. ** - -export {VideoIntelligenceServiceClient} from './video_intelligence_service_client'; diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client.ts.baseline deleted file mode 100644 index 671eea50e118..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client.ts.baseline +++ /dev/null @@ -1,496 +0,0 @@ -// Copyright 2026 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. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/video_intelligence_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './video_intelligence_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service that implements Google Cloud Video Intelligence API. - * @class - * @memberof v1 - */ -export class VideoIntelligenceServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('videointelligence'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - operationsClient: gax.OperationsClient; - videoIntelligenceServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of VideoIntelligenceServiceClient. - * - * @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://cloud.google.com/docs/authentication/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 VideoIntelligenceServiceClient({fallback: true}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof VideoIntelligenceServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); - } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; - this._servicePath = 'videointelligence.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof 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 as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process === 'object' && '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); - - const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback) { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = []; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const annotateVideoResponse = protoFilesRoot.lookup( - '.google.cloud.videointelligence.v1.AnnotateVideoResponse') as gax.protobuf.Type; - const annotateVideoMetadata = protoFilesRoot.lookup( - '.google.cloud.videointelligence.v1.AnnotateVideoProgress') as gax.protobuf.Type; - - this.descriptors.longrunning = { - annotateVideo: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - annotateVideoResponse.decode.bind(annotateVideoResponse), - annotateVideoMetadata.decode.bind(annotateVideoMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.videointelligence.v1.VideoIntelligenceService', gapicConfig as gax.ClientConfig, - 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.videoIntelligenceServiceStub) { - return this.videoIntelligenceServiceStub; - } - - // Put together the "service stub" for - // google.cloud.videointelligence.v1.VideoIntelligenceService. - this.videoIntelligenceServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.videointelligence.v1.VideoIntelligenceService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.videointelligence.v1.VideoIntelligenceService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const videoIntelligenceServiceStubMethods = - ['annotateVideo']; - for (const methodName of videoIntelligenceServiceStubMethods) { - const callPromise = this.videoIntelligenceServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.videoIntelligenceServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'videointelligence.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); - } - return 'videointelligence.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * 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' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - -/** - * Performs asynchronous video annotation. Progress and results can be - * retrieved through the `google.longrunning.Operations` interface. - * `Operation.metadata` contains `AnnotateVideoProgress` (progress). - * `Operation.response` contains `AnnotateVideoResponse` (results). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.inputUri - * Input video location. Currently, only - * [Google Cloud Storage](https://cloud.google.com/storage/) URIs are - * supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * {@link protos.google.rpc.Code.INVALID_ARGUMENT|google.rpc.Code.INVALID_ARGUMENT}). For more information, see - * [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - * A video URI may include wildcards in `object-id`, and thus identify - * multiple videos. Supported wildcards: '*' to match 0 or more characters; - * '?' to match 1 character. If unset, the input video should be embedded - * in the request as `input_content`. If set, `input_content` should be unset. - * @param {Buffer} request.inputContent - * The video data bytes. - * If unset, the input video(s) should be specified via `input_uri`. - * If set, `input_uri` should be unset. - * @param {number[]} request.features - * Required. Requested video annotation features. - * @param {google.cloud.videointelligence.v1.VideoContext} request.videoContext - * Additional video context and/or feature-specific parameters. - * @param {string} [request.outputUri] - * Optional. Location where the output (in JSON format) should be stored. - * Currently, only [Google Cloud Storage](https://cloud.google.com/storage/) - * URIs are supported, which must be specified in the following format: - * `gs://bucket-id/object-id` (other URI formats return - * {@link protos.google.rpc.Code.INVALID_ARGUMENT|google.rpc.Code.INVALID_ARGUMENT}). For more information, see - * [Request URIs](https://cloud.google.com/storage/docs/request-endpoints). - * @param {string} [request.locationId] - * Optional. Cloud region where annotation should take place. Supported cloud - * regions: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no region - * is specified, a region will be determined based on video file location. - * @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 - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/video_intelligence_service.annotate_video.js - * region_tag:videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async - */ - annotateVideo( - request?: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - annotateVideo( - request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - annotateVideo( - request: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - annotateVideo( - request?: protos.google.cloud.videointelligence.v1.IAnnotateVideoRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback - ? (error, response, rawResponse, _) => { - this._log.info('annotateVideo response %j', rawResponse); - callback!(error, response, rawResponse, _); // We verified callback above. - } - : undefined; - this._log.info('annotateVideo request %j', request); - return this.innerApiCalls.annotateVideo(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('annotateVideo response %j', rawResponse); - return [response, rawResponse, _]; - }); - } -/** - * Check the status of the long running operation returned by `annotateVideo()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v1/video_intelligence_service.annotate_video.js - * region_tag:videointelligence_v1_generated_VideoIntelligenceService_AnnotateVideo_async - */ - async checkAnnotateVideoProgress(name: string): Promise>{ - this._log.info('annotateVideo long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.annotateVideo, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.videoIntelligenceServiceStub && !this._terminated) { - return this.videoIntelligenceServiceStub.then(stub => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - void this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} \ No newline at end of file diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client_config.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client_config.json.baseline deleted file mode 100644 index e99ce74a90cc..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_client_config.json.baseline +++ /dev/null @@ -1,30 +0,0 @@ -{ - "interfaces": { - "google.cloud.videointelligence.v1.VideoIntelligenceService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AnnotateVideo": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_proto_list.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_proto_list.json.baseline deleted file mode 100644 index e28d401f1a27..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/src/v1/video_intelligence_service_proto_list.json.baseline +++ /dev/null @@ -1,3 +0,0 @@ -[ - "../../protos/google/cloud/videointelligence/v1/video_intelligence.proto" -] diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.js.baseline deleted file mode 100644 index 97981e6b07e2..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.js.baseline +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2026 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. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const videointelligence = require('videointelligence'); - -function main() { - const videoIntelligenceServiceClient = new videointelligence.VideoIntelligenceServiceClient(); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.ts.baseline deleted file mode 100644 index 4b3782f73c52..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/fixtures/sample/src/index.ts.baseline +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2026 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. ** - -import {VideoIntelligenceServiceClient} from 'videointelligence'; - -// check that the client class type name can be used -function doStuffWithVideoIntelligenceServiceClient(client: VideoIntelligenceServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const videoIntelligenceServiceClient = new VideoIntelligenceServiceClient(); - doStuffWithVideoIntelligenceServiceClient(videoIntelligenceServiceClient); -} - -main(); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/install.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/install.ts.baseline deleted file mode 100644 index f66069aa3940..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/system-test/install.ts.baseline +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2026 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. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/test/gapic_video_intelligence_service_v1.ts.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/test/gapic_video_intelligence_service_v1.ts.baseline deleted file mode 100644 index 075b669d76a7..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/test/gapic_video_intelligence_service_v1.ts.baseline +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright 2026 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. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as videointelligenceserviceModule from '../src'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -describe('v1.VideoIntelligenceServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'videointelligence.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.servicePath; - assert.strictEqual(servicePath, 'videointelligence.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'videointelligence.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'videointelligence.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = videointelligenceserviceModule.v1.VideoIntelligenceServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.videoIntelligenceServiceStub, undefined); - await client.initialize(); - assert(client.videoIntelligenceServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.videoIntelligenceServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has close method for the non-initialized client', done => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.videoIntelligenceServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('annotateVideo', () => { - it('invokes annotateVideo without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.annotateVideo = stubLongRunningCall(expectedResponse); - const [operation] = await client.annotateVideo(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateVideo without error using callback', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.annotateVideo = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.annotateVideo( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes annotateVideo with call error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateVideo = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.annotateVideo(request), expectedError); - }); - - it('invokes annotateVideo with LRO error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.videointelligence.v1.AnnotateVideoRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.annotateVideo = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.annotateVideo(request); - await assert.rejects(operation.promise(), expectedError); - }); - - it('invokes checkAnnotateVideoProgress without error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkAnnotateVideoProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkAnnotateVideoProgress with error', async () => { - const client = new videointelligenceserviceModule.v1.VideoIntelligenceServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkAnnotateVideoProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); -}); diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/tsconfig.json.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/tsconfig.json.baseline deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/tsconfig.json.baseline +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/core/generator/gapic-generator-typescript/baselines/videointelligence/webpack.config.js.baseline b/core/generator/gapic-generator-typescript/baselines/videointelligence/webpack.config.js.baseline deleted file mode 100644 index 3ee1fd719b83..000000000000 --- a/core/generator/gapic-generator-typescript/baselines/videointelligence/webpack.config.js.baseline +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'VideoIntelligenceService', - filename: './video-intelligence-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/core/generator/gapic-generator-typescript/package-lock.json b/core/generator/gapic-generator-typescript/package-lock.json index b9f44aea0416..bda9d2d183c5 100644 --- a/core/generator/gapic-generator-typescript/package-lock.json +++ b/core/generator/gapic-generator-typescript/package-lock.json @@ -48,6 +48,7 @@ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.24" @@ -61,6 +62,7 @@ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", "js-tokens": "^4.0.0", @@ -75,6 +77,7 @@ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz", "integrity": "sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -84,6 +87,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, + "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.2", @@ -113,13 +117,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@babel/generator": { "version": "7.27.0", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/parser": "^7.27.0", "@babel/types": "^7.27.0", @@ -136,6 +142,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.0.tgz", "integrity": "sha512-LVk7fbXml0H2xH34dFzKQ7TDZ2G4/rVTOrq9V+icbbadjbVxxeFeDsNHv2SrZeWoA+6ZiTyWYWtScEIW07EAcA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/compat-data": "^7.26.8", "@babel/helper-validator-option": "^7.25.9", @@ -152,6 +159,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.25.9.tgz", "integrity": "sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/traverse": "^7.25.9", "@babel/types": "^7.25.9" @@ -165,6 +173,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.26.0.tgz", "integrity": "sha512-xO+xu6B5K2czEnQye6BHA7DolFFmS3LB7stHZFaOLb1pAwO1HWLS8fXA+eh0A2yIvltPVmx3eNNDBJA2SLHXFw==", "dev": true, + "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9", @@ -181,6 +190,7 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -189,6 +199,7 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -198,6 +209,7 @@ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.25.9.tgz", "integrity": "sha512-e/zv1co8pp55dNdEcCynfj9X7nyUKUXoUEwfXqaZt0omVOmDe9oOTdKStH4GmAw6zxMFs50ZayuMfHDKlO7Tfw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -207,6 +219,7 @@ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz", "integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==", "dev": true, + "license": "MIT", "dependencies": { "@babel/template": "^7.27.0", "@babel/types": "^7.27.0" @@ -219,6 +232,7 @@ "version": "7.27.0", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", + "license": "MIT", "dependencies": { "@babel/types": "^7.27.0" }, @@ -234,6 +248,7 @@ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/parser": "^7.27.0", @@ -248,6 +263,7 @@ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", "@babel/generator": "^7.27.0", @@ -265,6 +281,7 @@ "version": "7.27.0", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", + "license": "MIT", "dependencies": { "@babel/helper-string-parser": "^7.25.9", "@babel/helper-validator-identifier": "^7.25.9" @@ -278,6 +295,7 @@ "resolved": "https://registry.npmjs.org/@bazel/bazelisk/-/bazelisk-1.26.0.tgz", "integrity": "sha512-bTNcHdGyEQ9r7SczEYUa0gkEQhJo1ld2BjXI8fWBvsUeoHi03QpUs2HZgDbjjrpQFQqG2ZbO7ihZvH8MjhUTHw==", "dev": true, + "license": "Apache-2.0", "bin": { "bazel": "bazelisk.js", "bazelisk": "bazelisk.js" @@ -288,6 +306,7 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -300,6 +319,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -310,6 +330,7 @@ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.6.0.tgz", "integrity": "sha512-WhCn7Z7TauhBtmzhvKpoQs0Wwb/kBcy4CwpuI0/eEIr2Lx2auxmulAzLr91wVZJaz47iUZdkXOK7WlAfxGKCnA==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^3.4.3" }, @@ -328,6 +349,7 @@ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.1.tgz", "integrity": "sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } @@ -337,6 +359,7 @@ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", "dev": true, + "license": "MIT", "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", @@ -371,6 +394,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -399,6 +423,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -411,6 +436,7 @@ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz", "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } @@ -420,6 +446,7 @@ "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.2.tgz", "integrity": "sha512-DJS3s0OVH4zFDB1PzjxAsHqJT6sKVbRwwML0ZBP9PbU7Yebtu/7SWMRzvO2J3nUi9pRNITCfu4LJeooM2w4pjg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "arrify": "^2.0.0", "extend": "^3.0.2" @@ -433,6 +460,7 @@ "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-4.0.0.tgz", "integrity": "sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=14.0.0" } @@ -442,6 +470,7 @@ "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-4.0.0.tgz", "integrity": "sha512-Orxzlfb9c67A15cq2JQEyVc7wEsmFBmHjZWZYQMUyJ1qivXyMwdyNOs9odi79hze+2zqdTtu1E19IM/FtqZ10g==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=14" } @@ -478,6 +507,7 @@ "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.13.3.tgz", "integrity": "sha512-FTXHdOoPbZrBjlVLHuKbDZnsTxXv2BlHF57xw6LuThXacXvtkahEPED0CKMk6obZDf65Hv4k3z62eyPNpvinIg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@grpc/proto-loader": "^0.7.13", "@js-sdsl/ordered-map": "^4.4.2" @@ -491,6 +521,7 @@ "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.13.tgz", "integrity": "sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "lodash.camelcase": "^4.3.0", "long": "^5.0.0", @@ -510,6 +541,7 @@ "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", "deprecated": "Use @eslint/config-array instead", "dev": true, + "license": "Apache-2.0", "dependencies": { "@humanwhocodes/object-schema": "^2.0.3", "debug": "^4.3.1", @@ -548,6 +580,7 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=12.22" }, @@ -561,13 +594,15 @@ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz", "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==", "deprecated": "Use @eslint/object-schema instead", - "dev": true + "dev": true, + "license": "BSD-3-Clause" }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", "dev": true, + "license": "ISC", "dependencies": { "string-width": "^5.1.2", "string-width-cjs": "npm:string-width@^4.2.0", @@ -585,6 +620,7 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -596,13 +632,15 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -620,6 +658,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -635,6 +674,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -649,6 +689,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -658,6 +699,7 @@ "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -666,13 +708,15 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", "dev": true, + "license": "MIT", "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -683,6 +727,7 @@ "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", "dev": true, + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/js-sdsl" @@ -692,6 +737,7 @@ "version": "0.2.9", "resolved": "https://registry.npmjs.org/@jsdoc/salty/-/salty-0.2.9.tgz", "integrity": "sha512-yYxMVH7Dqw6nO0d5NIV8OQWnitU8k6vXH8NtgqAfIa/IUqRMxRv/NUJJ08VEKbAakwxlgBl5PJdrU0dMPStsnw==", + "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.21" }, @@ -717,6 +763,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -730,6 +777,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } @@ -739,6 +787,7 @@ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -752,6 +801,7 @@ "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" } @@ -761,6 +811,7 @@ "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", @@ -779,6 +830,7 @@ "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "universal-user-agent": "^6.0.0" @@ -792,6 +844,7 @@ "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/request": "^8.4.1", "@octokit/types": "^13.0.0", @@ -805,13 +858,15 @@ "version": "24.2.0", "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@octokit/plugin-paginate-rest": { "version": "11.4.4-cjs.2", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.4.4-cjs.2.tgz", "integrity": "sha512-2dK6z8fhs8lla5PaOTgqfCGBxgAv/le+EhPs27KklPhm1bKObpu6lXzwfUEQ16ajXzqNrKMujsFyo9K2eaoISw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.7.0" }, @@ -827,6 +882,7 @@ "resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-4.0.1.tgz", "integrity": "sha512-GihNqNpGHorUrO7Qa9JbAl0dbLnqJVrV8OXe2Zm5/Y4wFkZQDfTreBzVmiRfJVfE4mClXdihHnbpyyO9FSX4HA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 18" }, @@ -839,6 +895,7 @@ "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.3.2-cjs.1.tgz", "integrity": "sha512-VUjIjOOvF2oELQmiFpWA1aOPdawpyaCUqcEBc/UOUnj3Xp6DJGrJ1+bjUIIDzdHjnFNO6q57ODMfdEZnoBkCwQ==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.8.0" }, @@ -854,6 +911,7 @@ "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/endpoint": "^9.0.6", "@octokit/request-error": "^5.1.1", @@ -869,6 +927,7 @@ "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/types": "^13.1.0", "deprecation": "^2.0.0", @@ -883,6 +942,7 @@ "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-20.1.2.tgz", "integrity": "sha512-GmYiltypkHHtihFwPRxlaorG5R9VAHuk/vbszVoRTGXnAsY60wYLkh/E2XiFmdZmqrisw+9FaazS1i5SbdWYgA==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/core": "^5.0.2", "@octokit/plugin-paginate-rest": "11.4.4-cjs.2", @@ -898,6 +958,7 @@ "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", "dev": true, + "license": "MIT", "dependencies": { "@octokit/openapi-types": "^24.2.0" } @@ -907,6 +968,7 @@ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", "dev": true, + "license": "MIT", "optional": true, "engines": { "node": ">=14" @@ -917,6 +979,7 @@ "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.2.tgz", "integrity": "sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.20.0 || ^14.18.0 || >=16.0.0" }, @@ -927,27 +990,32 @@ "node_modules/@protobufjs/aspromise": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/base64": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/codegen": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/eventemitter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/fetch": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", "dependencies": { "@protobufjs/aspromise": "^1.1.1", "@protobufjs/inquire": "^1.1.0" @@ -956,33 +1024,39 @@ "node_modules/@protobufjs/float": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/inquire": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/path": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/pool": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" }, "node_modules/@protobufjs/utf8": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" }, "node_modules/@tootallnate/once": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 10" } @@ -991,47 +1065,55 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node12": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node14": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@tsconfig/node16": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/caseless": { "version": "0.12.5", "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz", "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/js-yaml": { "version": "4.0.9", "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", - "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==" + "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", + "license": "MIT" }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/linkify-it": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/@types/linkify-it/-/linkify-it-5.0.0.tgz", - "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==" + "integrity": "sha512-sVDA58zAw4eWAffKOaQH5/5j3XeayukzDk+ewSsnv3p4yJEZHCCzMDiZM8e0OUrRvmpGZ85jf4yDHkHsgBNr9Q==", + "license": "MIT" }, "node_modules/@types/long": { "version": "5.0.0", @@ -1039,6 +1121,7 @@ "integrity": "sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA==", "deprecated": "This is a stub types definition. long provides its own type definitions, so you do not need this installed.", "dev": true, + "license": "MIT", "dependencies": { "long": "*" } @@ -1047,6 +1130,7 @@ "version": "14.1.2", "resolved": "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz", "integrity": "sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog==", + "license": "MIT", "dependencies": { "@types/linkify-it": "^5", "@types/mdurl": "^2" @@ -1055,25 +1139,29 @@ "node_modules/@types/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==" + "integrity": "sha512-RGdgjQUZba5p6QEFAVx2OGb8rQDL/cPRG7GiedRzMcJ1tYnUANBncjbSB1NRGwbvjcPeikRABz2nshyPk1bhWg==", + "license": "MIT" }, "node_modules/@types/minimist": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/mocha": { "version": "10.0.10", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/module-alias": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/@types/module-alias/-/module-alias-2.0.4.tgz", "integrity": "sha512-5+G/QXO/DvHZw60FjvbDzO4JmlD/nG5m2/vVGt25VN1eeP3w2bCoks1Wa7VuptMPM1TxJdx6RjO70N9Fw0nZPA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/node": { "version": "22.18.12", @@ -1088,25 +1176,29 @@ "version": "2.4.4", "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/nunjucks": { "version": "3.2.6", "resolved": "https://registry.npmjs.org/@types/nunjucks/-/nunjucks-3.2.6.tgz", "integrity": "sha512-pHiGtf83na1nCzliuAdq8GowYiXvH5l931xZ0YEHaLMNFgynpEqx+IPStlu7UaDkehfvl01e4x/9Tpwhy7Ue3w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/object-hash": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/object-hash/-/object-hash-3.0.6.tgz", "integrity": "sha512-fOBV8C1FIu2ELinoILQ+ApxcUKz4ngq+IWUYrxSGjXzzjUALijilampwkMgEtJ+h2njAW3pi853QpzNVCHB73w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/request": { "version": "2.48.12", "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.12.tgz", "integrity": "sha512-G3sY+NpsA9jnwm0ixhAFQSJ3Q9JkpLZpJbI3GMv0mIAT0y3mRabYeINzal5WOChIiaTEGQYlHOKgkaM9EisWHw==", "dev": true, + "license": "MIT", "dependencies": { "@types/caseless": "*", "@types/node": "*", @@ -1118,13 +1210,15 @@ "version": "7.7.0", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.7.0.tgz", "integrity": "sha512-k107IF4+Xr7UHjwDc7Cfd6PRQfbdkiRabXGRjo07b4WyPahFBZCZ1sE+BNxYIJPPg73UkfOsVOLwqVc/6ETrIA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/tough-cookie": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@types/yargs": { "version": "17.0.34", @@ -1140,13 +1234,15 @@ "version": "21.0.3", "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.4.0", "@typescript-eslint/scope-manager": "5.62.0", @@ -1181,6 +1277,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1193,6 +1290,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/scope-manager": "5.62.0", "@typescript-eslint/types": "5.62.0", @@ -1220,6 +1318,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "5.62.0", "@typescript-eslint/visitor-keys": "5.62.0" @@ -1237,6 +1336,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/typescript-estree": "5.62.0", "@typescript-eslint/utils": "5.62.0", @@ -1264,6 +1364,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", "dev": true, + "license": "MIT", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -1277,6 +1378,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "@typescript-eslint/types": "5.62.0", "@typescript-eslint/visitor-keys": "5.62.0", @@ -1304,6 +1406,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1316,6 +1419,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@types/json-schema": "^7.0.9", @@ -1342,6 +1446,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1354,6 +1459,7 @@ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", "dev": true, + "license": "MIT", "dependencies": { "@typescript-eslint/types": "5.62.0", "eslint-visitor-keys": "^3.3.0" @@ -1370,19 +1476,22 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", "dev": true, + "license": "MIT", "dependencies": { "event-target-shim": "^5.0.0" }, @@ -1395,6 +1504,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz", "integrity": "sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1406,13 +1516,15 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/acorn-es7-plugin/-/acorn-es7-plugin-1.1.7.tgz", "integrity": "sha512-7D+8kscFMf6F2t+8ZRYmv82CncDZETsaZ4dEl5lh3qQez7FVABk2Vz616SAbnIq1PbNsLVaZjl2oSkk5BWAKng==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/acorn-walk": { "version": "8.3.4", "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^8.11.0" }, @@ -1425,6 +1537,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -1437,6 +1550,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 14" } @@ -1446,6 +1560,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, + "license": "MIT", "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -1462,6 +1577,7 @@ "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", "dev": true, + "license": "BSD-3-Clause OR MIT", "engines": { "node": ">=0.4.2" } @@ -1471,6 +1587,7 @@ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.21.3" }, @@ -1485,6 +1602,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -1493,6 +1611,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -1503,28 +1622,48 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "license": "Python-2.0" }, "node_modules/array-find": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz", "integrity": "sha512-kO/vVCacW9mnpn3WPWbTVlEnOabK2L7LWi2HViURtCM46y1zb6I8UMjx4LgbiqadTgHnLInUronwn3ampNTJtQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/array-union": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -1534,6 +1673,7 @@ "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -1542,13 +1682,15 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", "dev": true, + "license": "MIT", "dependencies": { "retry": "0.13.1" } @@ -1557,12 +1699,14 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" }, "node_modules/base64-js": { "version": "1.5.1", @@ -1582,27 +1726,46 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/before-after-hook": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/bignumber.js": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.0.tgz", "integrity": "sha512-EM7aMFTXbptt/wZdMlBv2t8IViwQL+h6SLHosp8Yf0dqJMTnY6iL32opnAB6kAdL0SZPuvcAzFr31o0c/R3/RA==", "dev": true, + "license": "MIT", "engines": { "node": "*" } }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", - "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "license": "MIT" }, "node_modules/brace-expansion": { "version": "2.0.3", @@ -1618,6 +1781,7 @@ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dev": true, + "license": "MIT", "dependencies": { "fill-range": "^7.1.1" }, @@ -1629,7 +1793,8 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/browserslist": { "version": "4.24.4", @@ -1650,6 +1815,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "caniuse-lite": "^1.0.30001688", "electron-to-chromium": "^1.5.73", @@ -1674,13 +1840,15 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/builtins": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/builtins/-/builtins-5.1.0.tgz", "integrity": "sha512-SW9lzGTLvWTP1AY8xeAMZimqDrIaSdLQUcVr9DMef51niJ022Ri87SwRRKYm4A6iHfkPaiVUu/Duw2Wc4J7kKg==", "dev": true, + "license": "MIT", "dependencies": { "semver": "^7.0.0" } @@ -1690,6 +1858,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -1702,6 +1871,7 @@ "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", "integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==", "dev": true, + "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.0", "es-define-property": "^1.0.0", @@ -1720,6 +1890,7 @@ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, + "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" @@ -1733,6 +1904,7 @@ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, + "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" @@ -1749,6 +1921,7 @@ "resolved": "https://registry.npmjs.org/call-matcher/-/call-matcher-1.1.0.tgz", "integrity": "sha512-IoQLeNwwf9KTNbtSA7aEBb1yfDbdnzwjCetjkC8io5oGeOmK2CBNdg0xr+tadRYKO0p7uQyZzvon0kXlZbvGrw==", "dev": true, + "license": "MIT", "dependencies": { "core-js": "^2.0.0", "deep-equal": "^1.0.0", @@ -1761,6 +1934,7 @@ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -1770,6 +1944,7 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -1779,6 +1954,7 @@ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", "integrity": "sha512-YrwaA0vEKazPBkn0ipTiMpSajYDSe+KjQfrjhcBMxJt/znbvlHd8Pw/Vamaz5EB4Wfhs3SUR3Z9mwRu/P3s3Yg==", "dev": true, + "license": "MIT", "dependencies": { "camelcase": "^5.3.1", "map-obj": "^4.0.0", @@ -1809,12 +1985,14 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/catharsis": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.9.0.tgz", "integrity": "sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A==", + "license": "MIT", "dependencies": { "lodash": "^4.17.15" }, @@ -1826,6 +2004,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -1841,13 +2020,57 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "optional": true, + "peer": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, + "license": "MIT", "dependencies": { "restore-cursor": "^3.1.0" }, @@ -1860,6 +2083,7 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", "dev": true, + "license": "ISC", "engines": { "node": ">= 10" } @@ -1868,6 +2092,7 @@ "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", @@ -1881,6 +2106,7 @@ "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -1897,6 +2123,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -1907,13 +2134,15 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, + "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -1926,6 +2155,7 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 6" } @@ -1934,13 +2164,15 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/core-js": { "version": "2.6.12", @@ -1948,19 +2180,22 @@ "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", "dev": true, - "hasInstallScript": true + "hasInstallScript": true, + "license": "MIT" }, "node_modules/create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1975,6 +2210,7 @@ "resolved": "https://registry.npmjs.org/d/-/d-1.0.2.tgz", "integrity": "sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==", "dev": true, + "license": "ISC", "dependencies": { "es5-ext": "^0.10.64", "type": "^2.7.2" @@ -1988,6 +2224,7 @@ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", "dev": true, + "license": "MIT", "engines": { "node": ">= 12" } @@ -1997,6 +2234,7 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", "dev": true, + "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -2014,6 +2252,7 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2023,6 +2262,7 @@ "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", "dev": true, + "license": "MIT", "dependencies": { "decamelize": "^1.1.0", "map-obj": "^1.0.0" @@ -2039,6 +2279,7 @@ "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -2048,6 +2289,7 @@ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.2.tgz", "integrity": "sha512-5tdhKF6DbU7iIzrIOa1AOUt39ZRm13cmL1cGEh//aqR8x9+tNfbywRf0n5FD/18OKMdo7DNEtrX2t22ZAkI+eg==", "dev": true, + "license": "MIT", "dependencies": { "is-arguments": "^1.1.1", "is-date-object": "^1.0.5", @@ -2066,13 +2308,15 @@ "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", - "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "license": "MIT" }, "node_modules/define-data-property": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", "dev": true, + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", @@ -2090,6 +2334,7 @@ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", "dev": true, + "license": "MIT", "dependencies": { "define-data-property": "^1.0.1", "has-property-descriptors": "^1.0.0", @@ -2107,6 +2352,7 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4.0" } @@ -2115,13 +2361,15 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/diff": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } @@ -2131,6 +2379,7 @@ "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "dev": true, + "license": "MIT", "dependencies": { "path-type": "^4.0.0" }, @@ -2143,6 +2392,7 @@ "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, + "license": "Apache-2.0", "dependencies": { "esutils": "^2.0.2" }, @@ -2155,6 +2405,7 @@ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", "dev": true, + "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", @@ -2169,6 +2420,7 @@ "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==", "dev": true, + "license": "MIT", "dependencies": { "end-of-stream": "^1.4.1", "inherits": "^2.0.3", @@ -2180,13 +2432,15 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "safe-buffer": "^5.0.1" } @@ -2195,18 +2449,21 @@ "version": "1.5.137", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.137.tgz", "integrity": "sha512-/QSJaU2JyIuTbbABAo/crOs+SuAZLS+fVVS10PVrIT9hrRkmZl8Hb0xPSkKRUUWHQtYzXHpQUW3Dy5hwMzGZkA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" }, "node_modules/empower-assert": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/empower-assert/-/empower-assert-1.1.0.tgz", "integrity": "sha512-Ylck0Q6p8y/LpNzYeBccaxAPm2ZyuqBgErgZpO9KT0HuQWF0sJckBKCLmgS1/DEXEiyBi9XtYh3clZm5cAdARw==", "dev": true, + "license": "MIT", "dependencies": { "estraverse": "^4.2.0" } @@ -2216,6 +2473,7 @@ "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, + "license": "MIT", "dependencies": { "once": "^1.4.0" } @@ -2224,6 +2482,7 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "license": "BSD-2-Clause", "engines": { "node": ">=0.12" }, @@ -2236,6 +2495,7 @@ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, + "license": "MIT", "dependencies": { "is-arrayish": "^0.2.1" } @@ -2245,6 +2505,7 @@ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -2254,6 +2515,7 @@ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -2263,6 +2525,7 @@ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", "dev": true, + "license": "MIT", "dependencies": { "es-errors": "^1.3.0" }, @@ -2275,6 +2538,7 @@ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", "dev": true, + "license": "MIT", "dependencies": { "es-errors": "^1.3.0", "get-intrinsic": "^1.2.6", @@ -2291,6 +2555,7 @@ "integrity": "sha512-p2snDhiLaXe6dahss1LddxqEm+SkuDvV8dnIQG0MWjyHpcMNfXKPE+/Cc0y+PhxJX3A4xGNeFCj5oc0BUh6deg==", "dev": true, "hasInstallScript": true, + "license": "ISC", "dependencies": { "es6-iterator": "^2.0.3", "es6-symbol": "^3.1.3", @@ -2306,6 +2571,7 @@ "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", "integrity": "sha512-zw4SRzoUkd+cl+ZoE15A9o1oQd920Bb0iOJMQkQhl3jNc03YqVjAhG7scf9C5KWRU/R13Orf588uCC6525o02g==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "^0.10.35", @@ -2317,6 +2583,7 @@ "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", "integrity": "sha512-mz3UqCh0uPCIqsw1SSAkB/p0rOzF/M0V++vyN7JqlPtSW/VsYgQBvVvqMLmfBuyMzTpLnNqi6JmcSizs4jy19A==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "~0.10.14", @@ -2331,6 +2598,7 @@ "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.6.tgz", "integrity": "sha512-TE3LgGLDIBX332jq3ypv6bcOpkLO0AslAQo7p2VqX/1N46YNsvIWgvjojjSEnWEGWMhr1qUbYeTSir5J6mFHOw==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.62", @@ -2348,6 +2616,7 @@ "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.4.tgz", "integrity": "sha512-U9bFFjX8tFiATgtkJ1zg25+KviIXpgRvRHS8sau3GfhVzThRQrOeksPeT0BWW2MNZs1OEWJ1DPXOQMn0KKRkvg==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.2", "ext": "^1.7.0" @@ -2361,6 +2630,7 @@ "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", "dev": true, + "license": "ISC", "dependencies": { "d": "1", "es5-ext": "^0.10.46", @@ -2372,6 +2642,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", "engines": { "node": ">=6" } @@ -2381,6 +2652,7 @@ "resolved": "https://registry.npmjs.org/escallmatch/-/escallmatch-1.5.0.tgz", "integrity": "sha512-iMF4I4I2E16DPusKDgTtQeIBNX0oOS53Ih6sr/2fh+1SDRsXvG8Y3ZOXGWlDkNNo066XBIkfaDRLfZpqcD+vGA==", "dev": true, + "license": "MIT", "dependencies": { "call-matcher": "^1.0.0", "esprima": "^2.0.0" @@ -2391,6 +2663,7 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", "dev": true, + "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -2404,6 +2677,7 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -2415,6 +2689,7 @@ "version": "1.14.3", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.3.tgz", "integrity": "sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw==", + "license": "BSD-2-Clause", "dependencies": { "esprima": "^4.0.1", "estraverse": "^4.2.0", @@ -2437,6 +2712,7 @@ "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", "integrity": "sha512-75IUQsusDdalQEW/G/2esa87J7raqdJF+Ca0/Xm5C3Q58Nr4yVYjZGp/P1+2xiEVgXRrA39dpRb8LcshajbqDQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "es6-map": "^0.1.3", "es6-weak-map": "^2.0.1", @@ -2453,6 +2729,7 @@ "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, + "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", @@ -2508,6 +2785,7 @@ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", "dev": true, + "license": "MIT", "bin": { "eslint-config-prettier": "bin/cli.js" }, @@ -2520,6 +2798,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-4.1.0.tgz", "integrity": "sha512-GILhQTnjYE2WorX5Jyi5i4dz5ALWxBIdQECVQavL6s7cI76IZTDWleTHkxz/QT3kvcs2QlGHvKLYsSlPOlPXnQ==", "dev": true, + "license": "MIT", "dependencies": { "eslint-utils": "^2.0.0", "regexpp": "^3.0.0" @@ -2539,6 +2818,7 @@ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^1.1.0" }, @@ -2554,6 +2834,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=4" } @@ -2563,6 +2844,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-n/-/eslint-plugin-n-15.7.0.tgz", "integrity": "sha512-jDex9s7D/Qial8AGVIHq4W7NswpUD5DPDL2RH8Lzd9EloWUuvUkHfv4FRLMipH5q2UtyurorBkPeNi1wVWNh3Q==", "dev": true, + "license": "MIT", "dependencies": { "builtins": "^5.0.1", "eslint-plugin-es": "^4.1.0", @@ -2612,6 +2894,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -2624,6 +2907,7 @@ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz", "integrity": "sha512-gH3iR3g4JfF+yYPaJYkN7jEl9QbweL/YfkoRlNnuIEHEz1vHVlCmWOS+eGGiRuzHQXdJFCOTxRgvju9b8VUmrw==", "dev": true, + "license": "MIT", "dependencies": { "prettier-linter-helpers": "^1.0.0", "synckit": "^0.9.1" @@ -2654,6 +2938,7 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^4.1.1" @@ -2667,6 +2952,7 @@ "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", "dev": true, + "license": "MIT", "dependencies": { "eslint-visitor-keys": "^2.0.0" }, @@ -2685,6 +2971,7 @@ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10" } @@ -2693,6 +2980,7 @@ "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "license": "Apache-2.0", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, @@ -2716,6 +3004,7 @@ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" @@ -2732,6 +3021,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -2741,6 +3031,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", "dev": true, + "license": "MIT", "dependencies": { "type-fest": "^0.20.2" }, @@ -2769,6 +3060,7 @@ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, + "license": "MIT", "dependencies": { "deep-is": "^0.1.3", "fast-levenshtein": "^2.0.6", @@ -2786,6 +3078,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -2798,6 +3091,7 @@ "resolved": "https://registry.npmjs.org/esniff/-/esniff-2.0.1.tgz", "integrity": "sha512-kTUIGKQ/mDPFoJ0oVfcmyJn4iBDRptjNVIzwIFR7tqWXdVI9xfA2RMwY/gbSpJG3lkdWNEjLap/NqVHZiJsdfg==", "dev": true, + "license": "ISC", "dependencies": { "d": "^1.0.1", "es5-ext": "^0.10.62", @@ -2813,6 +3107,7 @@ "resolved": "https://registry.npmjs.org/espower/-/espower-2.1.2.tgz", "integrity": "sha512-2qa3aEFtcgPB782jTKDPu82hOdw8+zJsWdOn12Tey8XlexHTqsYUIdLC2B7cUECENXly0vZblH1CEZcqttPNjw==", "dev": true, + "license": "MIT", "dependencies": { "array-find": "^1.0.0", "escallmatch": "^1.5.0", @@ -2830,6 +3125,7 @@ "resolved": "https://registry.npmjs.org/espower-location-detector/-/espower-location-detector-1.0.0.tgz", "integrity": "sha512-Y/3H6ytYwqC3YcOc0gOU22Lp3eI5GAFGOymTdzFyfaiglKgtsw2dePOgXY3yrV+QcLPMPiVYwBU9RKaDoh2bbQ==", "dev": true, + "license": "MIT", "dependencies": { "is-url": "^1.2.1", "path-is-absolute": "^1.0.0", @@ -2842,6 +3138,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -2851,6 +3148,7 @@ "resolved": "https://registry.npmjs.org/espower-source/-/espower-source-2.3.0.tgz", "integrity": "sha512-Wc4kC4zUAEV7Qt31JRPoBUc5jjowHRylml2L2VaDQ1XEbnqQofGWx+gPR03TZAPokAMl5dqyL36h3ITyMXy3iA==", "dev": true, + "license": "MIT", "dependencies": { "acorn": "^5.0.0", "acorn-es7-plugin": "^1.0.10", @@ -2874,6 +3172,7 @@ "resolved": "https://registry.npmjs.org/espower-typescript/-/espower-typescript-10.0.1.tgz", "integrity": "sha512-Otz3g+JKQCPG3CxyUQnmcmr9LeYXe+bEU2F/WtBeaByIj+kgR+8lyYSa1Rcqh27b/sp9EjrDLDUTW+d7dsfJQw==", "dev": true, + "license": "MIT", "dependencies": { "espower-source": "^2.3.0", "minimatch": "^5.1.0", @@ -2892,6 +3191,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -2900,6 +3200,7 @@ "version": "9.6.1", "resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz", "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "license": "BSD-2-Clause", "dependencies": { "acorn": "^8.9.0", "acorn-jsx": "^5.3.2", @@ -2916,6 +3217,7 @@ "version": "8.14.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -2927,6 +3229,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "license": "MIT", "peerDependencies": { "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } @@ -2935,6 +3238,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "license": "BSD-2-Clause", "bin": { "esparse": "bin/esparse.js", "esvalidate": "bin/esvalidate.js" @@ -2948,6 +3252,7 @@ "resolved": "https://registry.npmjs.org/espurify/-/espurify-1.8.1.tgz", "integrity": "sha512-ZDko6eY/o+D/gHCWyHTU85mKDgYcS4FJj7S+YD6WIInm7GQ6AnOjmcL4+buFV/JOztVLELi/7MmuGU5NHta0Mg==", "dev": true, + "license": "MIT", "dependencies": { "core-js": "^2.0.0" } @@ -2957,6 +3262,7 @@ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "estraverse": "^5.1.0" }, @@ -2969,6 +3275,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -2978,6 +3285,7 @@ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "estraverse": "^5.2.0" }, @@ -2990,6 +3298,7 @@ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -2998,6 +3307,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -3006,6 +3316,7 @@ "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } @@ -3015,6 +3326,7 @@ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", "integrity": "sha512-D9rRn9y7kLPnJ+hMq7S/nhvoKwwvVJahBi2BPmx3bvbsEdK3W9ii8cBSGjP+72/LnM4n6fo3+dkCX5FeTQruXA==", "dev": true, + "license": "MIT", "dependencies": { "d": "1", "es5-ext": "~0.10.14" @@ -3025,6 +3337,7 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -3034,6 +3347,7 @@ "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", "dev": true, + "license": "MIT", "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", @@ -3057,6 +3371,7 @@ "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", "integrity": "sha512-6hxeJYaL110a9b5TEJSj0gojyHQAmA2ch5Os+ySCiA1QGdS697XWY1pzsrSjqA9LDEEgdB/KypIlR59RcLuHYw==", "dev": true, + "license": "ISC", "dependencies": { "type": "^2.7.2" } @@ -3065,13 +3380,15 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, + "license": "MIT", "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", @@ -3085,19 +3402,22 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-diff": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.3.0.tgz", "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/fast-glob": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", "dev": true, + "license": "MIT", "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -3114,6 +3434,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.1" }, @@ -3125,12 +3446,14 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "license": "MIT" }, "node_modules/fast-xml-builder": { "version": "1.1.5", @@ -3175,6 +3498,7 @@ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, + "license": "ISC", "dependencies": { "reusify": "^1.0.4" } @@ -3194,6 +3518,7 @@ "url": "https://paypal.me/jimmywarting" } ], + "license": "MIT", "dependencies": { "node-domexception": "^1.0.0", "web-streams-polyfill": "^3.0.3" @@ -3207,6 +3532,7 @@ "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, + "license": "MIT", "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -3222,6 +3548,7 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.0" } @@ -3231,6 +3558,7 @@ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", "dev": true, + "license": "MIT", "dependencies": { "flat-cache": "^3.0.4" }, @@ -3243,6 +3571,7 @@ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dev": true, + "license": "MIT", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -3255,6 +3584,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" @@ -3271,6 +3601,7 @@ "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true, + "license": "BSD-3-Clause", "bin": { "flat": "cli.js" } @@ -3280,6 +3611,7 @@ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz", "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", "dev": true, + "license": "MIT", "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.3", @@ -3301,6 +3633,7 @@ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", "dev": true, + "license": "ISC", "dependencies": { "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" @@ -3317,6 +3650,7 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", "dev": true, + "license": "ISC", "engines": { "node": ">=14" }, @@ -3329,6 +3663,7 @@ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.5.tgz", "integrity": "sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A==", "dev": true, + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -3346,6 +3681,7 @@ "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", "dev": true, + "license": "MIT", "dependencies": { "fetch-blob": "^3.1.2" }, @@ -3356,13 +3692,31 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3372,6 +3726,7 @@ "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -3618,6 +3973,7 @@ "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", @@ -3633,11 +3989,13 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", "dev": true, "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -3647,6 +4005,7 @@ "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", "dev": true, + "license": "Apache-2.0", "dependencies": { "gaxios": "^6.1.1", "google-logging-utils": "^0.0.2", @@ -3661,6 +4020,7 @@ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.9.0" } @@ -3669,6 +4029,7 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } @@ -3678,6 +4039,7 @@ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, + "license": "MIT", "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", @@ -3702,6 +4064,7 @@ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", "dev": true, + "license": "MIT", "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" @@ -3715,6 +4078,7 @@ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -3749,6 +4113,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, + "license": "ISC", "dependencies": { "is-glob": "^4.0.3" }, @@ -3777,6 +4142,7 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -3786,6 +4152,7 @@ "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", "dev": true, + "license": "MIT", "dependencies": { "array-union": "^2.1.0", "dir-glob": "^3.0.1", @@ -3806,6 +4173,7 @@ "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", "dev": true, + "license": "Apache-2.0", "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", @@ -3823,6 +4191,7 @@ "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-5.1.1-rc.1.tgz", "integrity": "sha512-HSHw7NytSxiyTp3WgWQXu4Cnl49VH2qRcAU047fmShUbbxkGwYX3MlipxhDkWIWMRl7Dktyq2gRvwQVP6ILgUA==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@grpc/grpc-js": "^1.12.6", "@grpc/proto-loader": "^0.7.13", @@ -3846,6 +4215,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "license": "MIT", "dependencies": { "debug": "4" }, @@ -3858,6 +4228,7 @@ "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.0.0-rc.5.tgz", "integrity": "sha512-s9rlpplwdb/KCq2DYevVTM/MpozeVZuR3pkzDGXtRhY7wD4fXftIYXUAerX07ZPB3J8/dHUJsX7fPnN2O4Psuw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "extend": "^3.0.2", "https-proxy-agent": "^7.0.1", @@ -3872,6 +4243,7 @@ "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-7.0.0-rc.1.tgz", "integrity": "sha512-E6c+AdIaK1LNA839OyotiTca+B2IG1nDlMjnlcck8JjXn3fVgx57Ib9i6iL1/iqN7bA3EUQdcRRu+HqOCOABIg==", "dev": true, + "license": "Apache-2.0", "dependencies": { "gaxios": "^7.0.0-rc.1", "google-logging-utils": "^1.0.0", @@ -3886,6 +4258,7 @@ "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.0.0-rc.2.tgz", "integrity": "sha512-LjkDUtHV8mFFV0pDWpPTjUuAPd6WDBs2y/mTzGSmwQJkDRinOpQyu7e/0pqQoDoanKGwaQJH5729uZ+/5Uz8fw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "base64-js": "^1.3.0", "ecdsa-sig-formatter": "^1.0.11", @@ -3904,6 +4277,7 @@ "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.1.tgz", "integrity": "sha512-rcX58I7nqpu4mbKztFeOAObbomBbHU2oIb/d3tJfF3dizGSApqtSwYJigGCooHdnMyQBIw8BrWyK96w3YXgr6A==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=14" } @@ -3913,6 +4287,7 @@ "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0-rc.1.tgz", "integrity": "sha512-UjE/egX6ixArdcCKOkheuFQ4XN4/0gX92nd2JPVEYuRU2sWHAWuOVGnowm1fQUdQtaxqn1n8H0hOb2LCaUhJ3A==", "dev": true, + "license": "MIT", "dependencies": { "gaxios": "^7.0.0-rc.1", "jws": "^4.0.0" @@ -3926,6 +4301,7 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "dev": true, + "license": "MIT", "dependencies": { "data-uri-to-buffer": "^4.0.0", "fetch-blob": "^3.1.4", @@ -3940,12 +4316,12 @@ } }, "node_modules/google-gax/node_modules/retry-request": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-8.0.0.tgz", - "integrity": "sha512-dJkZNmyV9C8WKUmbdj1xcvVlXBSvsUQCkg89TCK8rD72RdSn9A2jlXlS2VuYSTHoPJjJEfUHhjNYrlvuksF9cg==", + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-8.0.2.tgz", + "integrity": "sha512-JzFPAfklk1kjR1w76f0QOIhoDkNkSqW8wYKT08n9yysTmZfB+RQ2QoXoTAeOi1HD9ZipTyTAZg3c4pM/jeqgSw==", "dev": true, + "license": "MIT", "dependencies": { - "@types/request": "^2.48.12", "extend": "^3.0.2", "teeny-request": "^10.0.0" }, @@ -3958,6 +4334,7 @@ "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-10.1.0.tgz", "integrity": "sha512-3ZnLvgWF29jikg1sAQ1g0o+lr5JX6sVgYvfUJazn7ZjJroDBUTWp44/+cFVX0bULjv4vci+rBD+oGVAkWqhUbw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", @@ -3973,6 +4350,7 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, + "license": "MIT", "dependencies": { "agent-base": "6", "debug": "4" @@ -3986,6 +4364,7 @@ "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=14" } @@ -4034,6 +4413,7 @@ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -4044,19 +4424,22 @@ "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/gtoken": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", "dev": true, + "license": "MIT", "dependencies": { "gaxios": "^6.0.0", "jws": "^4.0.0" @@ -4070,6 +4453,7 @@ "resolved": "https://registry.npmjs.org/gts/-/gts-6.0.2.tgz", "integrity": "sha512-lp9+eDzzm6TYqiBpgGY00EInxBHFTJiU5brsVp11qXCJEw7Q6WNNngja0spZeqSFWSquaRuHQUuWxdZLaxnKmw==", "dev": true, + "license": "Apache-2.0", "dependencies": { "@typescript-eslint/eslint-plugin": "5.62.0", "@typescript-eslint/parser": "5.62.0", @@ -4102,6 +4486,7 @@ "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -4110,6 +4495,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", "engines": { "node": ">=8" } @@ -4119,6 +4505,7 @@ "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", "dev": true, + "license": "MIT", "dependencies": { "es-define-property": "^1.0.0" }, @@ -4131,6 +4518,7 @@ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -4143,6 +4531,7 @@ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", "dev": true, + "license": "MIT", "dependencies": { "has-symbols": "^1.0.3" }, @@ -4158,6 +4547,7 @@ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", "dev": true, + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -4170,6 +4560,7 @@ "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true, + "license": "MIT", "bin": { "he": "bin/he" } @@ -4179,6 +4570,7 @@ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "dev": true, + "license": "ISC", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4191,6 +4583,7 @@ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^4.0.0" }, @@ -4202,7 +4595,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/html-entities": { "version": "2.6.0", @@ -4218,13 +4612,15 @@ "type": "patreon", "url": "https://patreon.com/mdevils" } - ] + ], + "license": "MIT" }, "node_modules/http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", "dev": true, + "license": "MIT", "dependencies": { "@tootallnate/once": "2", "agent-base": "6", @@ -4239,6 +4635,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "license": "MIT", "dependencies": { "debug": "4" }, @@ -4251,6 +4648,7 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, + "license": "MIT", "dependencies": { "agent-base": "^7.1.2", "debug": "4" @@ -4264,6 +4662,7 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true, + "license": "Apache-2.0", "engines": { "node": ">=10.17.0" } @@ -4273,6 +4672,7 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, + "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -4285,6 +4685,7 @@ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -4294,6 +4695,7 @@ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", "dev": true, + "license": "MIT", "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" @@ -4310,6 +4712,7 @@ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.8.19" } @@ -4319,6 +4722,7 @@ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4328,6 +4732,7 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "license": "ISC", "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -4336,13 +4741,15 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" }, "node_modules/inquirer": { "version": "7.3.3", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", "dev": true, + "license": "MIT", "dependencies": { "ansi-escapes": "^4.2.1", "chalk": "^4.1.0", @@ -4367,6 +4774,7 @@ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", "integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==", "dev": true, + "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "has-tostringtag": "^1.0.2" @@ -4382,13 +4790,30 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true + "dev": true, + "license": "MIT" + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } }, "node_modules/is-core-module": { "version": "2.16.1", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", "dev": true, + "license": "MIT", "dependencies": { "hasown": "^2.0.2" }, @@ -4404,6 +4829,7 @@ "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", "dev": true, + "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "has-tostringtag": "^1.0.2" @@ -4420,6 +4846,7 @@ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4428,6 +4855,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", "engines": { "node": ">=8" } @@ -4437,6 +4865,7 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", "dependencies": { "is-extglob": "^2.1.1" }, @@ -4449,6 +4878,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -4458,6 +4888,7 @@ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -4467,6 +4898,7 @@ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4476,6 +4908,7 @@ "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", "dev": true, + "license": "MIT", "dependencies": { "call-bound": "^1.0.2", "gopd": "^1.2.0", @@ -4494,6 +4927,7 @@ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -4506,6 +4940,7 @@ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -4517,19 +4952,22 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/jackspeak": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" }, @@ -4544,7 +4982,8 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/js-yaml": { "version": "4.1.1", @@ -4562,6 +5001,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.2.tgz", "integrity": "sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA==", + "license": "Apache-2.0", "dependencies": { "xmlcreate": "^2.0.4" } @@ -4570,6 +5010,7 @@ "version": "4.0.4", "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-4.0.4.tgz", "integrity": "sha512-zeFezwyXeG4syyYHbvh1A967IAqq/67yXtXvuL5wnqCkFZe8I0vKfm+EO+YEvLguo6w9CDUbrAXVtJSHh2E8rw==", + "license": "Apache-2.0", "dependencies": { "@babel/parser": "^7.20.15", "@jsdoc/salty": "^0.2.1", @@ -4598,6 +5039,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "license": "MIT", "engines": { "node": ">=8" } @@ -4607,6 +5049,7 @@ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", "dev": true, + "license": "MIT", "bin": { "jsesc": "bin/jsesc" }, @@ -4619,6 +5062,7 @@ "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", "dev": true, + "license": "MIT", "dependencies": { "bignumber.js": "^9.0.0" } @@ -4627,31 +5071,36 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true, + "license": "MIT", "bin": { "json5": "lib/cli.js" }, @@ -4687,6 +5136,7 @@ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dev": true, + "license": "MIT", "dependencies": { "json-buffer": "3.0.1" } @@ -4696,6 +5146,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -4704,6 +5155,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", + "license": "MIT", "dependencies": { "graceful-fs": "^4.1.9" } @@ -4713,6 +5165,7 @@ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1", "type-check": "~0.4.0" @@ -4725,12 +5178,14 @@ "version": "1.2.4", "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/linkify-it": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "license": "MIT", "dependencies": { "uc.micro": "^2.0.0" } @@ -4740,6 +5195,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^5.0.0" }, @@ -4760,19 +5216,22 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, + "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -4787,13 +5246,15 @@ "node_modules/long": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", - "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==" + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", "dev": true, + "license": "ISC", "dependencies": { "yallist": "^3.0.2" } @@ -4802,13 +5263,15 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/map-obj": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -4837,6 +5300,7 @@ "version": "8.6.7", "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz", "integrity": "sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA==", + "license": "Unlicense", "peerDependencies": { "@types/markdown-it": "*", "markdown-it": "*" @@ -4846,6 +5310,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "license": "MIT", "bin": { "marked": "bin/marked.js" }, @@ -4858,6 +5323,7 @@ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -4865,13 +5331,15 @@ "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", - "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==", + "license": "MIT" }, "node_modules/meow": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz", "integrity": "sha512-+obSblOQmRhcyBt62furQqRAQpNyWXo8BuQ5bN7dG8wmwQ+vwHKp/rCFD4CrTP8CsDQD1sjoZ94K417XEUk8IQ==", "dev": true, + "license": "MIT", "dependencies": { "@types/minimist": "^1.2.0", "camelcase-keys": "^6.2.2", @@ -4898,6 +5366,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz", "integrity": "sha512-OIAYXk8+ISY+qTOwkHtKqzAuxchoMiD9Udx+FSGQDuiRR+PJKJHc2NJAXlbhkGwTt/4/nKZxELY1w3ReWOL8mw==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -4910,6 +5379,7 @@ "resolved": "https://registry.npmjs.org/merge-estraverse-visitors/-/merge-estraverse-visitors-1.0.0.tgz", "integrity": "sha512-YcT59TImpdL2qe+I7OWI+ESjBVov9CWTQjK9Issk58BNQzyputg2s8wOE+DDvxtgmPHG4L6xAl0yAwbNCyXszg==", "dev": true, + "license": "MIT", "dependencies": { "estraverse": "^4.0.0" } @@ -4918,13 +5388,15 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } @@ -4934,6 +5406,7 @@ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" @@ -4947,6 +5420,7 @@ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", "dev": true, + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -4959,6 +5433,7 @@ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -4968,6 +5443,7 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, + "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -4980,6 +5456,7 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -4989,6 +5466,7 @@ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -5009,6 +5487,7 @@ "version": "1.2.8", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -5018,6 +5497,7 @@ "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", "dev": true, + "license": "MIT", "dependencies": { "arrify": "^1.0.1", "is-plain-obj": "^1.1.0", @@ -5032,6 +5512,7 @@ "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5041,6 +5522,7 @@ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", "dev": true, + "license": "ISC", "engines": { "node": ">=16 || 14 >=14.17" } @@ -5049,6 +5531,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "license": "MIT", "bin": { "mkdirp": "bin/cmd.js" }, @@ -5169,13 +5652,15 @@ "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/multi-stage-sourcemap": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/multi-stage-sourcemap/-/multi-stage-sourcemap-0.2.1.tgz", "integrity": "sha512-umaOM+8BZByZIB/ciD3dQLzTv50rEkkGJV78ta/tIVc/J/rfGZY5y1R+fBD3oTaolx41mK8rRcyGtYbDXlzx8Q==", "dev": true, + "license": "MIT", "dependencies": { "source-map": "^0.1.34" } @@ -5196,25 +5681,29 @@ "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/natural-compare-lite": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/ncp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", "integrity": "sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA==", "dev": true, + "license": "MIT", "bin": { "ncp": "bin/ncp" } @@ -5223,7 +5712,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -5241,6 +5731,7 @@ "url": "https://paypal.me/jimmywarting" } ], + "license": "MIT", "engines": { "node": ">=10.5.0" } @@ -5250,6 +5741,7 @@ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, + "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -5269,13 +5761,15 @@ "version": "2.0.19", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.19.tgz", "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/normalize-package-data": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^4.0.1", "is-core-module": "^2.5.0", @@ -5291,6 +5785,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -5298,11 +5793,24 @@ "node": ">=10" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/npm-run-path": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.0.0" }, @@ -5315,6 +5823,7 @@ "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.4.tgz", "integrity": "sha512-26XRV6BhkgK0VOxfbU5cQI+ICFUtMLixv1noZn1tGU38kQH5A5nmmbk/O45xdyBhD1esk47nKrY0mvQpZIhRjQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "a-sync-waterfall": "^1.0.0", "asap": "^2.0.3", @@ -5339,6 +5848,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "license": "MIT", "engines": { "node": ">= 6" } @@ -5348,6 +5858,7 @@ "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz", "integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.7", "define-properties": "^1.2.1" @@ -5364,6 +5875,7 @@ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -5372,6 +5884,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", "dependencies": { "wrappy": "1" } @@ -5381,6 +5894,7 @@ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, + "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -5395,6 +5909,7 @@ "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", + "license": "MIT", "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", @@ -5411,6 +5926,7 @@ "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", + "license": "MIT", "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" @@ -5431,6 +5947,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", + "license": "MIT", "dependencies": { "prelude-ls": "~1.1.2" }, @@ -5443,6 +5960,7 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5452,6 +5970,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { "yocto-queue": "^0.1.0" }, @@ -5467,6 +5986,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^3.0.2" }, @@ -5482,6 +6002,7 @@ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -5490,13 +6011,15 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true + "dev": true, + "license": "BlueOak-1.0.0" }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, + "license": "MIT", "dependencies": { "callsites": "^3.0.0" }, @@ -5509,6 +6032,7 @@ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, + "license": "MIT", "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", @@ -5527,6 +6051,7 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5552,6 +6077,7 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -5561,6 +6087,7 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5569,13 +6096,15 @@ "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/path-scurry": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" @@ -5591,13 +6120,15 @@ "version": "10.4.3", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5606,7 +6137,8 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/picomatch": { "version": "2.3.2", @@ -5626,6 +6158,7 @@ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.8.0" } @@ -5635,6 +6168,7 @@ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, + "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -5650,6 +6184,7 @@ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", "dev": true, + "license": "MIT", "dependencies": { "fast-diff": "^1.1.2" }, @@ -5697,6 +6232,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/protobufjs-cli/-/protobufjs-cli-1.2.0.tgz", "integrity": "sha512-+YvqJEmsmZHGzE5j0tvEzFeHm0sX7pzRFpyj7+GazhkS4Y0r+jgbioVvFxxSWIlPzUel/lxeOnLChBmV8NmyHA==", + "license": "BSD-3-Clause", "dependencies": { "chalk": "^4.0.0", "escodegen": "^1.13.0", @@ -5724,6 +6260,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "license": "BSD-2-Clause", "engines": { "node": ">=4.0" } @@ -5732,7 +6269,8 @@ "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5751,6 +6289,7 @@ "version": "7.7.1", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -5762,6 +6301,7 @@ "version": "0.2.3", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "license": "MIT", "engines": { "node": ">=14.14" } @@ -5771,6 +6311,7 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -5779,6 +6320,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "license": "MIT", "engines": { "node": ">=6" } @@ -5801,13 +6343,15 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/quick-lru": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-4.0.1.tgz", "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -5817,6 +6361,7 @@ "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "^5.1.0" } @@ -5826,6 +6371,7 @@ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", "integrity": "sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==", "dev": true, + "license": "MIT", "dependencies": { "@types/normalize-package-data": "^2.4.0", "normalize-package-data": "^2.5.0", @@ -5841,6 +6387,7 @@ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-7.0.1.tgz", "integrity": "sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==", "dev": true, + "license": "MIT", "dependencies": { "find-up": "^4.1.0", "read-pkg": "^5.2.0", @@ -5858,6 +6405,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, + "license": "MIT", "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" @@ -5871,6 +6419,7 @@ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, + "license": "MIT", "dependencies": { "p-locate": "^4.1.0" }, @@ -5883,6 +6432,7 @@ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, + "license": "MIT", "dependencies": { "p-try": "^2.0.0" }, @@ -5898,6 +6448,7 @@ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, + "license": "MIT", "dependencies": { "p-limit": "^2.2.0" }, @@ -5910,6 +6461,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=8" } @@ -5918,13 +6470,15 @@ "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/read-pkg/node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -5937,6 +6491,7 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver" } @@ -5946,6 +6501,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.6.0.tgz", "integrity": "sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=8" } @@ -5955,6 +6511,7 @@ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, + "license": "MIT", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -5964,11 +6521,27 @@ "node": ">= 6" } }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/redent": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", "dev": true, + "license": "MIT", "dependencies": { "indent-string": "^4.0.0", "strip-indent": "^3.0.0" @@ -5982,6 +6555,7 @@ "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", "dev": true, + "license": "MIT", "dependencies": { "call-bind": "^1.0.8", "define-properties": "^1.2.1", @@ -6002,6 +6576,7 @@ "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" }, @@ -6013,6 +6588,7 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -6021,6 +6597,7 @@ "version": "0.2.4", "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.4.tgz", "integrity": "sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw==", + "license": "MIT", "dependencies": { "lodash": "^4.17.21" } @@ -6030,6 +6607,7 @@ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.10.tgz", "integrity": "sha512-NPRy+/ncIMeDlTAsuqwKIiferiawhefFJtkNSW0qZJEqMEb+qBt/77B/jGeeek+F0uOeN05CDa6HXbbIgtVX4w==", "dev": true, + "license": "MIT", "dependencies": { "is-core-module": "^2.16.0", "path-parse": "^1.0.7", @@ -6050,6 +6628,7 @@ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, + "license": "MIT", "engines": { "node": ">=4" } @@ -6059,6 +6638,7 @@ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, + "license": "MIT", "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -6072,6 +6652,7 @@ "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", "dev": true, + "license": "MIT", "engines": { "node": ">= 4" } @@ -6081,6 +6662,7 @@ "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-7.0.2.tgz", "integrity": "sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w==", "dev": true, + "license": "MIT", "dependencies": { "@types/request": "^2.48.8", "extend": "^3.0.2", @@ -6095,6 +6677,7 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, + "license": "MIT", "engines": { "iojs": ">=1.0.0", "node": ">=0.10.0" @@ -6106,6 +6689,7 @@ "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, + "license": "ISC", "dependencies": { "glob": "^7.1.3" }, @@ -6131,8 +6715,9 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", "dev": true, + "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -6166,6 +6751,7 @@ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -6189,6 +6775,7 @@ "url": "https://feross.org/support" } ], + "license": "MIT", "dependencies": { "queue-microtask": "^1.2.2" } @@ -6198,6 +6785,7 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { "tslib": "^1.9.0" }, @@ -6223,19 +6811,22 @@ "type": "consulting", "url": "https://feross.org/support" } - ] + ], + "license": "MIT" }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" } @@ -6245,6 +6836,7 @@ "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { "randombytes": "^2.1.0" } @@ -6254,6 +6846,7 @@ "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", "dev": true, + "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -6271,6 +6864,7 @@ "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", "dev": true, + "license": "MIT", "dependencies": { "define-data-property": "^1.1.4", "es-errors": "^1.3.0", @@ -6286,6 +6880,7 @@ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" }, @@ -6298,6 +6893,7 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -6306,13 +6902,15 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -6322,6 +6920,7 @@ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "devOptional": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" } @@ -6331,6 +6930,7 @@ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", "dev": true, + "license": "MIT", "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -6341,6 +6941,7 @@ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", "dev": true, + "license": "Apache-2.0", "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -6350,13 +6951,15 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", - "dev": true + "dev": true, + "license": "CC-BY-3.0" }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, + "license": "MIT", "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -6366,13 +6969,15 @@ "version": "3.0.21", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.21.tgz", "integrity": "sha512-Bvg/8F5XephndSK3JffaRqdT+gyhfqIPwDHpX80tJrF8QQRYMo8sNMeaZ2Dp5+jhwKnUmIOyFFQfHRkjJm5nXg==", - "dev": true + "dev": true, + "license": "CC0-1.0" }, "node_modules/stream-events": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", "dev": true, + "license": "MIT", "dependencies": { "stubs": "^3.0.0" } @@ -6381,13 +6986,15 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, + "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" } @@ -6396,6 +7003,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -6411,6 +7019,7 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, + "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -6424,6 +7033,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -6437,6 +7047,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -6449,6 +7060,7 @@ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -6458,6 +7070,7 @@ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", "dev": true, + "license": "MIT", "dependencies": { "min-indent": "^1.0.0" }, @@ -6469,6 +7082,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "license": "MIT", "engines": { "node": ">=8" }, @@ -6493,12 +7107,14 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -6511,6 +7127,7 @@ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true, + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -6523,6 +7140,7 @@ "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", "dev": true, + "license": "MIT", "dependencies": { "@pkgr/core": "^0.1.0", "tslib": "^2.6.2" @@ -6538,13 +7156,15 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/teeny-request": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-9.0.0.tgz", "integrity": "sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==", "dev": true, + "license": "Apache-2.0", "dependencies": { "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", @@ -6561,6 +7181,7 @@ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, + "license": "MIT", "dependencies": { "debug": "4" }, @@ -6573,6 +7194,7 @@ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, + "license": "MIT", "dependencies": { "agent-base": "6", "debug": "4" @@ -6585,11 +7207,13 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", "dev": true, "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" ], + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -6598,19 +7222,22 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, + "license": "MIT", "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -6623,6 +7250,7 @@ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, + "license": "MIT", "dependencies": { "is-number": "^7.0.0" }, @@ -6634,13 +7262,15 @@ "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/trim-newlines": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-3.0.1.tgz", "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -6650,6 +7280,7 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, + "license": "MIT", "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -6693,6 +7324,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, + "license": "MIT", "bin": { "acorn": "bin/acorn" }, @@ -6705,6 +7337,7 @@ "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true, + "license": "BSD-3-Clause", "engines": { "node": ">=0.3.1" } @@ -6713,13 +7346,15 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "dev": true, + "license": "0BSD" }, "node_modules/tsutils": { "version": "3.21.0", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", "dev": true, + "license": "MIT", "dependencies": { "tslib": "^1.8.1" }, @@ -6734,13 +7369,15 @@ "version": "2.7.3", "resolved": "https://registry.npmjs.org/type/-/type-2.7.3.tgz", "integrity": "sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", "dev": true, + "license": "MIT", "dependencies": { "prelude-ls": "^1.2.1" }, @@ -6753,6 +7390,7 @@ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true, + "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -6764,13 +7402,15 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/type-name/-/type-name-2.0.2.tgz", "integrity": "sha512-kkgkuqR/jKdKO5oh/I2SMu2dGbLXoJq0zkdgbxaqYK+hr9S9edwVVGf+tMUFTx2gH9TN2+Zu9JZ/Njonb3cjhA==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/typescript": { "version": "5.6.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -6782,12 +7422,14 @@ "node_modules/uc.micro": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", - "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==", + "license": "MIT" }, "node_modules/uglify-js": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", + "license": "BSD-2-Clause", "bin": { "uglifyjs": "bin/uglifyjs" }, @@ -6804,13 +7446,15 @@ "node_modules/undici-types": { "version": "6.21.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" }, "node_modules/universal-user-agent": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/update-browserslist-db": { "version": "1.1.3", @@ -6831,6 +7475,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" @@ -6847,6 +7492,7 @@ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { "punycode": "^2.1.0" } @@ -6855,13 +7501,16 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).", "dev": true, + "license": "MIT", "bin": { "uuid": "dist/bin/uuid" } @@ -6870,13 +7519,15 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, + "license": "Apache-2.0", "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -6886,13 +7537,15 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz", "integrity": "sha512-9YlCL/ynK3CTlrSRrDxZvUauLzAswPCrsaCgilqFevUYpeEW0/3ScEjaa3kbW/T0ghhkEr7mv+fpjqn1Y1YuTA==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/walkdir": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz", "integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=6.0.0" } @@ -6902,6 +7555,7 @@ "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", "dev": true, + "license": "MIT", "engines": { "node": ">= 8" } @@ -6910,13 +7564,15 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true + "dev": true, + "license": "BSD-2-Clause" }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, + "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" @@ -6927,6 +7583,7 @@ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { "isexe": "^2.0.0" }, @@ -6941,6 +7598,7 @@ "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -6949,13 +7607,15 @@ "version": "9.3.2", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.2.tgz", "integrity": "sha512-Xz4Nm9c+LiBHhDR5bDLnNzmj6+5F+cyEAWPMkbs2awq/dYazR/efelZzUAjB/y3kNHL+uzkHvxVVpaOfGCPV7A==", - "dev": true + "dev": true, + "license": "Apache-2.0" }, "node_modules/wrap-ansi": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", "string-width": "^5.0.1", @@ -6974,6 +7634,7 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, + "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -6991,6 +7652,7 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -7003,6 +7665,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", "dev": true, + "license": "MIT", "engines": { "node": ">=12" }, @@ -7014,13 +7677,15 @@ "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true + "dev": true, + "license": "MIT" }, "node_modules/wrap-ansi/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", "dev": true, + "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", "emoji-regex": "^9.2.2", @@ -7038,6 +7703,7 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", "dev": true, + "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" }, @@ -7051,13 +7717,15 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" }, "node_modules/write-file-atomic": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", "dev": true, + "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" @@ -7069,13 +7737,15 @@ "node_modules/xmlcreate": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.4.tgz", - "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==" + "integrity": "sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg==", + "license": "Apache-2.0" }, "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.4" } @@ -7084,6 +7754,7 @@ "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", "engines": { "node": ">=10" } @@ -7092,12 +7763,14 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true + "dev": true, + "license": "ISC" }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -7116,6 +7789,7 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, + "license": "ISC", "engines": { "node": ">=10" } @@ -7125,6 +7799,7 @@ "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, + "license": "MIT", "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", @@ -7140,6 +7815,7 @@ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -7152,6 +7828,7 @@ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, @@ -7164,6 +7841,7 @@ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true, + "license": "MIT", "engines": { "node": ">=8" } @@ -7172,6 +7850,7 @@ "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", "engines": { "node": ">=12" } @@ -7181,6 +7860,7 @@ "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=6" } @@ -7190,6 +7870,7 @@ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", "dev": true, + "license": "MIT", "engines": { "node": ">=10" }, diff --git a/core/generator/gapic-generator-typescript/typescript/test/unit/api.ts b/core/generator/gapic-generator-typescript/typescript/test/unit/api.ts index 4be052b5bccc..0f0cae89cbc2 100644 --- a/core/generator/gapic-generator-typescript/typescript/test/unit/api.ts +++ b/core/generator/gapic-generator-typescript/typescript/test/unit/api.ts @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +// Basic comment. + import {API} from '../../src/schema/api.js'; import type * as protos from '../../../protos/index.js'; import assert from 'assert'; diff --git a/core/generator/gapic-generator-typescript/yarn.lock b/core/generator/gapic-generator-typescript/yarn.lock index 5dc992012238..36b587c831a2 100644 --- a/core/generator/gapic-generator-typescript/yarn.lock +++ b/core/generator/gapic-generator-typescript/yarn.lock @@ -24,7 +24,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.26.8.tgz" integrity sha512-oH5UPLMWR3L2wEFLnFJ1TZXqHufiTKAiLfqw5zkhS4dKXLJ10yVztfil/twG8EDTA4F/tvVNw9nOl4ZMslB8rQ== -"@babel/core@^7.26.8": +"@babel/core@^7.0.0", "@babel/core@^7.26.8": version "7.26.10" resolved "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz" integrity sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ== @@ -208,7 +208,7 @@ "@google-cloud/storage@^7.15.2": version "7.19.0" - resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-7.19.0.tgz#34fb7cc4eacede5a2f1f0d6cefa0c70a22078c5b" + resolved "https://registry.npmjs.org/@google-cloud/storage/-/storage-7.19.0.tgz" integrity sha512-n2FjE7NAOYyshogdc7KQOl/VZb4sneqPjWouSyia9CMDdMhRX5+RIbqalNmC7LOLzuLAN89VlF2HvG8na9G+zQ== dependencies: "@google-cloud/paginator" "^5.0.0" @@ -310,14 +310,6 @@ resolved "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz" integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - "@jridgewell/trace-mapping@^0.3.24", "@jridgewell/trace-mapping@^0.3.25": version "0.3.25" resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz" @@ -326,6 +318,14 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@js-sdsl/ordered-map@^4.4.2": version "4.4.2" resolved "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz" @@ -340,7 +340,7 @@ "@nodable/entities@^2.1.0": version "2.1.0" - resolved "https://registry.yarnpkg.com/@nodable/entities/-/entities-2.1.0.tgz#f543e5c6446720d4cf9e498a83019dd159973bc2" + resolved "https://registry.npmjs.org/@nodable/entities/-/entities-2.1.0.tgz" integrity sha512-nyT7T3nbMyBI/lvr6L5TyWbFJAI9FTgVRakNoBqCD+PmID8DzFrrNdLLtHMwMszOtqZa8PAOV24ZqDnQrhQINA== "@nodelib/fs.scandir@2.1.5": @@ -351,7 +351,7 @@ "@nodelib/fs.stat" "2.0.5" run-parallel "^1.1.9" -"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": +"@nodelib/fs.stat@^2.0.2", "@nodelib/fs.stat@2.0.5": version "2.0.5" resolved "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz" integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== @@ -369,7 +369,7 @@ resolved "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz" integrity sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA== -"@octokit/core@^5.0.2": +"@octokit/core@^5", "@octokit/core@^5.0.2", "@octokit/core@5": version "5.2.2" resolved "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz" integrity sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg== @@ -574,7 +574,7 @@ dependencies: long "*" -"@types/markdown-it@^14.1.1": +"@types/markdown-it@*", "@types/markdown-it@^14.1.1": version "14.1.2" resolved "https://registry.npmjs.org/@types/markdown-it/-/markdown-it-14.1.2.tgz" integrity sha512-promo4eFwuiW+TfGxhi+0x3czqTYJkG8qB17ZUJiVF10Xm7NLVRSLUsfRTU/6h1e24VvRnXCx+hG7li58lkzog== @@ -602,7 +602,7 @@ resolved "https://registry.npmjs.org/@types/module-alias/-/module-alias-2.0.4.tgz" integrity sha512-5+G/QXO/DvHZw60FjvbDzO4JmlD/nG5m2/vVGt25VN1eeP3w2bCoks1Wa7VuptMPM1TxJdx6RjO70N9Fw0nZPA== -"@types/node@*", "@types/node@>=13.7.0", "@types/node@^22.18.12": +"@types/node@*", "@types/node@^22.18.12", "@types/node@>=13.7.0": version "22.18.12" resolved "https://registry.npmjs.org/@types/node/-/node-22.18.12.tgz" integrity sha512-BICHQ67iqxQGFSzfCFTT7MRQ5XcBjG5aeKh5Ok38UBbPe5fxTyE+aHFxwVrGyr8GNlqFMLKD1D3P2K/1ks8tog== @@ -672,7 +672,7 @@ semver "^7.3.7" tsutils "^3.21.0" -"@typescript-eslint/parser@5.62.0": +"@typescript-eslint/parser@^5.0.0", "@typescript-eslint/parser@5.62.0": version "5.62.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz" integrity sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA== @@ -779,11 +779,26 @@ acorn@^5.0.0: resolved "https://registry.npmjs.org/acorn/-/acorn-5.7.4.tgz" integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== -acorn@^8.11.0, acorn@^8.4.1, acorn@^8.9.0: +"acorn@^6.0.0 || ^7.0.0 || ^8.0.0", acorn@^8.9.0: + version "8.14.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz" + integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== + +acorn@^8.11.0: + version "8.14.1" + resolved "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz" + integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== + +acorn@^8.4.1: version "8.14.1" resolved "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz" integrity sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg== +agent-base@^7.1.2: + version "7.1.3" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz" + integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw== + agent-base@6: version "6.0.2" resolved "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz" @@ -791,11 +806,6 @@ agent-base@6: dependencies: debug "4" -agent-base@^7.1.2: - version "7.1.3" - resolved "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz" - integrity sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw== - ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" @@ -840,6 +850,14 @@ ansi-styles@^6.1.0: resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + arg@^4.1.0: version "4.1.3" resolved "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz" @@ -907,6 +925,11 @@ bignumber.js@^9.0.0: resolved "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.0.tgz" integrity sha512-EM7aMFTXbptt/wZdMlBv2t8IViwQL+h6SLHosp8Yf0dqJMTnY6iL32opnAB6kAdL0SZPuvcAzFr31o0c/R3/RA== +binary-extensions@^2.0.0: + version "2.3.0" + resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== + bluebird@^3.7.2: version "3.7.2" resolved "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz" @@ -914,7 +937,7 @@ bluebird@^3.7.2: brace-expansion@^1.1.7: version "1.1.13" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.13.tgz#d37875c01dc9eff988dd49d112a57cb67b54efe6" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz" integrity sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w== dependencies: balanced-match "^1.0.0" @@ -922,12 +945,12 @@ brace-expansion@^1.1.7: brace-expansion@^2.0.1, brace-expansion@^2.0.2: version "2.0.3" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.3.tgz#0493338bdd58e319b1039c67cf7ee439892c01d9" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.3.tgz" integrity sha512-MCV/fYJEbqx68aE58kv2cA/kiky1G8vux3OR6/jbS+jIMe/6fJWa0DTzJU7dqijOWYwHi1t29FlfYI9uytqlpA== dependencies: balanced-match "^1.0.0" -braces@^3.0.3: +braces@^3.0.3, braces@~3.0.2: version "3.0.3" resolved "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== @@ -939,7 +962,7 @@ browser-stdout@^1.3.1: resolved "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz" integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== -browserslist@^4.24.0: +browserslist@^4.24.0, "browserslist@>= 4.21.0": version "4.24.4" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz" integrity sha512-KDi1Ny1gSePi1vm0q4oxSF8b4DR44GF4BbmS2YdhPLOEqd8pDviZOGH/GsmRwoWJ2+5Lr085X7naowMwKHDG1A== @@ -951,7 +974,7 @@ browserslist@^4.24.0: buffer-equal-constant-time@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + resolved "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz" integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== buffer-from@^1.0.0: @@ -1051,6 +1074,21 @@ chardet@^0.7.0: resolved "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz" integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== +chokidar@^3.3.0: + version "3.6.0" + resolved "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + chokidar@^4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz" @@ -1137,7 +1175,7 @@ cross-spawn@^7.0.2, cross-spawn@^7.0.3, cross-spawn@^7.0.6: shebang-command "^2.0.0" which "^2.0.1" -d@1, d@^1.0.1, d@^1.0.2: +d@^1.0.1, d@^1.0.2, d@1: version "1.0.2" resolved "https://registry.npmjs.org/d/-/d-1.0.2.tgz" integrity sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw== @@ -1150,7 +1188,7 @@ data-uri-to-buffer@^4.0.0: resolved "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz" integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A== -debug@4, debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5: +debug@^4.1.0, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4, debug@^4.3.5, debug@4: version "4.4.0" resolved "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz" integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA== @@ -1268,7 +1306,7 @@ eastasianwidth@^0.2.0: resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -ecdsa-sig-formatter@1.0.11, ecdsa-sig-formatter@^1.0.11: +ecdsa-sig-formatter@^1.0.11, ecdsa-sig-formatter@1.0.11: version "1.0.11" resolved "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz" integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== @@ -1454,7 +1492,7 @@ escope@^3.3.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-prettier@9.1.0: +eslint-config-prettier@*, eslint-config-prettier@9.1.0: version "9.1.0" resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz" integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== @@ -1534,7 +1572,7 @@ eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4 resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz" integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== -eslint@8.57.1: +eslint@*, "eslint@^6.0.0 || ^7.0.0 || ^8.0.0", "eslint@^6.0.0 || ^7.0.0 || >=8.0.0", eslint@>=4.19.1, eslint@>=5, eslint@>=7.0.0, eslint@>=8.0.0, eslint@8.57.1: version "8.57.1" resolved "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz" integrity sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA== @@ -1685,7 +1723,12 @@ estraverse@^4.0.0, estraverse@^4.1.0, estraverse@^4.1.1, estraverse@^4.2.0: resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== -estraverse@^5.1.0, estraverse@^5.2.0: +estraverse@^5.1.0: + version "5.3.0" + resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +estraverse@^5.2.0: version "5.3.0" resolved "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1777,14 +1820,14 @@ fast-levenshtein@^2.0.6, fast-levenshtein@~2.0.6: fast-xml-builder@^1.1.5: version "1.1.5" - resolved "https://registry.yarnpkg.com/fast-xml-builder/-/fast-xml-builder-1.1.5.tgz#50188e1452a5fa095f415d3e63dcac0a1dbcbf11" + resolved "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.5.tgz" integrity sha512-4TJn/8FKLeslLAH3dnohXqE3QSoxkhvaMzepOIZytwJXZO69Bfz0HBdDHzOTOon6G59Zrk6VQ2bEiv1t61rfkA== dependencies: path-expression-matcher "^1.1.3" fast-xml-parser@^5.3.4: version "5.7.1" - resolved "https://registry.yarnpkg.com/fast-xml-parser/-/fast-xml-parser-5.7.1.tgz#17697550bdd2a0a0d47cdc4b456c009c4cbe8a06" + resolved "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.7.1.tgz" integrity sha512-8Cc3f8GUGUULg34pBch/KGyPLglS+OFs05deyOlY7fL2MTagYPKrVQNmR1fLF/yJ9PH5ZSTd3YDF6pnmeZU+zA== dependencies: "@nodable/entities" "^2.1.0" @@ -1860,7 +1903,7 @@ flat@^5.0.2: flatted@^3.2.9: version "3.4.2" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.4.2.tgz#f5c23c107f0f37de8dbdf24f13722b3b98d52726" + resolved "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz" integrity sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA== foreground-child@^3.1.0: @@ -1941,19 +1984,19 @@ gaxios@^6.0.0, gaxios@^6.0.2, gaxios@^6.1.1: node-fetch "^2.6.9" uuid "^9.0.1" -gaxios@^7.0.0: - version "7.1.1" - resolved "https://registry.npmjs.org/gaxios/-/gaxios-7.1.1.tgz" - integrity sha512-Odju3uBUJyVCkW64nLD4wKLhbh93bh6vIg/ZIXkWiLPBrdgtc65+tls/qml+un3pr6JqYVFDZbbmLDQT68rTOQ== +gaxios@^7.0.0-rc.1, gaxios@^7.0.0-rc.4: + version "7.0.0-rc.5" + resolved "https://registry.npmjs.org/gaxios/-/gaxios-7.0.0-rc.5.tgz" + integrity sha512-s9rlpplwdb/KCq2DYevVTM/MpozeVZuR3pkzDGXtRhY7wD4fXftIYXUAerX07ZPB3J8/dHUJsX7fPnN2O4Psuw== dependencies: extend "^3.0.2" https-proxy-agent "^7.0.1" node-fetch "^3.3.2" -gaxios@^7.0.0-rc.1, gaxios@^7.0.0-rc.4: - version "7.0.0-rc.5" - resolved "https://registry.npmjs.org/gaxios/-/gaxios-7.0.0-rc.5.tgz" - integrity sha512-s9rlpplwdb/KCq2DYevVTM/MpozeVZuR3pkzDGXtRhY7wD4fXftIYXUAerX07ZPB3J8/dHUJsX7fPnN2O4Psuw== +gaxios@^7.0.0: + version "7.1.1" + resolved "https://registry.npmjs.org/gaxios/-/gaxios-7.1.1.tgz" + integrity sha512-Odju3uBUJyVCkW64nLD4wKLhbh93bh6vIg/ZIXkWiLPBrdgtc65+tls/qml+un3pr6JqYVFDZbbmLDQT68rTOQ== dependencies: extend "^3.0.2" https-proxy-agent "^7.0.1" @@ -1968,15 +2011,6 @@ gcp-metadata@^6.1.0: google-logging-utils "^0.0.2" json-bigint "^1.0.0" -gcp-metadata@^7.0.0: - version "7.0.1" - resolved "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-7.0.1.tgz" - integrity sha512-UcO3kefx6dCcZkgcTGgVOTFb7b1LlQ02hY1omMjjrrBzkajRMCFgYOjs7J71WqnuG1k2b+9ppGL7FsOfhZMQKQ== - dependencies: - gaxios "^7.0.0" - google-logging-utils "^1.0.0" - json-bigint "^1.0.0" - gcp-metadata@^7.0.0-rc.1: version "7.0.0-rc.1" resolved "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-7.0.0-rc.1.tgz" @@ -1986,6 +2020,15 @@ gcp-metadata@^7.0.0-rc.1: google-logging-utils "^1.0.0" json-bigint "^1.0.0" +gcp-metadata@^7.0.0: + version "7.0.1" + resolved "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-7.0.1.tgz" + integrity sha512-UcO3kefx6dCcZkgcTGgVOTFb7b1LlQ02hY1omMjjrrBzkajRMCFgYOjs7J71WqnuG1k2b+9ppGL7FsOfhZMQKQ== + dependencies: + gaxios "^7.0.0" + google-logging-utils "^1.0.0" + json-bigint "^1.0.0" + gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" @@ -2039,9 +2082,16 @@ glob-parent@^6.0.2: dependencies: is-glob "^4.0.3" +glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + glob@^10.4.5: version "10.5.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-10.5.0.tgz#8ec0355919cd3338c28428a23d4f24ecc5fe738c" + resolved "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz" integrity sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg== dependencies: foreground-child "^3.1.0" @@ -2053,7 +2103,7 @@ glob@^10.4.5: glob@^7.1.3: version "7.2.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" @@ -2065,7 +2115,7 @@ glob@^7.1.3: glob@^8.0.0: version "8.1.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + resolved "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz" integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== dependencies: fs.realpath "^1.0.0" @@ -2212,14 +2262,6 @@ gtoken@^7.0.0: gaxios "^6.0.0" jws "^4.0.0" -gtoken@^8.0.0: - version "8.0.0" - resolved "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0.tgz" - integrity sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw== - dependencies: - gaxios "^7.0.0" - jws "^4.0.0" - gtoken@^8.0.0-rc.1: version "8.0.0-rc.1" resolved "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0-rc.1.tgz" @@ -2228,6 +2270,14 @@ gtoken@^8.0.0-rc.1: gaxios "^7.0.0-rc.1" jws "^4.0.0" +gtoken@^8.0.0: + version "8.0.0" + resolved "https://registry.npmjs.org/gtoken/-/gtoken-8.0.0.tgz" + integrity sha512-+CqsMbHPiSTdtSO14O51eMNlrp9N79gmeqmXeouJOhfucAedHw9noVe/n5uJk3tbKE6a+6ZCQg3RPhVhHByAIw== + dependencies: + gaxios "^7.0.0" + jws "^4.0.0" + gts@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/gts/-/gts-6.0.2.tgz" @@ -2375,7 +2425,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.3: +inherits@^2.0.3, inherits@2: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2412,6 +2462,13 @@ is-arrayish@^0.2.1: resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + is-core-module@^2.11.0, is-core-module@^2.16.0, is-core-module@^2.5.0: version "2.16.1" resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz" @@ -2437,7 +2494,7 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -2510,7 +2567,7 @@ js-tokens@^4.0.0: js-yaml@^4.1.0, js-yaml@^4.1.1: version "4.1.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.1.tgz#854c292467705b699476e1a2decc0c8a3458806b" + resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz" integrity sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA== dependencies: argparse "^2.0.1" @@ -2582,7 +2639,7 @@ json5@^2.1.3, json5@^2.2.3: jwa@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-2.0.1.tgz#bf8176d1ad0cd72e0f3f58338595a13e110bc804" + resolved "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz" integrity sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg== dependencies: buffer-equal-constant-time "^1.0.1" @@ -2591,7 +2648,7 @@ jwa@^2.0.1: jws@^4.0.0: version "4.0.1" - resolved "https://registry.yarnpkg.com/jws/-/jws-4.0.1.tgz#07edc1be8fac20e677b283ece261498bd38f0690" + resolved "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz" integrity sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA== dependencies: jwa "^2.0.1" @@ -2670,7 +2727,7 @@ lodash.merge@^4.6.2: lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21: version "4.18.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.18.1.tgz#ff2b66c1f6326d59513de2407bf881439812771c" + resolved "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz" integrity sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q== log-symbols@^4.1.0: @@ -2725,9 +2782,9 @@ markdown-it-anchor@^8.6.7: resolved "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-8.6.7.tgz" integrity sha512-FlCHFwNnutLgVTflOYHPW2pPcl2AACqVzExlkGQNsi4CJgqOHN7YTgDd4LuhgN1BFO3TS0vLAruV1Td6dwWPJA== -markdown-it@^14.1.0: +markdown-it@*, markdown-it@^14.1.0: version "14.1.1" - resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-14.1.1.tgz#856f90b66fc39ae70affd25c1b18b581d7deee1f" + resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz" integrity sha512-BuU2qnTti9YKgK5N+IeMubp14ZUKUUw7yeJbkjtosvHiP0AZ5c8IAgEMk79D0eC8F23r4Ac/q8cAIFdm2FtyoA== dependencies: argparse "^2.0.1" @@ -2822,23 +2879,44 @@ min-indent@^1.0.0: resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: +minimatch@^3.0.5: + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.1.1: + version "3.1.5" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" + integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.1.2: version "3.1.5" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.5.tgz#580c88f8d5445f2bd6aa8f3cadefa0de79fbd69e" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz" integrity sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w== dependencies: brace-expansion "^1.1.7" minimatch@^5.0.1, minimatch@^5.1.0: version "5.1.9" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.9.tgz#1293ef15db0098b394540e8f9f744f9fda8dee4b" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz" integrity sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw== dependencies: brace-expansion "^2.0.1" -minimatch@^9.0.4, minimatch@^9.0.5: +minimatch@^9.0.4: version "9.0.9" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz" + integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== + dependencies: + brace-expansion "^2.0.2" + +minimatch@^9.0.5: + version "9.0.9" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz" integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg== dependencies: brace-expansion "^2.0.2" @@ -2977,6 +3055,11 @@ normalize-package-data@^3.0.0: semver "^7.3.4" validate-npm-package-license "^3.0.1" +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + npm-run-path@^4.0.1: version "4.0.1" resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz" @@ -3114,14 +3197,9 @@ path-exists@^4.0.0: resolved "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz" integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== -path-expression-matcher@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/path-expression-matcher/-/path-expression-matcher-1.1.3.tgz#8bf7c629dc1b114e42b633c071f06d14625b4e0d" - integrity sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ== - -path-expression-matcher@^1.5.0: +path-expression-matcher@^1.1.3, path-expression-matcher@^1.5.0: version "1.5.0" - resolved "https://registry.yarnpkg.com/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz#3b98545dc88ffebb593e2d8458d0929da9275f4a" + resolved "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.5.0.tgz" integrity sha512-cbrerZV+6rvdQrrD+iGMcZFEiiSrbv9Tfdkvnusy6y0x0GKBXREFg/Y65GhIfm0tnLntThhzCnfKwp1WRjeCyQ== path-is-absolute@^1.0.0: @@ -3157,9 +3235,9 @@ picocolors@^1.0.0, picocolors@^1.1.1: resolved "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.2" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.2.tgz#5a942915e26b372dc0f0e6753149a16e6b1c5601" + resolved "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz" integrity sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA== prelude-ls@^1.2.1: @@ -3179,7 +3257,7 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@3.3.3: +prettier@>=3.0.0, prettier@3.3.3: version "3.3.3" resolved "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz" integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== @@ -3207,10 +3285,10 @@ protobufjs-cli@^1.2.0: tmp "^0.2.1" uglify-js "^3.7.7" -protobufjs@7.5.4: - version "7.5.4" - resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz" - integrity sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg== +protobufjs@^7.0.0, protobufjs@^7.2.5, protobufjs@^7.4.0, protobufjs@^7.5.3, protobufjs@^7.5.5: + version "7.5.5" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.5.tgz" + integrity sha512-3wY1AxV+VBNW8Yypfd1yQY9pXnqTAN+KwQxL8iYm3/BjKYMNg4i0owhEe26PWDOMaIrzeeF98Lqd5NGz4omiIg== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" @@ -3225,10 +3303,10 @@ protobufjs@7.5.4: "@types/node" ">=13.7.0" long "^5.0.0" -protobufjs@^7.2.5, protobufjs@^7.4.0, protobufjs@^7.5.3, protobufjs@^7.5.5: - version "7.5.5" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.5.5.tgz#b7089ca4410374c75150baf277353ef76db69f96" - integrity sha512-3wY1AxV+VBNW8Yypfd1yQY9pXnqTAN+KwQxL8iYm3/BjKYMNg4i0owhEe26PWDOMaIrzeeF98Lqd5NGz4omiIg== +protobufjs@7.5.4: + version "7.5.4" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz" + integrity sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg== dependencies: "@protobufjs/aspromise" "^1.1.2" "@protobufjs/base64" "^1.1.2" @@ -3303,6 +3381,13 @@ readdirp@^4.0.1: resolved "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz" integrity sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg== +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + redent@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz" @@ -3389,7 +3474,7 @@ reusify@^1.0.4: resolved "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz" integrity sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw== -rimraf@3.0.2, rimraf@^3.0.2: +rimraf@^3.0.2, rimraf@3.0.2: version "3.0.2" resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -3425,21 +3510,41 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.2.1, safe-buffer@~5.2.0: resolved "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -"semver@2 || 3 || 4 || 5": - version "5.7.2" - resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - semver@^6.3.1: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.0.0, semver@^7.1.2, semver@^7.3.4, semver@^7.3.7, semver@^7.3.8: +semver@^7.0.0: + version "7.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz" + integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== + +semver@^7.1.2: + version "7.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz" + integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== + +semver@^7.3.4: version "7.7.1" resolved "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz" integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== +semver@^7.3.7: + version "7.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz" + integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== + +semver@^7.3.8: + version "7.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz" + integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== + +"semver@2 || 3 || 4 || 5": + version "5.7.2" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== + serialize-javascript@^6.0.2: version "6.0.2" resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz" @@ -3559,6 +3664,13 @@ stream-shift@^1.0.2: resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz" integrity sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ== +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + "string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" @@ -3577,7 +3689,7 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" -string-width@^5.0.1, string-width@^5.1.2: +string-width@^5.0.1: version "5.1.2" resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz" integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== @@ -3586,12 +3698,14 @@ string-width@^5.0.1, string-width@^5.1.2: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== +string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== dependencies: - safe-buffer "~5.2.0" + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" "strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" @@ -3633,7 +3747,7 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: strnum@^2.2.3: version "2.2.3" - resolved "https://registry.yarnpkg.com/strnum/-/strnum-2.2.3.tgz#0119fce02749a11bb126a4d686ac5dbdf6e57586" + resolved "https://registry.npmjs.org/strnum/-/strnum-2.2.3.tgz" integrity sha512-oKx6RUCuHfT3oyVjtnrmn19H1SiCqgJSg+54XqURKp5aCMbrXrhLjRN9TjuwMjiYstZ0MzDrHqkGZ5dFTKd+zg== stubs@^3.0.0: @@ -3813,7 +3927,7 @@ type@^2.7.2: resolved "https://registry.npmjs.org/type/-/type-2.7.3.tgz" integrity sha512-8j+1QmAbPvLZow5Qpi6NCaN8FB60p/6x8/vfNqOk/hC+HuvFZhL4+WfekuhQLiqFZXOgQdrs3B+XxEmCc6b3FQ== -typescript@5.6.2: +"typescript@>= 2.7", typescript@>=2.7, "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta", typescript@>=5, typescript@5.6.2: version "5.6.2" resolved "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz" integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== @@ -3830,7 +3944,7 @@ uglify-js@^3.19.3, uglify-js@^3.7.7: underscore@~1.13.2: version "1.13.8" - resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.8.tgz#a93a21186c049dbf0e847496dba72b7bd8c1e92b" + resolved "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz" integrity sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ== undici-types@~6.21.0: @@ -3868,7 +3982,12 @@ uuid@^8.0.0: resolved "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -uuid@^9.0.0, uuid@^9.0.1: +uuid@^9.0.0: + version "9.0.1" + resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + +uuid@^9.0.1: version "9.0.1" resolved "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==